pros and cons of propositional logic
play

Pros and cons of propositional logic Propositional logic is - PowerPoint PPT Presentation

Pros and cons of propositional logic Propositional logic is declarative : pieces of syntax correspond to facts Propositional logic allows partial/disjunctive/negated information (unlike most data structures and databases) First-order logic


  1. Pros and cons of propositional logic Propositional logic is declarative : pieces of syntax correspond to facts Propositional logic allows partial/disjunctive/negated information (unlike most data structures and databases) First-order logic Propositional logic is compositional : meaning of B 1 , 1 ∧ P 1 , 2 is derived from meaning of B 1 , 1 and of P 1 , 2 Meaning in propositional logic is context-independent Chapter 8 (unlike natural language, where meaning depends on context) Propositional logic has very limited expressive power (unlike natural language) E.g., cannot say “pits cause breezes in adjacent squares” except by writing one sentence for each square Chapter 8 1 Chapter 8 3 Outline First-order logic ♦ Why FOL? Whereas propositional logic assumes world contains facts , first-order logic (like natural language) assumes the world contains ♦ Syntax and semantics of FOL • Objects: people, houses, numbers, theories, Ronald McDonald, colors, ♦ Fun with sentences baseball games, wars, centuries . . . ♦ Wumpus world in FOL • Relations: red, round, bogus, prime, multistoried . . . , brother of, bigger than, inside, part of, has color, occurred after, owns, comes between, . . . • Functions: father of, best friend, third inning of, one more than, end of . . . Chapter 8 2 Chapter 8 4

  2. Logics in general Atomic sentences Atomic sentence = predicate ( term 1 , . . . , term n ) Language Ontological Epistemological or term 1 = term 2 Commitment Commitment Propositional logic facts true/false/unknown Term = function ( term 1 , . . . , term n ) First-order logic facts, objects, relations true/false/unknown or constant or variable Temporal logic facts, objects, relations, times true/false/unknown Probability theory facts degree of belief E.g., Brother ( KingJohn, RichardTheLionheart ) Fuzzy logic facts + degree of truth known interval value > ( Length ( LeftLegOf ( Richard )) , Length ( LeftLegOf ( KingJohn ))) Chapter 8 5 Chapter 8 7 Syntax of FOL: Basic elements Complex sentences Complex sentences are made from atomic sentences using connectives Constants KingJohn, 2 , UCB, . . . Predicates Brother, >, . . . ¬ S, S 1 ∧ S 2 , S 1 ∨ S 2 , S 1 ⇒ S 2 , S 1 ⇔ S 2 Functions Sqrt, LeftLegOf, . . . Variables x, y, a, b, . . . E.g. Sibling ( KingJohn, Richard ) ⇒ Sibling ( Richard,KingJohn ) Connectives ∧ ∨ ¬ ⇒ ⇔ > (1 , 2) ∨ ≤ (1 , 2) Equality = > (1 , 2) ∧ ¬ > (1 , 2) Quantifiers ∀ ∃ Chapter 8 6 Chapter 8 8

  3. Truth in first-order logic Truth example Sentences are true with respect to a model and an interpretation Consider the interpretation in which Richard → Richard the Lionheart Model contains ≥ 1 objects (domain elements) and relations among them John → the evil King John Brother → the brotherhood relation Interpretation specifies referents for constant symbols → objects Under this interpretation, Brother ( Richard, John ) is true predicate symbols → relations just in case Richard the Lionheart and the evil King John function symbols → functional relations are in the brotherhood relation in the model 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 Chapter 8 9 Chapter 8 11 Models for FOL: Example Models for FOL: Lots! Entailment in propositional logic can be computed by enumerating models crown We can enumerate the FOL models for a given KB vocabulary: on head For each number of domain elements n from 1 to ∞ brother person For each k -ary predicate P k in the vocabulary person For each possible k -ary relation on n objects king brother For each constant symbol C in the vocabulary For each choice of referent for C from n objects . . . R J Computing entailment by enumerating FOL models is not easy! $ left leg left leg Chapter 8 10 Chapter 8 12

  4. Universal quantification Existential quantification ∀ � variables � � sentence � ∃ � variables � � sentence � Everyone at Berkeley is smart: Someone at Stanford is smart: ∀ x At ( x, Berkeley ) ⇒ Smart ( x ) ∃ x At ( x, Stanford ) ∧ Smart ( x ) ∀ x P is true in a model m iff P is true with x being ∃ x P is true in a model m iff P is true with x being each possible object in the model some possible object in the model Roughly speaking, equivalent to the conjunction of instantiations of P Roughly speaking, equivalent to the disjunction of instantiations of P ( At ( KingJohn, Berkeley ) ⇒ Smart ( KingJohn )) ( At ( KingJohn, Stanford ) ∧ Smart ( KingJohn )) ∧ ( At ( Richard, Berkeley ) ⇒ Smart ( Richard )) ∨ ( At ( Richard, Stanford ) ∧ Smart ( Richard )) ∧ ( At ( Berkeley, Berkeley ) ⇒ Smart ( Berkeley )) ∨ ( At ( Stanford, Stanford ) ∧ Smart ( Stanford )) ∧ . . . ∨ . . . Chapter 8 13 Chapter 8 15 A common mistake to avoid Another common mistake to avoid Typically, ⇒ is the main connective with ∀ Typically, ∧ is the main connective with ∃ Common mistake: using ∧ as the main connective with ∀ : Common mistake: using ⇒ as the main connective with ∃ : ∀ x At ( x, Berkeley ) ∧ Smart ( x ) ∃ x At ( x, Stanford ) ⇒ Smart ( x ) means “Everyone is at Berkeley and everyone is smart” is true if there is anyone who is not at Stanford! ∃ x ¬ At ( x, Stanford ) ∨ Smart ( x ) just needs one person not at Stanford to make the sentence true. Chapter 8 14 Chapter 8 16

  5. Properties of quantifiers Fun with sentences Brothers are siblings ∀ x ∀ y is the same as ∀ y ∀ x ∀ x, y Brother ( x, y ) ⇒ Sibling ( x, y ) . ∃ x ∃ y is the same as ∃ y ∃ x “Sibling” is symmetric ∃ x ∀ y is not the same as ∀ y ∃ x ∃ x ∀ y Loves ( x, y ) “There is a person who loves everyone in the world” ∀ y ∃ x Loves ( x, y ) “Everyone in the world is loved by at least one person” Quantifier duality: each can be expressed using the other ∀ x Likes ( x, IceCream ) ¬∃ x ¬ Likes ( x, IceCream ) ∃ x Likes ( x, Broccoli ) ¬∀ x ¬ Likes ( x, Broccoli ) Chapter 8 17 Chapter 8 19 Fun with sentences Fun with sentences Brothers are siblings Brothers are siblings ∀ x, y Brother ( x, y ) ⇒ Sibling ( x, y ) . “Sibling” is symmetric ∀ x, y Sibling ( x, y ) ⇔ Sibling ( y, x ) . One’s mother is one’s female parent Chapter 8 18 Chapter 8 20

  6. Fun with sentences Equality Brothers are siblings term 1 = term 2 is true under a given interpretation if and only if term 1 and term 2 refer to the same object ∀ x, y Brother ( x, y ) ⇒ Sibling ( x, y ) . E.g., ∀ x × ( Sqrt ( x ) , Sqrt ( x )) = x are satisfiable “Sibling” is symmetric 2 = 2 is valid ∀ x, y Sibling ( x, y ) ⇔ Sibling ( y, x ) . E.g., definition of (full) Sibling in terms of Parent : ∀ x, y Sibling ( x, y ) ⇔ [ ¬ ( x = y ) ∧ ∃ m, f ¬ ( m = f ) ∧ One’s mother is one’s female parent Parent ( m, x ) ∧ Parent ( f, x ) ∧ Parent ( m, y ) ∧ Parent ( f, y )] ∀ x, y Mother ( x, y ) ⇔ ( Female ( x ) ∧ Parent ( x, y )) . A first cousin is a child of a parent’s sibling Chapter 8 21 Chapter 8 23 Fun with sentences Interacting with FOL KBs Brothers are siblings Suppose a wumpus-world agent is using an FOL KB and perceives a smell and a breeze (but no glitter) at t = 5 : ∀ x, y Brother ( x, y ) ⇒ Sibling ( x, y ) . Tell ( KB, Percept ([ Smell, Breeze, None ] , 5)) “Sibling” is symmetric Ask ( KB, ∃ a Action ( a, 5)) ∀ x, y Sibling ( x, y ) ⇔ Sibling ( y, x ) . I.e., does KB entail any particular actions at t = 5 ? One’s mother is one’s female parent Answer: Y es, { a/Shoot } ← substitution (binding list) ∀ x, y Mother ( x, y ) ⇔ ( Female ( x ) ∧ Parent ( x, y )) . Given a sentence S and a substitution σ , Sσ denotes the result of plugging σ into S ; e.g., A first cousin is a child of a parent’s sibling S = Smarter ( x, y ) ∀ x, y FirstCousin ( x, y ) ⇔ ∃ p, ps Parent ( p, x ) ∧ Sibling ( ps, p ) ∧ σ = { x/Hillary, y/Bill } Parent ( ps, y ) Sσ = Smarter ( Hillary, Bill ) Ask ( KB, S ) returns some/all σ such that KB | = Sσ Chapter 8 22 Chapter 8 24

  7. Knowledge base for the wumpus world Summary First-order logic: “Perception” ∀ b, g, t Percept ([ Smell, b, g ] , t ) ⇒ Smelt ( t ) – objects and relations are semantic primitives ∀ s, b, t Percept ([ s, b, Glitter ] , t ) ⇒ AtGold ( t ) – syntax: constants, functions, predicates, equality, quantifiers Increased expressive power: sufficient to define wumpus world Reflex: ∀ t AtGold ( t ) ⇒ Action ( Grab, t ) Reflex with internal state: do we have the gold already? ∀ t AtGold ( t ) ∧ ¬ Holding ( Gold, t ) ⇒ Action ( Grab, t ) Holding ( Gold, t ) is not a percept ⇒ keeping track of change is essential Chapter 8 25 Chapter 8 27 Deducing hidden properties Properties of locations: ∀ x, t At ( Agent, x, t ) ∧ Smelt ( t ) ⇒ Smelly ( x ) ∀ x, t At ( Agent, x, t ) ∧ Breeze ( t ) ⇒ Breezy ( x ) Squares are breezy near a pit: Diagnostic rule—infer cause from effect ∀ y Breezy ( y ) ⇒ ∃ x Pit ( x ) ∧ Adjacent ( x, y ) Causal rule—infer effect from cause ∀ x, y Pit ( x ) ∧ Adjacent ( x, y ) ⇒ Breezy ( y ) Neither of these is complete—e.g., the causal rule doesn’t say whether squares far away from pits can be breezy Definition for the Breezy predicate: ∀ y Breezy ( y ) ⇔ [ ∃ x Pit ( x ) ∧ Adjacent ( x, y )] Chapter 8 26

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend