Knowledge based Agents Shobhanjana Kalita Dept. of Computer Science & Engineering Tezpur University Slides prepared from Artificial Intelligence A Modern approach by Russell & Norvig
Knowledge Based Agents Agents that can form representations of the would, use a process of inference to derive new representations about the world, and use these new representations to deduce what to do Knowledge representation and reasoning In partially observable environments, a knowledge-based agent In partially observable environments, a knowledge-based agent can combine general knowledge with current percepts to infer hidden aspects of the current state prior to selecting actions E.g. A doctor using knowledge and experience to infer disease, understanding natural language, etc Problem-solving agents use knowledge that is very specific and inflexible
Knowledge Based Models Data, Information, Knowledge Data: Unprocessed facts Information: Interpreted data so that it has some meaning Knowledge: Combination of various information using logical reason/inference Symbol-system hypothesis: Knowledge can be captured as symbol-structures and intelligent behavior can be achieved through manipulation (reasoning/inference) of such symbolstructures Red: represents the colour red my_car: represents my car Red(my_car): represents the colour of my car is red
Knowledge Based Models Inference is the process of deriving new knowledge from existing knowledge The set of existing knowledge is called the knowledge-base (KB) of the agent. Set of sentences A sentence represents some assertion/truth of the world in a knowledge representation language Examples, Questions Answers Statements Inference Mechanism Learning Mechanism Knowledge Base
Knowledge Base A knowledge base contains facts/information about the world using a knowledge representation language Abi is an elephant (specific knowledge/facts) All elephants are grey in colour (general knowledge/rules) Elephants are mammals (general knowledge/rules) Inference: Abi is a mammal Question: Is Abi red in color? Answer: No
KR language A KR language should be able to Represent adequately the knowledge for the problem (representational adequacy) Use proper syntax that has clear and precise semantics Reason on that knowledge, drawing new conclusions Example: Propositional Logic Predicate Logic/ First Order Logic
Propositional Logic: Syntax Propositional Logic allows knowledge to be represented in the form symbols in the simplest manner Syntax: Atomic sentences corresponding to some assertion in a possible world or model, are assigned a single propositional symbol Such atomic sentences are also called propositions that can be either true or false A = Abi is an elephant B = Abi is pink in colour Complex sentences are constructed from atomic sentences using logical connectives
PL: Logical Connectives Syntax: Logical Connectives (not): A literal is either an atomic sentence (a positive literal) or a negated atomic sentence (a negative literal). E.g.: A, B etc (and): Several literals can be combined with an and operator to form a conjunction. In order for a conjunction to be true, all of its literals have to be true. E.g. A B (or): Several literals can be combined with an and operator to form a conjunction. In order for a conjunction to be true, all of its literals have to be true. E.g. A B (implies): An implication (or conditional) of the form P Q says that if its premise/antecedent (P) is true then its conclusion/consequent(q) must be true. Implications are similar to if-then rule. E.g. A B (bi-conditional): A biconditional P Q is true if P Q is true and Q P is true
PL: Well-formed Formulae The formal grammar of propositional logic that describes what type of sentences are valid/well-formed:
PL: Semantics A model fixes the truth value - true or false - for every proposition symbol The semantics for propositional logic specify how to compute the truth value of any atomic/complex sentence, given a model The rules for computing the truth value when using connectives The rules for computing the truth value when using connectives is specified using truth tables
PL: Inference A Knowledge Base is a conjunction of atomic/complex sentence The aim of logical inference is to decide whether KB α (KB entails α ) for some sentence α If the set of statements in the KB is true given some model than α will always be true for that model An inference algorithm that derives only entailed sentences is called sound An inference algorithm that can derive any sentence that is entailed is called complete A sentence is satisfiable if it is true in some model. KB α if and only if the sentence (KB α ) is unsatisfiable. Proof by refutation or proof by contradiction is often used to answer questions in knowledge based systems
PL: Reasoning or Inference Rules The following inference rules can be used to prove that KB α, for some sentence α Proof by refutation: This is done by showing KB α is unsatisfiable Rule Premise Conclusion Modus Ponens A, A B B And Introduction A, B A B And Elimination A B A Double Negation A A Unit Resolution A B, B A Resolution A B, B C A C
PL: Resolution Refutation In order to prove some sentence α is True (entailed by a KB), an inference mechanism called resolution refutation is used. Convert all rules in the KB to Conjunctive Normal Form (CNF): write every rule in KB as a conjunction of disjunctions Due to And Elimination, each conjunctive part can be treated as a sentence in the KB Negate the desired conclusion (α) and convert to CNF Apply resolution rule until either The rule cannot be applied anymore indicating that α cannot be proved Derive a FALSE i.e. a contradiction is derived indicating α is not true
PL: Resolution Refutation Example: Converting to CNF (p q) (p r) ((p q) (p r)) ((p r) (p q)) ( (p q) (p r)) ( (p r) (p q)) ((p q) ( p r)) ((p r) ( p q)) (((p p) ( q p)) r) (((p p) ( r p)) q) ( q p r) ( r p q) ( q p r) and ( r p q) are clauses By And Elimination ( q p r) and ( r p q) are part of the KB
PL: Resolution Refutation Given a KB: p q r q Convert KB and α to CNF KB: p q r q α: p r Include α to the KB KB: p q r q p r To prove (α): p r Apply resolution wherever possible α: (p r )
PL: Resolution Refutation p q p q r q r r CONTRADICTION: Therefore α is unsatisfiable, that is: KB α