1 Declarative Programming Motivation Warm Fuzzies What is Logic?... Logic Programming? Mechanics of Prolog Terms, Substitution, Unification, Horn Clauses,

Slides:



Advertisements
Similar presentations
4-6 Arithmetic Sequences Warm Up Lesson Presentation Lesson Quiz
Advertisements

Applications Computational LogicLecture 11 Michael Genesereth Spring 2004.
1 Knowledge Representation Introduction KR and Logic.
1 Knowledge and reasoning – second part Knowledge representation Logic and representation Propositional (Boolean) logic Normal forms Inference in propositional.
Constraint Satisfaction Problems
Inference in First-Order Logic
Implications Adriano Joaquim de O Cruz ©2002 NCE/UFRJ
Chapter 1 The Study of Body Function Image PowerPoint
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Properties of Real Numbers CommutativeAssociativeDistributive Identity + × Inverse + ×
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Addition Facts
CS4026 Formal Models of Computation Part II The Logic Model Lecture 1 – Programming in Logic.
Dr. Alexandra I. Cristea CS 319: Theory of Databases: C3.
Reductions Complexity ©D.Moshkovitz.
Solve Multi-step Equations
Artificial Intelligence
ABC Technology Project
Chapter 9 -- Simplification of Sequential Circuits.
3 Logic The Study of What’s True or False or Somewhere in Between.
Digital Logic Design Gate-Level Minimization
1 Undirected Breadth First Search F A BCG DE H 2 F A BCG DE H Queue: A get Undiscovered Fringe Finished Active 0 distance from A visit(A)
VOORBLAD.
Direct-Current Circuits
Quadratic Inequalities
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
1 Logic Programming Technical Foundation Second part of Cmput325 Fall 2004 R Greiner + B Price.
Russell and Norvig Chapter 7
© 2012 National Heart Foundation of Australia. Slide 2.
1 Knowledge Based Systems (CM0377) Lecture 11 (Last modified 26th March 2001)
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
25 seconds left…...
Januar MDMDFSSMDMDFSSS
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
PSSA Preparation.
Inference Rules Universal Instantiation Existential Generalization
1 Decidability continued…. 2 Theorem: For a recursively enumerable language it is undecidable to determine whether is finite Proof: We will reduce the.
1 Programming Languages (CS 550) Mini Language Interpreter Jeremy R. Johnson.
SAT Solver CS 680 Formal Methods Jeremy Johnson. 2 Disjunctive Normal Form  A Boolean expression is a Boolean function  Any Boolean function can be.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
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.
Propositional Logic Russell and Norvig: Chapter 6 Chapter 7, Sections 7.1—7.4 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2003/home.htm.
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Knowledge Representation I (Propositional Logic) CSE 473.
Methods of Proof Chapter 7, second half.
Knoweldge Representation & Reasoning
Rutgers CS440, Fall 2003 Propositional Logic Reading: Ch. 7, AIMA 2 nd Ed. (skip )
Logical Inference 2 rule based reasoning
Pattern-directed inference systems
Logical Agents Logic Propositional Logic Summary
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
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.:
CS6133 Software Specification and Verification
© Copyright 2008 STI INNSBRUCK Intelligent Systems 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.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
EA C461 Artificial Intelligence
Presentation transcript:

1 Declarative Programming Motivation Warm Fuzzies What is Logic?... Logic Programming? Mechanics of Prolog Terms, Substitution, Unification, Horn Clauses, Proof process Example: List Processing Theoretical Foundations Semantics Logic / Theorem Proving … Resolution Other Issues Search Strategies Declarative/Procedural,... “Impure'' Operators” --- NOT, ! Utilities ? Constraint Programming ? Bayesian Belief Nets

2 Entailment Spse we assert  1,  2, … on(a,b), on(a,b) ⇒ above(a,b), … Then... you should believe  1,  2, … What else should we believe? (Should we believe some β – eg, “ above(a,b) ”?) Entailment addresses this: You should believe all (and only) entailments. Later: Present ALGORITHM for computing these entailments a b c

3 Interpretation Vocabulary: (literals) on ab : if a is immediately on b on bc : if b is immediately on c above ab : a is (somewhere) above b above ac : a is (somewhere) above c An “interpretation” (aka “world”) assigns True xor False to each literal n literals ⇒ 2 n possible worlds, I b a c on ab on ac above a b above a c I1I … I2I … I3I … I4I … I5I … I6I … I7I … I8I … I9I … I … I … I … I … I … I … I …  

4 Models Write  Ii  if  is True (+) in world I i So  I1 on b c ⊭ I6 on ac on ab on ac above a b above a c I1I … I2I … I3I … I4I … I5I … I6I … I7I … I8I … I9I … I … I … I … I … I … I … I …   Let I (  ) = { I ∣⊨ I  }

