Computer Sciences Department University of Wisconsin, Madison

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

First-Order Logic Chapter 8.
First-Order Logic.
L41 Lecture 2: Predicates and Quantifiers.. L42 Agenda Predicates and Quantifiers –Existential Quantifier  –Universal Quantifier 
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"
Computability and Complexity 8-1 Computability and Complexity Andrei Bulatov Logic Reminder.
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.
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.
1 Knowledge Representation and Reasoning. 2 Knowledge Representation & Reasoning How knowledge about the world can be represented How knowledge about.
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.
The Foundations: Logic and Proofs
First Order Logic Chapter 7. PL is a Weak Representational Language §Propositional Logic (PL) is not a very expressive language because: §Hard to identify.
1 Last time: Logic and Reasoning Knowledge Base (KB): contains a set of sentences expressed using a knowledge representation language TELL: operator to.
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.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
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.
Lecture 7 – Jan 28, Chapter 2 The Logic of Quantified Statements.
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.
11 Artificial Intelligence CS 165A Tuesday, October 30, 2007  Knowledge and reasoning (Ch 7) Propositional logic  First-order logic (Ch 8) 1.
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.
Predicate Logic One step stronger than propositional logic Copyright © Curt Hill.
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.
ARTIFICIAL INTELLIGENCE Lecture 2 Propositional Calculus.
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.
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.
PREDICATES AND QUANTIFIERS COSC-1321 Discrete Structures 1.
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.
Artificial Intelligence Logical Agents Chapter 7.
Knowledge Representation Lecture 2 out of 5. Last Week Intelligence needs knowledge We need to represent this knowledge in a way a computer can process.
Knowledge Representation using First-Order Logic
Last time: Logic and Reasoning
Chapter 3 The Logic of Quantified Statements
First-Order Logic Chapter 8.
ARTIFICIAL INTELLIGENCE
Notes 8: Predicate logic and inference
The Foundations: Logic and Proofs
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: LOGICS AND PROOF
First-Order Logic Chapter 8.
First-Order Logic Representation
Week #2 – 4/6 September 2002 Prof. Marie desJardins
Chapter 8, Part 1 First Order Predicate Calculus FOPC
Computer Security: Art and Science, 2nd Edition
First-order Logic Propositional logic (cont…)
Predicates and Quantifiers
Chapter 1: Propositional and First-Order Logic
This Lecture Substitution model
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
CS201: Data Structures and Discrete Mathematics I
First-Order Logic Chapter 8.
First-Order Logic Chapter 8.
Chapter 8, Part 1 First Order Predicate Calculus FOPC
Presentation transcript:

Computer Sciences Department University of Wisconsin, Madison First Order Logic Xiaojin Zhu jerryzhu@cs.wisc.edu Computer Sciences Department University of Wisconsin, Madison [Based on slides from Burr Settles]

Problems with propositional logic Consider the game “minesweeper” on a 10x10 field with only one landmine. How do you express the knowledge, with propositional logic, that the squares adjacent to the landmine will display the number 1?

Problems with propositional logic Consider the game “minesweeper” on a 10x10 field with only one landmine. How do you express the knowledge, with propositional logic, that the squares adjacent to the landmine will display the number 1? Intuitively with a rule like landmine(x,y)  number1(neighbors(x,y)) but propositional logic cannot do this…

Problems with propositional logic Propositional logic has to say, e.g. for cell (3,4): Landmine_3_4  number1_2_3 Landmine_3_4  number1_2_4 Landmine_3_4  number1_2_5 Landmine_3_4  number1_3_3 Landmine_3_4  number1_3_5 Landmine_3_4  number1_4_3 Landmine_3_4  number1_4_4 Landmine_3_4  number1_4_5 And similarly for each of Landmine_1_1, Landmine_1_2, Landmine_1_3, …, Landmine_10_10! Difficult to express large domains concisely Don’t have objects and relations First Order Logic is a powerful upgrade

Ontological commitment Logics are characterized by what they consider to be ‘primitives’ Logic Primitives Available Knowledge Propositional facts true/false/unknown First-Order facts, objects, relations Temporal facts, objects, relations, times Probability Theory degree of belief 0…1 Fuzzy degree of truth

First Order Logic syntax Term: an object in the world Constant: Jerry, 2, Madison, Green, … Variables: x, y, a, b, c, … Function(term1, …, termn) Sqrt(9), Distance(Madison, Chicago) Maps one or more objects to another object Can refer to an unnamed object: LeftLeg(John) Represents a user defined functional relation A ground term is a term without variables.

