First-Order Logic Daniel Weld CSE 473 Spring 2012.

Slides:



Advertisements
Similar presentations
First-Order Logic.
Advertisements

Artificial Intelligence
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Propositional Logic Reading: C , C Logic: Outline Propositional Logic Inference in Propositional Logic First-order logic.
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 9 Jim Martin.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Knowledge Representation I (Propositional Logic) CSE 473.
CSE 473 Artificial Intelligence Review. © Daniel S. Weld 2 Logistics Problem Set due at midnight Exam next Wed 8:30—10:30 Regular classroom Closed book.
Methods of Proof Chapter 7, second half.
INTRODUÇÃO AOS SISTEMAS INTELIGENTES Prof. Dr. Celso A.A. Kaestner PPGEE-CP / UTFPR Agosto de 2011.
Knowledge Representation III First-Order Logic
Knoweldge Representation & Reasoning
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
1 Soundness and Completeness zKB |- S: S is provable from KB. zA proof procedure is sound if: yIf KB |- S, then KB |= S. yThat is, the procedure produces.
Rutgers CS440, Fall 2003 Propositional Logic Reading: Ch. 7, AIMA 2 nd Ed. (skip )
Knowledge Representation IV Inference in First-Order Logic CSE 473.
Propositional Logic Agenda: Other forms of inference in propositional logic Basics of First Order Logic (FOL) Vision Final Homework now posted on web site.
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
Logical Agents Chapter 7 (based on slides from Stuart Russell and Hwee Tou Ng)
Logical Agents. Knowledge bases Knowledge base = set of sentences in a formal language Declarative approach to building an agent (or other system): 
CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Jan 19, 2012.
UIUC CS 497: Section EA Lecture #3 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Propositional Logic: Logical Agents (Part I) This lecture topic: Propositional Logic (two lectures) Chapter (this lecture, Part I) Chapter 7.5.
Knowledge Representation IV Inference for First-Order Logic CSE 473.
Pattern-directed inference systems
1 Logical Agents CS 171/271 (Chapter 7) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Logical Agents Logic Propositional Logic Summary
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logic in AI CSE 573. © Daniel S. Weld 2 Logistics Monday? Reading Ch 8 Ch 9 thru p 278 Section 10.3 Projects Due 11/10 Teams and project plan due by this.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
S P Vimal, Department of CSIS, BITS, Pilani
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
1 Logical Agents CS 171/271 (Chapter 7) Some text and images in these slides were drawn from Russel & Norvig’s published material.
1 Logical Agents Chapter 7. 2 A simple knowledge-based agent The agent must be able to: –Represent states, actions, etc. –Incorporate new percepts –Update.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
CSE 473 Propositional Logic SAT Algorithms Dan Weld (With some slides from Mausam, Stuart Russell, Dieter Fox, Henry Kautz, Min-Yen Kan…) Irrationally.
1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Jan 24, 2012.
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
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.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 11 Jim Martin.
© Daniel S. Weld Topics Agency Problem Spaces SearchKnowledge Representation Planning PerceptionNLPMulti-agentRobotics Uncertainty MDPs Supervised.
First-Order Logic Reading: C. 8 and C. 9 Pente specifications handed back at end of class.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Computing & Information Sciences Kansas State University Wednesday, 13 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 10 of 42 Wednesday, 13 September.
First-Order Logic Semantics Reading: Chapter 8, , FOL Syntax and Semantics read: FOL Knowledge Engineering read: FOL.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7 Part I. 2 Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Logical Agents. Inference : Example 1 How many variables? 3 variables A,B,C How many models? 2 3 = 8 models.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Propositional Logic: Logical Agents (Part I)
Knowledge Representation III First-Order Logic
Knowledge Representation II
First-Order Logic CSE 573 A handful of GENERAL SEARCH TECHNIQUES lie at the heart of practically all work in AI We will encounter the SAME PRINCIPLES again.
Knowledge Representation III First-Order Logic
Artificial Intelligence: Agents and Propositional Logic.
Logical Agents Chapter 7.
Knowledge Representation I (Propositional Logic)
Presentation transcript:

First-Order Logic Daniel Weld CSE 473 Spring 2012

Overview Introduction & Agents Search, Heuristics & CSPs Adversarial Search Logical Knowledge Representation Planning & MDPs Reinforcement Learning Uncertainty & Bayesian Networks Machine Learning NLP & Special Topics

© Daniel S. Weld 3 Propositional. Logic vs. First Order Ontology Syntax Semantics Inference Algorithm Complexity Objects, Properties, Relations Atomic sentences Connectives Variables & quantification Sentences have structure: terms father-of(mother-of(X))) Unification Forward, Backward chaining Prolog, theorem proving DPLL, GSAT Fast in practice Semi-decidableNP-Complete Facts (P, Q) Interpretations (Much more complicated) Truth Tables

