1 / 84

Computer Science CPSC 502 Lecture 6 Finish Planning Start Logic ( Ch 5)

Computer Science CPSC 502 Lecture 6 Finish Planning Start Logic ( Ch 5). Lecture Overview. Finish Planning Logics Propositional, Definite Clause Logic: Syntax and Semantics Two different proof Procedures Reasoning with individuals and relations. Where Are We?. Representation.

libby
Download Presentation

Computer Science CPSC 502 Lecture 6 Finish Planning Start Logic ( Ch 5)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Science CPSC 502 Lecture 6 Finish Planning Start Logic(Ch 5)

  2. Lecture Overview • Finish Planning • Logics • Propositional, Definite Clause Logic: • Syntax and Semantics • Two different proof Procedures • Reasoning with individuals and relations

  3. Where Are We? Representation Reasoning Technique Stochastic Deterministic • Environment Problem Type Arc Consistency Constraint Satisfaction Vars + Constraints Search Static Belief Nets Logics Variable Elimination Query Search Decision Nets Sequential STRIPS Variable Elimination Planning Search First Part of the Course Markov Processes Value Iteration

  4. Where Are We? Representation Reasoning Technique Stochastic Deterministic • Environment Problem Type Arc Consistency Constraint Satisfaction Vars + Constraints Search Static Belief Nets Logics Variable Elimination Query Search Decision Nets Sequential STRIPS Variable Elimination Planning Search Back to static problems, but with richer representation Markov Processes Value Iteration

  5. Logics in AI: Similar slide to the one for planning Propositional Definite Clause Logics Semantics and Proof Theory Satisfiability Testing (SAT) Propositional Logics First-Order Logics Hardware Verification Description Logics Production Systems Software Verification Product Configuration Ontologies Cognitive Architectures Semantic Web Video Games Applications Summarization Tutoring Systems Information Extraction

  6. Logics in AI: Similar slide to the one for planning Propositional Definite Clause Logics Semantics and Proof Theory Satisfiability Testing (SAT) Propositional Logics First-Order Logics Hardware Verification Description Logics Production Systems Software Verification Product Configuration Ontologies Cognitive Architectures You will know You will know a little Semantic Web Video Games Applications Summarization Tutoring Systems Information Extraction

  7. What you already know about logic... • From programming: Some logical operators • If ((amount > 0) && (amount < 1000)) || !(age < 30) • ... You know what they mean in a “procedural” way Logic is the language of Mathematics. To define formal structures (e.g., sets, graphs) and to prove statements about those We use logic as aRepresentation and Reasoning System that can be used to formalize a domain and to reason about it

  8. Logic: a framework for representation & reasoning • When we represent a domain about which we have only partial (but certain) information, we need to represent…. • Objects, properties, sets, groups, actions, events, time, space, … • All these can be represented as • Objects • Relationships between objects • Logic is the language to express knowledge about the world this way • http://en.wikipedia.org/wiki/John_McCarthy (1927 - 2011) Logic and AI “The Advice Taker” Coined “Artificial Intelligence”. Dartmouth W’shop (1956)

  9. Why Logics? • “Natural”to express knowledge about the world • (more natural than a “flat” set of variables & constraints) • e.g. “Every 101 student will pass the course” Course (c1) Name-of (c1, 101) • It is easy to incrementally add knowledge • It is easy to check and debug knowledge • Provides language for asking complex queries • Well understood formal properties

  10. Logic: A general framework for reasoning • live_w4? • lit_l2? • General problem: Query answering • tell the computer how the world works • tell the computer some facts about the world • ask a yes/no question about whether other facts must be true • Solving it with Logic • Begin with a task domain. • Distinguish those things you want to talk about (the ontology) • Choose symbols in the computer to denote elements of your ontology • Tell the system knowledge about the domain • Ask the system whether new statements about the domain are true or false

  11. /down / up Sintax: are these sentences that a reasoning procedure can process? Sematic: what do these statements say about the world I need to represent?

  12. To Define a Logic We Need • Syntax: specifies the symbols used, and how they can be combined to form legal sentences • Knowledge base is a set of sentences in the language • Semantics: specifies the meaning of symbols and sentences • Reasoning theory or proof procedure: a specification of how an answer can be produced. • Sound: only generates correct answers with respect to the semantics • Complete: Guaranteed to find an answer if it exists

  13. Propositional Definite Clauses • We will start with a simple logic • Primitive elements are propositions: Boolean variables that can be {true, false} • Two kinds of statements: • that a proposition is true • that a proposition is true if one or more other propositions are true • Why only propositions? • We can exploit the Boolean nature for efficient reasoning • Starting point for more complex logics • We need to specify: syntax, semantics, proof procedure

  14. Propositional Definite Clauses: Syntax Definition (atom) An atomis a symbol starting with a lower case letter Examples: p1; live_l1 Definition (body) A bodyis an atom or is of the form b1∧b2 where b1and b2 are bodies. Examples: p1 ∧p2; ok_w1 ∧ live_w0 Definition (definite clause) A definite clause is - an atom or - a rule of the form h←bwhere h is an atom (“head”) and b is a body. (Read this as “h if b”.) Examples: p1 ←p2; live_w0 ← live_w1 ∧ up_s2 Definition (KB) A knowledge base (KB) is a set of definite clauses

  15. atoms definiteclauses, KB Do any of these statements mean anything? Syntax doesn't answer this question! rules

  16. PDC Syntax: more examples • Definition (definite clause) • A definite clause is • an atom or • a rule of the form h←b where h is an atom (‘head’) and b is a body. (Read this as ‘h if b.’) • ai_is_fun • ai_is_fun∨ ai_is_boring • ai_is_fun←learn_useful_techniques • ai_is_fun←learn_useful_techniques∧notTooMuch_work • ai_is_fun←learn_useful_techniques∧ TooMuch_work • ai_is_fun← f(time_spent, material_learned) • srtsyj← errt ∧ gffdgdgd Which of the following are legal PDC clause?

  17. PDC Syntax: more examples • Definition (definite clause) • A definite clause is • an atom or • a rule of the form h←b where h is an atom (‘head’) and b is a body. (Read this as ‘h if b.’) • ai_is_fun YES • ai_is_fun∨ ai_is_boring NO • ai_is_fun←learn_useful_techniques YES • ai_is_fun←learn_useful_techniques∧notTooMuch_work YES • ai_is_fun←learn_useful_techniques∧ TooMuch_work NO • ai_is_fun← f(time_spent, material_learned) NO • srtsyj← errt ∧ gffdgdgd NO Which of the following are legal PDC clause?

  18. Propositional Definite Clauses: Semantics Definition (interpretation) An interpretation I assigns a truth value to each atom. • Semantics allows you to relate the symbols in the logic to the domain you're trying to model. • If our domain has 5 atoms, how many interpretations are there? • ……. values for each atom, so ……. combinations • Similar to possible worlds in CSPs

  19. Propositional Definite Clauses: Semantics Definition (interpretation) An interpretation I assigns a truth value to each atom. • Definition (truth values of statements) • A body b1∧ b2is true in I if and only if b1 is true in I and b2 is true in I. • A rule h ← b is false in I if and only if b is true in I and h is false in I. Semantics allows you to relate the symbols in the logic to the domain you're trying to model. We can use the interpretation to determine the truth value of clauses

  20. PDC Semantics: Example Truth values under different interpretations F=false, T=true

  21. PDC Semantics: Example h←b is only false if b is true and h is false Truth values under different interpretations F=false, T=true

  22. PDC Semantics: Example for truth values h←a1∧a2 Body of the clause: a1∧a2 Body is only true if both a1and a2 are true in I Truth values under different interpretations F=false, T=true

  23. Propositional Definite Clauses: Semantics Definition (interpretation) An interpretation I assigns a truth value to each atom. • Definition (truth values of statements) • A body b1∧ b2is true in I if and only if b1 is true in I and b2 is true in I. • A rule h ← b is false in I if and only if b is true in I and h is false in I. • A knowledge base KB is true in I if and only if every clause in KB is true in I. Semantics allows you to relate the symbols in the logic to the domain you're trying to model. We can use the interpretation to determine the truth value of clauses

  24. Propositional Definite Clauses: Semantics Definition (interpretation) An interpretation I assigns a truth value to each atom. • Definition (truth values of statements) • A body b1∧ b2is true in I if and only if b1 is true in I and b2 is true in I. • A rule h ← b is false in I if and only if b is true in I and h is false in I. • A knowledge base KB is true in I if and only if every clause in KB is true in I. Definition (model) A model of a knowledge base KB is an interpretation in which KB is true. Similar to CSPs: a model of a set of clauses is an interpretation that makes all of the clauses true

  25. PDC Semantics: Knowledge Base (KB) • A knowledge base KB is true in I if and only if every clause in KB is true in I. KB3 KB1 KB2 • p • r • s ← q ∧ p • p • q • s ← q • p • q ← r ∧ s • Which of the three KB above are True in I1

  26. PDC Semantics: Example for models Definition (model) A model of a knowledge base KB is an interpretation in which every clause in KB is true. Which of the interpretations below are models of KB? p ← q KB = q r ← s

  27. OK but…. • …. Who cares?Where are we going with this? • Remember what we want to do with Logic • Tell the system knowledge about a task domain. • This is your KB • which expresses true statements about the world • Ask the system whether new statements about the domain are true or false. • We want the system responses to be • Sound: only generates correct answers with respect to the semantics • Complete: Guaranteed to find an answer if it exists

  28. For Instance… • Tell the system knowledge about a task domain. • Ask the system whether new statements about the domain are true or false • p? • r? • s?

  29. Or, More Interestingly • Tell the system knowledge about a task domain. • Ask the system whether new statements about the domain are true or false • live_w4? • lit_l2?

  30. To Obtain This We Need One More Definition Definition (logical consequence) If KB is a set of clauses and G is a conjunction of atoms, G is a logical consequence of KB, written KB ⊧G, if G is true in every model of KB. • we also say that G logically follows from KB, or that KB • entailsG. • In other words, KB ⊧G if there is no interpretation in which • KB is true and G is false. • when KB is TRUE, then G must be TRUE • We want a reasoning procedure that can find all and only the • logical consequences of a knowledge base

  31. Example: Logical Consequences • Which of the following is true? • KB ⊧ q, • KB ⊧ p, • KB ⊧ s, • KB ⊧ r

  32. Proof Procedure • We want a reasoning procedure (proof procedure) that can find all and only the logical consequences of a knowledge base • Why?

  33. User’s View of Semantics • Choose a task domain: intended interpretation. • Associate an atom with each proposition you want to represent. • Tell the system clauses that are true in the intended interpretation: axiomatizing the domain. • Ask questions about the intended interpretation. • If KB ⊧ g, • then g must be true in all models, so it is true in the intended interpretation (which is a model). • The user can interpret the answer using their intended interpretation of the symbols.

  34. Computer’s view of semantics • The computer doesn’t have access to the intended interpretation. • All it knows is the knowledge base. • The computer can determine if a formula is a logical consequence of KB. • If KB ⊧ g then g must be true in the intended interpretation. • Otherwise, there is a model of KB in which g is false. This could be the intended interpretation. The computer wouldn't know!

  35. Proof Procedures • If I tell you I have a proof procedure for PDCL • What do I need to show you in order for you to trust my procedure? That is sound and complete • A proof procedure is a mechanically derivable demonstration that a formula logically follows from a knowledge base. • Given a proof procedure P, KB ⊦P g means g can be derived from knowledge base KB with the proof procedure.

  36. Soundness and Completeness Definition (soundness) A proof procedure P is sound if KB ⊦P g implies KB ⊧ g. • sound: every atom derived by P follows logically from KB (i.e. is true in every model) • Soundness of proof procedure P: need to prove that If g can be derived by the procedure (KB ⊦Pg)then g is true in all models of KB (KB ⊧ g) Definition (completeness) A proof procedure P is complete if KB ⊧ g implies KB ⊦P g. • complete: every atom that logically follows from KB is derived by P If g is true in all models of KB (KB ⊧ g)then g is derived by the procedure (KB ⊦Pg) • Completeness of proof procedure P: need to prove that

  37. Simple Proof Procedure Simple proof procedure S • Enumerate all interpretations • For each interpretation I, check whether it is a model of KB • i.e., check whether all clauses in KB are true in I • KB ⊦S g if g holds in all such models problem with this approach? • If there are n propositions in the KB, must check all the interpretations! • Goal of proof theory • find sound and complete proof procedures that allow us to prove that a logical formula follows from a KB avoiding to do the above

  38. Lecture Overview • Finish Planning • Logics • Propositional, Definite Clause Logic: • Syntax and Semantics • Two different proof Procedures • Reasoning with individuals and relations

  39. Bottom-up proof procedure • One rule of derivation, a generalized form of modus ponens: • If “h← b1 …  bm" is a clause in the knowledge base, and each bi has been derived, then h can be derived. • This rule also covers the case when m = 0.

  40. Bottom-up proof procedure • C :={}; • repeat • select clause “h ← b1∧ … ∧bm” in KB such that bi∈C for all i, and h ∉C; • C := C ∪{ h } • until no more clauses can be selected. KB⊦ G if G⊆C at the end of this procedure

  41. Bottom-up proof procedure: example {} a← b  c a← e  f b← f  k c← e d←k e. f← j  e f← c j← c C := {}; repeat select clause h← b1…  bm in KB such that bi C for all i, and h  C; C := C  {h} until no more clauses can be selected.

  42. Bottom-up proof procedure: example {} {e} {c,e} {c,e,f} {c,e,f,j} {a,c,e,f,j} Done. a← b  c a← e  f b← f  k c← e d←k e. f← j  e f← c j← c C := {}; repeat select clause h← b1…  bmin KB such that bi C for all i, and h  C; C := C  {h} until no more clauses can be selected.

  43. Lecture Overview • Recap Lecture 24 • Bottom-Up Proof Procedure • Soundness • Completeness • Top-Down Proof Procedure (time permitting)

  44. Soundness of bottom-up proof procedure BU Definition (soundness) A proof procedure P is sound if KB ⊦P g implies KB ⊧ g. • sound: every atom g that P derives follows logically from KB C := {}; Repeat select clause h← b1…  bmin KB such that bi C for all i, and h  C; C := C  {h} until no more clauses can be selected. What do we need to prove to show that BU is sound ?

  45. Soundness of bottom-up proof procedure BU Definition (soundness) A proof procedure P is sound if KB ⊦P g implies KB ⊧ g. • sound: every atom g that P derives follows logically from KB C := {}; repeat select clause h← b1…  bmin KB such that bi C for all i, and h  C; C := C  {h} until no more clauses can be selected. If g  C at the end of BU procedure, then g is true in all models of KB (KB ⊧ g) What do we need to prove to show that BU is sound ?

  46. Soundness of bottom-up proof procedure BU What do we need to prove to show that BU is sound ? If g  C at the end of BU procedure, then g is true in all models of KB (KB ⊧ g) • Let h be the first atom added to C that is not true in every model of KB. • In particular, suppose I is a model of KB in which h isn’t true • There must be a clause in KB of form • h b1...  bn • where each biis true in I. • Because h is false in I, this clause is false in I. • Therefore I is not a model of KB=> Contradiction By contradiction: Suppose there is a g such that KB ⊦ g but not KB ⊧ g.

  47. Completeness of BU: general idea • We define a specific model of our KB, in which • every atom in C at the end of BU is true • every other atom is false • This is called minimal model • Using this model, we’ll then show that, if KB ⊧ G, • then G must be in C, that is If g is true in all models of KB (KB ⊧ g)then g  C at the end of BU procedure (KB ⊦BUg)

  48. Minimal Model C := {}; repeat select clause h← b1…  bmin KB such that bi C for all i, and h  C; C := C  {h} until no more clauses can be selected. • Definition (minimal model) • The minimal modelMM is the interpretation in which – • every element of BU’s fixed point C is true • every other atom is false. The C at the end of BU procedure is a fixed point: • Further applications of our rule of derivation will not change C!

  49. Minimal model MM is a model of KB • Definition (minimal model) • The minimal modelMM is the interpretation in which • every element of BU’s fixed point C is true • every other atom is false. Proof by contradiction. Assume that MM is not a model of KB. • Then there must exist some clause in KB which is false in MM • Like every clause in KB, it is of the form h← b1…  bm (with m  0). • h← b1…  bm can only be false in MM if each bi is true in MM and h is false in MM. • Since each bi is true in MM, each bi must be in C as well. • BU would add h to C, so h would be true in MM • Contradiction! Thus, MM is a model of KB

  50. Completeness of bottom-up procedure If g is true in all models of KB (KB ⊧ g)then g  C at the end of BU procedure (KB ⊦BUg) Direct proof based on minimal model: • Suppose KB ⊧ g. Then g is true in all models of KB. • Thus g is true in the minimal model. • Thus g  C at the end of BU procedure. • Thus KB ⊦BU g. Done. KB ⊧ g implies KB ⊦BU g

More Related