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.

Slides:



Advertisements
Similar presentations
First-Order Logic Chapter 8.
Advertisements

Moving on to First-Order Logic Language, Meaning, Logic USEM 40a James Pustejovsky.
First-Order Logic.
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.
First-Order Logic (FOL) aka. predicate calculus. First-Order Logic (FOL) Syntax User defines these primitives: –Constant symbols (i.e., the "individuals"
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.
1 DCP 1172 Introduction to Artificial Intelligence Lecture notes for Ch.8 [AIAM-2nd Ed.] First-order Logic (FOL) Chang-Sheng Chen.
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
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. 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, 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.
FIRST-ORDER LOGIC FOL or FOPC
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.
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.
First Order Logic Chapter 7. PL is a Weak Representational Language §Propositional Logic (PL) is not a very expressive language because: §Hard to identify.
CSE PredLogic 1 Knowledge Representation with Logic: First Order Predicate Calculus Outline –Introduction to First Order Predicate Calculus (FOPC)
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.
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.
First-Order Logic Introduction Syntax and Semantics Using First-Order Logic Summary.
First Order Logic Chapter 8 Some material adopted from notes by Tim Finin And Andreas Geyer-Schulz.
First-Order Logic Chapter 8. Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Knowledge engineering in FOL.
1 First-Order Logic Propositional logic does not represent and cannot handle objects. First-order logic is to represent and reason on objects and their.
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.
REVIEW : Quantifiers A key to predicate logic we have been ignoring is the inclusion of quantifiers You should recall from discrete that you can also write.
For Friday Read chapter 8 Homework: –Chapter 7, exercises 2 and 10 Program 1, Milestone 2 due.
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 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.
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.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
1 CS 2710, ISSP 2610 Chapter 8, Part 1 First Order Predicate Calculus FOPC.
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
CMSC 671 Fall 2001 Class #12/13 – Thursday, October 11 / Tuesday, October 16.
Vampire: A Theorem Prover for First- Order Classical Logic Jason Gruber COSC Tuesday May 3, 2005.
Knowledge Representation using First-Order Logic
Course Instructor: kinza ch
Last time: Logic and Reasoning
First-Order Logic: Review
LẬP TRÌNH HƯỚNG ĐỐI TƯỢNG C++
CS201: Data Structures and Discrete Mathematics I
Môn: Lập trình Hướng đối tượng (Object Oriented Programming)
First Order Logic Chapter 8
Chapter 8, Part 1 First Order Predicate Calculus FOPC
First Order Logic.
Computer Sciences Department University of Wisconsin, Madison
Chapter 1: Propositional and First-Order Logic
CS201: Data Structures and Discrete Mathematics I
First-Order Logic Chapter 8.
First-Order Logic: Review
Chapter 8, Part 1 First Order Predicate Calculus FOPC
Presentation transcript:

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 toán suy diễn) III.Prolog (cú pháp, ngữ nghĩa, lập trình prolog, bài tập và thực hành) IV.Logic cấp một (cú pháp, ngữ nghĩa, sức mạnh biểu diễn, các thuật toán suy diễn) Lecture 1 Lecture 2 Lecture 3,4

CS 561, Session Lecture 3 First-order logic Syntax Semantics

CS 561, Session 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

CS 561, Session FOL: Syntax of basic elements – Cú pháp logic cấp 1 Constant symbols: 1, 5, A, B, USC, JPL, Alex, Manos, … Predicate symbols: >, Friend, Student, Colleague, … Function symbols: +, sqrt, SchoolOf, TeacherOf, ClassOf, … Variables: x, y, z, next, first, last, … Connectives: , , ,  Quantifiers: ,  Equality: = Note: -Ký hiệu viết hoa, thường ngược với Prolog! -Các ký hiệu hàm và lượng từ  không có trong prolog

CS 561, Session Khác nhau giữa hàm và vị từ 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)

First-Order Logic (FOL) Syntax – Cú pháp  User defines these primitives (các ký hiệu do người dùng đinh nghĩa): 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… Cú pháp …  FOL supplies these primitives (các ký hiệu từ ngôn ngữ logic cấp 1): Variable symbols. E.g., x,y Connectives. Same as in PL: not (~), and (^), or (v), implies (=>), if and only if ( ) Quantifiers: Universal ( ) and Existential ( )

