1/46 Logical Agents عاملهاي منطقي Chapter 7 (part 2) Modified by Vali Derhami.

Slides:



Advertisements
Similar presentations
Russell and Norvig Chapter 7
Advertisements

Inference Rules Universal Instantiation Existential Generalization
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 20
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
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.
1 CS 4700: Foundations of Artificial Intelligence Carla P. Gomes Module: Satisfiability (Reading R&N: Chapter 7)
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.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 3 Logic Representations (Part 2)
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.
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.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 11 Jim Martin.
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
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: Agents and Propositional Logic.
CS 416 Artificial Intelligence
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:

1/46 Logical Agents عاملهاي منطقي Chapter 7 (part 2) Modified by Vali Derhami

2/46 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 applications 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

3/46 Reasoning Patterns in Propositional Logic Inference rules: The patterns of inference: 1-Modus Ponens (قياس استثنايي) 2-And –Elimination تمامي هم ارزهاي منطقي در اسلايد 28از قسمت اول مي توانند بعنوان قاعده استنتاج بكار روند اثبات : دنباله اي از كاربردهاي قواعد اسنتاج يكنواختي: مجموعه جملات ايجاب شده فقط زماني مي تواند افزايش يابند كه اطلاعاتي به پايگاه دانش افزوده شود.

4/46 Resolution تحليل: تحليل: يك روش استنتاج ساده در صورت همراه شدن با هر الگوريتم جستجوي كامل، يك الگوريتم استنتاج كامل را ايجاد ميكند In Wumpus world, consider the agent returns from [2,1] to [1,1] and then goes to [1,2], where it perceives a stench, but no breeze. We add the following facts to the knowledge base:

