• Terms represent specific objects in the world and can be constants, variables or functions. • Predicate Symbols refer to a particular relation among objects. • Sentences represent facts, and are made of of terms, quantifiers and predicate symbols.
• Functions allow us to refer to objects indirectly (via some relationship). • Quantifiers and variables allow us to refer to a collection of objects without explicitly naming each object.
• Predicates: Brother, Sister, Mother , Father • Objects: Bill, Hillary, Chelsea, Roger • Facts expressed as atomic sentences a.k.a. literals: Father(Bill,Chelsea) Mother(Hillary,Chelsea) Brother(Bill,Roger) ¬ Father(Bill,Chelsea)
Variables and Universal Quantification
• Universal Quantification allows us to make a statement about a collection of objects: ∀ x Cat(x) ⇒ Mammel(x) ll ” All cats are mammels or A “F ∀ x Father(Bill,x) ⇒ Mother(Hillary,x) All of Bill’ kids are also Hillary’ kids. s s
Variables and Existential Quantification
• Existential Quantification allows us to state that an object does exist (without naming it): ∃ Cat(x) ∧ Mean(x) x ere There is a mean cat. “Th ” ists ex ∃x Father(Bill,x) ∧ Mother(Hillary,x) There is a kid whose father is Bill and whose mother is Hillary
∀ x,y Parent(x,y) ⇒ Child(y,x) ∀ x ∃y Loves(x,y) ∀ x [Passtest(x) ∨ (∃x ShootDave(x))]
• Functions are terms - they refer to a specific object. • We can use functions to symbolically refer to objects without naming them. • Examples: fatherof(x) age(x) times(x,y) succ(x)
∀ x Equal(x,x) Equal(factorial(0),1) ∀ x Equal(factorial(s(x)), times(s(x),factorial(x)))
Representing facts with Predicate Logic - Example
• Marcus was a man • Marcus was a Pompeian • All Pompeians were Romans • Caesar was a ruler. • All Romans were either loyal to Caesar or hated him. • Everyone is loyal to someone. • Men only try to assassinate rulers they are not loyal to. • Marcus tried to assassinate Caesar
Predicate Logic Knowledgebase
∀ x Pompeian(x) ⇒ Roman(x)
∀ x Romans(x) ⇒ Loyalto(x,Caesar) ∨ Hate(x,Caesar) ∀ x ∃y Loyalto(x,y) ∀ x ∀ y Man(x) ∧ Ruler(y) ∧ Tryassassinate(x,y) ⇒ ¬ Loyalto(x,y) Tryassassinate(Marcus,Caesar)
Was Marcus a Roman? Was Marcus loyal to Caesar? Who was Marcus loyal to? Was Marcus a ruler? Will the test be easy?
Isa and Instance relationships
• The example uses inheritance without explicitly having isa or instance predicates. • We could rewrite the facts using isa and instance explicitly: instance(Marcus,man) instance(Marcus,Pompeian) isa(Pompeian,Roman)
Using the predicates:
Father(x,y) Mother(x,y) Brother(x,y) Sister(x,y)
Construct predicate logic facts that establish the following relationships: – – – – – GrandParent GrandFather GrandMother Uncle Cousin
Proof procedure for Predicate Logic
• Same idea, but a few added complexities:
– conversion to CNF is much more complex. – Matching of literals requires providing a matching of variables, constants and/or functions. ¬ Skates(x) ∨ LikesHockey(x) ¬ LikesHockey(y) We can resolve these only if we assume x and y refer to the same object.
Predicate Logic and CNF
• Converting to CNF is harder - we need to worry about variables and quantifiers. 1. Eliminate all implications ⇒ 2. Reduce the scope of all ¬ to single term. * 3. Make all variable names unique 4. Move Quantifiers Left * 5. Eliminate Existential Quantifiers * 6. Eliminate Universal Quantifiers * 7. Convert to conjunction of disjuncts 8. Create separate clause for each conjunct.
Eliminate Existential Quantifiers
• Any variable that is existentially quantified means we are saying there is some value for that variable that makes the expression true. • To eliminate the quantifier, we can replace the variable with a function. • We don’ know what the function is, we...