TDDC17 Seminar 6 First-Order Logic Resolution Nonmonotonic Reasoning Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Limited expressivity of propositional Physics of the Wumpus World: Modeling is difficult with Propositional Logic Schemas: ( Bx,y ⇔ (Px,y+1 ∨ Px,y-1 ∨ Px+1,y ∨ Px-1,y ))# Def. of breeze in pos [x,y] ( Sx,y ⇔ (Wx,y+1 ∨ Wx,y-1 ∨ Wx+1,y ∨ Wx-1,y ))# Def. of stench in pos [x,y] (W1,1 ∨ W1,2 ∨ … ∨ W4,4 ))" ..., etc. Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden There is at least one wumpus! There is only one wumpus! Spectrum of Logics and Languages Higher-Order Logic 2nd-Order Logic Circumscription Default Logic Modal Logics: Epistemic, Doxastic, Temporal,... 1st-Order Logic + Fixpoints Inductive Definitions Datalog 1st-Order Logic Description Logic Definite Clauses Horn Clauses Compile! Propositional Logic Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Ontological Commitment of 1st-order logic Facts Objects Relations Model with: • 5 objects • 2 binary relations • brother • on-head • 3 unary relations • person • crown • king 1 • unary function • left-leg() Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden FOL: Language and Syntax: Components • Object Constants - Infinite set of object constants. • Convention: Begin with capital letters or numerals • Examples: Aa, 125, Q, Battery1 •Variables – Infinite set of variables • Convention: Use lower case letters • Examples: p,q,r,s,t,…, p1,p2, and so on. Name individuals in a domain of discourse • Function Constants - Infinite set of function constants of all arities. Name relations between objects Refer to some or all objects with particular constraints • Convention: Begin with lower case letters and have an arity • Examples: presidentOf, onTopOf (arity 1), times, plus (arity 2) Relation Constants Infinite set of relation constants of all arities. • • Convention: Begin with capital letters and have an arity. • Examples: Large, Clear (arity 1), Parent (arity 2) •Quantifier symbols -- ∀and ∃. • ∀ is called the universal quantifier. ∃ is called the existential quantifier Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Language and Syntax: Terms Terms • An object constant is a term • Examples: Aa, 125, Q, Battery1 A • variable symbol is a term. • Examples: p,q,r,s,t,…, p1,p2, and so on. • A function constant of arity n, followed by n terms in parentheses and separated by commas, is a term. • Examples: fatherOf(John, p), onTopOf(B1), armOf(R1) Connectives and Delimiters Propositional connectives: ∧, ∨, ⊃, and, ¬$ Delimiters: [, ], (, ). Separator: , Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Language and Syntax: wffs • Atoms: a relation constant of arity n followed by n terms in parentheses and separated by commas is an atom. An atom is a wff. • Examples: P(A,B,c), IsBlock(onTopOf(B1)) • Propositional wffs: Any expression formed out of predicate calculus wffs in the same way that the propositional calculus forms wffs out of other wffs is a wff, called a propositional wff. • Examples: P(A,B1,C) ⊃ (IsBlock(onTopOf(B1)) ∧ Heavy(C)) # • If ω is a wff and ν is a variable symbol, then both and (∃ν)ω are wffs. + Boolean combinations atoms Boolean combinations of ground atoms (∀ν)ω • ν is the variable quantified over and ω is said to be within the scope of the quantifier. • If all variable symbols besides ν in ω are quantified over, then (Qν)ω is called a closed wff. (Q can be ∀or ∃. ) Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Semantics: Restricted to propositional wffs The language restricted to propositional wffs can be used to refer to objects in the world as well as propositions (with internal structure) about objects (properties and relations). Using the language, we can refer to: • an infinite number of objects (or individuals) in the world. (but not sets of objects!) • an infinite number of functions on individuals • an infinite number of relations on individuals Language IsBlock(onTopOf(B)) P(A,B,C) Interpretation 3 World P: {<A,B,C>, <D,F,E>} Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden A C 1 B onTopOf: {<B>-->A <C> -->B <A> -->Floor} Interpretations An Interpretation of an expression in the predicate calculus is an assignment that maps: • object constants into constants (objects) in the world • n-ary function constants into n-ary functions • n-ary relation constants into n-ary relations • The set of objects to which the object constants assignments are made is called the domain of the interpretation. A Extended Interpretation is an interpretation that also maps all variables into the domain (an assignment) Given an extended interpretation for its component parts, an atom has value True just in case the denoted relation holds for those individuals denoted by its terms, otherwise the atom has value False. The values of non-atomic wffs can be determined in the same way as for the propositional formulas using truth tables. Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Semantics of Quantification (∀ν)ω has the value True (under a given interpretation), just in case ω has the value True for all assignments of the variable symbol ν to objects in the domain. (∃ν)ω has the value True (under a given interpretation), just in case ω has the value True for at least one assignment of the variable symbol ν to objects in the domain. Every object on the floor is clear There is at least one object on the floor Some objects are big (∀ x) [On(x, Floor) ⊃ Clear(x)] # Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden An Example Object Constants: A, B, C, Floor Relation Constants: On, Clear On(B,A) On(A, Floor) On(C,Floor) Clear(B) Clear(C) B A Floor KB1 On(B,A) On(C,Floor) Clear(B) Clear(C) Clear(B) ∧ Clear(C) ⊃ On(A,Floor) KB2 C A --> A B --> B C --> C Floor --> Floor On --> {<A, Floor>,<B,A>, <C,Floor>} Clear --> {<B>, <C>} Interpretation Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Another Example On(B,A) On(C,Floor) Clear(B) Clear(C) Object Constants: A, B, C, Floor Relation Constants: On, Clear Clear(B) ∧ Clear(C) ⊃ On(A,Floor) Are these sentences True using the interpretation to the right? (∃x)On(x,Floor) Find one extended interpretation where On(x, Floor) is true. (∀x) Clear(B) ∧ Clear(C) ⊃ On(x,Floor) Make sure the non-quantified part of the formula is true for all extended interpretations. Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden B A Floor A --> A B --> B C --> C Floor --> Floor On --> {<A, Floor>,<B,A>, <C,Floor>} Clear --> {<B>, <C>} Interpretation C On Domains and Models • Language with 2 constants, R,J and one binary relation Some models Naming individuals: • More than one name • No name Under-constrained in FOL! Richard has two brothers? Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden On Domains and Models • Language with 2 constants, R,J and one binary relation Some models Naming individuals: •Unique Names Assumptions •Domain Closure Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Database Semantics Many applications assume UNA, DC Resolution and Unification Propositional Case: {R} {P} {¬P, ¬R} Resolve on P {¬R} Resolve on R {} Matching a positive and negative literal is more or less trivial because the atom in question has no structure. In First-Order Logic Case: {P(f(y),A), Q(B,C)} {¬P(x,A), R(x,C)} {?} Matching the internal structure of atoms is more complex and involves generating substitutions Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Substitutions Recall that terms of an expression can be object constants, variables or functional expressions which include function constants and terms. A substitution instance of an expression is obtained by substituting terms for variables in that expression. We denote a substitution instance by ωs, where ω is an expression and s a substitution. P[z, f(w), B] Alphabetic Variant P[x, f(y), B] P[g(z), f(A), B] P[C, f(A), B] Ground instance {x/z, y/w} {x/g(z), y/A} {x/C, y/A} A substitution is represented by a set of ordered pairs s = {ψ1/τ1, ψ2/τ2, . . ., ψn/τn }, where the pair ψi/τi means that term τi is substituted for every occurrence of the variable ψi throughout the scope of the substitution. Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Substitution Properites The composition of two substitutions s1 and s2, denoted by s1s2, is obtained by first applying s2 to the terms of s1 and then adding any pairs of s2 having variables not occurring among the variables of s1. s1= { z/g(x,y) } s2= { x/A, y/B, w/C, z/D} s1s2= { z/g(A,B) , x/A, y/B, w/C} (ω s1)s2 = ω (s1s2) s1(s2s3) = (s1s2)s3 Associative s1s2 ≠ s2s1 Not Commutative Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Most General Unifiers (MGU) Denote the set of substitution instances of a set {ωi} of expressions by {ωi}s. A set of expressions is unifiable if there exists a substitution s such that ω1 s = ω2 s = ω3 s . . . . In such a case , s is said to be a unifier of {ωi} since its use collapses the set to a singleton. s= {x/A, y/B} unifies {P[x, f(y), B], P[x, f(B), B]} yielding {P[A, f(B), B]} s binds too much! We do not need to bind x to A to unify the 2 expressions. The most general (or simplest) unifier ( mgu), g of {ωi} , has the property that if s is any unifier of {ωi} yielding {ωi}s, then there exists a substitution s´ such that {ωi}s = {ωi}gs´. Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Unification Algorithm Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Skolemization: Required for CNF Form Let ω be a quantified sentence of the form (∀ν1) . . . (∀νn)(∃y)ω(νi, y), where the variables ν1 . . . νn are universally quantified, the variable y is existentially quantified, and these variables appear in the component sentence ω. The Skolemization of (∀ν1) . . . (∀νn)(∃ y)ω(νi, y) is the sentence (∀ν1) . . . (∀νn)ω(νi,f(ν1, . . , νn)), where y has been replaced with f(ν1, . . , νn), in the subexpression ω. f must be a new function symbol that does not already appear in the theory. (∃x)(∀y)[ Mother(x) ∧ Mother-of(x,y)] (∀y) (∃x) [Mother(x) ∧ Mother-of(x,y)] Skolemization x is the mother of everyone any y has a mother (∀y) [Mother(f(y)) ∧ Mother-of(f(y),y)] (∃x) Mother(x) Mother(M1) Skolem constant The point is to remove all existential quantifiers leaving only universal quantifiers. Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden CNF Form for First-Order Logic 1. Eliminate implication signs (using the ∨ form). 2. Reduce the scopes of negation signs. (using DeMorgan Laws, double negation) 3. Standardize the variables. Rename quantified variables so that each quantifier has its own variable symbol. 4. Eliminate existential quantifiers (replace with Skolem functions or constants) 5. Convert to prenex form. (move all ∀ quantifiers to front of the formula). 6. Eliminate universal quantifiers (all variables are universally quantified). 7. Put the matrix (quantifier free part of 5) into conjunctive normal form using DeMorgan’s rules, etc. 3-6: Additions for FOL Deal with quantifiers and variable names Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Example Eliminate Implications: Reduce the scope of negation: Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Standardize/rename Variables Skolemize: Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Drop Universal Quantifiers: Put into CNF form using DeMorgan’s rules, etc.: Finished! Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Example (∀h)[[Big(h) ∧ House(h) ⊃ Work(h)] ∨% [(∃m) Cleans(m,h) ∧ ¬(∃g) Garden(g,h)]]% Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Resolution for First-Order Logic Suppose γ1 ∪{φ} and γ2 ∪ {¬ψ} are two clauses and φ and ¬ψ are positive and negative literals, respectively. Then, % γ1 ∪{φ} γ2 ∪ {¬ψ}% where φµ = ψµ% [γ1 ∪ γ2]µ% and µ is the mgu of φ and ψ . Binary Resolution: resolves on 2 literals clause 1 clause 2 {Q(x), R(x)} ∪{P(x,x)} {¬Q(B), S(y)} ∪{¬P(A, z)} {Q(A), R(A), ¬Q(B), S(y)} resolvant {z/A, x/A} Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Soundness and Completeness First-Order Logic Resolution is Sound! First-Order Logic Resolution is not refutation complete using the current resolution rule. It can be made complete with the addition of Factoring: the removal of redundant literals Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden An Example: Package Delivery Robot All of the packages in room 27 are smaller than any of the packages in room 28: 1. (∀x,y){[Package(x)∧ Package(y) ∧ Inroom(x,27) ∧ Inroom(y,28) ]# ⊃ Smaller(x,y)}# A is a package and B is a package: 2. Package(A)# 3. Package(B) Is package A in room 27? Package A is either in room 27 or room 28: Inroom(A,27) ? 4. Inroom(A,27) ∨ Inroom(A,28) In which room is package A? Package B is in room 27: 5. Inroom(B,27) # Package B is not smaller than package A: 6. ¬Smaller(B,A) Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden ∃u Inroom(A,u) ?" Robot’s Situation Room 27 Robot’s current Location. Robot’s Goal: Fetch Package A and bring it to the current location. Room 28 Where is package A? Go there, pick it up, go back (generate a plan) Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Resolution example Is package A in room 27? (7) Negate the query: (7’) Put 1-6 into CNF form 2-6 are already in CNF form. Call them 2’-6’ Put 1 into CNF form: Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden CNF form Eliminate implications: Reduce scope of negation sign: Simplify: Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden CNF form Standardize/rename variables: Drop universals: 1’ Finished! Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Resolution Theory is in CNF form: 1’ 2’ 3’ 4’ 5’ 6’ 7’ Negated query: Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Resolution Proof Resolve 7’ and 4’ 8: Resolve 8 and 1’ 9: Resolve 9 and 2’ 10: Resolve 10 and 3’ Continued next slide...... Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Resolution Proof 10: Resolve 10 and 3’ 11: Resolve 11 and 6’ 12: Resolve 12 and 5’ Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Reasoning About Action and Change Nonmonotonic Logics Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Reasoning about action and change • One of the most difficult problems in formal knowledge representation! • • • • Late 60’s and 70’s: difficulties in modeling Invention of nonmonotonic logic in 70’s Great progress in 80’s and 90’s Need for scalable, efficient solutions for incomplete environments in the 00’s. (WWW, Robotics) Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden KPLAB Knowledge Processing Lab Reasoning about Action and Change How do we represent and develop efficient inference mechanisms for dynamic behaviors of agents in incompletely specified environments? Actions & Effects Epistemics & Causality Temporal & Spatial Reasoning Sensing & Observation Planning & Plan Execution Prediction and Explanation Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden KPLAB Knowledge Processing Lab Some Problems [t1 ]at(gold, 2, 3) ?? Is the gold still at 2,3 after the agent moves to 1,2 ? Are the pits in the same place after the agent moves to 1,2 ? [t1 ]at(agent, 1, 2) [t,t1 ]Goto(agent, 1, 1, 1, 2) [t]at(agent, 1, 1) [t]at(gold, 2, 3) The Frame Problem The world tends to remain inert. Most actions are local and do not disturb the larger frame. Most features in the world do not change. How can this rule of thumb be represented succinctly in logic? Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden KPLAB Knowledge Processing Lab Some More Problems [t1 ]inpocket(agent, bubblegum) ?? The Ramification Problem [t1 ]at(agent, 1, 2) [t,t1 ]Goto(agent, 1, 1, 1, 2) [t]at(agent, 1, 1) [t]at(gold, 2, 3) [t]inpocket(agent, bubblegum) Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden There are many ramifications to an action, causal dependencies that become true when an action is executed How can one succinctly represent these ramified effects without making action specifications overly detailed? KPLAB Knowledge Processing Lab More Problems Goto Action [at(agent, x, y) ^ ad jacent(x, y, x1 , y1 ) ^ Sa f e(x1 , y1 )] ! [at(agent, x1 , y1 ) ^ ¬at(agent, x, y)] But what if ...... A giant bird flies by and drops a turd and blocks the path? The Wumpus breaks the rules and goes on the move? The Gold falls off a shelf and hits the agent in the head knocking it unconscious? The agent is wearing red-white and blue and a virtual Usama Bin Ladin enters the game as a virus and exterminates anything with those colors? The Qualification Problem All actions have exceptions (possibly infinite). How can we succinctly represent that actions work most of the time but there are exceptions, and we can add them to the theory in a manner that doesn’t force us to go into the action rules and change them all the time? Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden KPLAB Knowledge Processing Lab Some Formalisms • • • • • • Situation Calculus -- McCarthy (1959-63) • Situation Calculus (Revised) -- Reiter et al Event Calculus -- Kowalski (logic programming) Fluent Calculus -- Thielscher The A Family - Lifschitz, Gelfond, Baral Features and Fluents -- Sandewall Temporal Action Logics (TAL) -- Doherty et al Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden KPLAB Knowledge Processing Lab Using TAL Narratives for Projection #obs [0] Safe(1,1) & !Wumpus(1,1) & !Pit(1,1) & Alive(agent1) #occ [0,1] goto(agent1,1,1,1,2) #dep I([1] sense(agent1, breeze)) #occ [1,2] goto(agent1, 1,2,1,1) #occ [2,3] goto(agent1, 1,1,2,1) #dep I([3] sense(agent1, stench)) 4 Given that I execute these actions and sense these percepts, what can I say about the wumpus world? 3 P 2 1 1 2 Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden 3 4 KPLAB Knowledge Processing Lab Using Narratives for Explanation #obs [0] Safe(1,1) & !Wumpus(1,1) & !Pit(1,1) & Alive(agent1) #occ [0,1] goto(agent1,1,1,1,2) #dep I([1] sense(agent1, breeze)) …. ….. #obs [10] Wumpus(1,3) & !Alive(agent1) 4 Given that the agent executed these actions and sensed these percepts and given the following observations at time 10, how can we explain them? 3 P 2 1 1 Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden 2 3 KPLAB Knowledge Processing Lab 4 Using TAL Narratives to Plan #obs [0] Safe(1,1) & !Wumpus(1,1) & !Pit(1,1) & Alive(agent1) Initial State Specification ? #obs [t] Winner(agent1) & Gold(1,1) TALPlanner Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden Goal Generate a sequence of actions which make the observations at t true given the initial state observations at time 0. KPLAB Knowledge Processing Lab Multi-Agent Iphone Game Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden KPLAB Knowledge Processing Lab Techniques for solving A&C Problems Open & Closed World Assumptions Predicate Completion Negation as Failure to Prove Circumscription Default Logic Common thread: • Make assumptions about incomplete information. • Do this by refering to meta-theoretic concepts. • The entailment relation becomes nonmonotonic. If an atom is not in a database, assume it is false. The sufficient conditions for a predicate in a theory are also the necessary conditions. If I can’t prove a literal is true, assume it is false. The objects or tuples that can be shown to satisfy a relation are the only ones that do. If a formula is consistent with a theory then assume it is true Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden KPLAB Knowledge Processing Lab Monotonicity Classical Logic: IF THEN Practical Reasoning is often not as conservative. We often “jump” to conclusions or assume something is true if there is no reason to believe otherwise. (ceteris paribus in law) XX Nonmonotonic Logics do not have the property of monotonicity Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden KPLAB Knowledge Processing Lab Sufficient and Necessary Conditions P is a sufficient condition for something being Q P is a necessary condition for something being Q The only things that are Q are P. P is both necessary and sufficient Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden KPLAB Knowledge Processing Lab Circumscription Informally Narrative Theory in L(FL) Narrative Theory in L(FL) Make those sufficient conditions for change the only conditions + Circumscription Axiom No spurious change! Models for the narrative Sufficient conditions for change Intended set of preferred Models for the narrative By Minimizing Occludes we minimize unnecessary change. If a feature does not have to change value relative to the axioms it won’t! Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden KPLAB Knowledge Processing Lab λxy. (P (x) → Q(y)) to t̄ = ⟨a, z⟩ is the formula P (a) → Q(z). If U and V are relation expressions of the same arity, then U ≤ V stands for ∀x̄. (U (x̄) → V (x̄)).10 Similarly, if Ū = ⟨U1 , . . . , Un ⟩ and V̄ = ⟨V1 , . . . , Vn ⟩ are similar tuples of relation expressions, i.e., for 1 ≤ i ≤ n, Ui and Vi are of the n ! [Ui ≤ Vi ]. We write Ū = V̄ same arity, then Ū ≤ V̄ is an abbreviation for Circumscription i=1 for (Ū ≤ V̄ ) ∧ (V̄ ≤ Ū ), and Ū < V̄ for (Ū ≤ V̄ ) ∧ ¬(V̄ ≤ Ū ). Definition 5.3.1. Let P̄ = ⟨P1 . . . , Pn ⟩ be a tuple of distinct relation symbols, S̄ = ⟨S1 , . . . , Sm ⟩ be a tuple of distinct relation symbols disjoint with P̄ , and let T (P̄ , S̄) be a theory. The circumscription of P̄ in T (P̄ , S̄) with varied S̄, written Circ(T ; P̄ ; S̄), is the sentence T (P̄ , S̄) ∧ ∀X̄∀Ȳ . ¬[T (X̄, Ȳ ) ∧ X̄ < P̄ ] (5.3) where X̄ = ⟨X1 . . . , Xn ⟩ and Ȳ = ⟨Y1 , . . . , Ym ⟩ are tuples of relation variables 5.3 Circumscription ! similar to P̄ and S̄, respectively.11 10 11 91 Note that U ≤ V means that the extension is a subset Observe that (5.3) can of beUrewritten as of the extension of V . T (X̄, Ȳ ) is the sentence obtained from T (P̄ , S̄) by replacing all occurrences P̄ ,nS̄) ∧ ∀X̄∀Ȳ . {[T (X̄, ∧ [X̄ ≤ P̄ ]] → [P̄ of ≤ X̄]} , respectively, andȲ )all occurrences S1 . . . , Sm by of P1 . . . , Pn by X1 . . T. ,(X Y1 . . . , Ym , respectively. Intuition: which, in turn, is an abbreviation for Minimizes T (P̄ , S̄)∧ $ % !" Extensions 5.3 91 # Circumscription # ∀x̄.(X (x̄) → P (x̄)) → ∀x̄.(P (x̄) → X (x̄)) . ∀X̄∀Ȳ . T (X̄, Ȳ ) ∧ of selected Observe that (5.3) can be rewritten as T (P̄ , S̄) ∧ ∀X̄∀Ȳ . {[T (X̄, Ȳ ) Definition ∧ [X̄ ≤ P̄ ]] →5.3.2. [P̄ ≤ X̄]} A formula A is said to be a consequence of the circumPredicates n n i i i i=1 i i=1 scription of P̄ in T (P̄ , S̄) with variable S̄ if and only if Circ(T ; P̄ ; S̄) |= A.12 which, in turn, is an abbreviation for ! T (P̄ , S̄)∧ Artificial Computer Systems Division $ % !"Intelligence & Integrated Example 5.3.3. Let# KPLAB n nT consist of the following formulas: Department of Computer and# Information Science Knowledge Linköping University, Sweden ∀x̄.(Xi (x̄) → Pi (x̄)) → ∀x̄.(Pi (x̄) → Xi (x̄)) . ∀X̄∀Ȳ . T (X̄, Ȳ ) ∧ i=1 Processing Lab Bird(Tweety) i=1 ∀x.[(Bird(x) ∧ ¬Ab(x)) → F lies(x)]. Definition 5.3.2. A formula A is said to be a consequence of the circumscription of P̄ in T (P̄ , S̄) with variable S̄ if and only if Circ(T ; P̄ ; S̄) |= A.12 Let P̄ = ⟨Ab⟩ and S̄ = ⟨F lies⟩. ! Circ(T ; P̄ ; S̄) = T (P̄ , S̄) ∧ Example 5.3.3. Let T consist of the following formulas: ∀X∀Y. { [Bird(Tweety) ∧ ∀x.[(Bird(x) ∧ ¬X(x)) → Y (x)]∧ Bird(Tweety) ∀x.[(Bird(x) ∧ ¬Ab(x)) → F lies(x)]. ∀x.[X(x) → Ab(x)] ] → ∀x.[Ab(x) → X(x)] } . A Famous Example! In its basic form, the idea is to find relational expressions for X and Y that Let P̄ = ⟨Ab⟩ and S̄ = ⟨F lies⟩. when substituted into the theory T , will result in strengthening the theory so Circ(T ; P̄ ; S̄) = T (P̄ , S̄) ∧ additional inferences can be made. For example, substituting λx.False for X and λx.Bird(x) for Y , one can conclude that ∀X∀Y. { [Bird(Tweety) ∧ ∀x.[(Bird(x) ∧ ¬X(x)) → Y (x)]∧ ∀x.[X(x) → X(x)] } . Circ(T ;→ P̄ ;Ab(x)] S̄) |= ]T→∧∀x.[Ab(x) A (5.4) In its basic form, the idea iswhere to findArelational expressions for X and Y that is when substituted into the theory T , will result in strengthening the theory so additional inferences can be {∀x.[(Bird(x) made. For example, substituting λx.False X ∧ ¬False) → Bird(x)] ∧ for ∀x.[False → Ab(x)]} → and λx.Bird(x) for Y , one can conclude that Circ(T ; P̄ ; S̄) |= T ∧ A where A is (5.4) ∀x.[Ab(x) → False]. Since A can be simplified to the logically equivalent sentence ∀x.[Ab(x) → False], {∀x.[(Bird(x) ∧ ¬False) → Bird(x)] ∧ ∀x.[False → Ab(x)]} → which in turn is equivalent to → ∀x.¬Ab(x), ∀x.[Ab(x) False]. one can infer by (5.4) that Since A can be simplified toCirc(T the logically equivalent sentence ; P̄ ; S̄) |= F lies(Tweety). ∀x.[Ab(x) → False], ! 12 Here |= denotes the entailment relation of the second-order logic. which in turn is equivalent to ∀x.¬Ab(x), one can infer by (5.4) that Circ(T ; P̄ ; S̄) |= F lies(Tweety). 12 ! Artificial Intelligence & Integrated Computer Systems Division KPLAB Linköping University, Sweden Knowledge Processing Lab Here |= denotes the relation of the second-order logic. Department of Computer andentailment Information Science What to Know! • • Propositional and First-Order Logic Resolution Theorem Proving for both. • You should be able to model and solve a problem using resolution • This implies knowing transformation to CNF forms • You should understand problems associated with reasoning about action and change and intuitions behind circumscription. • Look at the Situation Calculus in the book Artificial Intelligence & Integrated Computer Systems Division Department of Computer and Information Science Linköping University, Sweden