FOL syntax Atom: smallest T/F expression Predicate(term1, …, termn) Teacher(Jerry, you), Bigger(sqrt(2), x) Convention: read “Jerry (is)Teacher(of) you” Maps one or more objects to a truth value Represents a user defined relation term1 = term2 Radius(Earth)=6400km, 1=2 Represents the equality relation when two terms refer to the same object

FOL syntax Sentence: T/F expression Atom Complex sentence using connectives: Ù Ú Ø Þ Û Spouse(Jerry, Jing) Þ Spouse(Jing, Jerry) Less(11,22) Ù Less(22,33) Complex sentence using quantifiers ", $ Sentences are evaluated under an interpretation Which objects are referred to by constant symbols Which objects are referred to by function symbols What subsets defines the predicates

FOL quantifiers Universal quantifier: " Sentence is true for all values of x in the domain of variable x. Main connective typically is Þ Forms if-then rules “all humans are mammals” "x human(x) Þ mammal(x) Means if x is a human, then x is a mammal

FOL quantifiers "x human(x) Þ mammal(x) It’s a big AND: Equivalent to the conjunction of all the instantiations of variable x: (human(Jerry) Þ mammal(Jerry)) Ù (human(Jing) Þ mammal(Jing)) Ù (human(laptop) Þ mammal(laptop)) Ù … Common mistake is to use Ù as main connective "x human(x) Ù mammal(x) This means everything is human and a mammal! (human(Jerry) Ù mammal(Jerry)) Ù (human(Jing) Ù mammal(Jing)) Ù (human(laptop) Ù mammal(laptop)) Ù …

FOL quantifiers Existential quantifier: $ Sentence is true for some value of x in the domain of variable x. Main connective typically is  “some humans are male” x human(x)  male(x) Means there is an x who is a human and is a male

x pig(x) Þ fly(x) (wrong) FOL quantifiers x human(x)  male(x) It’s a big OR: Equivalent to the disjunction of all the instantiations of variable x: (human(Jerry)  male(Jerry))  (human(Jing)  male(Jing))  (human(laptop)  male(laptop))  … Common mistake is to use Þ as main connective “Some pig can fly” x pig(x) Þ fly(x) (wrong)

FOL quantifiers x human(x)  male(x) It’s a big OR: Equivalent to the disjunction of all the instantiations of variable x: (human(Jerry)  male(Jerry))  (human(Jing)  male(Jing))  (human(laptop)  male(laptop))  … Common mistake is to use Þ as main connective “Some pig can fly” x pig(x) Þ fly(x) (wrong) This is true if there is something not a pig! (pig(Jerry) Þ fly(Jerry))  (pig(laptop) Þ fly(laptop))  …

FOL quantifiers Properties of quantifiers: x y is the same as y x Example: "x "y likes(x,y) Everyone likes everyone. "y "x likes(x,y) Everyone is liked by everyone.

FOL quantifiers Properties of quantifiers: x y is not the same as y x x y is not the same as y x Example: x y likes(x,y) Everyone likes someone (can be different). y x likes(x,y) There is someone who is liked by everyone.

Somebody does not sleep. FOL quantifiers Properties of quantifiers: x P(x)when negated becomes x P(x) x P(x)when negated becomes x P(x) Example: x sleep(x) Everybody sleeps. x sleep(x) Somebody does not sleep.

There does not exist someone who does not sleep. FOL quantifiers Properties of quantifiers: x P(x)is the same as x P(x) x P(x)is the same as x P(x) Example: x sleep(x) Everybody sleeps. x sleep(x) There does not exist someone who does not sleep.

FOL syntax A free variable is a variable that is not bound by an quantifier, e.g. $y Likes(x,y): x is free, y is bound A well-formed formula (wff) is a sentence in which all variables are quantified (no free variable) Short summary so far: Constants: Bob, 2, Madison, … Variables: x, y, a, b, c, … Functions: Income, Address, Sqrt, … Predicates: Teacher, Sisters, Even, Prime… Connectives: Ù Ú Ø Þ Û Equality: = Quantifiers: " $

More summary Term: constant, variable, function. Denotes an object. (A ground term has no variables) Atom: the smallest expression assigned a truth value. Predicate and = Sentence: an atom, sentence with connectives, sentence with quantifiers. Assigned a truth value Well-formed formula (wff): a sentence in which all variables are quantified

Thinking in logical sentences Convert the following sentences into FOL: “Elmo is a monster.” What is the constant? Elmo What is the predicate? Is a monster Answer: monster(Elmo) “Tinky Winky and Dipsy are teletubbies” “Tom, Jerry or Mickey is not a mouse.”

