CS 497: Section EA

CS 440 / ECE 448
Introduction to Artificial Intelligence
Spring 2010
Lecture #9
Instructor: Eyal Amir
Grad TAs: Wen Pu, Yonatan Bisk
Undergrad TAs: Sam Johnson, Nikhil Johri
Last Time: First-order logic
• First-order logic (FOL) models the world
• Vocabulary: object-Constant symbols,
Predicate symbols, Function symbols
• Connectives: &, v, ~, …
• Quantifiers: Exists (x), For-all (x)
• Interpretations
• Models
First-Order Theories
• Vocabulary L:
– Function symbols (f(x,y))
– Predicate (relation) symbols (P(x,A))
– Constant symbols (A,B,C,…)
• FOL language: quantification over objects
wm( woman( w)  man(m)  loves(m, w))
wm( woman( w)  man(m)  loves(m, w))
w( woman( w)  m(man(m)  loves(m, w)))
Quantifier Scope
• Switching the order of universal quantifiers does
not change the meaning:
– (x)(y)P(x,y) <=> (y)(x) P(x,y)
• Similarly, you can switch the order of existential
quantifiers:
– (x)(y)P(x,y) <=> (y)(x) P(x,y)
• Switching the order of universals and existential
does change meaning:
– Everyone likes someone: (x)(y) likes(x,y)
– Someone is liked by everyone: (y)(x) likes(x,y)
•
Quantifiers
Universal quantifiers are often used with “implies” to
form “rules”:
– (x) student(x) => smart(x) means “All students are smart”
• Universal quantification is rarely used to make
blanket statements about every individual in the
world:
– (x)student(x)^smart(x) means “Everyone in the world is a
student and is smart”
• Existential quantifiers are usually used with “and” to
specify a list of properties about an individual:
– (x) student(x) ^ smart(x) means “There is a student who is
smart”
• A common mistake is to represent this English
sentence as the FOL sentence:
– (x) student(x) => smart(x)
What’s the problem?
Model Theory
• Structure/Interpretation: <U,I>
– U = Universe of elements
– I = Mapping of
• Constant symbols to elements in U
• Predicate symbols to relations over U
• Function symbols to functions over U
╨
• M
T
-
M satisfies T
– T is a theory, i.e., a set of FOL sentences in
language L for which M is an interpretation
Logical Entailment
  wm( woman( w)  man(m)  loves(m, w))
  wm( woman( w)  man(m)  loves(m, w))
  w( woman( w)  m(man(m)  loves(m, w)))
╨ ╨
 


╨ ╨
M1
M1