Quantifiers – Các lượng từ  và  Universal quantification corresponds to conjunction ("and") in that (  x)P(x) means that P holds for all values of x in the domain associated with that variable. E.g., ( , x) dolphin(x) => mammal(x) Existential quantification corresponds to disjunction ("or") in that (  x)P(x) means that P holds for some value of x in the domain associated with that variable. E.g., (  x) mammal(x) ^ lays-eggs(x) Universal quantifiers are usually used with "implies" to form "if-then rules." E.g., (  x) 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: (  x)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., (  x) 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: (  x) cs student(x) => smart(x) Switching the order of universal quantifiers does not change the meaning: (  x)(  y)P(x,y) is logically equivalent to (  y)(  x)P(x,y). Similarly, you can switch the order of existential quantifiers. Switching the order of universals and existentials does change meaning: Everyone likes someone: (  x)(  y)likes(x,y) Someone is liked by everyone: (  y)(  x)likes(x,y)

CS 561, Session FOL: Atomic sentences (Câu đơn) AtomicSentence  Predicate(Term, …) | Term = Term Term  Function(Term, …) | Constant | Variable Examples: SchoolOf(Manos) Colleague(TeacherOf(Alex), TeacherOf(Manos)) >((+ x y), x)

CS 561, Session FOL: Complex sentences (câu phức) 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)

CS 561, Session Terms and Examples (hạng thức và ví dụ) Constants: object constants refer to individuals Alan, Sam, R225, R216 Variables PersonX, PersonY, RoomS, RoomT Functions father_of(PersonX) product_of(Number1,Number2)

CS 561, Session Sentences and examples (Câu và ví dụ) Sentences: make claims about objects (Well-formed formulas, (wffs)) Atomic Sentences (predicate expressions): loves(John,Mary), brother_of(John,Ted) Complex Sentences (Atomic Sentences connected by booleans): loves(John,Mary) brother_of(John,Ted) teases(Ted, John)

CS 561, Session Predicates and Quantifiers (vị từ và lượng từ) Predicates in(Alan,R225) partOf(R225,Pender) fatherOf(PersonX,PersonY) Quantifiers  x Dog(x) => Mamm(x) (All dogs are mammals.)  x Bird(x)  Cannotfly(x) (Some birds can’t fly.) [(  x,y) Bird(x)  Cannotfly(x)  Bird(y)  Cannotfly(y)]  [x≠y]  [  z Bird(z)  Cannotfly(z) => z=x  z=y] (2 birds can’t fly.) (chú ý ở đây sử dụng ký hiệu “[“ và “]” cho dễ đọc, đúng ra phải là ký hiệu “(“ và “)” để đúng cú pháp của logic cấp 1.

CS 561, Session Semantics of atomic sentences (ngữ nghĩa câu đơn) 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

CS 561, Session Example model (mô hình) 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

CS 561, Session Universal quantification (for all)  - Lượng từ phổ quát  “Every one in the cs561 class is smart”:  x In(cs561, x)  Smart(x)  P corresponds to the conjunction of instantiations of P In(cs561, Manos)  Smart(Manos)  In(cs561, Dan)  Smart(Dan)  … In(cs561, Clinton)  Smart(Clinton)

CS 561, Session  thường đi với   is a natural connective to use with  Common mistake: to use  in conjunction with  e.g:  x In(cs561, x)  Smart(x) means “every one is in cs561 and everyone is smart”

CS 561, Session Existential quantification (there exists)  - Lượng từ tồn tại  “Someone in the cs561 class is smart”:  x In(cs561, x)  Smart(x)  P corresponds to the disjunction of instantiations of P In(cs561, Manos)  Smart(Manos)  In(cs561, Dan)  Smart(Dan)  … In(cs561, Clinton)  Smart(Clinton)

CS 561, Session  thường đi với   is a natural connective to use with  Common mistake: to use  in conjunction with  e.g:  x In(cs561, x)  Smart(x) is true if there is anyone that is not in cs561! (remember, false  true is valid).

CS 561, Session Properties of quantifiers Proof? Not all by one person but each one at least by one

CS 561, Session 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))

CS 561, Session Example sentences Brothers are siblings. Sibling is transitive. One’s mother is one’s sibling’s mother. A first cousin is a child of a parent’s sibling.

CS 561, Session 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 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)

CS 561, Session 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)

CS 561, Session 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)

CS 561, Session 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)

CS 561, Session 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)

CS 561, Session 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)))

CS 561, Session 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.