1
CSCI 5582 Fall 2006
CSCI 5582 Artificial Intelligence
Lecture 11 Jim Martin
CSCI 5582 Fall 2006
Today 10/5
- First Order Logic
– Also called First Order Predicate Calculus
- Break
- New HW
CSCI 5582 Fall 2006
CSCI 5582 Artificial Intelligence Lecture 11 Jim Martin CSCI 5582 - - PDF document
CSCI 5582 Artificial Intelligence Lecture 11 Jim Martin CSCI 5582 Fall 2006 Today 10/5 First Order Logic Also called First Order Predicate Calculus Break New HW CSCI 5582 Fall 2006 Clarification Implies TT A B A->B
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
– Also called First Order Predicate Calculus
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
– Objects: people, houses, numbers, colors, baseball games, wars, … – Relations: red, round, prime, brother of, bigger than, part of, comes between, … – Functions: father of, best friend, one more than, plus, …
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
– Brother(KingJohn, RichardTheLionheart) – > (Length(LeftLegOf(Richard)), Length(LeftLegOf(KingJohn)))
CSCI 5582 Fall 2006
¬S, S1 ∧ S2, S1 ∨ S2, S1 ⇒ S2, S1 ⇔ S2,
CSCI 5582 Fall 2006
interpretation
among them
constant symbols →
predicate symbols → relations function symbols → functional relations
iff the objects referred to by term1,...,termn are in the relation referred to by predicate.
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
∀<variables> <sentence> Everyone at CU is smart: ∀x At(x, CU) ⇒ Smart(x) ∀x P is true in a model m iff P is true with x being each possible
Roughly speaking, equivalent to the conjunction of instantiations of P At(KingJohn,CU) ⇒ Smart(KingJohn) ∧At(Richard,CU) ⇒ Smart(Richard) ∧At(Ralphie,CU) ⇒ Smart(Ralphie) ∧ ...
CSCI 5582 Fall 2006
∃<variables> <sentence> Someone at CU is smart: ∃x At(x, CU) ∧ Smart(x) ∃x P is true in a model m iff P is true with x being some possible object in the model
P At(KingJohn,CU) ∧ Smart(KingJohn) ∨ At(Richard,CU) ∧ Smart(Richard) ∨ At(Ralphie, CU) ∧ Smart(VUB) ∨ ...
CSCI 5582 Fall 2006
∀x ∀y is the same as ∀y ∀x ∃x ∃y is the same as ∃y ∃x ∃x ∀y is not the same as ∀y ∃x ∃x ∀y Loves(x,y) – “There is a person who loves everyone in the world” ∀y ∃x Loves(x,y) – “Everyone in the world is loved by at least one person”
∀x Likes(x,IceCream) ¬∃x ¬Likes(x,IceCream) ∃x Likes(x,Broccoli) ¬∀x ¬Likes(x,Broccoli)
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
Resolve 1 and 3 Resolve 2 and 5 Resolve 4 and 6 Convert to Normal Form
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
CSCI 5582 Fall 2006
def WalkSAT(clauses, p=0.5, max_flips=10000): model = dict([(s, random.choice([True, False])) for s in prop_symbols(clauses)]) for i in range(max_flips): satisfied, unsatisfied = [], [] for clause in clauses: if_(pl_true(clause, model), satisfied, unsatisfied).append(clause) if not unsatisfied: return model clause = random.choice(unsatisfied) if probability(p): sym = random.choice(prop_symbols(clause)) else: raise NotImplementedError model[sym] = not model[sym]
CSCI 5582 Fall 2006