Thinking in logical sentences We can also do this with relations: “America bought Alaska from Russia.” What are the constants? America, Alaska, Russia What are the relations? Bought Answer: bought(America, Alaska, Russia) “Warm is between cold and hot.” “Jerry and Jing are married.”

Thinking in logical sentences Now let’s think about quantifiers: “Jerry likes everything.” What’s the constant? Jerry Thing? Just use a variable x Everything? Universal quantifier Answer: x likes(Jerry, x) i.e. likes(Jerry, IceCream)  likes(Jerry, Jing)  likes(Jerry, Armadillos)  … “Jerry likes something.” “Somebody likes Jerry.”

Thinking in logical sentences We can also have multiple quantifiers: “somebody heard something.” What are the variables? Somebody, something How are they quantified? Both are existential Answer: x,y heard(x,y) “Everybody heard everything.” “Somebody did not hear everything.”

Thinking in logical sentences Let’s allow more complex quantified relations: “All stinky shoes are allowed.” How are ideas connected? Being a shoe and being stinky implies it’s allowed Answer: x shoe(x)  stinky(x)  allowed(x) “No stinky shoes are allowed.” Answers: x shoe(x)  stinky(x)  allowed(x) x shoe(x)  stinky(x)  allowed(x) x shoe(x)  stinky(x)  allowed(x) (?)

Thinking in logical sentences x allowed(x)   (shoe(x)  stinky(x)) “No stinky shoes are allowed.” x shoe(x)  stinky(x)  allowed(x) (?) x (shoe(x)  stinky(x)) Ú allowed(x) x  ((shoe(x)  stinky(x)) Ú allowed(x)) x (shoe(x)  stinky(x))  allowed(x) But this says “Jerry is a stinky shoe and Jerry is not allowed.” How about x allowed(x)   (shoe(x)  stinky(x))

Thinking in logical sentences And some more complex relations: “No one sees everything.” Answer: x y sees(x,y) Equivalently: “Everyone doesn’t see something.” Answer: x y sees(x,y) “Everyone sees nothing.” Answer: x y sees(x,y)

Thinking in logical sentences And some really complex relations: “Any good amateur can beat some professional.” Ingredients: x, amateur(x), good(x), y, professional(y), beat(x,y) Answer: x [{amateur(x)  good(x)}  y {professional(y)  beat(x,y)}] “Some professionals can beat all amateurs.” x [professional(x)  y {amateur(y)  beat(x,y)}]

Thinking in logical sentences We can throw in functions and equalities, too: “Jerry and Jing are the same age.” Are functional relations specified? Are equalities specified? Answer: age(Jerry) = age(Jing) “There are exactly two shoes.” ?

Thinking in logical sentences “There are exactly two shoes.” First try: x y shoe(x)  shoe(y)

Thinking in logical sentences “There are exactly two shoes.” First try: x y shoe(x)  shoe(y) Second try: x y shoe(x)  shoe(y)  (x=y)

Thinking in logical sentences “There are exactly two shoes.” First try: x y shoe(x)  shoe(y) Second try: x y shoe(x)  shoe(y)  (x=y) Third try: x y shoe(x)  shoe(y)  (x=y)  z (shoe(z)  (x=z)  (y=z))

Thinking in logical sentences Interesting words: always, sometimes, never “Good people always have friends.”

Thinking in logical sentences Interesting words: always, sometimes, never “Good people always have friends.” x person(x)  good(x)  y(friend(x,y)) “Busy people sometimes have friends.”

Thinking in logical sentences Interesting words: always, sometimes, never “Good people always have friends.” x person(x)  good(x)  y(friend(x,y)) “Busy people sometimes have friends.” x person(x)  busy(x)  y(friend(x,y)) “Bad people never have friends.”

Thinking in logical sentences Interesting words: always, sometimes, never “Good people always have friends.” x person(x)  good(x)  y(friend(x,y)) “Busy people sometimes have friends.” x person(x)  busy(x)  y(friend(x,y)) “Bad people never have friends.” x person(x)  bad(x)  y(friend(x,y))

Thinking in logical sentences Tricky sentences “x is above y if and only if x is directly on the 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.”

Thinking in logical sentences Tricky sentences “x is above y if and only if x is directly on the 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)  [onTop(x,y)  z{onTop(x,z)  above(z,y)}]

Next: Inference for FOL Recall that in propositional logic, inference is easy Enumerate all possibilities (truth tables) Apply sound inference rules on facts But in FOL, we have the concepts of variables, relations, and quantification This complicates things quite a bit! We will discuss inference in FOL next time.