First-Order Logic Prof. Dr. Widodo Budiharto 2018

Slides:



Advertisements
Similar presentations
First-Order Logic Chapter 8.
Advertisements

First-Order Logic.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Some Thoughts to Consider 7 What is the difference between Knowledge Engineering and Programming? What is the difference between Knowledge Engineering.
First-Order Logic Chapter 8.
Artificial Intelligence Lecture No. 10 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
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.
First-Order Logic Inference
1 FOL Resolution based Inferencing Resolution based rules studied earlier can lead to inferences, rules such as modus ponen, unit resolution etc… Other.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2004.
Cooperating Intelligent Systems Inference in first-order logic Chapter 9, AIMA.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Cooperating Intelligent Systems Inference in first-order logic Chapter 9, AIMA.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Fall 2004.
First-Order Logic Chapter 8. Problem of Propositional Logic  Propositional logic has very limited expressive power –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.
Predicate Calculus.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2005.
Inference in First-Order Logic Inference Rules with Quantifiers The three new inference rules are as follows: Universal Elimination: For any sentence ,
1 Inference in First-Order Logic. 2 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward chaining.
Cooperating Intelligent Systems Inference in first-order logic Chapter 9, AIMA.
FIRST ORDER LOGIC Levent Tolga EREN.
CHAPTER 9 Oliver Schulte Inference in First-Order Logic.
Inference in First-Order Logic CS 271: Fall 2007 Instructor: Padhraic Smyth.
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 Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
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 first- order logic. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward chaining.
Inference in First-Order Logic 부산대학교 전자전기컴퓨터공학과 인공지능연구실 김민호
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.
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.
First-Order Logic Chapter 8.
Knowledge Representation using First-Order Logic
Knowledge Representation using First-Order Logic
Course Instructor: kinza ch
Inference in first-order logic
School of Computer Science & Engineering
Inference in First-Order Logic
First-Order Logic Chapter 8.
Knowledge Representation & Reasoning
Artificial Intelligence First Order Logic
Inference in First-Order Logic
Inference in first-order logic part 1
Example of Knowledge Base
Artificial intelli-gence 1:Inference in first-order logic
Artificial Intelligence
Artificial intelligence: Inference in first-order logic
Artificial Intelligence Inference in First Order Logic
First-Order Logic Chapter 8.
Inference in first-order logic
Inference in first-order logic part 1
Inference in First Order Logic (1)
First-Order Logic Chapter 8.
First-Order Logic Inference
First-Order Logic Chapter 8.
Logical Agents Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

First-Order Logic Prof. Dr. Widodo Budiharto 2018 Course : Artificial Intelligence First-Order Logic Prof. Dr. Widodo Budiharto 2018

Outline First-Order Logic Quantifiers Inference using First-order Logic Exercise

Pros and Cons of Propositional Logic Propositional logic is declarative: pieces of syntax correspond to facts Propositional logic is compositional: meaning of B1,1 ^ P1,2 is derived from meaning of B1,1 and of P1,2 Meaning in propositional logic is context-independent Propositional logic has very limited expressive power E.g., cannot say “pits cause breezes in adjacent squares” except by writing one sentence for each square

Introduction to First-Order Logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes the world contains: Objects: people, houses, numbers, colors, baseball games, wars, … Relations: red, round, prime, brother of, bigger than, part of, comes between, … Functions: father of, best friend, one more than, plus, …

Introduction to First-Order Logic English Squares adjacent to pits are breezy Propositional Logic B1,1  (P1,2  P2,1), B2,1  (P1,1  P2,2  P3,1 ), etc We should define all possible facts that satisfy the “English” First-Order Logic  s Breezy(s)   r Adjacent(r,s)  Pit(r) We can satisfy the “English” with only a sentence

Introduction to First-Order Logic Standard Logic Symbols  = For all ; [e.g : every one, every body, any time, etc]  = There exists ; [e.g : some one, some time, etc]  = Implication ; [ if … then ….]  = Equivalent ; biconditional [if … and … only … if …]  = Not ; negation  = OR ; disjunction  = AND ; conjunction

