Logical Inference

Logical Inference

Logical Inference CS 3793/5233 Artificial Intelligence Logical Inference – 1 Logic ⊲ Logic We want to tell our computers facts that are Propositional Logic Examples true of the world. Proof Procedures “It is raining.” Consistency-Based Diagnosis Some of these facts specify how one thing is The Limitations of Logic related to another. “It is raining implies it is wet.” We want our computers to be able to infer what else must be true of the world. “It is wet.” A logic is a system for inference from facts. CS 3793/5233 Artificial Intelligence Logical Inference – 2 Syntax Logic A proposition is something that is true or false. Propositional Logic An atomic proposition or atom consists of a ⊲ Syntax Informal Semantics single symbol. (≈ boolean variable) Informal Example Formal Semantics 1 A compound proposition is constructed from Formal Semantics 2 Examples simpler propositions p and q using logical Proof Procedures operators (≈ boolean expression): Consistency-Based Diagnosis – ¬p (read “not p”)–negation The Limitations of Logic – p ∧ q (read “p and q”)–conjunction – p ∨ q (read “p or q”)–disjunction – p → q (read “p implies q”)–implication – q ← p (read “q if p”)–implication – p ↔ q (read “p iff q”)–equivalence [Note: I prefer using → to ←.] CS 3793/5233 Artificial Intelligence Logical Inference – 3 Informal Semantics Logic Semantics maps between symbols and the world. Propositional Logic Syntax Informal Begin with a task domain. ⊲ Semantics Informal Example Choose symbols in the computer to denote Formal Semantics 1 Formal Semantics 2 propositions. Examples Symbol ≈ variable name Proof Procedures Consistency-Based Tell the system knowledge about the domain. Diagnosis Knowledge ≈ code and inputs The Limitations of Logic Ask the system true/false questions. Ask questions ≈ run a function The system should answer true, false or unknown as appropriate. You can interpret the answer because you know the meaning of the symbols. CS 3793/5233 Artificial Intelligence Logical Inference – 4 Informal Semantics Example Logic In computer: Propositional Logic Syntax sw up ∧ power ∧ unlit l1 → l1 broken Informal Semantics Informal ⊲ Example In user’s mind: sw up = switch is up, Formal Semantics 1 Formal Semantics 2 power = there is power in, Examples unlit l1 = light #1 isn’t lit, Proof Procedures l broken Consistency-Based 1 = light #1 is broken Diagnosis The computer doesn’t know the meaning of The Limitations of Logic the symbols. The user can interpret the symbols using their meaning. CS 3793/5233 Artificial Intelligence Logical Inference – 5 Formal Semantics 1 Logic An interpretation I maps atoms to true or Propositional Logic Syntax false. Informal Semantics Informal Example Based on how logical operators work, an Formal ⊲ Semantics 1 Formal Semantics 2 interpretation maps each proposition to a truth Examples value. Proof Procedures Propositions may have different truth values in Consistency-Based Diagnosis different interpretations. The Limitations of Logic p q ¬p p ∧ q p ∨ q p → q q ← p p ↔ q true true false true true true true true true false false false true false false false false true true false true true true false false false true false false true true true CS 3793/5233 Artificial Intelligence Logical Inference – 6 Formal Semantics 2 Logic A knowledge base is a set of propositions that Propositional Logic Syntax the agent is given as being true. Informal Semantics Informal Example A model of knowledge base is an Formal Semantics 1 Formal ⊲ Semantics 2 interpretation in which all the propositions in Examples the knowledge base are true. Proof Procedures KB p Consistency-Based If is a knowledge base and is a Diagnosis proposition, KB entails p (written KB |= p) The Limitations of Logic if p is true in every model of KB. KB |= p means that no interpretation exists in which KB is true and p is false. If KB |= p we also say p logically follows from KB, or p is a logical consequence of KB. CS 3793/5233 Artificial Intelligence Logical Inference – 7 Simple Example Logic KB = {p → q, p, s → r} Propositional Logic Examples ⊲ Simple Example p q r s model? Simple Example Electrical Environment I1 true true true true Representation I2 false false false false Proof Procedures Consistency-Based I3 true true false false Diagnosis The Limitations of I4 true true true false Logic I5 true true false true Which of p, q, r, s are entailed by KB? CS 3793/5233 Artificial Intelligence Logical Inference – 8 Simple Example Logic KB = {p → q, p, s → r} Propositional Logic Examples Simple Example p q r s model of KB? ⊲ Simple Example Electrical Environment I1 true true true true yes Representation I2 false false false false no Proof Procedures Consistency-Based I3 true true false false yes Diagnosis The Limitations of I4 true true true false yes Logic I5 true true false true no Which of p, q, r, s are entailed by KB? p and q CS 3793/5233 Artificial Intelligence Logical Inference – 9 Electrical Environment Logic Propositional Logic Examples Simple Example Simple Example Electrical ⊲ Environment Representation Proof Procedures Consistency-Based Diagnosis The Limitations of Logic CS 3793/5233 Artificial Intelligence Logical Inference – 10 Representation Logic light l live w ok l lit l Propositional Logic 1 0 ∧ 1 → 1 Examples light l2 live w1 ∧ up s2 → live w0 Simple Example Simple Example down s1 live w2 ∧ down s2 → live w0 Electrical Environment up s2 live w3 ∧ up s1 → live w1 ⊲ Representation Proof Procedures up s3 live w3 ∧ down s1 → live w2 Consistency-Based Diagnosis ok l1 live w4 ∧ ok l2 → lit l2 The Limitations of Logic ok l2 live w3 ∧ up s3 → live w4 ok cb1 live w3 → live p1 ok cb2 live w5 ∧ ok cb1 → live w3 live outside live w6 → live p2 live w5 ∧ ok cb2 → live w6 live outside → live w5 CS 3793/5233 Artificial Intelligence Logical Inference – 11 Proofs Logic A proof is a derivation that a proposition Propositional Logic Examples logically follows from a knowledge base. Proof Procedures Given a proof procedure, KB ⊢ p means p can ⊲ Proofs Brute Force be derived or proved from KB. CSP Inference Definite Clauses Recall KB |= p means KB entails p, that p is Example Contradiction true in all models of KB. Inference Rules Resolution A proof procedure is sound if KB ⊢ p only if Example Consistency-Based KB |= p. Anything that is proved is also Diagnosis The Limitations of entailed. Logic A proof procedure is complete if KB |= p then also KB ⊢ p. Everything that is entailed can be proved. CS 3793/5233 Artificial Intelligence Logical Inference – 12 Brute Force Inference Logic Enumerate all interpretations. Propositional Logic Examples Determine which interpretations are models of Proof Procedures the KB. Proofs ⊲ Brute Force Determine which atoms (and any other CSP Inference Definite Clauses propositions of interest) are true in all models Example Contradiction (or false in all models). Inference Rules n Resolution This is Ω(2 ) where n is the number of atoms. Example Consistency-Based Diagnosis The Limitations of Logic CS 3793/5233 Artificial Intelligence Logical Inference – 13 CSP Inference Logic Set up KB as a CSP. Each atom is a variable Propositional Logic Examples with two possible values. Each proposition in Proof Procedures the KB is a constraint. Proofs Brute Force Solutions of CSP = models of KB. ⊲ CSP Inference Definite Clauses Run arc consistency/domain splitting. Example Contradiction Don’t stop after finding one CSP solution (KB Inference Rules Resolution model). Find them all. Example Consistency-Based Determine which atoms are true in all models Diagnosis The Limitations of (or false in all models). Logic This is still potentially exponential, but more efficient than brute force. See Section 4.6.1. CS 3793/5233 Artificial Intelligence Logical Inference – 14 Definite Clause Inference Logic Suppose all propositions in KB are definite Propositional Logic Examples clauses, either: Proof Procedures Proofs – an atom (e.g., an observation), or Brute Force CSP Inference – of the form p → q, where p and q are ⊲ Definite Clauses Example atoms (e.g., a rule about the behavior of Contradiction Inference Rules the world) Resolution Example – of the form p1 ∧ . ∧ pk → q, where q and Consistency-Based Diagnosis each pi are atoms The Limitations of Logic Running CSP inference is efficient (linear in the length of the KB). See Section 5.2. CS 3793/5233 Artificial Intelligence Logical Inference – 15 Definite Clause Example Logic KB = {a, b, a → c, b ∧ c → d, d ∧ e → f} Propositional Logic Examples Proof Procedures Know a and b. Proofs Brute Force CSP Inference Definite Clauses Derive c from a and a → c. ⊲ Example Contradiction Inference Rules d b c b c d Resolution Derive from and and ∧ → Example Consistency-Based Diagnosis Cannot derive e or f. The Limitations of Logic CS 3793/5233 Artificial Intelligence Logical Inference – 16 Proof by Contradiction Logic Suppose we want to determine if KB |= p. Propositional Logic ′ Examples Let KB = KB ∪ {¬p} Proof Procedures KB′ Proofs Determine that no model exists for . Brute Force Conclude that KB |= p. CSP Inference Definite Clauses Should probably show that KB has at least Example ⊲ Contradiction one model. Inference Rules Resolution Example Consistency-Based Diagnosis The Limitations of Logic CS 3793/5233 Artificial Intelligence Logical Inference – 17 Inference Rules Logic Modus ponens is an inference rule. If p is true, Propositional Logic Examples and if p → q is true, then q is true. Proof Procedures That is, if KB |= p and KB |= p → q, then Proofs Brute Force KB |= q. CSP Inference Definite Clauses Resolution inference rule (really, two rules) Example Contradiction ⊲ Inference Rules – If KB |= p ∨ q and KB |= ¬p, then Resolution Example KB |= q. Consistency-Based Diagnosis – If KB |= p ∨ q and KB |= ¬p ∨ r, then The Limitations of KB q r Logic |= ∨ .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    30 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