First-Order Logic (FOL) aka. predicate calculus. First-Order Logic (FOL) Syntax User defines these primitives: –Constant symbols (i.e., the "individuals"

Slides:



Advertisements
Similar presentations
Inference in First-Order Logic
Advertisements

First-Order Logic (FOL) aka. predicate calculus
Some Prolog Prolog is a logic programming language
First-Order Logic.
Inference Rules Universal Instantiation Existential Generalization
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"
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.
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.
Horn Form A sentence is in Horn form if and only if ….
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Russell and Norvig: Chapters 8 and 9 CMSC421 – Fall 2006
First-Order Logic Chapter 8.
SE Last time: Logic and Reasoning Knowledge Base (KB): contains a set of sentences expressed using a knowledge representation language TELL: operator.
Basic Knowledge Representation in First Order Logic Some material adopted from notes by Tim Finin And Andreas Geyer-Schulz.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
DISCRETE MATHEMATICS I LECTURES CHAPTER 3 Dr. Adam P. Anthony Spring 2011 Some material adapted from lecture notes provided by Dr. Chungsim Han and Dr.
Knowledge Representation Methods
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
CS 460, Session Midterm format Date: 10/07/2004 from 5:00pm – 6:30pm Location: WPH B27 (our regular classroom) Credits: 30% of overall grade Approx.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2004.
CS 561, Session Last time: Logic and Reasoning Knowledge Base (KB): contains a set of sentences expressed using a knowledge representation language.
Knoweldge Representation & Reasoning
Inference in First-Order Logic
Propositional Logic Agenda: Other forms of inference in propositional logic Basics of First Order Logic (FOL) Vision Final Homework now posted on web site.
CSE 311 Foundations of Computing I Lecture 6 Predicate Logic, Logical Inference Spring
Artificial Intelligence
Inference in First-Order logic Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Logical Inference 2 rule based reasoning
Pattern-directed inference systems
Logical Agents Logic Propositional Logic Summary
1 CMSC 471 Fall 2002 Class #10/12–Wednesday, October 2 / Wednesday, October 9.
1 Predicate (Relational) Logic 1. Introduction The propositional logic is not powerful enough to express certain types of relationship between propositions.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
CSE 311 Foundations of Computing I Lecture 7 Logical Inference Autumn 2012 CSE
Hazırlayan DISCRETE COMPUTATIONAL STRUCTURES Propositional Logic PROF. DR. YUSUF OYSAL.
9/30/98 Prof. Richard Fikes Inference In First Order Logic Computer Science Department Stanford University CS222 Fall 1998.
Intelligent Systems Predicate Logic. Outline Motivation Technical Solution – Syntax – Semantics – Inference Illustration by Larger Example Extensions.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
CS6133 Software Specification and Verification
First Order Logic Chapter 8 Some material adopted from notes by Tim Finin And Andreas Geyer-Schulz.
1ApatiraUthman 2AtphasoukJason 3ChauMinh 4CohenDavid 5CookNathan 6de GuzmanArmand 7EdgcombAlex 8GarciaSteven 9HichbornGeoffrey 10HuiCharles 11KazemiAzadeh.
Artificial Intelligence 7. Making Deductive Inferences Course V231 Department of Computing Imperial College, London Jeremy Gow.
CS-554 Part-3: First-Order Logic
For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9.
For Friday Read chapter 8 Homework: –Chapter 7, exercises 2 and 10 Program 1, Milestone 2 due.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 11 Jim Martin.
ECE457 Applied Artificial Intelligence R. Khoury (2007)Page 1 Implication Truth Table If α is true, then β must be true for the implication to be true.
First-Order Logic Reading: C. 8 and C. 9 Pente specifications handed back at end of class.
First-Order Logic Semantics Reading: Chapter 8, , FOL Syntax and Semantics read: FOL Knowledge Engineering read: FOL.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Basic Knowledge Representation in First Order Logic Chapter 7 Some material adopted from notes by Tim Finin And Andreas Geyer-Schulz.
1 Outline Quantifiers and predicates Translation of English sentences Predicate formulas with single variable Predicate formulas involving multiple variables.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
For Friday Finish chapter 9 Program 1 due. Program 1 Any questions?
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
Vampire: A Theorem Prover for First- Order Classical Logic Jason Gruber COSC Tuesday May 3, 2005.
Logical Inference 2 Rule-based reasoning
Last time: Logic and Reasoning
First-Order Logic (FOL) aka. predicate calculus
Logical Inference 2 Rule-based reasoning
Predicate logic Also known as predicate calculus or First-Order-Logic(FOL) or First- Order-Predicate-Calculus (FOPC). Meant to overcome the weaknesses.
CS201: Data Structures and Discrete Mathematics I
Chapter 1: Propositional and First-Order Logic
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
CS201: Data Structures and Discrete Mathematics I
First-Order Logic Chapter 8.
Presentation transcript:

First-Order Logic (FOL) aka. predicate calculus

First-Order Logic (FOL) Syntax User defines these primitives: –Constant symbols (i.e., the "individuals" in the world) E.g., Mary, 3 –Function symbols (mapping individuals to individuals) E.g., father-of(Mary) = John, color-of(Sky) = Blue –Predicate symbols (mapping from individuals to truth values) E.g., greater(5,3), green(Grass), color(Grass, Green)

First-Order Logic (FOL) Syntax… FOL supplies these primitives: –Variable symbols. E.g., x,y –Connectives. Same as in PL: not (~), and (^), or (v), implies (=>), if and only if ( ) –Quantifiers: Universal ( A ) and Existential ( E )

Quantifiers Universal quantification. –E.g., (Ax) dolphin(x) => mammal(x) Existential quantification. –E.g., (Ex) mammal(x) ^ lays-eggs(x) Universal quantifiers are usually used with "implies" to form "if- then rules." –E.g., (Ax) cs-student(x) => smart(x) means "All cs students are smart." –You rarely use universal quantification to make blanket statements about every individual in the world: (Ax)cs-student(x) ^ smart(x) meaning that everyone in the world is a cs student and is smart.

Quantifiers … Existential quantifiers are usually used with "and" to specify a list of properties or facts about an individual. –E.g., (Ex) cs-student(x) ^ smart(x) means "there is a cs student who is smart." –A common mistake is to represent this English sentence as the FOL sentence: (Ex) cs-student(x) => smart(x)

First-Order Logic (FOL) Syntax… Sentences are built up of terms and atoms: –A term (denoting a real-world object) is a constant symbol, a variable symbol, or a function e.g. left-leg-of ( ). For example, x and f(x1,..., xn) are terms, where each xi is a term. –An atom (which has value true or false) is either an n-place predicate of n terms, or, if P and Q are atoms, then ~P, P V Q, P ^ Q, P => Q, P Q are atoms –A sentence is an atom, or, if P is a sentence and x is a variable, then (Ax)P and (Ex)P are sentences –A well-formed formula (wff) is a sentence containing no "free" variables. I.e., all variables are "bound" by universal or existential quantifiers. E.g., (Ax)P(x,y) has x bound as a universally quantified variable, but y is free.

Translating English to FOL Every gardener likes the sun. (Ax) gardener(x) => likes(x,Sun) You can fool some of the people all of the time. (Ex)(At) (person(x) ^ time(t)) => can-fool(x,t) You can fool all of the people some of the time. (Ax)(Et) (person(x) ^ time(t) => can-fool(x,t) All purple mushrooms are poisonous. (Ax) (mushroom(x) ^ purple(x)) => poisonous(x)

Translating English to FOL… No purple mushroom is poisonous. ~(Ex) purple(x) ^ mushroom(x) ^ poisonous(x) or, equivalently, (Ax) (mushroom(x) ^ purple(x)) => ~poisonous(x) Deb is not tall. ~tall(Deb) X is above Y if X is on directly on top of Y or else there is a pile of one or more other objects directly on top of one another starting with X and ending with Y. (Ax)(Ay) above(x,y) (on(x,y) v (Ez) (on(x,z) ^ above(z,y)))

Inference Rules for FOL Inference rules for PL apply to FOL as well. For example, Modus Ponens, And- Introduction, And-Elimination, etc. New sound inference rules for use with quantifiers: –Universal Elimination If (Ax)P(x) is true, then P(c) is true, where c is a constant in the domain of x. For example, from (Ax)eats(Ziggy, x) we can infer eats(Ziggy, IceCream). The variable symbol can be replaced by any ground term, i.e., any constant symbol or function symbol applied to ground terms only. –Existential Introduction If P(c) is true, then (Ex)P(x) is inferred. For example, from eats(Ziggy, IceCream) we can infer (Ex)eats(Ziggy, x). All instances of the given constant symbol are replaced by the new variable symbol. Note that the variable symbol cannot already exist anywhere in the expression. –Existential Elimination From (Ex)P(x) infer P(c). For example, from (Ex)eats(Ziggy, x) infer eats(Ziggy, Cheese). Note that the variable is replaced by a brand new constant that does not occur in this or any other sentence in the Knowledge Base. In other words, we don't want to accidentally draw other inferences about it by introducing the constant. All we know is there must be some constant that makes this true, so we can introduce a brand new one to stand in for that (unknown) constant.

Inference Rules for FOL Inference rules for PL apply to FOL as well. For example, Modus Ponens, And-Introduction, And-Elimination, etc. Generalized Modus Ponens (GMP) –Combines And-Introduction, Universal-Elimination, and Modus Ponens –E.g.: from P(c), Q(c), and (Ax)(P(x) ^ Q(x)) => R(x), derive R(c) –A substitution list Theta = {v1/t1, v2/t2,..., vn/tn} means to replace all occurrences of variable symbol vi by term ti. Substitutions are made in left-to-right order in the list. E.g.: subst({x/IceCream, y/Ziggy}, eats(y,x)) = eats(Ziggy, IceCream)

 x P(x) => Q(x)  x  P(x) => Q(x)  x Q(x) => S(x)  x R(x) => S(x)  Cannot be converted to Horn Want to conclude S(A) S(A) is true if Q(A) or R(A) is true, and one of those must be true because either P(A) or  P(A) Generalized Modus Ponens Backward chaining Forward chaining Incompleteness of the generalized modus ponens inference rule

Generalized Modus Ponens in Horn FOL Generalized Modus Ponens (GMP) is complete for KBs containing only Horn clauses –A Horn clause is a sentence of the form: (Ax) (P1(x) ^ P2(x) ^... ^ Pn(x)) => Q(x) where there are 0 or more Pi 's, and the Pi 's and Q are positive (i.e., un-negated) literals –For example, P(a) v Q(a) is a sentence in FOL but is not a Horn clause. Generalized Modus Ponens Forward chaining Backward chaining

Forward Chaining Natural deduction using GMP is complete for KBs containing only Horn clauses. Proofs start with the given axioms in KB, deriving new sentences using GMP until the goal/query sentence is derived. This defines a forward chaining inference procedure because it moves "forward" from the KB to the goal.

Example of forward chaining Example: KB = All cats like fish, cats eat everything they like, and Ziggy is a cat. In FOL, KB = 1.(Ax) cat(x) => likes(x, Fish) 2.(Ax)(Ay) (cat(x) ^ likes(x,y)) => eats(x,y) 3.cat(Ziggy) Goal query: Does Ziggy eat fish? Proof: Data-driven 1.Use GMP with (1) and (3) to derive: 4. likes(Ziggy, Fish) 2.Use GMP with (3), (4) and (2) to derive eats(Ziggy, Fish) 3.So, Yes, Ziggy eats fish.

Backward Chaining Natural deduction using GMP is complete for KBs containing only Horn clauses. Proofs start with the goal query, find implications that would allow you to prove it, and then prove each of the antecedents in the implication, continuing to work "backwards" until we get to the axioms, which we know are true.

Backward chaining Example: Does Ziggy eat fish? To prove eats(Ziggy, Fish), first see if this is known from one of the axioms directly. Here it is not known, so see if there is a Horn clause that has the consequent (i.e., right-hand side) of the implication matching the goal. Proof: Goal Driven 1.Goal matches RHS of Horn clause (2), so try and prove new sub-goals cat(Ziggy) and likes(Ziggy, Fish) that correspond to the LHS of (2) 2.cat(Ziggy) matches axiom (3), so we've "solved" that sub-goal 3.likes(Ziggy, Fish) matches the RHS of (1), so try and prove cat(Ziggy) 4.cat(Ziggy) matches (as it did earlier) axiom (3), so we've solved this sub- goal 5.There are no unsolved sub-goals, so we're done. Yes, Ziggy eats fish.