5/46 تحليل (ادامه) we can now derive the absence of pits in [2,2] and [1,3],([1,1] is already known( : Respect to R11 and R12: Respect to R 10 (R10 :  P11), and R 16 : Known from past: Respect to R15 and Rr13:

6/46 تحليل (ادامه) Conjunctive Normal Form (CNF) (فرم نرمال عطفي) conjunction of disjunctions of literals (clauses) تركيب AND از ليترال كه با هم ORشده اند. Literal: a atomic sentence. Ex; P, Q, or,  A Clause: a disjunction of literals. E.g., (A   B)  (B   C   D) Unit resolution inference rule: Where l i and m are complementary literals

7/46 تحليل (ادامه) Full Resolution inference rule (for CNF): l 1  …  l k, m 1  …  m n l 1  …  l i-1  l i+1  …  l k  m 1  …  m j-1  m j+1 ...  m n where l i and m j are complementary literals. E.g., P 1,3  P 2,2,  P 2,2 P 1,3 Using any complete search, Resolution is sound and complete for propositional logic توجه، تحليل هميشه مي تواند براي اثبات ياتكذيب يك جمله استفاده شود

8/46 Conversion to CNF تبديل به فرم نرمال عطفي B 1,1  (P 1,2  P 2,1 ) 1.Eliminate , replacing α  β with (α  β)  (β  α). (B 1,1  (P 1,2  P 2,1 ))  ((P 1,2  P 2,1 )  B 1,1 ) 2. Eliminate , replacing α  β with  α  β. (  B 1,1  (P 1,2  P 2,1 ))  (  (P 1,2  P 2,1 )  B 1,1 ) 3. Move  inwards using de Morgan's rules and double- negation: (  B 1,1  P 1,2  P 2,1 )  ((  P 1,2   P 2,1 )  B 1,1 ) 4. Apply distributivity law (  over  ) and flatten: (  B 1,1  P 1,2  P 2,1 )  (  P 1,2  B 1,1 )  (  P 2,1  B 1,1 )

9/46 Resolution algorithm Proof by contradiction, i.e., to Prove KB  a, show KB  α unsatisfiable

10/46 Steps in Resolution algorithm (KB  a) is converted into CNF. The resolution rule is applied to the resulting clauses. Each pair that contains complementary literals is resolved to produce a new clause, which is added to the set if it is not already present. The process continues until one of two things happens: 1- two clauses resolve to yield the empty clause, in which case KB entails a. 2- there are no new clauses that can be added, in which case KB does not entail a.

11/46 Resolution example KB = (B 1,1  (P 1,2  P 2,1 ))  B 1,1,α =  P 1,2

12/46 Ground resolution theorem If a set of clauses is unsatisfiable, then the resolution closure of those clauses contains the empty clause. اثبات بعنوان تمرين

13/46 Forward and backward chaining Horn Form (restricted): فرم محدود شده اي از فرم نرمال عطفي است تركيب OR از ليترال ها كه حداكثر يكي از آنها مثبت است. مزاياي آن: 1- تبديل به فرم شرطي  P 1,1  B 1,1   P 1,2  (P 1,1   P 1,2 )  B 1,1 (P 1,1   P 1,2 )  B 1,1 KB = conjunction of Horn clauses –Horn clause = proposition symbol; or (conjunction of symbols)  symbol –E.g., C  (B  A)  (C  D  B) –بندهاي هورني كه دقيقا يك ليترال مثبت دارند را بند معين (Definite clause) مي نامند

14/46 Forward and backward chaining 2- اجازه استناج با استفاده از قياس استثنايي: Modus Ponens (for Horn Form): complete for Horn KBs α 1, …,α n,α 1  …  α n  β β Can be used with forward chaining or backward chaining. 3- زمان تصميم گيري در مورد ايجاب در بندهاي هورن مي تواند بر حسب اندازه پايگاه دانش بصورت خطي باشد: These algorithms are very natural and run in linear time

15/46 Forward and backward chaining A Horn clause with no positive literals can be written as an implication whose conclusion is the literal False. Ex: —wumpus cannot be in both [1,1] and [1,2]—is equivalent to. Such sentences are called integrity (کامل ( constraints in the database world,

16/46 Forward chaining Idea: fire any rule whose premises are satisfied in the KB, –add its conclusion to the KB, until query is found

17/46 Forward chaining algorithm Forward chaining is sound and complete for Horn KB

18/46 Forward chaining example

19/46 Forward chaining example

20/46 Forward chaining example

21/46 Forward chaining example

22/46 Forward chaining example

23/46 Forward chaining example

24/46 Forward chaining example

25/46 Forward chaining example

26/46 Proof of completeness FC derives every atomic sentence that is entailed by KB 1.FC reaches a fixed point where no new atomic sentences are derived 2.Consider the final state as a model m, assigning true/false to symbols 3.Every clause in the original KB is true in m a 1  …  a k  b 4.Hence m is a model of KB 5.If KB╞ q, q is true in every model of KB, including m

27/46 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

28/46 Backward chaining example

29/46 Backward chaining example

30/46 Backward chaining example

31/46 Backward chaining example

32/46 Backward chaining example

33/46 Backward chaining example

34/46 Backward chaining example

35/46 Backward chaining example

36/46 Backward chaining example

37/46 Backward chaining example

38/46 Forward vs. backward chaining FC is data-driven, automatic, unconscious processing (پروسس بي هدف), appropritate for Design, Control. –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, Diagnosis, –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

39/46 Efficient propositional inference Two families of efficient algorithms for propositional inference on Model checking:  Complete backtracking search algorithms –DPLL algorithm (Davis, Putnam, Logemann, Loveland)  Incomplete local search algorithms –WalkSAT algorithm

40/46 The DPLL algorithm Determine if an input propositional logic sentence (in CNF) is satisfiable. استفاده از روش عمق اول براي يافتن مدل. Improvements over truth table enumeration: 1.Early termination A clause is true if any literal is true. A sentence is false if any clause is false. 2.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. Make a pure symbol literal true. آگر جمله مدلي داشته باشد لذا مقدار سمبل هاي خالص مي تواند به گونه اي مقدار دهی شودند كه بند مربوطه اشان را صحيح كند. 3.Unit clause heuristic Unit clause: only one literal in the clause The only literal in a unit clause must be true. در واقع مقدار دهی تمام بندهای واحد قبل از انشعاب درخت

41/46 The DPLL algorithm

42/46 The WalkSAT algorithm Incomplete, local search algorithm هدف يافتن انتسابي است كه تمام بندها را ارضا كند.تابع ارزيابي كه تعداد بندهاي ارضا نشده را بشمارد از عهده اين كار بر مي آيد. On every iteration, the algorithm picks an unsatisfied clause and picks a symbol in the clause to flip. It chooses randomly between two ways to pick which symbol to flip: A) a "min-conflicts" step that minimizes the number of unsatisfied clauses in the new state, and B) a random walk" step that picks the symbol randomly. Evaluation function: The min-conflict heuristic of minimizing the number of unsatisfied clauses Balance between greediness and randomness

43/46 The WalkSAT algorithm

44/46 Hard satisfiability problems Consider random 3-CNF sentences. e.g., (  D   B  C)  (B   A   C)  (  C   B  E)  (E   D  B)  (B  E   C) m = number of clauses n = number of symbols –Hard problems seem to cluster near m/n = 4.3 (critical point)

45/46 Hard satisfiability problems

46/46 Hard satisfiability problems Median runtime for 100 satisfiable random 3- CNF sentences, n = 50

47/46 تکالیف : 5، 8 (الف- تا د) و 9 و سوالات تست