Propositional Logic 2

Propositional Logic 2

Propositional Logic 2 Syntactic Elements Logic An atomic sentence consists of a single propositional symbol, representing a proposition that can be true or false. A literal is a propositional symbol or its negation. Complex sentences are constructed from simpler sentences using logical connectives: ¬ (not), ∧ (and), ∨ (or), → (implies) [I prefer → to ⇒], and ↔ (iff). CS 5233 Artificial Intelligence Logic – 2 Propositional Logic 2 SyntacticElements.................................. ...... 2 Syntax Syntax............................................. ... 3 A proposition or propositional sentence can be formed as follows: Semantics.......................................... .... 4 Every propositional symbol is a sentence. Deduction.......................................... .... 5 If A is a sentence, then ¬A is a sentence. Entailment ......................................... .... 6 If A1 and A2 are sentences, then so are: TheWumpusWorldExample.............................. ... 7 A1 ∧ A2, (and, conjunction) InferenceRules ..................................... ..... 8 A1 ∨ A2, (or, disjunction) InferenceProcedures................................ ....... 9 A1 → A2, and (implies, implication) Resolution Inference Procedure. ........ 10 A1 ↔ A2. (iff, biconditional) UsefulEquivalences ................................. ..... 11 CS 5233 Artificial Intelligence Logic – 3 First-Order Logic 12 SyntacticElements.................................. ..... 12 Semantics Syntax............................................. .. 13 Semantics.......................................... ... 14 A world or domain is the set of facts we want to represent. InferenceRules ..................................... .... 15 An interpretation maps each propositional symbol to the world. Example:Setup...................................... ... 16 A sentence is true if its interpretation in the world is true. Example,Proof,Part1................................ .... 17 A knowledge base is a set of sentences. Example,Proof,Part2................................ .... 18 A world is a model of a KB if the KB is true for that world. Unification ......................................... ... 19 For convenience, a model can be thought of as a truth assignment to the Unify-ListsProcedure............................... ...... 20 symbols. Unify-TermsProcedure............................... ..... 21 CS 5233 Artificial Intelligence Logic – 4 Resolve Procedure Preliminaries . ........ 22 ResolveProcedure ................................... .... 23 1 2 Deduction The Wumpus World Example A sentence S is satisfiable within a KB if S is true in some model of the KB, i.e., some truth assignment makes S and the KB true. A sentence S is entailed by a KB if S is true in all models of the KB (denoted as KB |= S), i.e., every truth assignment that makes KB true also makes S true. Logical inference or deduction is concerned with producing entailed sentences from KBs. CS 5233 Artificial Intelligence Logic – 5 Entailment Sentences (KB) Sentence Interpretation Models Entails True in all CS 5233 Artificial Intelligence Logic – 7 Possible Truth Possible Truth Assignments Assignments Inference Rules Interpretation Modus Ponens From A → B and A Infer B Unit Resolution From A ∨ B Models and ¬B True in all Infer A Possible Worlds Possible Worlds Resolution From A ∨ B CS 5233 Artificial Intelligence Logic – 6 and ¬B ∨ C Infer A ∨ C CS 5233 Artificial Intelligence Logic – 8 3 4 Inference Procedures First-Order Logic 12 An inference procedure uses inference rules to produce proofs. Denoted as Syntactic Elements KB ⊢ S. An inference procedure is sound if it can only prove entailed sentences, i.e., A symbol in first-order logic can be a predicate, a function, a constant every sentence it proves is entailed. term, or a variable term. An inference procedure is complete if it can prove any entailed sentence, First-order logic uses the connectives ¬ (not), ∧ (and), ∨ (or), → i.e., every entailed sentence can be proved. (implies), and ↔ (iff). CS 5233 Artificial Intelligence Logic – 9 First-order logic also uses the quantifiers ∀ (for all) and ∃ (there exists). CS 5233 Artificial Intelligence Logic – 12 Resolution Inference Procedure Syntax Resolution applies to conjunctive normal form. A term is a constant or variable, or a function applied to a sequence of – A KB is a conjunction of sentences. terms. – Each sentence is a disjunction of literals. A ground term is a term with no variables. Resolution is refutation complete. If a KB is in CNF, and if the KB is An atomic sentence or atom is a predicate applied to a sequence of terms. inconsistent, then resolution will infer inconsistent literals. A ground atom is an atom with no variables. To deduce a sentence S, first temporarily add ¬S to the KB. Then, if Connectives can be used to construct more complex sentences in the usual resolution infers inconsistent literals, then ¬S is not satisfiable within the way. KB, which means that S is entailed. If A is a sentence and x is a variable, then: CS 5233 Artificial Intelligence Logic – 10 – ∀x A is a sentence (universal quantifier). – ∃x A is a sentence (existential quantifier). Useful Equivalences for Converting to CNF A well-formed formula is a sentence in which all the variables are quantified. Several logical equivalences are handy for converting sentences to CNF CS 5233 Artificial Intelligence Logic – 13 (p → q) ≡ (¬p ∨ q) ((p ∧ r) → (q ∨ s)) ≡ (¬p ∨¬r ∨ q ∨ s) Semantics (p → (q ∧ r)) The connectives ∧, ∨, ¬, →, and ↔ are evaluated in the usual way. ≡ ((p → q) ∧ (p → r)) ∀x A is true if every substitution for x makes A true. ≡ ((¬p ∨ q) ∧ (¬p ∨ r)) ∃x A is true if at least one substitution for x makes A true. ((p ∨ q) → r) An interpretation consists of objects in the world and mappings for terms ≡ ((p → r) ∧ (q → r)) and predicates. ≡ ((¬p ∨ r) ∧ (¬q ∨ r)) Each ground term is mapped to an object. CS 5233 Artificial Intelligence Logic – 11 Each predicate is mapped to a relation (think relational database). A ground atom is true if the predicate’s relation holds between the terms’ objects. CS 5233 Artificial Intelligence Logic – 14 5 6 Inference Rules Example, Proof, Part 1 Universal From ∀x A(x) -parent(x,y) | -ancestor(y,z) | ancestor(x,z) Elimination Infer A(t) where t is any term -ancestor(Liz,Billy) --------------------------------------------- Existential From ∃x A(x) -parent(Liz,y) | -ancestor(y,Billy) Elimination Infer A(c) where c is a new constant Resolution From ∀x,y B(y) ∨ A(x) -mother(x,y) | parent(x,y) (disjunctive) and ∀x, z ¬A(x) ∨ C(z) -parent(Liz,y) | -ancestor(y,Billy) --------------------------------------------- Infer ∀y,z B(y) ∨ C(z) -mother(Liz,y) | -ancestor(y,Billy) Resolution From ∀x,y B(y) → A(x) (implicative) and ∀x,z A(x) → C(z) mother(Liz,Charley) Infer ∀y,z B(y) → C(z) -mother(Liz,y) | -ancestor(y,Billy) --------------------------------------------- CS 5233 Artificial Intelligence Logic – 15 -ancestor(Charley,Billy) CS 5233 Artificial Intelligence Logic – 17 Example: Setup Example, Proof, Part 2 Knowledge Base -parent(x,y) | ancestor(x,y) -parent(x,y) | -ancestor(y,z) | ancestor(x,z) -ancestor(Charley,Billy) --------------------------------------------- -parent(x,y) | ancestor(x,y) -parent(Charley,Billy) -mother(x,y) | parent(x,y) -father(x,y) | parent(x,y) -father(x,y) | parent(x,y) mother(Liz,Charley) -parent(Charley,Billy) father(Charley,Billy) --------------------------------------------- -father(Charley,Billy) To prove ancestor(Liz,Billy) father(Charley,Billy) Refute -ancestor(Liz,Billy) -father(Charley,Billy) CS 5233 Artificial Intelligence Logic – 16 --------------------------------------------- contradiction CS 5233 Artificial Intelligence Logic – 18 Unification To use the resolution inference rule, we need to be able to match atoms in sentences. This is called unification. If successful, unification returns a substitution. A substitution specifies values for variables that would make the two atoms identical. CS 5233 Artificial Intelligence Logic – 19 7 8 Unify-Lists Procedure Resolve Procedure Preliminaries The Resolve procedure assumes that sentences A and B are disjunctions function Unify-Lists(A, B, θ) represented as sets of literals. A literal is an atom or its negation. if A and B have different predicates/functions Resolve assumes that sentences A and B have no variables with the or have different numbers of arguments same names. then return failure Resolve returns all the sentences it infers. for i ← 1 to number of arguments do CS 5233 Artificial Intelligence Logic – 22 termA ← ith argument of A termB ← ith argument of B θ ← Unify-Terms(termA, termB, θ) Resolve Procedure if θ = failure then return failure end for function Resolve(A, B) return θ for each litA in A do for each litB in B do CS 5233 Artificial Intelligence Logic – 20 if one of litA and litB is negated, not both then θ ← Unify-Lists(litA, litB, empty substitution) Unify-Terms Procedure if θ =6 failure and has no recursive substs. then A′ ← apply substitution θ to A litA′ ← apply substitution θ to litA function Unify-Terms(A, B, θ) B′ ← apply substitution θ to B while A is a variable and θ[A] exists litB ′ ← apply substitution θ to litB do A ← θ[A] C ← (A′ −{litA′}) ∪ (B′ −{litB ′}) while B is a variable and θ[B] exists add C to formulas inferred do B ← θ[B] return formulas inferred if A = B then do nothing A A B else if is a variable then θ[ ] ← CS 5233 Artificial Intelligence Logic – 23 else if B is a variable then θ[B] ← A else if A or B is a constant then θ ← failure else θ ← Unify-Lists(A, B, θ) return θ CS 5233 Artificial Intelligence Logic – 21 9 10.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    5 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us