1 DCP 1172 Introduction to Artificial Intelligence Lecture notes for Ch.8 [AIAM-2nd Ed.] First-order Logic (FOL) Chang-Sheng Chen.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

First-Order Logic Chapter 8.
First-Order Logic.
Artificial Intelligence
Logic.
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.
First-Order Logic (FOL) aka. predicate calculus. First-Order Logic (FOL) Syntax User defines these primitives: –Constant symbols (i.e., the "individuals"
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Chương 3 Tri thức và lập luận. Nội dung chính chương 3 I.Logic – ngôn ngữ của tư duy II.Logic mệnh đề (cú pháp, ngữ nghĩa, sức mạnh biểu diễn, các thuật.
Knowledge Representation Methods
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.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
Logic. Propositional Logic Logic as a Knowledge Representation Language A Logic is a formal language, with precisely defined syntax and semantics, which.
First-Order Logic Chapter 8.
CS 561, Sessions Knowledge and reasoning – second part Knowledge representation Logic and representation Propositional (Boolean) logic Normal forms.
CS 561, Session Midterm format Date: 10/10/2002 from 11:00am – 12:20 pm Location: THH 101 Credits: 35% of overall grade Approx. 4 problems, several.
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.
Knowledge Representation using First-Order Logic (Part II) Reading: Chapter 8, First lecture slides read: Second lecture slides read:
CS 561, Session Last time: Logic and Reasoning Knowledge Base (KB): contains a set of sentences expressed using a knowledge representation language.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
FIRST-ORDER LOGIC FOL or FOPC
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
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.
Agents that Reason Logically Logical agents have knowledge base, from which they draw conclusions TELL: provide new facts to agent ASK: decide on appropriate.
Propositional Logic Agenda: Other forms of inference in propositional logic Basics of First Order Logic (FOL) Vision Final Homework now posted on web site.
FIRST ORDER LOGIC Levent Tolga EREN.
CSE PredLogic 1 Knowledge Representation with Logic: First Order Predicate Calculus Outline –Introduction to First Order Predicate Calculus (FOPC)
Propositional Logic: Logical Agents (Part I) This lecture topic: Propositional Logic (two lectures) Chapter (this lecture, Part I) Chapter 7.5.
1 Logical Agents CS 171/271 (Chapter 7) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Logical Agents Logic Propositional Logic Summary
1 Last time: Logic and Reasoning Knowledge Base (KB): contains a set of sentences expressed using a knowledge representation language TELL: operator to.
11 Artificial Intelligence CS 165A Thursday, November 1, 2007  First-order logic (Ch 8)  Inference in FOL (Ch 9) 1.
Computing & Information Sciences Kansas State University Wednesday, 20 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 12 of 42 Wednesday, 20 September.
First-Order Logic Chapter 8. Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Knowledge engineering in FOL.
First-Order Logic Introduction Syntax and Semantics Using First-Order Logic Summary.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 11 of 41 Wednesday, 15.
1 Logical Agents CS 171/271 (Chapter 7) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 12 Friday, 17 September.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
CS6133 Software Specification and Verification
First-Order Logic Chapter 8. Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Knowledge engineering in FOL.
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.
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.
1 Propositional logic (cont…) 命題論理 Syntax&Semantics of first-order logic 構文論と意味論 Deducing hidden properties Describing actions Propositional logic (cont…)
11 Artificial Intelligence CS 165A Tuesday, October 30, 2007  Knowledge and reasoning (Ch 7) Propositional logic  First-order logic (Ch 8) 1.
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 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.
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.
Computing & Information Sciences Kansas State University Lecture 12 of 42 CIS 530 / 730 Artificial Intelligence Lecture 12 of 42 William H. Hsu Department.
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.
1 First Order Logic CS 171/271 (Chapter 8) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Basic Knowledge Representation in First Order Logic Chapter 7 Some material adopted from notes by Tim Finin And Andreas Geyer-Schulz.
First-Order Logic Chapter 8. Problem of Propositional Logic  Propositional logic has very limited expressive power –E.g., cannot say "pits cause breezes.
1 CS 2710, ISSP 2610 Chapter 8, Part 1 First Order Predicate Calculus FOPC.
Artificial Intelligence Logical Agents Chapter 7.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Last time: Logic and Reasoning
EA C461 – Artificial Intelligence Logical Agent
Artificial Intelligence
First Order Logic.
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
First-Order Logic Chapter 8.
Representations & Reasoning Systems (RRS) (2.2)
Logical Agents Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

1 DCP 1172 Introduction to Artificial Intelligence Lecture notes for Ch.8 [AIAM-2nd Ed.] First-order Logic (FOL) Chang-Sheng Chen

DCP1172, Ch.8 2 Midterm format Date: 11/19/2004 from 10:15 am – 11:55 am Location: EC016 Credits: 25% of overall grade Approx. 5 problems, several questions in each. Material: everything so far (or, up to Sec. 8.3). No books (or other material) are allowed. Duration will be 100 minutes.

DCP1172, Ch.8 3 Question 1 – problems with short answer Problem 1-1: Forward search vs. backward search. Please explain with your example. Problem 1-2: Translate the following English sentences to FOL. … Problem 1-3: Please explain the phrase " Truth depends on interpretation.” by showing with an example. …

DCP1172, Ch.8 4 Question Type 2: multiple-choices Please choose the topics that are candidates for the midterm exam ? (a)Informed search (b) Logical programming (c) Constraint Searching Program (d) Decision making under uncertainty (e) Probability Reasoning System Answer: (a), (c)

DCP1172, Ch.8 5 Question Type 3- Matching Here are a few things that are related to NCTU and NTHU, please match the correct ones to each of them. (a) (b) (c) IPv4 address range, *.* (d) The current administrator of TANet Hsinchu-Miaoli regional center (e) The university with the largest number of students in Taiwan Answer:,

DCP1172, Ch.8 6 Question type 4 – calculation or inference (with much more detailed involved) Problem 4-1: Please find an optimal solution to go from NCTU to the Hsinchu Railway Station. Here is the related information … the most economic way (e.g., less money) the most efficient way (e.g., less time)...

DCP1172, Ch.8 7 Last time: Logic and Reasoning Knowledge Base (KB): contains a set of sentences expressed using a knowledge representation language TELL: operator to add a sentence to the KB ASK: operator to query the KB Logics are KRLs where conclusions can be drawn Syntax Semantics Entailment: KB |= α iff a is true in all worlds where KB is true Inference: KB |– i α, sentence α can be derived from KB using procedure i Sound: whenever KB |– i α then KB |= α is true Complete: whenever KB |= a then KB |– i a

DCP1172, Ch.8 8 Last Time: Syntax of propositional logic

DCP1172, Ch.8 9 Last Time: Semantics of Propositional logic

DCP1172, Ch.8 10 Last Time: Inference rules for propositional logic

DCP1172, Ch.8 11 This time First-order logic Syntax Semantics Wumpus world example Ontology (ont = ‘to be’; logica = ‘word’): kinds of things one can talk about in the language

DCP1172, Ch.8 12 Why first-order logic? We saw that propositional logic is limited because it only makes the ontological commitment that the world consists of facts. Difficult to represent even simple worlds like the Wumpus world; e.g., “don’t go forward if the Wumpus is in front of you” takes 64 rules

DCP1172, Ch.8 13 First-order logic (FOL) Ontological commitments: Objects: wheel, door, body, engine, seat, car, passenger, driver Relations: Inside(car, passenger), Beside(driver, passenger) Functions: ColorOf(car) Properties: Color(car), IsOpen(door), IsOn(engine) Functions are relations with single value for each object

DCP1172, Ch.8 14 Semantics there is a correspondence between functions, which return values predicates, which are true or false Function: father_of(Mary) = Bill Predicate: father_of(Mary, Bill)

DCP1172, Ch.8 15 Examples: “One plus two equals three” Objects:one, two, three, one plus two Relations:equals Properties:-- Functions:plus (“one plus two” is the name of the object obtained by applying function plus to one and two; three is another name for this object) “Squares neighboring the Wumpus are smelly” Objects:Wumpus, square Relations:neighboring Properties:smelly Functions:--

DCP1172, Ch.8 16 FOL: Syntax of basic elements Constant symbols: 1, 5, A, B, Alex, Manos, … Predicate symbols: >, Friend, Student, Colleague, … Function symbols: +, sqrt, SchoolOf, TeacherOf, ClassOf, … Variables: x, y, z, next, first, last, … Connectives: , , ,  Quantifiers: ,  Equality: =

DCP1172, Ch.8 17 Syntax of Predicate Logic Symbol set constants Boolean connectives variables functions predicates (relations) quantifiers

DCP1172, Ch.8 18 Syntax of Predicate Logic Terms: a reference to an object variables, constants, functional expressions (can be arguments to predicates) Examples: first([a,b,c]), sq_root(9), sq_root(n), tail([a,b,c])

DCP1172, Ch.8 19 Syntax of Predicate Logic Sentences: make claims about objects Well-formed formulas, (wffs) Atomic Sentences (predicate expressions): Loves(John,Mary), Brother(John,Ted) Complex Sentences (Atomic Sentences connected by booleans): ¬ Loves(John,Mary) Brother(John,Ted) ^ Brother(Ted,John) Mother(Alice, John) ⇒ Mother(Alice,Ted)

DCP1172, Ch.8 20 Examples of Terms: Constants, Variables and Functions Constants: object constants refer to individuals Alan, Sam, R225, R216 Variables PersonX, PersonY, RoomS, RoomT Functions father_of(PersonX) product_of(Number1,Number2)

DCP1172, Ch.8 21 Examples of Predicates and Quantifiers Predicates In(Alan,R225) PartOf(R225,BuildingEC3) FatherOf(PersonX,PersonY) Quantifiers All dogs are mammals. Some birds can’t fly. 3 birds can’t fly.

DCP1172, Ch.8 22 Semantics Referring to individuals Jackie son-of(Jackie), Sam Referring to states of the world person(Jackie), female(Jackie) mother(Sam, Jackie)

DCP1172, Ch.8 23 FOL: Atomic sentences AtomicSentence  Predicate(Term, …) | Term = Term Term  Function(Term, …) | Constant | Variable Examples: SchoolOf(Manos) Colleague(TeacherOf(Alex), TeacherOf(Manos)) >((+ x y), x)

DCP1172, Ch.8 24 FOL: Complex sentences Sentence  AtomicSentence | Sentence Connective Sentence | Quantifier Variable, … Sentence |  Sentence | (Sentence) Examples: S1  S2, S1  S2, (S1  S2)  S3, S1  S2, S1  S3 Colleague(Paolo, Maja)  Colleague(Maja, Paolo) Student(Alex, Paolo)  Teacher(Paolo, Alex)

DCP1172, Ch.8 25 Semantics of atomic sentences Sentences in FOL are interpreted with respect to a model Model contains objects and relations among them Terms: refer to objects (e.g., Door, Alex, StudentOf(Paolo)) Constant symbols: refer to objects Predicate symbols: refer to relations Function symbols: refer to functional Relations An atomic sentence predicate(term 1, …, term n ) is true iff the relation referred to by predicate holds between the objects referred to by term 1, …, term n

DCP1172, Ch.8 26 Example model Objects: John, James, Marry, Alex, Dan, Joe, Anne, Rich Relation: sets of tuples of objects {,,, …} {,,, …} E.g.: Parent relation -- {,, } then Parent(John, James) is true Parent(John, Marry) is false

DCP1172, Ch.8 27 Quantifiers Expressing sentences about collections of objects without enumeration (naming individuals) E.g., All Trojans are clever Someone in the class is sleeping Universal quantification (for all):  Existential quantification (three exists): 

DCP1172, Ch.8 28 Universal quantification (for all):   “Every one in the DCP1172 class is smart”:  x In(DCP1172, x)  Smart(x)  P corresponds to the conjunction of instantiations of P In(DCP1172, Manos)  Smart(Manos)  In(DCP1172, Dan)  Smart(Dan)  … In(DCP1172, Clinton)  Smart(Clinton)

DCP1172, Ch.8 29 Universal quantification (for all):   is a natural connective to use with  Common mistake: to use  in conjunction with  e.g:  x In(DCP1172, x)  Smart(x) means “every one is in DCP1172 and everyone is smart”

DCP1172, Ch.8 30 Existential quantification (there exists):   “Someone in the dcp1172 class is smart”:  x In(dcp1172, x)  Smart(x)  P corresponds to the disjunction of instantiations of P In(dcp1172, Manos)  Smart(Manos)  In(dcp1172, Dan)  Smart(Dan)  … In(dcp1172, Clinton)  Smart(Clinton)

DCP1172, Ch.8 31 Existential quantification (there exists):   is a natural connective to use with  Common mistake: to use  in conjunction with  e.g:  x In(dcp1172, x)  Smart(x) is true if there is anyone that is not in dcp1172! (remember, false  true is valid).

DCP1172, Ch.8 32 Properties of quantifiers Proof? Not all by one person but each one at least by one

DCP1172, Ch.8 33 Proof In general we want to prove:  x P(x) ¬  x ¬ P(x)   x P(x) = ¬(¬(  x P(x))) = ¬(¬(P(x1) ^ P(x2) ^ … ^ P(xn)) ) = ¬(¬P(x1) v ¬P(x2) v … v ¬P(xn)) )   x ¬P(x) = ¬P(x1) v ¬P(x2) v … v ¬P(xn)  ¬  x ¬P(x) = ¬(¬P(x1) v ¬P(x2) v … v ¬P(xn))

DCP1172, Ch.8 34 Example sentences Brothers are siblings  x, y Brother(x, y)  Sibling(x, y) Sibling is transitive  x, y, z Sibling(x, y)  Sibling(y, z)  Sibling(x, z) One’s mother is one’s sibling’s mother  m, c,d Mother(m, c)  Sibling(c, d)  Mother(m, d) A first cousin is a child of a parent’s sibling  c, d FirstCousin(c, d)   p, ps Parent(p, d)  Sibling(p, ps)  Parent(ps, c)

DCP1172, Ch.8 35 Example sentences One’s mother is one’s sibling’s mother  m, c,d Mother(m, c)  Sibling(c, d)  Mother(m, d)  c,d  m Mother(m, c)  Sibling(c, d)  Mother(m, d) cd m Mother of sibling

DCP1172, Ch.8 36 Translating English to FOL Every gardener likes the sun.  x gardener(x) => likes(x,Sun) You can fool some of the people all of the time.  x  t (person(x) ^ time(t)) => can-fool(x,t)

DCP1172, Ch.8 37 Translating English to FOL You can fool all of the people some of the time.  x  t (person(x) ^ time(t) => can-fool(x,t) All purple mushrooms are poisonous.  x (mushroom(x) ^ purple(x)) => poisonous(x)

DCP1172, Ch.8 38 Translating English to FOL… No purple mushroom is poisonous. ¬(  x) purple(x) ^ mushroom(x) ^ poisonous(x) or, equivalently, (  x) (mushroom(x) ^ purple(x)) => ¬poisonous(x)

DCP1172, Ch.8 39 Translating English to FOL… There are exactly two purple mushrooms. (  x)(  y) mushroom(x) ^ purple(x) ^ mushroom(y) ^ purple(y) ^ ¬(x=y) ^ (  z) (mushroom(z) ^ purple(z)) => ((x=z) v (y=z)) Deb is not tall. ¬tall(Deb)

DCP1172, Ch.8 40 Translating English to FOL… 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. (  x)(  y) above(x,y) (on(x,y) v (  z) (on(x,z) ^ above(z,y)))

DCP1172, Ch.8 41 Equality

DCP1172, Ch.8 42 Higher-order logic? First-order logic allows us to quantify over objects (= the first-order entities that exist in the world). Higher-order logic also allows quantification over relations and functions. e.g., “two objects are equal iff all properties applied to them are equivalent”:  x,y (x=y)  (  p, p(x)  p(y)) Higher-order logics are more expressive than first-order; however, so far we have little understanding on how to effectively reason with sentences in higher-order logic.

DCP1172, Ch.8 43 Logical agents for the Wumpus world 1.TELL KB what was perceived Uses a KRL to insert new sentences, representations of facts, into KB 2.ASK KB what to do. Uses logical reasoning to examine actions and select best. Remember: generic knowledge-based agent:

DCP1172, Ch.8 44 Using the FOL Knowledge Base Set of solutions

DCP1172, Ch.8 45 Wumpus world, FOL Knowledge Base

DCP1172, Ch.8 46 Deducing hidden properties

DCP1172, Ch.8 47 Situation calculus

DCP1172, Ch.8 48 Describing actions May result in too many frame axioms

DCP1172, Ch.8 49 Describing actions (cont’d)

DCP1172, Ch.8 50 Planning

DCP1172, Ch.8 51 Generating action sequences [ ] = empty plan Recursively continue until it gets to empty plan [ ]

DCP1172, Ch.8 52 Summary