outline
play

Outline First-order logic Syntax and semantics Inference - PDF document

Outline First-order logic Syntax and semantics Inference First-order Logic Propositionalization with ground inference Lifted resolution CS 486/686 Sept 25, 2008 University of Waterloo 1 2 CS486/686 Lecture Slides (c)


  1. Outline • First-order logic – Syntax and semantics • Inference First-order Logic – Propositionalization with ground inference – Lifted resolution CS 486/686 Sept 25, 2008 University of Waterloo 1 2 CS486/686 Lecture Slides (c) 2008 P. Poupart CS486/686 Lecture Slides (c) 2008 P. Poupart Introduction Recall: 4-Queens problem 1 2 3 4 • At least one queen in row 1: • Propositional logic provides a general language Q 11 ∨ Q 12 ∨ Q 13 ∨ Q 14 to encode deterministic domain knowledge. 1 • While the encoding is precise and well defined • At most one queen in row 1: 2 it is often tedious or complicated. Q 11 ⇒ ¬ Q 12 ∧ ¬ Q 13 ∧ ¬ Q 14 • Simple English sentences often lead to long 3 Q 12 ⇒ ¬ Q 11 ∧ ¬ Q 13 ∧ ¬ Q 14 logical formula. Q 13 ⇒ ¬ Q 11 ∧ ¬ Q 12 ∧ ¬ Q 14 4 Q 14 ⇒ ¬ Q 11 ∧ ¬ Q 12 ∧ ¬ Q 13 • Can we make propositional logic more concise and more natural? Repeat for every row, column and diagonal. This is too tedious! Can we be more concise? 3 4 CS486/686 Lecture Slides (c) 2008 P. Poupart CS486/686 Lecture Slides (c) 2008 P. Poupart First-order Logic First-order Logic Syntax • World • Sentence � Predicate(Term, …) | Term = Term – consist of objects and relations | (Sentence Connective Sentence) | Quantifier Variable, … Sentence – Has many objects | ¬ Sentence • Term � Function(Term, …) | Constant | Variable • Connective � ⇒ | ∧ | ∨ | ⇔ • First-order logic: • Quantifier � ∀ | ∃ – Natural: use predicates to encode relations • Constant � A | X 1 | John | … and constants to encode objects • Variable � a | x | s | … – Concise: use quantifiers (e.g., ∀ , ∃ ) to talk • Predicate � Before | HasColor | Raining | … about many objects simultaneously • Function � Mother | LeftLeg | … 5 6 CS486/686 Lecture Slides (c) 2008 P. Poupart CS486/686 Lecture Slides (c) 2008 P. Poupart 1

  2. Example: kinship domain Symbols • Constant symbols: objects • Elizabeth is the mother of Charles Mother(Elizabeth,Charles) – E.g. William, Elizabeth, Charles • Predicate symbols: relationships • Charles is the father of William – Binary: Mother( , ), Grandmother( , ) Father(Charles,William) – Unary: Female( ) • One’s grandmother is the mother of – Predicates have a truth value one’s parent • Function symbols: functions ∀ x,z ∃ y Grandmother(x,z) ⇔ – Denote an object Mother(x,y) ∧ Parent(y,z) – E.g.: MotherOf(William) = Elizabeth 7 8 CS486/686 Lecture Slides (c) 2008 P. Poupart CS486/686 Lecture Slides (c) 2008 P. Poupart Quantifiers Nested Quantifiers • Order of identical quantifiers doesn’t • Universal quantifier: ∀ matter – For all – ∀ x P(x) ≡ P(const1) ∧ P(const2) ∧ … • Brothers are siblings – ∀ x ∀ y Brother(x,y) ⇒ siblings(x,y) • Existential quantifier: ∃ – ∀ y ∀ x Brother(x,y) ⇒ siblings(x,y) – There exists – ∃ x P(x) ≡ P(const1) ∨ P(const2) ∨ … • Similarly for existential quantifiers – ∃ x ∃ y P(x,y) ≡ ∃ y ∃ x P(x,y) 9 10 CS486/686 Lecture Slides (c) 2008 P. Poupart CS486/686 Lecture Slides (c) 2008 P. Poupart Nested Quantifiers Connections between ∀ and ∃ • Order of different quantifiers matters • We only need one of the quantifiers • ∀ x ∃ y Loves(x,y) • De Morgan’s rule – Everyone loves someone – ∀ x ¬ P ≡ ¬∃ x P ¬ P ∧ ¬ Q ≡ ¬ (P ∨ Q) – Conjunction of disjunctions (CNF) – ¬∀ x P ≡ ∃ x ¬ P ¬ (P ∧ Q) ≡ ¬ P ∨ ¬ Q – ∀ x P ≡ ¬∃ x ¬ P P ∧ Q ≡ ¬ ( ¬ P ∨ ¬ Q) • ∃ x ∀ y Loves(x,y) – ∃ x P ≡ ¬∀ x ¬ P P ∨ Q ≡ ¬ ( ¬ P ∧ ¬ Q) – There is a person that loves everyone – Disjunction of conjunction (DNF) 11 12 CS486/686 Lecture Slides (c) 2008 P. Poupart CS486/686 Lecture Slides (c) 2008 P. Poupart 2

  3. Equality Practice: 4-Queens problem • Special relation • 4-queens problem in first-order logic • Predicates: • We could define an “Equality” predicate – Queen( , ) • Constants: – x = y ≡ Equality(x,y) • True: when x and y are the same – 1, 2, 3, 4 (column and row numbers) • False: otherwise • Column constraints: – ∀ i,j 1 ,j 2 Queen(i,j 1 ) ∧ j 1 ≠ j 2 ⇒ ¬ Queen(i,j 2 ) – ∀ i ∃ j Queen(i,j) 13 14 CS486/686 Lecture Slides (c) 2008 P. Poupart CS486/686 Lecture Slides (c) 2008 P. Poupart Practice: street puzzle Practice: street puzzle • Predicates: • The Spaniard has a dog – House(), Person( ), Color( ), Drink( ), Job( ), Animal( ) – ∀ x House(x) ⇒ (Attr(x,Spaniard) ⇔ Attr(x,Dog)) – Attr( , ) (attribute of) • Constants: • the green house is on the immediate left of – 1, 2, 3, 4, 5 (house number) the red house – English, Spaniard, Japanese, Italian, Norwegian – Red, Green, White, Yellow, Blue – ¬ Attr(1,Red) ∧ – Tea, Coffee, Milk, Juice, Water – ¬ Attr(5,Green) ∧ – Painter, Sculptor, Diplomat, Violinist, Doctor – Dog, Snails, Fox, Horse, Zebra – ∀ x House(x) ∧ x ≠ 1 ⇒ • Function: (Attr(x,Red) ⇔ Attr(Left(x),Green)) – Left(x): number of the house to the immediate left of x 15 16 CS486/686 Lecture Slides (c) 2008 P. Poupart CS486/686 Lecture Slides (c) 2008 P. Poupart Propositional vs first-order logic Propositional � first-order logic • Propositional logic: • Variables � predicates – variables • Indices � constants • First-order logic: – Quantifiers, predicates, constants, functions • 4-queens problem: • Syntactically different! – Q 11 ⇒ ¬ Q 12 ∧ ¬ Q 13 ∧ ¬ Q 14 • Are they equally expressive? – Q(1,1) ⇒ ¬ Q(1,2) ∧ ¬ Q(1,3) ∧ ¬ Q(1,4) – Prop logic � 1 st -order logic: yes – 1 st -order logic � prop logic: yes (finite domains) no (infinite domains) 17 18 CS486/686 Lecture Slides (c) 2008 P. Poupart CS486/686 Lecture Slides (c) 2008 P. Poupart 3

  4. First-order � propositional logic First-order � propositional logic • Quantifiers • ∀ x House(x) ∧ x ≠ 1 ⇒ (Attr(x,Red) ⇔ Attr(Left(x),Green)) – ∀ � conjunction – ∃ � disjunction • ∀ x House x ∧ x ≠ 1 ⇒ (Attr x,Red ⇔ Attr Left(x),Green ) • Predicates � variables • (House 1 ∧ 1 ≠ 1 ⇒ (Attr 1,Red ⇔ Attr Left(1),Green )) ∧ • Constants � indices (House 2 ∧ 2 ≠ 1 ⇒ (Attr 2,Red ⇔ Attr Left(2),Green )) ∧ • Functions of constants � functions of (House 3 ∧ 3 ≠ 1 ⇒ (Attr 3,Red ⇔ Attr Left(3),Green )) ∧ indices (House 4 ∧ 4 ≠ 1 ⇒ (Attr 4,Red ⇔ Attr Left(4),Green )) ∧ (House 5 ∧ 5 ≠ 1 ⇒ (Attr 5,Red ⇔ Attr Left(5),Green )) 19 20 CS486/686 Lecture Slides (c) 2008 P. Poupart CS486/686 Lecture Slides (c) 2008 P. Poupart Inference Lifted Inference • Propositionalize KB • First-order logic: – Run favorite ground inference algorithm – Quantifiers allow us to characterize several (e.g., backtracking (DPLL), resolution objects simultaneously – Efficient? • No: propositionalizing may yield an exponentially large • Lifted inference: formula • ∀ x ∃ y ∀ z P(x,y,z) � conjunction of disjunctions of – Do inference by reasoning about several terms conjunctions simultaneously • O(n m ) where n is # of constants and m is # of quantifiers – Ground terms only when necessary • Alternative: lifted inference – Hope: determine truth value of goal formula without grounding all terms – Work directly with first-order formula 21 22 CS486/686 Lecture Slides (c) 2008 P. Poupart CS486/686 Lecture Slides (c) 2008 P. Poupart Lifted Resolution Reduction to Lifted CNF Six steps Two phases 1. Eliminate implications 1. Reduce to lifted conjunctive normal form 2. Move negations inwards 2. Resolution with unification 3. Standardize variables 4. Skolemize 5. Drop universal quantifiers 6. Distribute ∨ over ∧ 23 24 CS486/686 Lecture Slides (c) 2008 P. Poupart CS486/686 Lecture Slides (c) 2008 P. Poupart 4

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