AI – Lecture No.4 Knowledge Representation: Symbolic Logic Search and KR Knowledge Base Set of sentences Three levels of a knowledge-based agent: knowledge level logical level implementation level KR languages Symbolic logic language A logic involves: a language with a syntax semantics inference rules Rule of inference – check you know the definition, we have already discussed about Proof Ex: = {P, P Q, T}, R Q T Logic – is a formal system Propositional logic Syntax: atoms, logical connectives, wffs Semantics Interpretation Satisfiability and models Properties of formulas: valid, satisfiable, inconsistent, equivalence Entailment logically entails or logically follows from or is a logical consequence of 1 Model theory Proof theory Sound and completeness Sound IR or set of IR Complete IR or set of IR PSAT, CNF PSAT NP-complete problem kSAT 2 important theorems The deduction theorem Reductio ad absurdum (refutation theorem) First-order logic Syntax: object constants, relational constants, function constants, variables, logical connectives, logical quantifiers over variables, term, literal, clause, wffs Equality symbol Semantics Interpretation, model Domain Conceptualisation Examples: All objects (in the universe) are red apples All apples are red There is a red apple All purple mushrooms are poisonous x (Purple(x) Mushroom(x)) Poisoneous(x) x Purple(x) (Mushroom(x) Poisoneous(x)) x Mushroom (x) (Purple (x) Poisoneous(x)) All packages in room 27 are smaller than any of the packages in room 28. Every package in the room 27 is smaller than one of the packages in room 28. Hold for FOPL: Properties of formulas, entailement, model theory, proof theory, soundness and completeness of IR, Deduction theorem 2 Inference rules in FOPL Modus Ponens (MP) Modus Tolens (MT) And elimination (AE) And Introduction (AI) Universal Instantiation (UI) Existential Instantiation (EI) Resolution Example: Harry and Ralph Situation Calculus Diachronic rules – rules that describe the way in which world changes or does not change Result: A x S S Result(action, situation) = new situation Effect axioms xys (OnTable(x,s) OnTable(y,s) Clear(x,s) Clear(y,s) x y) On(x,y, Result(Stack(x,y),s)) Frame axioms xys (On(x,y,s) Clear(x,s) Clear(x, Result(Unstack(x,y),s)) Frame problem Qualification problem Ramification problem Deducing hidden properties if the world Causal rules – infer effect from cause, reflect direction of causality in the world: some hidden property in the world causes certain percepts to be generated. l1l2s At(Wumpus,l1,s) Adjacent(l1,l2) Smelly(l2) l1l2s At(Pit,l1,s) Adjacent(l1,l2) Breezy(l2) Diagnostic rules - Infer cause from effect, infer the presence of hidden properties directly from perceipt-derived information l s At(Agent,l, s) Breeze(s) Breezy(l) l s At(Agent,l, s) Stench(s) Smelly(l) 3 4 Problem in NL Horses are faster than dogs and there is a greyhound that is faster than every rabbit. We know that Harry is a horse and that Ralph is a rabbit. Derive that Harry is faster than Ralph. Problem translated in FOPL x y Horse(x) Dog(y) Faster(x,y) y Greyhound(y) (z Rabbit(z) Faster(y,z)) Horse(Harry) Rabbit(Ralph) Added axioms to represent commonsense knowledge y Greyhound(y) Dog(y) x y z Faster(x,y) Faster(y,z) Faster(x,z) Theorem: Faster(Harry, Ralph) ? Theorem proving using Proof Theory and a set of inference rules 1. x y Horse(x) Dog(y) Faster(x,y) 2. y Greyhound(y) (z Rabbit(z) Faster(y,z)) 3. y Greyhound(y) Dog(y) 4. xyz Faster(x,y) Faster(y,z) Faster(x,z) 5. Horse(Harry) 6. Rabbit(Ralph) 7. Greyhound(Greg) (z Rabbit(z) Faster(Greg,z)) 2, EI 8. Greyhound(Greg) 7, AE 9. z Rabbit(z) Faster(Greg,z)) 7, AE 10. Rabbit(Ralph) Faster(Greg,Ralph) 9, UI 11. Faster(Greg,Ralph) 6,10, MP 12. Greyhound(Greg) Dog(Greg) 3, UI 13. Dog(Greg) 12, 8, MP 14. Horse(Harry) Dog(Greg) Faster(Harry, Greg) 1, UI 15. Horse(Harry) Dog(Greg) 5, 13, AI 16. Faster(Harry, Greg) 14, 15, MP 17. Faster(Harry, Greg) Faster(Greg, Ralph) Faster(Harry,Ralph) 4, UI 18. Faster(Harry, Greg) Faster(Greg, Ralph) 16, 11, AI 19. Faster(Harry,Ralph) 17, 19, MP QED 5 Ontological commitments – connected to the nature of reality Epistemological commitments – possible states of knowledge an agent can have using various types of knowledge Necessity and contingency Necessary knowledge (analytical) Contingency knowledge Level of knowledge Modal logic A modal is an expression (like ‘necessarily’ or ‘possibly’) that is used to qualify the truth of a judgement. Modal logic is, strictly speaking, the study of the deductive behavior of the expressions ‘it is necessary that’ and ‘it is possible that’. However, the term ‘modal logic’ may be used more broadly for a family of related systems. These include logics for belief, for tense and other temporal expressions, for the deontic (moral) expressions such as ‘it is obligatory that’ and ‘it is permitted that’, and many others. Narrowly construed, modal logic studies reasoning that involves the use of the expressions ‘necessarily’ and ‘possibly’. However, the term ‘modal logic’ is used more broadly to cover a family of logics with similar rules and a variety of different symbols. A list describing the best known of these logics follows. Modal Logics It is necessary that .. It is possible that .. p = p Deontic Logic O It is obligatory that .. P It is permitted that .. F It is forbidden that .. Temporal Logic G It will always be the case that .. F It will be the case that .. H It has always been the case that .. P It was the case that.. Doxastic Logic Bx x believes that .. 6 7