Artificial Intelligence: Agents and Propositional Logic.

Slides:



Advertisements
Similar presentations
Russell and Norvig Chapter 7
Advertisements

Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
Knowledge and reasoning – second part
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
Logical Agents Chapter 7.
Methods of Proof Chapter 7, second half.
INTRODUÇÃO AOS SISTEMAS INTELIGENTES Prof. Dr. Celso A.A. Kaestner PPGEE-CP / UTFPR Agosto de 2011.
Knoweldge Representation & Reasoning
Logic Agents and Propositional Logic CS 271: Fall 2007 Instructor: Padhraic Smyth.
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7.
Logical Agents. Knowledge bases Knowledge base = set of sentences in a formal language Declarative approach to building an agent (or other system): 
February 20, 2006AI: Chapter 7: Logical Agents1 Artificial Intelligence Chapter 7: Logical Agents Michael Scherger Department of Computer Science Kent.
Propositional Logic: Methods of Proof (Part II)
Logical Agents (NUS) Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
CHAPTERS 7, 8 Oliver Schulte Logical Inference: Through Proof to Truth.
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,
1 Problems in AI Problem Formulation Uninformed Search Heuristic Search Adversarial Search (Multi-agents) Knowledge RepresentationKnowledge Representation.
Propositional Logic: Methods of Proof (Part II) This lecture topic: Propositional Logic (two lectures) Chapter (previous lecture, Part I) Chapter.
Logic Agents and Propositional Logic 부산대학교 전자전기컴퓨터공학과 인공지능연구실 김민호
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
S P Vimal, Department of CSIS, BITS, Pilani
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
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 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.
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.
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
1 Logical Agents Chapter 7. 2 Logical Agents What are we talking about, “logical?” –Aren’t search-based chess programs logical Yes, but knowledge is used.
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 Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Logical Agents Russell & Norvig Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean)
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Inference in Propositional Logic (and Intro to SAT) CSE 473.
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 Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents. Inference : Example 1 How many variables? 3 variables A,B,C How many models? 2 3 = 8 models.
CS666 AI P. T. Chung Logic Logical Agents Chapter 7.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Notes 7: Knowledge Representation, The Propositional Calculus
EA C461 Artificial Intelligence
Inference in Propositional Logic (and Intro to SAT)
EA C461 – Artificial Intelligence Logical Agent
Notes 7: Knowledge Representation, The Propositional Calculus
Logical Inference: Through Proof to Truth
Logical Agents Chapter 7.
Artificial Intelligence Logical Agents
EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS
Logical Agents Chapter 7 Selected and slightly modified slides from
Logical Agents Reading: Russell’s Chapter 7
Artificial Intelligence
CS 416 Artificial Intelligence
EA C461 – Artificial Intelligence Logical Agent
Methods of Proof Chapter 7, second half.
Propositional Logic: Methods of Proof (Part II)
Problems in AI Problem Formulation Uninformed Search Heuristic Search
Presentation transcript:

Artificial Intelligence: Agents and Propositional Logic.

Propositional Logic AI 1 31 december 201831 december 201831 december 2018

Propositional Logic AI 1 31 december 201831 december 201831 december 2018

Propositional Logic AI 1 31 december 201831 december 201831 december 2018

Wumpus world logic AI 1 31 december 201831 december 201831 december 2018

Wumpus world logic AI 1 31 december 201831 december 201831 december 2018

Truth tables for inference Enumerate the models and check that  is true in every model In which KB is true. AI 1 31 december 201831 december 201831 december 2018

Inference by enumeration Depth-first enumeration of all models is sound and complete For n symbols, time complexity is O(2n), space complexity is O(n). AI 1 31 december 201831 december 201831 december 2018

Logical equivalence Two sentences are logically equivalent iff true in same set of models or   ß iff  |= ß and ß |= . AI 1 31 december 201831 december 201831 december 2018

Validity and satisfiability A sentence is valid if it is true in all models, e.g., True, A A, A  A, (A  (A  B))  B Validity is connected to inference via the Deduction Theorem: KB |= if and only if (KB  ) is valid A sentence is satisfiable if it is true in some model e.g., A  B, C A sentence is unsatisfiable if it is true in no models e.g., AA Satisfiability is connected to inference via the following: KB |=  if and only if (KB   ) is unsatisfiable Remember proof by contradiction. AI 1 31 december 201831 december 201831 december 2018

Inference rules in PL Modens Ponens And-elimination: from a conjuction any conjunction can be inferred: All logical equivalences of slide 39 can be used as inference rules. AI 1 31 december 201831 december 201831 december 2018

Example Assume R1 through R5: How can we prove P1,2? Biconditional elim. And elim. Contraposition Modens ponens Morgan’s rule AI 1 31 december 201831 december 201831 december 2018

