






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Chris BrooksDepartment of Computer ScienceUniversity of San Francisco
assign^ x^ the value “3 or 4” or “some value less than 10”. Separates declarative knowledge from inferenceprocedures Compositional The meaning of a sentence is a function of themeaning of its parts.
Department of Computer Science — University of San Francisco – p.1/
??
1 ,^2 Terms are either true or false. A model is an assignment of values to terms.^ The set of possible worlds that make a sentence true A model satisfies a sentence if the sentence is truegiven the assignments in the model.
Department of Computer Science — University of San Fra
resolution. A ∨ B and ¬A^ ∨^ C^ allows us to conclude
A^ is either true or not true. If
A^ is true, then
C^ must
be true. if^ A^ is false, then
B^ must be true. This can be generalized to clauses of any length.
Department of Computer Science — University of San Francisco – p.3/
??
Every propositional logic sentence can be converted toCNF.
Department of Computer Science — University of San Francisco – p.4/
??
becomes^ ¬A
becomes^ A ¬(A ∧ B)^ becomes^ (
∧^ C))^ becomes
∨^ C) Department of Computer Science — University of San Fra
Eliminating equivalence produces:^ (B⇒^ (P^1 ,^1
Removing implication gives us:^ (¬B∨^ (P^1 ,^1
)^ ∨^ B)^1 ,^1 Department of Computer Science — University of San Francisco – p.6/
??
Finally, we distribute OR over AND:^ (¬B∨^ P^1 ,^1
Now we have clauses that can be plugged into aresolution theorem prover. (can break ANDs intoseparate sentences) They’re less readable by a human, but morecomputationally useful.
Department of Computer Science — University of San Francisco – p.7/
??
A^ is true.
Insert^ ¬A^ into the KB and try to derive a contradiction.
Department of Computer Science — University of San Fra
Department of Computer Science — University of San Francisco – p.9/
??
Department of Computer Science — University of San Francisco – p.10/
??
predicates Functions: father-of(bart) = homer,fall-classes(student) = AI, etc. First-order logic
gives us all of this.
Department of Computer Science — University of San Fran
(x, y) Notice the scope - for each
x, a different
y^ is
(potentially) chosen. What if we said^
∃y∀xmother(
x, y)? this is not a problem when nesting quantifiers of thesame type. ∀x∀y brotherOf
(x, y)^ ⇒^ siblingOf
(x, y)^ and ∀y∀x brotherOf
(x, y)^ ⇒^ siblingOf
(x, y)^ are equivalent. We often write that as ∀x, y brotherOf
(x, y)^ ⇒^ siblingOf
(x, y)^ Department of Computer Science — University of San Francisco – p.18/
??
(x)^ says that it is not true that everyone isyellow. ∃x ¬yellow(x)^ has the same meaning - there issomeone who is not yellow. ¬∃x daughterOf^ (Bart, x
)^ says that there does not exist anyone who is Bart’s daughter. ∀x^ ¬daughterOf
(Bart, x)^ says that for all individuals they are not Bart’s daughter. In fact, we can use DeMorgan’s rules with quantifiersjust like with^ ∧^ and
Department of Computer Science — University of San Francisco – p.19/
??
(x, y)^ ⇔^ spouse
(x, y)^ ∧^ male(
x)
Two siblings have a parent in common^ ∀x, y sibling
(x, y)^ ⇔¬(x = y) ∧ ∃pP arent(x, p
)^ ∧^ P arent(y, p
Everyone who goes to Moe’s likes either Homer orBarney (but not both)^ ∀x goesT o
(moes, x)^ ⇒ (Likes(x, Homer)^ ⇔ ¬Likes
(x, Barney))^ Department of Computer Science — University of San Fran
(x, y)^ ∧^ angryAt
(y, homer) Everyone who works at the power plant is scared of Mr.Burns^ ∀x worksAt
(P owerP lant, x
)^ ⇒^ scaredOf
(x, burns) Department of Computer Science — University of San Francisco – p.21/
??
Department of Computer Science — University of San Francisco – p.22/
??
Department of Computer Science — University of San Fran
)^ →^ genre(x, Rock
)^ - subclass: all Punk songs are Rock songs. member(JohnLennon, Beatles
member(P aulM cCartney, Beatles
member(GeorgeHarrison, Beatles
member(RingoStarr, Beatles
)^ ∧ ∀x member
(x, Beatles)^ →
x^ ∈ {John, P aul, George, Ringo
}^ - exclusive membership: John, Paul, George, and Ringo are the Beatles. perf ormedBy
(Beatles, W hiteAlbum
)^ The WhiteAlbum is a Beatles album ∀x, y, zmember
(x, y)∧perf ormedBy
(y, z)^ →^ playedOn
(x, z)
if someone is a member of a group, and that groupperformed an album, then that person played on thatalbum.
Department of Computer Science — University of San Francisco – p.24/
??
)^ - “Holidays in the Sun” is a Punk song. ∀x genre(x, Rock
)^ →^ likes(Bob, x
)^ Bob likes all rock songs.^ We should be able to infer that Bob will like “Holidaysin the Sun” ∀w, x, y, z likes
(x, y)∧member
(z, y)∧perf ormedBy
(z, w)^ →
likes(x, w)^ - If someone likes albums by a band Y, and Zis a member of band Y, then that person will like albumsby person Z.
Department of Computer Science — University of San Francisco – p.25/
??
Department of Computer Science — University of San Fran
Department of Computer Science — University of San Francisco – p.27/
??
Department of Computer Science — University of San Francisco – p.28/
??
x^ that helps us with our proof. ∀xLivesIn(x, Springf ield
)^ ⇒^ knows(x, Homer
Since this is true for all
x, we can substitute {x^ =^ Bart} LivesIn(Bart, Springf ield
)^ ⇒^ knows(Bart, Homer
Department of Computer Science — University of San Fran
), Sibling(y, z
can produce
{Bart/y, x/z}
or {x/Bart, y/Bart, z/Bart
the first unification is more general than the second - itmakes fewer commitments. We want to find the
most general unifier
when
performing inference.^ (This is the heuristic in our search.)
Department of Computer Science — University of San Francisco – p.36/
??
)^ ∧^ P laysSax
(x)^ and^ Sibling
(Lisa, y)
We can unify
Sibling(x, Bart
)^ and^ Sibling
(Lisa, y)
with^ {x/Lisa, y/Bart
The process of finding a complete set of substitutions isa search process.^ State is the list of substitutions^ Successor function is the list of potential unificationsand new substitution lists.
Department of Computer Science — University of San Francisco – p.37/
??
Department of Computer Science — University of San Fran
rules^ :if (can_unify(rule,^ facts))
: fire_rule(rule)assert^ consequent
facts if^ (no^ rules^ fired)
: return
Department of Computer Science — University of San Francisco – p.39/
??
∧^ W eapon(y)^ ∧^ Hostile
(z)^ ∧^ Sells(x, y, z)^
⇒^ Criminal(x)
Nono has missiles. 2 .∃xOwns(N ono, x
)^ ∧^ M issile(x) Use Existential Elimination to substitute
Mfor^ x^1 3 .Owns(N ono, M^1
),^4 .M issile(M)^1
Department of Computer Science — University of San Francisco – p.40/
??
Owns(N ono, x)^ ⇒
Sells(W est, x, N ono
) Missiles are weapons. 6 .M issile(x)^ ⇒^ W eapon
(x) An enemy of America is a hostile nation. 7 .Enemy(x, America
)^ ⇒^ Hostile(x) West is American 8 .American(W est) Nono is an enemy of America 9 .Enemy(N ono, America
)
Department of Computer Science — University of San Fran
{x/M}. Add^1
W eapon(M)^1
Rule 5 matches with 3 and 4.
{x/M}. Add^1 Sells(W est, M
, N ono) 1 Rule 7 matches with 9.
{x/N ono}. Add
Hostile(N ono
Iterate again. Now we can match rule 1 with
{x/W est, y/M
, z/N ono} 1
and conclude
Criminal(W est
).^ Department of Computer Science — University of San Francisco – p.42/
??
Department of Computer Science — University of San Francisco – p.43/
??
Department of Computer Science — University of San Fran
=^ [] while^ (not^ (empty(goals)))
: goal^ =^ goals.dequeueunify(goals,^ substitution_list)foreach^ sentence
in^ KBif (unify(consequent(sentence,
q))) goals.push(antecedents(sentence))
Department of Computer Science — University of San Francisco – p.45/
??
(W est) To prove 1, prove: 2 .American(W est
),^3 .W eapon(y
)4.Hostile(z)
.Sells(W est, y, z
2 unifies with 8. To prove: 3 .W eapon(y)
.Hostile(z)5.Sells
(W est, y, z) 6 unifies with 3
{x/M}. To prove:^1
.^6 .M issile(M
),^4 .Hostile(z 1
)5.Sells(W est, M
, z) 1
We can unify 6 with 2
{x/M}^ and add^1
Owns(N ono, M
to the KB. To prove:
4 .Hostile(z)
.Sells(W est, M
, z) 1
To prove^ Hostile
(z), prove^ Enemy
(z, America). To prove: 7 .Enemy(z, America
),^5 .Sells(W est, M
, z),^6 .M issile 1
Department of Computer Science — University of San Francisco – p.46/
??
Enemy(N ono, America
){x/N ono}.
To prove:^5 .Sells
(W est, M, N ono^1
),^6 .M issile(M
To prove^ Sells
(W est, M, N ono^1
), prove^ M issile
(M)^ and^1
Owns(N ono, M
)^ To prove: 1 8 .Owns(N ono, M
),^6 .M issile( 1
8 resolves with the fact we added earlier. To prove: 6 .M issile(M^1
M issile(M)^1
resolves with 5. The list of goals is empty, so we are done.
Department of Computer Science — University of San Fran
KB fact^ =^ sos.popforeach^ fact^ in
usableresolve fact^ with^ usable simplify^ clauses,
remove^ duplicates
and^ tautologies if^ a^ clause^ has
no^ literals^ :return refutation^ found tilsos^ =^ []
Department of Computer Science — University of San Francisco – p.54/
??
W eapon(y)^ ∨ ¬Sells
(x, y, z)^ ∨ ¬Hostile
(z)^ ∨^ Criminal(x)
2 .¬M issile(x)^ ∨ ¬Owns
(N ono, x)^ ∨^ Sells(west, x, N ono
)
3 .¬Enemy(x, America
)^ ∨^ Hostile(x) 4 .¬M issile(x)^ ∨^ W eapon
(x) 5 .Owns(N ono, M^1
) 6 .M issile(M)^17 .American(W est
) 8 .Enemy(N ono, America
) 9 .¬Criminal(W est
)^ (added)
Department of Computer Science — University of San Francisco – p.55/
??
)^ ∨ ¬W eapon(y)^ ∨ ¬
Sells(W est, y, z)^ ∨ ¬
Hostile(z)
Resolve 10 and 7. Add
11 .¬W eapon(y)^ ∨ ¬
Sells(W est, y, z)^ ∨ ¬
Hostile(z)
Resolve 11 and 4. Add
12 .¬M issile(y)^ ∨ ¬
Sells(W est, y, z)^ ∨ ¬
Hostile(z)
Resolve 12 and 6. Add
13 .Sells(W est, M^1
, z)^ ∨ ¬Hostile(z) Resolve 13 and 2. Add
14 .¬M issile(M)^1
∨ ¬Owns(N ono, M
)^ ∨^ Hostile(N ono 1 )
Resolve 14 and 6. Add
15 .¬Owns(N ono, M
1 )^ ∨ ¬Hostile(N ono
)
Resolve 15 and 5. Add
16 ¬Hostile(N ono
) Resolve 16 and 3. Add
17 .¬Enemy(N ono, America
). Resolve 17 and 8. Contradiction!
Department of Computer Science — University of San Fran
(x, Homer)^ will be proven, but without an answer for who
x^ is. Can use full FOL, rather than just definite clauses.
Department of Computer Science — University of San Francisco – p.57/
??
Department of Computer Science — University of San Francisco – p.58/
??
Department of Computer Science — University of San Fran
Department of Computer Science — University of San Francisco – p.60/
??
syntax^ used^ by^
the^ CLIPS^ expert
system
(defrule^ drink-beer(thirsty^ homer)=>(assert^ (drink-beer
homer))) (defrule^ go-to-moes(thirsty^ homer)(at^ homer^ ˜moes)=>(assert^ (at^ homer
moes))) (defrule^ happy-homer(drink-beer^ homer)(at^ homer^ moes)(friday)=>(assert^ (happy
homer))) What would the network look like?
Department of Computer Science — University of San Francisco – p.61/
??
Single-input nodesreceive a fact, test it, and at homer friday!moespropagate. Two-input nodes group fire go-to-moesand unify facts thatmatch each parent. fire happy- We can also share nodeshomeramong rules, which im-proves efficiency. Department of Computer Science — University of San Fran
uncertainty
We’ll examine this in the context of Bayesiannetworks. We will see this idea of networks of information again.
Department of Computer Science — University of San Francisco – p.63/
??