Introduction to First-Order Logic Some kind of logic Epistemological commitment: the truth of what can be said about a sentence Language Ontological Epistemological Propositional logic facts true/false/unknown First-order logic facts, objects, relations Temporal logic facts, objects, relations, times Probability theory Degree of belief є [0, 1] Fuzzy logic Degree of truth є [0, 1] known interval value

Syntax and Semantic of First-Order Logic What are the objects? Relations? Functions?

Syntax and Semantic of First-Order Logic Basic elements Constants : KingJohn, 2, Binus, … (Objects) Predicates : Brother, >, loves, … (Relations) Functions : Sqrt, LeftLegOf, … (Functions) Variables : x, y, a, b,... Connectives : , , , ,  Equality : = Quantifiers : , 

Syntax and Semantic of First-Order Logic Term = function(term1,...,termn) or constant or variable A logical expression that refers to an object “Richard the Lionheart is the brother of King John”. e.g., Brother(Richard, John)  A term “King John’s left leg” e.g., LeftLeg(John)  A term

Syntax and Semantic of First-Order Logic Atomic sentence formed from a predicate symbol optionally followed by parenthesized list of terms Brother(Richard, John) Complex terms as arguments in atomic sentences is : married (Father(Richard), Mother(John)) An atomic sentence is true in a given model if The relation referred to by the predicate symbol holds among the objects referred to by the arguments.

Syntax and Semantic of First-Order Logic Complex sentence Are made from atomic sentences using connectives Examples:  Brother(LeftLeg(Richard), John) Brother(Richard, John)  Brother(John, Richard) King(Richard)  King(John)  King(Richard)  King(John)

Universal quantifiers Sentence: All Kings are persons Variable x = {Richard, King John, the crown} FOL: x King(x)  Person(x) Richard is a King  Richard is a person King John is a King  King John is a person The crown is a King  the crown is a person

Universal quantifiers Sentence: All Kings are persons Variable x = {Richard, King John, the crown} Attention! Don’t use  for  FOL: x King(x)  Person(x) Richard is a King  Richard is a person King John is a King  King John is a person The crown is a King  the crown is a person

Universal quantifiers

Existential quantifiers Sentence: The King John has a crown on his head Variable x = {Richard, King John, the crown} FOL: x Crown(x)  OnHead(x, John) x is pronounced “There exists an x such that …” or “For some x …” x P says that P is true in at least one extended interpretation that assigns x to a domain element

Existential quantifiers Sentence: The King John has a crown on his head Variable x = {Richard, King John, the crown} FOL: x Crown(x)  OnHead(x, John) Richard is a Crown  Richard is on John’s head King John is a Crown  King John is on John’s head The crown is a Crown  the crown is on John’s head (True) then the sentence is true, at least one

Existential quantifiers

Nested quantifiers Sentence: Brothers are siblings x y Brother(x, y)  Sibling(x, y) Consecutive quantifiers of the same type can be written as one quantifier with several variables To say that siblinghood is a symmetric relationship: x,y Sibling(x,y)  Sibling(y,x)

Nested quantifiers “Everybody loves somebody”: x y Loves(x, y) A mixture: “Everybody loves somebody”: x y Loves(x, y) “There is someone who is loved by everyone” : y x Loves(x, y)

Nested quantifiers

Using First-Order Logic Assertions and queries in first-order logic Sentences are added to a knowledge base using TELL, exactly as in propositional logic (Assertion) We can assert that John is a king, Richard is a person, and all kings are persons: TELL(KB, King(John)) . TELL(KB, Person(Richard)) . TELL(KB, ∀ x King(x) ⇒ Person(x)) .

Using First-Order Logic Assertions and queries in first-order logic We can ask questions of the knowledge base using ASK. ASK(KB, King(John)) Answer: True We can ask what value of x makes the sentence true, using ASKVARS ASKVARS(KB, Person(x)) Answer: {x/John} and {x/Richard}

