1 CS 2710, ISSP 2610 Chapter 7 Propositional Logic Reasoning.

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)
Logic Use mathematical deduction to derive new knowledge.
Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
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.
Artificial Intelligence Knowledge-based Agents Russell and Norvig, Ch. 6, 7.
Logical Agents Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Fall 2005.
Knowledge Representation & Reasoning.  Introduction How can we formalize our knowledge about the world so that:  We can reason about it?  We can do.
1 Problem Solving CS 331 Dr M M Awais Representational Methods Formal Methods Propositional Logic Predicate Logic.
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.
Computing & Information Sciences Kansas State University Lecture 11 of 42 CIS 530 / 730 Artificial Intelligence Lecture 11 of 42 William H. Hsu Department.
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 6 Dr Souham Meshoul CAP492.
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 in intelligent systems So far, we’ve used relatively specialized, naïve agents. How can we build agents that incorporate knowledge and a memory?
Logical Agents Chapter 7.
Methods of Proof Chapter 7, second half.
Knoweldge Representation & Reasoning
LOGICAL AGENTS Yılmaz KILIÇASLAN. Definitions Logical agents are those that can:  form representations of the world,  use a process of inference to.
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 5 Dr Souham Meshoul CAP492.
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 Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2005.
Logical Agents Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2008.
Rutgers CS440, Fall 2003 Propositional Logic Reading: Ch. 7, AIMA 2 nd Ed. (skip )
Inference is a process of building a proof of a sentence, or put it differently inference is an implementation of the entailment relation between sentences.
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): 
February 20, 2006AI: Chapter 7: Logical Agents1 Artificial Intelligence Chapter 7: Logical Agents Michael Scherger Department of Computer Science Kent.
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
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part A Knowledge Representation and Reasoning.
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,
Class Project Due at end of finals week Essentially anything you want, so long as its AI related and I approve Any programming language you want In pairs.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
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.
Knowledge Representation Lecture # 17, 18 & 19. Motivation (1) Up to now, we concentrated on search methods in worlds that can be relatively easily represented.
For Friday Read chapter 8 Homework: –Chapter 7, exercise 1.
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.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
Computing & Information Sciences Kansas State University Wednesday, 13 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 10 of 42 Wednesday, 13 September.
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 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,
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,
Artificial Intelligence Logical Agents Chapter 7.
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.
ECE457 Applied Artificial Intelligence Fall 2007 Lecture #6
EA C461 – Artificial Intelligence Logical Agent
Logical Agents Chapter 7 Selected and slightly modified slides from
Logical Agents Reading: Russell’s Chapter 7
Logical Agents Chapter 7.
Artificial Intelligence
CS 416 Artificial Intelligence
Logical Agents Chapter 7.
CS 416 Artificial Intelligence
Knowledge Representation I (Propositional Logic)
Methods of Proof Chapter 7, second half.
Logical Agents Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

1 CS 2710, ISSP 2610 Chapter 7 Propositional Logic Reasoning

2 Knowledge Based Agents Central component: knowledge base, or KB. A set of sentences in a knowledge representation language Generic Functions –TELL (add a fact to the knowledge base) –ASK (get next action based on info in KB) [Inference?]

Note We’re all familiar with logic from mathematics In AI, we need to think about things we usually take for granted To use the notion of prime number, you don’t have to think about what prime means … or number, for that matter In AI, we create knowledge representation schemes, which define the objects, predicates, and functions which exist 3

4 The Wumpus World Game is played in a MxN grid One player, one wumpus, one or more pits The wumpus eats anyone who enters its room A pit traps anyone who moves into its room (The wumpus can be shot by an agent, but the agent has only one arrow; this and some other details won’t come up in these notes) Player starts in 0,0 Forward, turn left, turn right If player tries to move forward and bumps into a wall, the player does not move Player can grab the gold if they are in the same room Goal: find gold while avoiding wumpus and pits

Sensors 5 sensors, each which gives one bit of information –Stench (if wumpus and player in adjacent, not diagonal, squares) –Breeze (if a pit and player in adjacent squares) –Glitter (if gold and player in the same room) –Bump (when the agent walks into a wall) –Scream (when wumpus is killed; sound can be perceived everywhere) Percepts: 5-tuples –[stench, breeze, glitter, bump, scream] 5