5 Models Write  Ii  if  is True (+) in world I i So  I1 on b c ⊭ I6 on bc on ab on ac above a b above a c I1I … I2I … I3I … I4I … I5I … I6I … I7I … I8I … I9I … I … I … I … I … I … I … I …   Let I (  ) = { I ∣⊨ I  } I (on ab )

6 Models Before seeing anything, REAL-WORLD  I = {I 1,…,I 16 } on ab on ac above a b above a c I1I … I2I … I3I … I4I … I5I … I6I … I7I … I8I … I9I … I … I … I … I … I … I … I …  

7 Models Before seeing anything, REAL-WORLD  I = {I 1,…,I 16 } Asserting  means REAL-WORLD  I (  ) Eg: Asserting on ab means REAL-WORLD ∈ I (on ab ) = {I 1,…,I 8 } Each assertion ELIMINATES some possible worlds on ab on ac above a b above a c I1I … I2I … I3I … I4I … I5I … I6I … I7I … I8I … I9I9I9I … I … I … I … I … I … I … I …  

8 I (on ab ) on ab on ac above a b above a c I1I … I2I … I3I … I4I … I5I … I6I … I7I … I8I … I9I … I … I … I … I … I … I … I …  

9 on ab on ac above a b above a c I1I … I2I … I3I … I4I … I5I … I6I … I7I … I8I … I9I … I … I … I … I … I … I … I …   I (¬on ab )

10 on ab on ac above a b above a c I1I … I2I … I3I … I4I … I5I … I6I … I7I … I8I … I9I … I … I … I … I … I … I … I …   I (on ac ) I (on ab )

11 on ab on bc above a b above a c I1I … I2I … I3I … I4I … I5I … I6I … I7I … I8I … I9I … I … I … I … I … I … I … I …   I (on ac & on ab )

12 on ab on bc above a b above a c I1I … I2I … I3I … I4I … I5I … I6I … I7I … I8I … I9I … I … I … I … I … I … I … I …   I (¬on ac v above ab )

13 Boolean Combinations I (χ) = {I ∣⊨ I χ} I ( on ab ) = {I1,…,I8} I (¬ on ab ) = {I9,…,I16} I ( on ab ⋀ on ac ) = {I1,…,I8} ∩ {I1,…,I4,I9,…,I12} = {I1,…,I4} I (¬ on ab ⋁ above ab ) = {I9,…,I16} ∪ {I1,I2,I5,I6,I9,I10,I13,I14} = {I1,I2,I5,I6,I9,…,I16} Note: I ( ¬  ) = I – I (  ) I (  ⋁ ξ) = I (  ) ∪ I (ξ) I (  ⋀ ξ) = I (  ) ∩ I (ξ) on ab on bc above a b above a c I1I … I2I … I3I … I4I … I5I … I6I … I7I … I8I … I9I … I … I … I … I … I … I … I …  

14 What else to believe? Assert ¬ on ab ⋁ above ab ⇒ REAL-WORLD  I (¬ on ab ⋁ above ab ) = {I 1, I 2, I 5, I 6, I 9, …, I 16 } on ab on bc above a b above a c I1I … I2I … I3I … I4I … I5I … I6I … I7I … I8I … I9I … I … I … I … I … I … I … I …   Assert on ab REAL-WORLD  I (¬ on ab ⋁ above ab ) ⋂ I ( on ab ) = {I 1, I 2, I 5,I 6 }

15 What else to believe? on ab on bc above a b above a c I1I … I2I … I3I … I4I … I5I … I6I … I7I … I8I … I9I … I … I … I … I … I … I … I …   REAL-WORLD  I (¬ on ab ⋁ above ab ) ⋂ I ( on ab ) = {I 1, I 2, I 5,I 6 } In each such world, above ab also holds! I ( [¬ on ab ⋁ above ab ] & on ab )  I ( above ab ) ⇒ We should believe above ab !

16 Entailment Given set of assertions  = {  1, … } set of (remaining) possible worlds = I (  ) Spse  holds in each world I  I (  ) I (  )  I (  ) Then you should believe  … as  is true, in every “still possible” world ! Write this    “  entails  ” “  is entailed by  ”

17 Answering Queries 1. Semantical Approach Entailment specifies what we should believe. Given n literals, write n  2 n table. Let W = all 2 n rows For each assertion  i let W := W ⋂ I (  i ) (ie, eliminate every row that does not satisfy  i ) Check  column. If ``+'' in each row (of W) then Answer “YES: {  i }   '' else Answer “IDK: {  i } ⊭  '' Problem: HUGE table! (  in predicate calculus) To decide {  i }  

18 Answering Queries 2. Syntactic Approach Proof Process (aka ``derivation'', ``deduction'') is mechanic process... for deciding whether conclusion follows from premises First consider “forward chaining”: KB ↝ KB' Implemented by... Apply sequence of individual (sound) Inference Rules to initial set of premises, to find new ones Sound  preserves truth If believe ``antecedent'', must believe conclusion Inference Rules  HornClause