© Daniel S. Weld 4 FOL Definitions Constants: a,b, dog33. Name a specific object. Variables: X, Y. Refer to an object without naming it. Functions: dad-of Mapping from objects to objects. Terms: dad-of(dog33) Refer to objects Atomic Sentences: in(dad-of(dog33), food6) Can be true or false Correspond to propositional symbols P, Q

© Daniel S. Weld 5 More Definitions Logical connectives: and, or, not, => male(dan)  male(father-of(dan)) P  Q male(dan)  male(son-of(father-of(dan)))

© Daniel S. Weld 6 More Definitions Quantifiers:  Forall  There exists Examples Dumbo is grey Elephants are grey There is a grey elephant

© Daniel S. Weld 7 More Definitions Quantifiers:  Forall  There exists Examples Dumbo is grey grey(dumbo) Elephants are grey There is a grey elephant

© Daniel S. Weld 8 More Definitions Quantifiers:  Forall  There exists Examples Dumbo is grey grey(dumbo) Elephants are grey  elephant(x)  grey(x) There is a grey elephant

© Daniel S. Weld 9 More Definitions Quantifiers:  Forall  There exists Examples Dumbo is grey grey(dumbo) Elephants are grey  x elephant(x)  grey(x) There is a grey elephant  x elephant(x)  grey(x)

© Daniel S. Weld 10 Quantifier / Connective Interaction 1.  x E(x)  G(x) 2.  x E(x)  G(x) 3.  x E(x)  G(x) 4.  x E(x)  G(x) E(x) == “x is an elephant” G(x) == “x has the color grey”

© Daniel S. Weld 11 Nested Quantifiers: Order matters! Examples Every dog has a tail  x  y P(x,y)   y  x P(x,y)  d  t has(d,t) Someone is loved by everyone  t  d has(d,t) ?  x  y loves(y, x) Every dog shares a tail!

12 Wumpus world in prop logic Let P i,j be true if there is a pit in [i, j]. Let B i,j be true if there is a breeze in [i, j]. KB:  P 1,1  B 1,1 "Pits cause breezes in adjacent squares" B 1,1  (P 1,2  P 2,1 ) B 2,1  (P 1,1  P 2,2  P 3,1 )

13 Wumpus world in prop logic Let pit(i,j) be true if there is a pit in [i, j]. Let breeze(i,j) be true if breezy in [i, j]. KB:  pit(1,1)  breeze(1,1) "Pits cause breezes in adjacent squares"  i,j breeze(i,j)  pit(i, add(j,1))  pit(i, add(j, -1))  …

14 Full Encoding of Wumpus World In propositional logic:  P 1,1  W 1,1 B x,y  (P x,y+1  P x,y-1  P x+1,y  P x-1,y ) S x,y  (W x,y+1  W x,y-1  W x+1,y  W x-1,y ) W 1,1  W 1,2  …  W 4,4  W 1,1   W 1,2  W 1,1   W 1,3 …  64 distinct proposition symbols, 155 sentences

© Daniel S. Weld 15 Semantics Syntax: a description of the legal arrangements of symbols (Def “sentences”) Semantics: what the arrangement of symbols means in the world Sentences Models Sentences Representation World Semantics Inference

© Daniel S. Weld 16 Satisfiability, Validity, & Entailment S is valid if it is true in all interpretations S is satisfiable if it is true in some interp S is unsatisfiable if it is false all interps S1 entails S2 if forall interps where S1 is true, S2 is also true |=

© Daniel S. Weld 17 Propositional Logic: SEMANTICS “Interpretation” (or “possible world”) Specifically, TRUTH ASSIGNMENTS Assignment to each variable either T or F Assignment of T or F to each connective P T T F F Q P  Q T FF F Symbols: PQ Models: T T F T …

18 Models Logicians often think in terms of models, which are formally structured worlds with respect to which truth can be evaluated In propositional case, each model = truth assignment Set of models can be enumerated in a truth table We say m is a model of a sentence α if α is true in m (Equivalently “m satisfies  ”) M(α) is the set of all models of α Then KB ╞ α iff M(KB)  M(α) E.g. KB = (P  Q)  (  P  R) α = (P  R)

© Daniel S. Weld 19 First Order Logic: Models Depiction of one possible “real-world” model

© Daniel S. Weld 20 Interpretations=Mappings syntactic tokens  model elements Depiction of one possible interpretation, assuming Constants: Functions: Relations: Richard JohnLeg(p,l)On(x,y) King(p)

© Daniel S. Weld 21 Interpretations=Mappings syntactic tokens  model elements Another interpretation, same assumptions Constants: Functions: Relations: Richard JohnLeg(p,l)On(x,y) King(p)

