chapter8
play

Chapter8 First-Order Logic 20070503 Chap8 1 Pros and Cons of - PDF document

Chapter8 First-Order Logic 20070503 Chap8 1 Pros and Cons of Prop. Logic PL is declarative Knowledge and inference are separate and inference is entirely domain-independent. PL is compositional Meaning of a sentence is a


  1. Chapter8 First-Order Logic 20070503 Chap8 1 Pros and Cons of Prop. Logic PL is declarative • Knowledge and inference are separate and inference is entirely domain-independent. PL is compositional • Meaning of a sentence is a function of the meaning of its parts PL allows partial/ disjunctive/negated information • The meaning of PL is context-independent. • PL has very limited expressive power • e.g. cannot say “pits cause breezes in adjacent squares” except by writing one sentence for each square 20070503 Chap8 2 1

  2. First-Order Logic PL assumes world contains facts. FOL= PL + predicates, quantifiers, variables, and equality FOL assumes the world contains Objects : things with individual identities • e.g. people, numbers, blocks A, B, C, D Properties : distinguishing objects from others • e.g. red, round, prime, smelly, … Inter-relations among objects - Functions : a special kind of relation in which there is only one “value” for a given “input.” e.g. father of, best friend, one more than, … - Relations e.g. brother of, bigger than, on(D, A), on(A, Table), … 20070503 Chap8 3 Logics in General Ontological Commitment: What it assums about the nature of reality. Epistemological Commitment: The possible states of knowledge that it allows wrt each fact. 20070503 Chap8 4 2

  3. Examples: Conceptualization • One plus two equals three - Objects: one, two, three, one plus two - Function: plus - Relation: equals • Squares neighboring the wumpus are smelly - Objects: wumpus, square - Property: smelly - Relations: neighboring • Evil King John ruled England in 1200 - Objects: John, England, 1200 - Properties: evil, king - Relations: ruled • All NTU students and their parents are smart 20070503 Chap8 5 Models for FOL: Example 5 objects: Richard, John, … 2 binary relations: brother, on head 3 unary relations: person, king, crown 1 unary function: left leg 20070503 Chap8 6 3

  4. Syntax of FOL → Sentence Atomic | Complex → ¬ Complex (Sentence) | Sentence | Sentence Connective Sentence | Quantifier Variable, K Sentence → Atomic Predicate( Term, K ) = | Term Term → K Term Function(T erm, ) | Constant | Variable → ∧ ∨ ⇒ ⇔ Connective | | | → ∀ ∃ Quantifier | → K Constant A | X | John 1 → K Variable a | x | s → L Predicate Before | HasColor | Raining | → L Functio n Mother | LeftLegOf | 20070503 Chap8 7 Semantics of FOL Sentences are true with respect to a model and • an interpretation . Model contains objects and relations among them. • Interpretation specifies referents for • constant symbols → objects predicate symbols → relations function symbols → functional relations An atomic sentence • Predicate(Term 1 , …Term n ) is true iff the objects referred to by Term 1 , …Term n are in the relation referred to by Predicate 20070503 Chap8 8 4

  5. Sentences and Terms • Sentence: represent a fact - Atomic sentence: a predicate symbol followed by a parenthesized list of terms. i.e. Predicate(Term, …) - Complex sentence: constructed via logical connectives - Quantified sentence: expressing properties of entire collections of objects, rather than having enumerate the objects by name. • Term: represent an object - Constant (0-ary function constant) - Variable (0-ary function variable) - Function(Term, …) 20070503 Chap8 9 Sentences and Terms (cont.) • Interpretation: - Each constant names exactly one object. - Not all objects have names. - Some objects have multiple names. - A relation is defined as a set of tuples of objects that satisfy it, e.g. the relation of brotherhood {< King John, Richard the Lionheart>, <Richard the Lionheart, King John>} - An n-ary function maps n objects into another object. 20070503 Chap8 10 5

  6. FOL Examples tall(Wendy ) • Wendy is tall. big(nose - of(Durante )) • Durante’s nose is big. • John loves his dog. loves(John , dog - of(John)) • John is the brother of Richard and vice versa. ∧ Brother(Ri chard, John) Brother(Jo hn, Richard) 20070503 Chap8 11 FOL Examples (cont.-1) • All kings are persons. ∀ ⇒ − − − x Kings(x) Persons(x) correct ∀ ∧ − − − x Kings(x) Persons(x) wrong All the following must be true: (correct) Richard is a king ⇒ Richard is a person. King John is a king ⇒ King John is a person. Richard’s left leg is a king ⇒ Richard’s left leg is a person. John’s left leg is a king ⇒ John’s left leg is a person. The crown is a king ⇒ The crown is a person. (wrong) Richard is a king ∧ Richard is a person. King John is a king ∧ King John is a person. Richard’s left leg is a king ∧ Richard’s left leg is a person. John’s left leg is a king ∧ John’s left leg is a person. The crown is a king ∧ The crown is a person. 20070503 Chap8 12 6

  7. FOL Examples (cont.-2) • King John has a crown on his head. ∃ ∧ − − − x Crown(x) OnHead(x, John) correct ∃ ⇒ − − − x Crown(x) OnHead(x, John) wrong At least one of the following must be true: (correct) Richard is a crown ∧ Richard is on John’s head. King John is a crown ∧ King John is on John’s head. Richard’s left leg is a crown ∧ Richard’s left leg is on John’s head. John’s left leg is a crown ∧ John’s left leg is on John’s head. The crown is a crown ∧ The crown is on John’s head. (wrong) Richard is a crown ⇒ Richard is on John’s head. King John is a crown ⇒ King John is on John’s head. Richard’s left leg is a crown ⇒ Richard’s left leg is on John’s head John’s left leg is a crown ⇒ John’s left leg is on John’s head. The crown is a crown ⇒ The crown is on John’s head. 20070503 Chap8 13 Representing Sentences in FOL • One plus two equals three. • Squares neighboring the wumpus are smelly. • Evil King John ruled England in 1200. • Spot is a cat. • All cats are mammals. • Spot has a sister who is a cat. • A person's brother has that person as a sibling. • Everybody loves somebody. • There is someone who is loved by everyone. • Everyone likes ice cream. There is no one who does not like ice cream. • Spot has at least two sisters. 20070503 Chap8 14 7

  8. Compound Sentences • Negation ¬ loves(John , dog - of(John)) • Conjunction ∧ loves(John , dog - of(John)) loves(John , country - of(John)) • Disjunction ∀ ∨ [odd( even( i i ) i )] • Implication ⇒ loves(John , country - of(John)) loves(John , dog - of(John)) • The truth or falsity of a compound sentence s can be determined from the truth or falsity of the component sentences of s . • atoms + logical connectives � Predicate Logic 20070503 Chap8 15 Quantification • Universal quantification - the sentence remains true for all values of the variable. loves(John , everything ) - John loves everything. ∀ x. loves(John , x) - Everything loves everything. ∀ ∀ x. y. loves(x, y) ∀ xy. loves(x, y) - John loves all fuzzy things. ∀ ⇒ x. fuzzy(x) loves(John , x) - All numbers are either odd or even. ∀ ∨ i [odd(i) even(i)] • Existential quantification - the sentence is true for some value(s) of the variable. - John loves something. ∃ x. loves(John , x) 20070503 Chap8 16 8

  9. Quantifiers • Quantifiers ∀ and ∃ can be thought of as the infinitary versions of ∧ and ∨ respectively. ∀ x. p(x) • A sentence holds in a model M if and only if p(Z) holds for every object Z in the domain of discourse. ∃ x. p(x) • Similarly, a sentence holds in a model M if and only if there is some object Z for which p is valid. (Ex1) If a person is the parent of another person, then the other person is the child of the person. ∀ ⇒ x, y Parent(x, y) Child(y, x) (Ex2) Everybody loves somebody. ∀ x ∃ y Loves(x, y) (Ex3) There is someone who is loved by everyone. ∃ x ∀ y Loves(y, x) 20070503 Chap8 17 Quantifiers (cont.) • de Morgan's Laws For any two sentences p and q , the following two expressions are equivalent. ¬ ∧ ≡ ¬ ∨ ¬ (p q) p q • Similarly, the following two are equivalent. ¬ ∨ ≡ ¬ ∧ ¬ (p q) p q • Negation involving quantifiers ∀ ¬ ≡ ¬ ∃ x P x P ∀ ≡ ¬ ∃ ¬ x P x P ¬ ∀ ≡ ∃ ¬ x P x P ∃ ≡ ¬ ∀ ¬ x P x P 20070503 Chap8 18 9

  10. Compositional Semantics Given a model M , FOL allows us to determine φ whether a sentence is true or false relative to an interpretation I and a variable assignment U . • The truth/falsity of any atom is defined by M . ¬ φ φ is true in M iff is not true in M . • a ∧ a a is true iff is true in M and is true in M . a • 1 1 2 2 a ∨ a a a is true iff at least one of and is true in M . • 1 1 2 2 20070503 Chap8 19 A common mistake to avoid Typically, ⇒ is the main connective with ∀ • Common mistake: • using ∧ as the main connective with ∀ e.g. Everyone at NUS is smart. ∀ x At(x,NUS) ⇒ Smart(x) --- (O) ∀ x At(x,NUS) ∧ Smart(x) --- (X) means “Everyone is at NUS and everyone is smart” 20070503 Chap8 20 10

More recommend