19 Derivation Process man(s) man(X)  mortal(X) KB 0 r1r1 man(s) man(X)  mortal(X) mortal(s) KB 1 r2r2 man(s) man(X)  mortal(X) mortal(s) cat(p) KB 2 r3r3 … r9r9 man(s) man(X)  mortal(X) mortal(s) cat(p) KB k

20 New Facts from Old: A sound Inference rule If “P  Q” “P”  KB Thencan add“Q”to KB Called “Modus Ponens” Written: [MP] P  Q P Q

21 Sound Inference Rules [MP] P  Q P Q [  D]P  Q ¬P Q [  E]  x.  (x)  (A) for any A [MT] P  Q ¬Q ¬P [&I]P Q P  Q [&E] P  Q P [RC] P  Q Q  R P  R [  I] P P  Q [MG] P  Q ¬P  Q Q [ ]P ¬ P Contradiction

22 Sound Rules of Inference KB 0 ir j KB 1 If ir j is sound [aka Truth-Preserving], then KB 0 ⊨ KB 1 … I (KB 0 )  I (KB 1 ) So… RW ∊ KB 0  RW ∊ KB 1 … if believe KB 0, must believe KB 1 ! Inference rule ir j maps KB 0 into KB 1

23 I (KB 1 ) Sound Rules of Inference Possible worlds I (KB 0 ) If ir j is sound [aka Truth-Preserving], then KB 0 ⊨ KB 1 … I (KB 0 )  I (KB 1 ) So… RW ∊ KB 0  RW ∊ KB 1 Hence: If believe KB 0, must believe KB 1. RW

24 Sound Rules of Inference – con’t Possible worlds I (KB 0 ) I (KB 1 ) In general, KB 1 = KB 0 + . So KB 1 ⊨ KB 0 … KB 1, KB 0 hold in EXACTLY same worlds: If each ri j is sound, then sequence  ri 1 … ri n  is sound.

25 Answering Queries If { ri j } j sound, then KB 0 ⊧ KB N Adding Truths (Forward Chaining) Given KB 0 produce KB N s.t. ri 1 KB 0 KB 1 KB N… ri N Answering Questions (Backward Chaining) Given KB 0,  ; determine if KB ⊧  Requires sound j s.t. ri 1 KB 0 KB 1 KB N… ri N and  KB N

26 Q: How to reason? Given KB, q, determine if KB ⊨ q ? A: Select Inference Rule IR Select Facts(s) {F i } from KB Apply rule IR to Facts {F i } to get new Fact  Add  to KB Repeat until find  = q Issues: 1. Lots of Inference Rules… Which one to use, when? 2. Is overall system “complete”? If  answer, guaranteed to find it? How to Reason?

27 ? Properties of Derivation Process ⊢  is SOUND  ⊢     ⊨  Produces only “true” results ⊢  is COMPLETE  ⊢     ⊨  Produces all “true” results ⊢  is DECIDABLE  ⊢  ?  returns Y or N in finite time

28 Degenerate ⊦  For any ,  ⊂ WFFs:  ⊬ N   ⊢ P  Notice ⊢ N is SOUND (returns everything logically entailed) ⊢ P is COMPLETE (returns everything logically entailed) ⊢ N, ⊢ P is DECIDABLE (answer every question) f’sure Just say “No”

29 For any sufficiently complicated domain as complex as arithmetic No ⊢  can be SOUND, COMPLETE, DECIDABLE!! Reduction to halting Problem. Fundamental Limitation Not Predicate Calculus’s fault: Reasoning is inherently undecidable, no manner what formalism used

30 Deals only with WORST -case! “Typical” case can be better. TradeOffs (to increase efficiency): ? Sacrifice SOUND ness? No – too severe. ? Sacrifice COMPLETE ness? Reasonable... Specific proposals: - Use only (incomplete set of) Inference Rules - Use complete set of Inference Rules, but limit depth (…stop expanding nodes…) ? Sacrifice EXPRESSIVE ness? [ EXPRESSIVE ness  what can be distinguished.] Common approach! (After all, Logic’s distinctions caused problems!) Disallow “ Ⅴ ” “¬” “  ” … Responses

31 o DataBase Systems ≈Sound, Complete, Limited Expressiveness Prolog ≈Sound, complete, Limited Expressiveness o General Theorem Provers ≈Sound, Complete, Complete Expressiveness o Production System (Emycin, OPS) ≈Sound, ≈ Complete, Limited Expressiveness o Frame systems ?Sound?, ?Complete?, Limited Expressiveness o Description Languages Sound, Complete, Limited Expressiveness o Truth Maintenance Implemented Systems