Searching for proofs Finding proofs is exactly like finding solutions to search problems. Search can be done forward (forward chaining) to derive goal or backward (backward chaining) from the goal. Searching for proofs is not more efficient than enumerating models, but in many practical cases, it is more efficient because we can ignore irrelevant properties. Monotonicity: the set of entailed sentences can only increase as information is added to the knowledge base. AI 1 31 december 201831 december 201831 december 2018

Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules Legitimate (sound) generation of new sentences from old Proof = a sequence of inference rule application can use inference rules as operators in a standard search algorithm Typically require transformation of sentences into a normal form Model checking truth table enumeration (always exponential in n) improved backtracking, e.g., Davis--Putnam-Logemann-Loveland (DPLL) heuristic search in model space (sound but incomplete) e.g., min-conflicts-like hill-climbing algorithms AI 1 31 december 201831 december 201831 december 2018

Resolution Start with Unit Resolution Inference Rule: Full Resolution Rule is a generalization of this rule: For clauses of length two: AI 1 31 december 201831 december 201831 december 2018

Resolution in Wumpus world At some point we can derive the absence of a pit in square 2,2: Now after biconditional elimination of R3 followed by a modens ponens with R5: Resolution : AI 1 31 december 201831 december 201831 december 2018

Resolution Uses CNF (Conjunctive normal form) Conjunction of disjunctions of literals (clauses) The resolution rule is sound: Only entailed sentences are derived Resolution is complete in the sense that it can always be used to either confirm or refute a sentence (it can not be used to enumerate true sentences.) AI 1 31 december 201831 december 201831 december 2018

Conversion to CNF B1,1  (P1,2  P2,1) Eliminate , replacing   ß with (  ß)(ß  ). (B1,1  (P1,2  P2,1))  ((P1,2  P2,1)  B1,1) Eliminate , replacing   ß with    ß. (B1,1  P1,2  P2,1)  ((P1,2  P2,1)  B1,1) Move  inwards using de Morgan's rules and double-negation: (B1,1  P1,2  P2,1)  ((P1,2  P2,1)  B1,1) Apply distributivity law ( over ) and flatten: (B1,1  P1,2  P2,1)  (P1,2  B1,1)  (P2,1  B1,1) AI 1 31 december 201831 december 201831 december 2018

Resolution algorithm Proof by contradiction, i.e., show KB  unsatisfiable AI 1 31 december 201831 december 201831 december 2018

Resolution algorithm First KB  is converted into CNF Then apply resolution rule to resulting clauses. The process continues until: There are no new clauses that can be added Hence  does not ential ß Two clauses resolve to entail the empty clause. Hence  does ential ß AI 1 31 december 201831 december 201831 december 2018

Resolution example KB = (B1,1  (P1,2 P2,1))  B1,1 = P1,2 AI 1 31 december 201831 december 201831 december 2018

Forward and backward chaining The completeness of resolution makes it a very important inference model. Real-world knowledge only requires a restricted form of clauses: Horn clauses = disjunction of literals with at most one positive literal Three important properties Can be written as an implication Inference through forward chaining and backward chaining. Deciding entailment can be done in a time linear size of the knowledge base. AI 1 31 december 201831 december 201831 december 2018

Forward chaining Idea: fire any rule whose premises are satisfied in the KB, add its conclusion to the KB, until query is found AI 1 31 december 201831 december 201831 december 2018

Forward chaining algorithm Forward chaining is sound and complete for Horn KB AI 1 31 december 201831 december 201831 december 2018

Forward chaining example 31 december 201831 december 201831 december 2018

Forward chaining example 31 december 201831 december 201831 december 2018

Forward chaining example 31 december 201831 december 201831 december 2018

Forward chaining example 31 december 201831 december 201831 december 2018

Forward chaining example 31 december 201831 december 201831 december 2018

Forward chaining example 31 december 201831 december 201831 december 2018

Forward chaining example 31 december 201831 december 201831 december 2018

Forward chaining example 31 december 201831 december 201831 december 2018

Proof of completeness FC derives every atomic sentence that is entailed by KB FC reaches a fixed point where no new atomic sentences are derived. Consider the final state as a model m, assigning true/false to symbols. Every clause in the original KB is true in m a1  …  ak  b Hence m is a model of KB If KB |= q, q is true in every model of KB, including m AI 1 31 december 201831 december 201831 december 2018

Backward chaining Idea: work backwards from the query q: to prove q by BC, check if q is known already, or prove by BC all premises of some rule concluding q Avoid loops: check if new subgoal is already on the goal stack Avoid repeated work: check if new subgoal has already been proved true, or has already failed AI 1 31 december 201831 december 201831 december 2018

Backward chaining example 31 december 201831 december 201831 december 2018

Backward chaining example 31 december 201831 december 201831 december 2018

Backward chaining example 31 december 201831 december 201831 december 2018