?
?
L={man, woman, loves}
M1=<U1,I1>
U1={Sue,Kim,Pat}
I1[man]={Pat}
I1[woman]={Sue,Kim}
I1[loves]={<Pat,Kim>,<Pat,Sue>}
Deduction Theorem
• Theorem: For FOL sentences A,B, A|=B iff
|= AB
• Equivalent Theorem: For FOL sentences
A,B, A|=B iff A&-B is not satisfiable
• Reason: A&-B  -(AB)
Connections between All and
Exists
• We can relate sentences involving 
and  using De Morgan’s laws:
•
•
•
•
(x) ~P(x)<=> ~(x) P(x)
~(x)P(x) <=> (x) ~P(x)
(x) P(x) <=> ~ (x) ~P(x)
(x) P(x) <=> ~(x) ~P(x)
Reasoning in FOL
•
Goal: for theory T and query Q
– Check if T |= Q
– Notice: T |= Q iff T & -Q is satisfiable
•
Algorithm:
1. Convert T & -Q to Clausal form
2. Run Resolution algorithm
3. If resolution returns FALSE, we return TRUE
Clausal Form
• Every FOL formula is consistencyequivalent to conjunction of F.O. clauses.
w( woman( w)  m(man(m)  loves(m, w)))
• First-order clause
– Only universal quantifiers (which are implicit)
– Disjunction of literals (atoms or their negation)
woman( w)  man( SKm( w))
woman(v)  loves( SKm(v), v))
Conversion to Clausal Form
1. “” replaced by “”, ””
2. Negations
front
atoms
w( woman( win) 
m(of
man
(m)  loves(m, w)))
3. Standardize
(unique
vars.)
w(woman( wvariables
)  m(man
(m)  loves
(m, w)))
w(womanexistentials
( w)  m(man
(m)  loves(m, w)))
4. Eliminate
(Skolemization)
w(woman
( w)  mquantifiers
(man(m)  loves(m, w)))
5.Drop
all universal
6.
w(Move
womandisjunctions
( w)  (man( SKm
( w)) 
loves
( SKm( w), w)))
in (put
into
CNF)
woman
( w) vars.
(man(standardize
( SKm( w))  loves
( SKm
( w), w))
7.
Rename
vars.
apart)
(woman( w)  man( SKm( w))) 
(woman(vw))loves
loves((SKm
SKm((vw),),vw
))))))
Next Time
• Reasoning procedure for FOL
– Proving entailment using Resolution
Axioms, definitions and theorems
• Axioms are facts and rules that attempt to capture all of
the (important) facts and concepts about a domain;
axioms can be used to prove theorems
– Mathematicians don’t want any unnecessary (dependent)
axioms –ones that can be derived from other axioms
– Dependent axioms can make reasoning faster, however
– Choosing a good set of axioms for a domain is a kind of design
problem
• A definition of a predicate is of the form “p(X) <=> …”
and can be decomposed into two parts
– Necessary description: “p(x) => …”
– Sufficient description “p(x) <= …”
– Some concepts don’t have complete definitions (e.g., person(x))
Axioms for Set Theory in FOL
1. The only sets are the empty set and those made by adjoining something to a
set:
s set(s) <=> (s=EmptySet) v (x,r Set(r) ^ s=Adjoin(s,r))
2. The empty set has no elements adjoined to it:
~ x,s Adjoin(x,s)=EmptySet
3. Adjoining an element already in the set has no effect:
x,s Member(x,s) <=> s=Adjoin(x,s)
4. The only members of a set are the elements that were adjoined into it:
x,s Member(x,s) <=> y,r (s=Adjoin(y,r) ^ (x=y  Member(x,r)))
5. A set is a subset of another iff all of the 1st set’s members are members of
the 2nd:
s,r Subset(s,r) <=> (x Member(x,s) => Member(x,r))
6. Two sets are equal iff each is a subset of the other:
s,r (s=r) <=> (subset(s,r) ^ subset(r,s))
7. Intersection
x,s1,s2 member(X,intersection(S1,S2)) <=> member(X,s1) ^ member(X,s2)
8. Union
x,s1,s2 member(X,union(s1,s2)) <=> member(X,s1)  member(X,s2)
Model Checking
• Given an interpretation, how do we decide
if it satisfies a formula (i.e., gives it a truth
value of TRUE)?
• What happens when the formula is not
closed?
Proof and Theorems
• Axiom systems and rule systems
– Propositional axioms: -A v A
– Substitution axioms: Ax[a]xA
– Identity axioms: x=x
– Equality axioms:
x1=y1…xn=ynf(x1,…,xn)=f(y1,…,yn)
x1=y1…xn=ynp(x1,…,xn)p(y1,…,yn)
• Rules:...
Proof and Theorems
• Axiom systems and rule systems
–…
• Rules:
– Expansion Rule: Infer BvA from A
– Contraction Rule: Infer A from AvA
– Associative Rule: Infer (AvB)vC from Av(BvC)
– Cut Rule: Infer BvC from AvB and –AvC
– -introduction rule: If x not free in B, then
infer xAB from AB
Proofs and Theorems
• Nonlogical axioms: Axioms made for a
certain theory
• Proofs – what are they?
• Completeness, Soundness (of an
inference procedure)
• Incompleteness of FOL (as a language) for
some intended models