First-Order Logic.

Slides:



Advertisements
Similar presentations
Inference in first-order logic
Advertisements

First-Order Logic Chapter 8.
Inference in First-Order Logic
Artificial Intelligence 8. The Resolution Method
Some Prolog Prolog is a logic programming language
Inference in first-order logic
Inference Rules Universal Instantiation Existential Generalization
1 A formula in predicate logic An atom is a formula. If F is a formula then (~F) is a formula. If F and G are Formulae then (F /\ G), (F \/ G), (F → G),
Standard Logical Equivalences
First-Order Logic (FOL) aka. predicate calculus. First-Order Logic (FOL) Syntax User defines these primitives: – Constant symbols (i.e., the "individuals"
ITCS 3153 Artificial Intelligence Lecture 15 First-Order Logic Chapter 9 Lecture 15 First-Order Logic Chapter 9.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Automated Deduction resolution (Otter) backward-chaining (Prolog)
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
Artificial Intelligence Inference in first-order logic Fall 2008 professor: Luigi Ceccaroni.
We have seen that we can use Generalized Modus Ponens (GMP) combined with search to see if a fact is entailed from a Knowledge Base. Unfortunately, there.
For Friday No reading Homework: –Chapter 9, exercise 4 (This is VERY short – do it while you’re running your tests) Make sure you keep variables and constants.
Logic.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
First-Order Logic. Limitations of propositional logic Suppose you want to say “All humans are mortal” –In propositional logic, you would need ~6.7 billion.
Inference in FOL All rules of inference for propositional logic apply to first-order logic We just need to reduce FOL sentences to PL sentences by instantiating.
Logic. Propositional Logic Logic as a Knowledge Representation Language A Logic is a formal language, with precisely defined syntax and semantics, which.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2004.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Inference in First-Order Logic
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Fall 2004.
First-Order Logic Chapter 8. Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Knowledge engineering in FOL.
Predicate Calculus.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2005.
Propositional Logic Agenda: Other forms of inference in propositional logic Basics of First Order Logic (FOL) Vision Final Homework now posted on web site.
Inference in First-Order Logic Inference Rules with Quantifiers The three new inference rules are as follows: Universal Elimination: For any sentence ,
INFERENCE IN FIRST-ORDER LOGIC IES 503 ARTIFICIAL INTELLIGENCE İPEK SÜĞÜT.
Inference in first-order logic I CIS 391 – Introduction to Artificial Intelligence AIMA Chapter (through p. 278) Chapter 9.5 (through p. 300)
Inference in First-Order logic Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
CS 416 Artificial Intelligence Lecture 12 First-Order Logic Chapter 9 Lecture 12 First-Order Logic Chapter 9.
Logical Agents Logic Propositional Logic Summary
Limitation of propositional logic  Propositional logic has very limited expressive power –(unlike natural language) –E.g., cannot say "pits cause breezes.
First-Order Logic Chapter 8. Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Knowledge engineering in FOL.
Inference in FOL Compared to predicate logic, more abstract reasoning and specific conclusions.
1 Inference in First-Order Logic CS 271: Fall 2009.
1 Inference in First Order Logic CS 171/271 (Chapter 9) Some text and images in these slides were drawn from Russel & Norvig’s published material.
An Introduction to Artificial Intelligence – CE Chapter 9 - Inference in first-order logic Ramin Halavati In which we define.
Artificial Intelligence First-Order Logic (FOL). Outline of this Chapter The need for FOL? What is a FOL? Syntax and semantics of FOL Using FOL.
1 First Order Logic CS 171/271 (Chapters 8 and 9) Some text and images in these slides were drawn from Russel & Norvig’s published material.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 11 Jim Martin.
Inference in first-order logic
First-Order Logic Chapter 8 (not 8.1). Outline Why FOL? Why FOL? Syntax and semantics of FOL Syntax and semantics of FOL Using FOL Using FOL Wumpus world.
Inference in First Order Logic. Outline Reducing first order inference to propositional inference Unification Generalized Modus Ponens Forward and backward.
First-Order Logic. Outline Why FOL? Syntax and semantics of FOL Using FOL Knowledge engineering in FOL.
First-Order Logic Reading: C. 8 and C. 9 Pente specifications handed back at end of class.
1 First Order Logic CS 171/271 (Chapter 8) Some text and images in these slides were drawn from Russel & Norvig’s published material.
First-Order Logic Chapter 8. Problem of Propositional Logic  Propositional logic has very limited expressive power –E.g., cannot say "pits cause breezes.
Inference in First-Order Logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
1 Chaining in First Order Logic CS 171/271 (Chapter 9, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Announcements  Upcoming due dates  Thursday 10/1 in class Midterm  Coverage: everything in lecture and readings except first-order logic; NOT probability.
Inference in first-order logic
Inference in First-Order Logic
Inference in First-Order Logic
Inference in first-order logic part 1
Artificial Intelligence
Artificial intelligence: Inference in first-order logic
Artificial Intelligence Inference in First Order Logic
Inference in first-order logic
Inference in first-order logic part 1
Inference in First Order Logic (1)
CS 188: Artificial Intelligence
First-Order Logic Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

First-Order Logic

Limitations of propositional logic Suppose you want to say “All humans are mortal” In propositional logic, you would need ~6.7 billion statements Suppose you want to say “Some people can run a marathon” You would need a disjunction of ~6.7 billion statements

First-order logic Propositional logic assumes the world consists of atomic facts First-order logic assumes the world contains objects, relations, and functions

Syntax of FOL Constants: John, Sally, 2, ... Variables: x, y, a, b,... Predicates: Person(John), Siblings(John, Sally), IsOdd(2), ... Functions: MotherOf(John), Sqrt(x), ... Connectives: , , , ,  Equality: = Quantifiers: ,  Term: Constant or Variable or Function(Term1, ... , Termn) Atomic sentence: Predicate(Term1, ... , Termn) or Term1 = Term2 Complex sentence: made from atomic sentences using connectives and quantifiers

Semantics of FOL Sentences are true with respect to a model and an interpretation Model contains objects (domain elements) and relations among them Interpretation specifies referents for constant symbols → objects predicate symbols → relations function symbols → functional relations An atomic sentence Predicate(Term1, ... , Termn) is true iff the objects referred to by Term1, ... , Termn are in the relation referred to by predicate

Universal quantification x P(x) Example: “Everyone at UNC is smart” x At(x,UNC)  Smart(x) Why not x At(x,UNC)  Smart(x)? Roughly speaking, equivalent to the conjunction of all possible instantiations of the variable: At(John, UNC)  Smart(John)  ... At(Richard, UNC)  Smart(Richard)  ... x P(x) is true in a model m iff P(x) is true with x being each possible object in the model

Existential quantification x P(x) Example: “Someone at UNC is smart” x At(x,UNC)  Smart(x) Why not x At(x,UNC)  Smart(x)? Roughly speaking, equivalent to the disjunction of all possible instantiations: [At(John,UNC)  Smart(John)]  [At(Richard,UNC)  Smart(Richard)]  … x P(x) is true in a model m iff P(x) is true with x being some possible object in the model

Properties of quantifiers 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” y x Loves(x,y) “Everyone is loved by at least one person” Quantifier duality: each quantifier can be expressed using the other with the help of negation x Likes(x,IceCream) x Likes(x,IceCream) x Likes(x,Broccoli) x Likes(x,Broccoli)

Equality Term1 = Term2 is true under a given model if and only if Term1 and Term2 refer to the same object E.g., definition of Sibling in terms of Parent: x,y Sibling(x,y)  [(x = y)  m,f  (m = f)  Parent(m,x)  Parent(f,x)  Parent(m,y)  Parent(f,y)]

Using FOL: The Kinship Domain Brothers are siblings x,y Brother(x,y)  Sibling(x,y) “Sibling” is symmetric x,y Sibling(x,y)  Sibling(y,x) One's mother is one's female parent m,c (Mother(c) = m)  (Female(m)  Parent(m,c))

Why “First order”? FOL permits quantification over variables Higher order logics permit quantification over functions and predicates: P,x [P(x)  P(x)] x,y (x=y)  [P (P(x)P(y))]

Inference in FOL All rules of inference for propositional logic apply to first-order logic We just need to reduce FOL sentences to PL sentences by instantiating variables and removing quantifiers

Reduction of FOL to PL Suppose the KB contains the following: x King(x)  Greedy(x)  Evil(x) King(John) Greedy(John) Brother(Richard,John) How can we reduce this to PL? Let’s instantiate the universal sentence in all possible ways: King(John)  Greedy(John)  Evil(John) King(Richard)  Greedy(Richard)  Evil(Richard) The KB is propositionalized Proposition symbols are King(John), Greedy(John), Evil(John), King(Richard), etc.

Reduction of FOL to PL What about existential quantification, e.g., x Crown(x)  OnHead(x,John) ? Let’s instantiate the sentence with a new constant that doesn’t appear anywhere in the KB: Crown(C1)  OnHead(C1,John)

Substitution Substitution of variables by ground terms: SUBST({v/g},P) Result of SUBST({x/Harry, y/Sally}, Loves(x,y)): Loves(Harry,Sally) Result of SUBST({x/John}, King(x)  Greedy(x)  Evil(x)): King(John)  Greedy(John)  Evil(John)

Universal instantiation (UI) A universally quantified sentence entails every instantiation of it: v P(v) SUBST({v/g}, P(v)) for any variable v and ground term g E.g., x King(x)  Greedy(x)  Evil(x) yields: King(John)  Greedy(John)  Evil(John) King(Richard)  Greedy(Richard)  Evil(Richard) King(Father(John))  Greedy(Father(John))  Evil(Father(John))

Existential instantiation (EI) An existentially quantified sentence entails the instantiation of that sentence with a new constant: v P(v) SUBST({v/C}, P(v)) for any sentence P, variable v, and constant C that does not appear elsewhere in the knowledge base E.g., x Crown(x)  OnHead(x,John) yields: Crown(C1)  OnHead(C1,John) provided C1 is a new constant symbol, called a Skolem constant

Propositionalization Every FOL KB can be propositionalized so as to preserve entailment A ground sentence is entailed by the new KB iff it is entailed by the original KB Idea: propositionalize KB and query, apply resolution, return result Problem: with function symbols, there are infinitely many ground terms For example, Father(X) yields Father(John), Father(Father(John)), Father(Father(Father(John))), etc.

Propositionalization Theorem (Herbrand 1930): If a sentence α is entailed by an FOL KB, it is entailed by a finite subset of the propositionalized KB Idea: For n = 0 to Infinity do Create a propositional KB by instantiating with depth-n terms See if α is entailed by this KB Problem: works if α is entailed, loops if α is not entailed Theorem (Turing 1936, Church 1936): Entailment for FOL is semidecidable: algorithms exist that say yes to every entailed sentence, but no algorithm exists that also says no to every nonentailed sentence

Review: FOL inference

Propositionalization Example KB: x King(x)  Greedy(x)  Evil(x) y Greedy(y) King(John) Brother(Richard,John) What will propositionalization produce? King(John)  Greedy(John)  Evil(John) King(Richard)  Greedy(Richard)  Evil(Richard) Greedy(John) Greedy(Richard) King(John) Brother(Richard,John) But what if all we want is to prove Evil(John)?

Generalized Modus Ponens (GMP) p1', p2', … , pn', (p1  p2  …  pn q) such that SUBST(θ, pi')= SUBST(θ, pi) for all i SUBST(θ,q) Used with definite clauses (exactly one positive literal) All variables assumed universally quantified Example: p1' is King(John) p1 is King(x) p2' is Greedy(y) p2 is Greedy(x) θ is {x/John,y/John} q is Evil(x) SUBST(θ,q) is Evil(John)

Unification UNIFY(α,β) = θ means that SUBST(θ, α) = SUBST(θ, β) p q θ Knows(John,x) Knows(John,Jane) {x/Jane} Knows(John,x) Knows(y,Mary) {x/Mary, y/John} Knows(John,x) Knows(y,Mother(y)) {y/John, x/Mother(John)} Knows(John,x) Knows(x,Mary) {x1/John, x2/Mary} Knows(John,x) Knows(y,z) {y/John, x/z} Standardizing apart eliminates overlap of variables Most general unifier

such that SUBST(θ, pi')= SUBST(θ, pi) for all i Inference with GMP p1', p2', … , pn', (p1  p2  …  pn q) such that SUBST(θ, pi')= SUBST(θ, pi) for all i SUBST(θ,q) Forward chaining Like search: keep proving new things and adding them to the KB until we can prove q Backward chaining Find p1, …, pn such that knowing them would prove q Recursively try to prove p1, …, pn

Example knowledge base The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American. Prove that Col. West is a criminal

Example knowledge base It is a crime for an American to sell weapons to hostile nations: American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Nono has some missiles x Owns(Nono,x)  Missile(x) Owns(Nono,M1)  Missile(M1) All of its missiles were sold to it by Colonel West Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missiles are weapons: Missile(x)  Weapon(x) An enemy of America counts as “hostile”: Enemy(x,America)  Hostile(x) West is American American(West) The country Nono is an enemy of America Enemy(Nono,America)

Forward chaining proof American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Owns(Nono,M1)  Missile(M1) Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missile(x)  Weapon(x) Enemy(x,America)  Hostile(x) American(West) Enemy(Nono,America)

Forward chaining proof American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Owns(Nono,M1)  Missile(M1) Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missile(x)  Weapon(x) Enemy(x,America)  Hostile(x) American(West) Enemy(Nono,America)

Forward chaining proof American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Owns(Nono,M1)  Missile(M1) Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missile(x)  Weapon(x) Enemy(x,America)  Hostile(x) American(West) Enemy(Nono,America)

Backward chaining example American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Owns(Nono,M1)  Missile(M1) Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missile(x)  Weapon(x) Enemy(x,America)  Hostile(x) American(West) Enemy(Nono,America)

Backward chaining example American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Owns(Nono,M1)  Missile(M1) Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missile(x)  Weapon(x) Enemy(x,America)  Hostile(x) American(West) Enemy(Nono,America)

Backward chaining example American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Owns(Nono,M1)  Missile(M1) Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missile(x)  Weapon(x) Enemy(x,America)  Hostile(x) American(West) Enemy(Nono,America)

Backward chaining example American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Owns(Nono,M1)  Missile(M1) Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missile(x)  Weapon(x) Enemy(x,America)  Hostile(x) American(West) Enemy(Nono,America)

Backward chaining example American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Owns(Nono,M1)  Missile(M1) Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missile(x)  Weapon(x) Enemy(x,America)  Hostile(x) American(West) Enemy(Nono,America)

Backward chaining example American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Owns(Nono,M1)  Missile(M1) Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missile(x)  Weapon(x) Enemy(x,America)  Hostile(x) American(West) Enemy(Nono,America)

Backward chaining algorithm

Resolution: FOL version p1  ···  pk, q1  ···  qn such that UNIFY(pi, qj) = θ SUBST(θ, p1  ···  pi-1  pi+1  ···  pk  q1  ···  qj-1  qj+1  ···  qn) For example, Rich(x)  Unhappy(x) Rich(Ken) Unhappy(Ken) with θ = {x/Ken} Apply resolution steps to CNF(KB  α); complete for FOL

Resolution proof: definite clauses