Environment? Discrete, static, single-agent (wumpus doesn’t move) Sequential (player’s decisions can affect future ones) Partially observable (locations of pits and wumpus are unobservable) 6

7 stench[Wumpus]stench Glitter [gold] stench, breeze [start]breeze[Pit]breeze 0 0

8 Wumpus Main difficulty: player doesn’t know locations of pits, gold, and wumpus Reason about configuration Knowledge evolves as new percepts arrive and actions are taken.

9 Examples of reasoning [diagram in lecture] 1.Player starts in (0,0). No stench or breeze. So, no pit or wumpus in (1,0) or (0,1). Player still alive, so no pit or wumpus in (0,0). Player moves to (1,0) 2.Breeze in (1,0). So, there must be a pit in (0,0), (2,0) or (1,1). Player already ruled out (0,0) 3.Since there is danger in moving to (2,0) and (1,1), player moves back to (0,0) 4.Player moves to (0,1). No positive percepts. Now player knows there is no pit in (1,1) yeah! and there is a pit in (2,0) (pit-def in diagram) Player combines knowledge gained at different times to make inferences

10 Fundamental Concepts of logical representation and reasoning Information is represented in sentences, which must have correct syntax ( ) * 7 = 21 vs. 2 ) + 7 = * ( 1 21 The semantics of a sentence defines its truth with respect to each possible world – an interpretation assigning T or F to all propositions W is a model of S means that sentence S is true under interpretation W [What do the following mean?] –X |= Y –X entails Y –Y logically follows from X

11 Which are true? Which are not true but useful? 1.{Man, Man  Mortal} |= Mortal 2.{Raining,Dog  Mammal} |= Mammal 3.{Raining,Raining  Wet} |= Wet 4.{Smoke, Fire  Smoke} |= Fire 5.{Tall ^ Silly} |= Tall 6.{Tall v Silly} |= Silly 7.{Tall, Silly} |= Tall ^ Silly [Wumpus world EG illustrating possible worlds and entailment]

12 Entailment (reminder) A |= B Under all interpretations in which A is true, B is true as well All models of A are models of B Whenever A is true, B is true as well A entails B B logically follows from A

13 Inference KB |-i A Inference algorithm i can derive A from KB A can be inferred from KB using i

14 Inference Algorithm Examples 1.{A,B} |- (^intro) A ^ B 2.{A, A  B} |- (MP) B 3.{A, B  A} |- (abduction) B 4.Internet says P|- (gullibility) P 5.Professor says P |- (trust in authority) P

15 Inference Algorithms Notes:  implication, piece of syntax |= entailment, used to describe semantics |- can be derived from* Inference algorithm, inference procedure, rule of inference, inference rule: procedure that derives sentences from sentences [Definition of soundness of inference algorithm i] [Definition of completeness of inference algorithm i] * Though it can mean different things in different math/logic contexts; see “turnstile” in Wikipedia

16 Monotonicity [A logic is monotonic if…]

17 Propositional Logic Syntax Sentence -> AtomicSent | complexSent AtomicSent -> true|false| P, Q, R … ComplexSent ->  sentence| ( sentence  sentence ) | ( sentence  sentence ) | ( sentence  sentence ) | ( sentence  sentence ) | ( sentence ) [no predicate or function symbols]

18 Propositional Logic Sentences If there is a pit at [1,1], there is a breeze at [1,0] P 11  B 10 There is a breeze at [2,2], if and only if there is a pit in the neighborhood B 22  ( P 21  P 23  P 12  P 32 ) There is no breeze at [2,2]  B 22

19 Semantics of Prop Logic In model-theoretic semantics, an interpretation assigns elements of the world to sentences, and defines the truth values of sentences Propositional logic: easy! Assign T or F to each proposition symbol; then assign truth values to complex sentences in the obvious way

20 Logical Equivalences Sentences A and B are logically equivalent if: they are true under exactly the same interpretations A |= B and B |= A

21 Validity A sentence (or set of sentences) is valid if it is true under all interpretations Example: P v ~P

22 Satisfiability A sentence (or set of sentences) is satisfiable if there exists some interpretation that makes it true An interpretation satisfies a set of sentences if it makes them true

23 Entailment A |= B All interpretations that satisfy A also satisfy B

24 Propositional Logic Inference Question: Does KB entail S? Method 1: Truth Table Entailment Method 2: Proof –Proof by deduction, induction, contradiction, etc.

25 ABCA  B A  C B  C FFFFFF FFTFFF FTFFFF FTTFFT TFFFFF TFTFTF TTFTFF TTTTTT A,B, Entails A  B A^C, C does not entail B  C

26 Example Proof by Deduction Knowledge S1: B 22  ( P 21  P 23  P 12  P 32 )rule S2:  B 22 observation Inferences S3: (B 22  (P 21  P 23  P 12  P 32 ))  ((P 21  P 23  P 12  P 32 )  B 22 ) S1,bi elim S4: ((P 21  P 23  P 12  P 32 )  B 22 ) S3, and elim S5: (  B 22   ( P 21  P 23  P 12  P 32 )) S4,contrapos S6:  (P 21  P 23  P 12  P 32 ) S2,S5, MP S7:  P 21   P 23   P 12   P 32 S6, DeMorg

27 Proofs A derivation A sequence of applications of rules of inference Reasoning by search Successor function: all possible applications of inference rules Monotonicity means search can be local, and more efficient

28 Resolution Resolution allows a complete inference mechanism (search-based) using only one rule of inference

29 Resolution winter v summer ~winter v cold Either winter or ~winter is true, so we know that summer or cold is true Resolution rule: –Given: P 1  P 2  P 3 …  P n, and  P 1  Q 1 …  Q m –Conclude: P 2  P 3 …  P n  Q 1 …  Q m Complementary literals P 1 and  P 1 “cancel out”

30 Resolution in Wumpus World There is a pit at 2,1 or 2,3 or 1,2 or 3,2 –P 21  P 23  P 12  P 32 There is no pit at 2,1 –  P 21 Therefore (by resolution) the pit must be at 2,3 or 1,2 or 3,2 –P 23  P 12  P 32

31 Resolution Any complete search algorithm, applying only the resolution rule, can derive any conclusion entailed by any KB in propositional logic.

32 Proof using Resolution To try to prove P from KB: –Convert KB and P into CNF –To prove P, prove KB   P is contradictory (empty clause) –Specifically, apply resolution using a complete search algorithm until: No new clauses can be added, (KB does not entail P) The empty clause is derived (KB does entail P).

33 B 22  ( P 21  P 23  P 12  P 32 ) Conversion to CNF 1.Eliminate , replacing with two implications (B 22  ( P 21  P 23  P 12  P 32 ))  ((P 21  P 23  P 12  P 32 )  B 22 ) 2.Replace implication (A  B) by  A  B (  B 22  ( P 21  P 23  P 12  P 32 ))  (  (P 21  P 23  P 12  P 32 )  B 22 ) 3.Move  “inwards” (unnecessary parens removed) (  B 22  P 21  P 23  P 12  P 32 )  ( (  P 21   P 23   P 12   P 32 )  B 22 ) 4. Distributive Law (  B 22  P 21  P 23  P 12  P 32 )  (  P 21  B 22 )  (  P 23  B 22 )  (  P 12  B 22 )  (  P 32  B 22 )

34 Previous Slide: Sentence is in CNF Next step (with simpler example): (P1 v P2 v ~P3) ^ P4 ^ ~P5 ^ (P2 v P3) Create a separate clause corresponding to each conjunct –P1 v P2 v ~P3 –P4 –~P5 –P2 v P3

35 Finally… –Add the negation of the goal to the set of clauses, and perform resolution. If you reach the empty clause, you have proved the goal

36 Simple Resolution EG When the agent is in 1,1, there is no breeze, so there can be no pits in neighboring squares (B11  (P12 v P21)); ~B11 Prove: ~P12. [lecture] [What if P and ~P are both in the KB?]

37 Horn Clauses A Horn Clause is a CNF clause with at most one positive literal Horn Clauses form the basis of forward and backward chaining The Prolog language is based on Horn Clauses Deciding entailment with Horn Clauses is linear in the size of the knowledge base

38 Reasoning with Horn Clauses Forward Chaining –For each new piece of data, generate all new facts, until the desired fact is generated –Data-directed reasoning Backward Chaining –To prove the goal, find a clause that contains the goal as its head, and prove the body recursively –Goal-directed reasoning The state space is an AND-OR graph; see 7.5.4

Wrap-up You are responsible for everything in Chapter 7 through –Note: we didn’t cover or 7.6 in lecture We will return to topics in 7.7 when we cover planning 39