Backward chaining example 31 december 201831 december 201831 december 2018

Backward chaining example 31 december 201831 december 201831 december 2018

Backward chaining example 31 december 201831 december 201831 december 2018

Backward chaining example 31 december 201831 december 201831 december 2018

Backward chaining example 31 december 201831 december 201831 december 2018

Backward chaining example 31 december 201831 december 201831 december 2018

Backward chaining example 31 december 201831 december 201831 december 2018

Forward vs. backward chaining FC is data-driven, automatic, unconscious processing, e.g., object recognition, routine decisions May do lots of work that is irrelevant to the goal BC is goal-driven, appropriate for problem-solving, e.g., Where are my keys? How do I get into a PhD program? Complexity of BC can be much less than linear in size of KB AI 1 31 december 201831 december 201831 december 2018

Effective propositional inference Two families of efficient algorithms for propositional inference based on model checking: Are used for checking satisfiability Complete backtracking search algorithms DPLL algorithm (Davis, Putnam, Logemann, Loveland) Improves TT-Entails? Algorithm. Incomplete local search algorithms WalkSAT algorithm AI 1 31 december 201831 december 201831 december 2018

The DPLL algorithm Determine if an input propositional logic sentence (in CNF) is satisfiable. Improvements over truth table enumeration: Early termination A clause is true if any literal is true. A sentence is false if any clause is false. E.g. (B1,1  P1,2  P2,1)  (P1,2  B1,1)  (P2,1  B1,1) Pure symbol heuristic Pure symbol: always appears with the same "sign" in all clauses. e.g., In the three clauses (A  B), (B  C), (C  A), A and B are pure, C is impure. Assign a pure symbol so that their literals are true. Unit clause heuristic Unit clause: only one literal in the clause or only one literal which has not yet received a value. The only literal in a unit clause must be true. First do this assignments before continuing with the rest (unit propagation!). AI 1 31 december 201831 december 201831 december 2018

The DPLL algorithm AI 1 31 december 201831 december 201831 december 2018

The WalkSAT algorithm Incomplete, local search algorithm. Evaluation function: The min-conflict heuristic of minimizing the number of unsatisfied clauses. Steps are taken in the space of complete assignments, flipping the truth value of one variable at a time. Balance between greediness and randomness. To avoid local minima AI 1 31 december 201831 december 201831 december 2018

The WalkSAT algorithm AI 1 31 december 201831 december 201831 december 2018

Hard satisfiability problems Underconstrained problems are easy: e.g n-queens in CSP. In SAT: e.g., (D  B  C)  (B  A  C)  (C  B  E)  (E  D  B)  (B  E  C) Increase in complexity by keeping the number of symbols fixed and increasing the amount of clauses. m = number of clauses n = number of symbols Hard problems seem to cluster near m/n = 4.3 (critical point) AI 1 31 december 201831 december 201831 december 2018

Hard satisfiability problems AI 1 31 december 201831 december 201831 december 2018

Hard satisfiability problems Median runtime for 100 satisfiable random 3-CNF sentences, n = 50 AI 1 31 december 201831 december 201831 december 2018

Inference-based agents in the wumpus world A wumpus-world agent using propositional logic ( a knowledge base about the physics of the W-world): P1,1 W1,1 Bx,y  (Px,y+1  Px,y-1  Px+1,y  Px-1,y) Sx,y  (Wx,y+1  Wx,y-1  Wx+1,y  Wx-1,y) W1,1  W1,2  …  W4,4 (at least one wumpus) W1,1  W1,2 (at most one wumpus) W1,1  W1,3 … 64 distinct proposition symbols, 155 sentences A fringe square is provably safe if the sentence is entailed by the knowledge base. AI 1 31 december 201831 december 201831 december 2018

AI 1 31 december 201831 december 201831 december 2018

Expressiveness limitation of propositional logic KB contains "physics" sentences for every single square With all consequences for large KB Better would be to have just two sentences for breezes and stenches for all squares. Impossible for propositional logic. Simplification in agent: location info is not in KB!! For every time t and every location [x,y], Ltx,y  FacingRightt  Forwardt  Ltx+1,y PROBLEM: Rapid proliferation of clauses. AI 1 31 december 201831 december 201831 december 2018

Summary Logical agents apply inference to a knowledge base to derive new information and make decisions. Basic concepts of logic: syntax: formal structure of sentences semantics: truth of sentences wrt models entailment: necessary truth of one sentence given another inference: deriving sentences from other sentences soundness: derivations produce only entailed sentences completeness: derivations can produce all entailed sentences Wumpus world requires the ability to represent partial and negated information, reason by cases, etc. Resolution is complete for propositional logic Forward, backward chaining are linear-time, complete for Horn clauses Propositional logic lacks expressive power AI 1 31 december 201831 december 201831 december 2018