Inference in First-Order Logic We begin with some simple inference rules (Instantiation) that can be applied to sentences with quantifiers to obtain sentences without quantifiers These rules lead naturally to the idea that first-order inference can be done by converting the knowledge base to propositional logic and using propositional inference

Universal Instantiation Universal Instantiation (UI) for any variable v and ground term g, Axiom that all greedy king are evil : 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 Existential Instantiation (EI) For any sentence α, variable v, and constant symbol k 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

Unification

Unification

Unification

Unification

Unification

Unification To unify Knows (John, x) and Knows (y, z), could return: θ = {y/John, x/z} or θ = {y/John, x/John, z/John} The first unifier is more general than the second. There is a single most general unifier (MGU) that is unique up to renaming of variables. MGU = { y/John, x/z }

Generalized Modus Ponens (GMP)

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 Colonel 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, i.e., 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)

Example: Knowledge Base Missiles are weapons: Missile(x)  Weapon(x) An enemy of America counts as "hostile“: Enemy(x, America)  Hostile(x) West, who is American … American(West) The country Nono, an enemy of America … Enemy(Nono, America)

Resolution

Conversion to CNF Sentence : “Everyone who loves all animals is loved by someone”: x [y Animal(y)  Loves(x, y)]  [y Loves(y, x)] Eliminate implications x [y Animal(y)  Loves(x, y)]  [y Loves(y, x)] Move  inwards: x p ≡ x p,  x p ≡ x p x [y (Animal(y)  Loves(x, y))]  [y Loves(y, x)] x [y Animal(y)  Loves(x, y)]  [y Loves(y, x)] x [y Animal(y)  Loves(x, y)]  [y Loves(y, x)]

Conversion to CNF Standardize variables: each quantifier should use a different one x [y Animal(y)  Loves(x, y)]  [z Loves(z, x)] Skolemize: a more general form of existential instantiation. Each existential variable is replaced by a Skolem function of the enclosing universally quantified variables: x [Animal(F(x))  Loves(x, F(x))]  Loves(G(x),x) Drop universal quantifiers: [Animal(F(x))  Loves(x,F(x))]  Loves(G(x),x) Distribute  over  : [Animal(F(x))  Loves(G(x),x)]  [Loves(x, F(x))  Loves(G(x), x)]

Conversion to CNF American(x)  Weapon(y)  Sells(x, y, z)  Hostile(z)  Criminal(x) American(x)  Weapon(y)  Sells(x, y, z)  Hostile(z)  Criminal(x) Owns(Nono,M1) and Missile(M1) Owns (Nono, M1) Missile(M1) Missile(x)  Owns(Nono, x)  Sells(West, x, Nono) Missile(x)  Owns(Nono, x)  Sells(West, x, Nono)

Conversion to CNF Missile(x)  Weapon(x) Missile(x)  Weapons(x) Enemy(x, America)  Hostile(x) Enemy(x, America)  Hostile(x) American(West) Enemy(Nono, America)

Resolution Knowledge Base in CNF American(x)  Weapon(y)  Sells(x, y, z)  Hostile(z)  Criminal(x) Missile(x)  Owns(Nono, x)  Sells(West, x, Nono) Enemy(x, America)  Hostile(x) Missile(x)  Weapons(x) Owns (Nono, M1) Missile(M1) American(West) Enemy(Nono, America)

Resolution

References Widodo Budiharto and Derwin Suhartono. (2014). Artificial Intelligence, Andi Offset Publisher Stuart Russell, Peter Norvig. 2010. Artificial Intelligence : A Modern Approach. Pearson Education. New Jersey. ISBN:9780132071482

Exercise Given sentences as premise: John is a student John is in the Informatics department Each Informatics’ student must be an engineering student Mathematic is a difficult lesson Each engineering student would definitely like Mathematic or hate it Each student would definitely like a lesson Students who have never attended difficult lesson certainly do not like the lesson Peter has never attended the Mathematic lesson Based on given premises above, please create: FOL Convert FOL in part a) to CNF Proof by Resolution, that Peter hate Mathematic.