© Daniel S. Weld 22 Skolemization Existential quantifiers aren’t necessary! Existential variables can be replaced by Skolem functions (or constants) Args to function are all surrounding  vars  d  t has(d, t)  x  y loves(y, x)  d has(d, f(d) )  y loves(y, f() )  y loves(y, f 97 )

© Daniel S. Weld 23 FOL Reasoning FO Forward & Backward Chaining FO Resolution Many other types of theorem proving Restricted representations Description logics Horn Clauses Compilation to SAT

© Daniel S. Weld 24 Forward Chaining Given  ?x lifeform(?x) => mortal(?x)  ?x mammal(?x) => lifeform(?x)  ?x dog(?x) => mammal(?x) dog(fido) Prove mortal(fido)  ?x dog(?x) => mammal(?x) dog(fido) mammal(fido) ?

© Daniel S. Weld 25 Unification Emphasize variables with ? Useful for FO inference (modus ponens, …) Also for compilation of FOPC -> propositional Unify( ,  ) returns “mgu” Unify(city(?a), city(kent)) returns ?a/kent Substitute(expr, mapping) returns new expr Substitute(connected(?a, ?b), {?a/kent}) returns connected(kent, ?b)

© Daniel S. Weld 26 Unification Examples Unify(road(?a, kent), road(seattle, ?b)) Unify(road(?a, ?a), road(seattle, kent)) Unify(f(g(?x, dog), ?y)), f(g(cat, ?y), dog) Unify(f(g(?x)), f(?x))

© Daniel S. Weld 27 Resolution [Robinson 1965] { (p   ), (  p     ) } |- R (      ) Recall Propositional Case: Literal in one clause Its negation in the other Result is disjunction of other literals }

© Daniel S. Weld 28 First-Order Resolution [Robinson 1965] { (p(?x)  a(a), (  p(q)  b(?x)  c(?y)) } |- R (a(a)  b(q)  c(?y)) Literal in one clause The negation of something which unifies in the other Result is disjunction of other literals / mgu

© Daniel S. Weld 29 First-Order Resolution Is it the case that  |=  ? Method Let =    Convert to clausal form Standardize variables Move quantifiers to front, skolemize to remove  Replace  with  and  Demorgan’s laws... Resolve until get empty clause

© Daniel S. Weld 30 Example Given  ?x man(?x) => mortal(?x)  ?x woman(?x) => mortal(?x)  ?x person(?x) => man(?x)  woman(?x) person(kelly) Prove mortal(kelly) [  m(?x),d(?x)] [  w(?y), d(?y)] [  p(?z),m(?z),w(?z)] [p (k)][  d(k)]

© Daniel S. Weld 31 Example Continued [  m(?x),d(?x)] [  w(?y), d(?y)] [  p(?z),m(?z),w(?z)] [p (k)] [  d(k)] [m(k),w(k)] [w(k), d(k)] [] [w(k)] [d(k)]

© Daniel S. Weld 32 KR with Description Logics Tbox Term Defs Assertions fathermother person grandmother Abox mother(jane) child-of(jane, bob) …

© Daniel S. Weld 33 Tbox Term definitions FO Language + inference organized into a taxonomy, e.g: father(x) = person(x)  male(x)   y childof(y,x) parent(x) = person(x)   y childof(y,x) Complexity of classifying new terms subsumption fathermother person grandmother Subsumption hierarchy 

© Daniel S. Weld 34 Abox Assertions Abox – separate language + inference for “propositional” assertions using Tbox terms e.g. person(kelley)

© Daniel S. Weld 35 Debate Restricted language thesis Disjunction, negation, particularization, order… Natural kinds Restricted classification thesis Concepts using contingent information: Treatable disease, democratic country, illegal act Counterargument Constructs: Omit vs limit Completeness Efficiency

© Daniel S. Weld 36 Compilation to Prop. Logic I Typed Logic  city a,b connected(a,b) Universe Cities: seattle, tacoma, enumclaw Equivalent propositional formula:

© Daniel S. Weld 37 Compilation to Prop. Logic II Universe Cities: seattle, tacoma, enumclaw Firms: IBM, Microsoft, Boeing First-Order formula  city c  firm f hasHQ(c, f) Equivalent propositional formula

© Daniel S. Weld 38 Hey! You said FO Inference is semi-decidable But you compiled it to SAT Which is NP Complete So now we can always do the inference?!? Tho it might take exponential time… Something seems wrong here….????

© Daniel S. Weld 39 Restricted Forms of FO Logic Known, Finite Universes Compile to SAT Frame Systems Ban certain types of expressions Horn Clauses Aka Prolog Function-Free Horn Clauses Aka Datalog