CHAPTER4 LOGICAL AGENT KNOWLEDGEBASED AGENT The central component
CHAPTER-4 LOGICAL AGENT
KNOWLEDGE-BASED AGENT • The central component of a knowledge-based agent is its knowledge base. • A knowledge base is a set of sentences. • Each sentence is expressed in a language called a knowledge representation language and represents language some assertion about the world. • There should be a way to add new sentences to KB, and to query what is known.
KNOWLEDGE-BASED AGENT • The standard names for these tasks are TELL and ASK. • Both tasks may involve inference –that is driving new sentence from old. • Inference must obey the fundamental requirement that when one ASKs a question o knowledge base , the answer should follow from what has been told, TELLED to the knowledge base previously.
Knowledge-based agent
KNOWLEDGE-BASED AGENT: BACKGROUND KNOWLEDGE The agent maintains a knowledge base , KB, which contain some back ground knowledge. Each time the agent program is called it does three things: First - TELLs the KB what it perceives Second -ASK the KB what action it should perform Third -The agent records its choice with TELL and the action is executed
KNOWLEDGE-BASED AGENT: BACKGROUND KNOWLEDGE The details of the representation language are hidden inside three functions: 1) MAKE-PERCEPT-SENTENCE: the agent perceived the given percept at the given time. 2) MAKE-ACTION-QUERY: constructs a sentence that asks what action should be done at the current time 3) MAKE –ACTION-SENTENCE: constructs a sentence asserting that the chosen action was executed. The details of inference mechanisms are hidden inside TELL and ASK
DECLARATIVE VS PROCEDURAL APPROACH • Designing the representation language to make it easy to express this knowledge in the form of sentences simplifies the construction problem. This is called the declarative approach to system building. • The procedural approach encodes desired behaviors directly as program code ; minimizing the role of explicit representation and reasoning can result in much more efficient system
THE WUMPUS WORLD • Wumpus world is a cave consisting of rooms connected by passageways. A beast that eats anyone who enters its room. • The Wumpus can be shot by an agent but the agent has only one arrow. Some rooms contain bottomless pits that will trap anyone who wanders into these rooms. • GOAL is to find a heap of gold.
WUMPUS WORLD PEAS DESCRIPTION • Performance measure: +1000 for picking up the gold, -1000 for falling into a pit or being eaten by the wumpus , 1 for each action taken and 10 for using up the arrow • Environment: A 4× 4 grid of rooms.
WUMPUS WORLD PEAS DESCRIPTION • Sensors: The agent has five sensors each of which gives a single bit of information. § Stench- In the square containing the Wumpus and in the directly (not diagonally) adjacent squares the agent will perceive a stench. § Breeze- In the square directly adjacent to a pit, the agent will perceive a breeze. § Glitter- In the square where the gold is, the agent will perceive a glitter. § When an agent walks into a wall, it will perceive a bump. § When the Wumpus is killed, it emits a woeful scream that can be perceived anywhere in the cave. • Actuators: The agent can move forward , turn left by 90 o or turn right by 90 o The agent dies if it enters a square containing a pit or a live wumpus.
LOGIC Syntax of the representation language , which specifies all the sentences that are well formed. X + Y =4 is a well –formed sentence X 2 Y += not a well-formed sentence A logic must also define the semantics of the language, meaning of sentences In logic the meaning is more precise. It defines the truth of each sentence with respect to each possible world Eg: x + y =4 is true, x=2 and y=4 x+y =4 is false , x=1 and y=1
LOGIC • The term model in place of Possible world – model • m is a model of α – the sentence α is true in model m
ENTAILMENT • The relation of logical entailment is the idea that a sentence follows logically from another sentence. α╞ β The sentence α entails the sentence β The formal definition : α╞ β if and only if in every model in which α is true β is also true. if α is true then β must also be true Eg: x+y =4 entails the sentence 4= x+y
INFERENCE • An inference algorithm i can derived a from KB, we write • KB ├i α • which is pronounced “α is derived from KB by i “ or “ i derives a from KB” • sentence α can be derived from KB by a procedure i (an inference algorithm)
PROPOSITIONAL LOGIC • Propositional logic is the simplest logic – illustrates basic ideas • The relation between a sentence and another sentence is called entailment. Syntax • The syntax of propositional logic defines the allowable sentences. • The atomic sentences- the indivisible syntactic elements-consist of a single proposition symbol. • Each such symbol stands for a proposition that can be true or false. • Uppercase names for symbols P, Q, R and so on. • There are two proposition symbols with fixed meanings: True is the always true –proposition and False is the always false proposition
PROPOSITIONAL LOGIC • Complex sentences are constructed from simpler sentences using logical connectives. • There are 5 connectives in common use: • NOT (¬): ¬W is called negation • AND(˄) : W 1, 3 A P 3, 1 is called conjuction ; it’s part are the conjuncts. • OR(˅) : A sentence using V such as (W 1, 3 A P 3, 1) V W 2, 2 is called disjunction ; is a disjunction of disjuncts. • Implies(⇒): A sentence such as (W 1, 3 A P 3, 1)⇒ ¬W 2, 2 is called an implication. Its premise or antecedent is (W 1, 3 A P 3, 1) and its conclusion or consequent is ¬W 2, 2. Implications are also known as rules or if-then statements. • If and only if(⇔): W 1, 3 ⇔ ¬W 2, 2 is a biconditional
BNF FOR PROPOSITIONAL LOGIC
ORDER OF PRECEDENCE The order of precedence in propositional logic is from highest to lowest is: ⌐, ᴧ, ᴠ, ⇒, ⇔
PROPOSITIONAL LOGIC: SEMANTICS • Semantics defines the rules for determining the truth of a sentence with respect to a particular model. Each model specifies true/false for each proposition symbol. • All sentences are constructed from atomic sentences and the five connectives. • A knowledge base consists of a set of sentences. Logical knowledge base is a conjunction of those sentences. • ⇒ (implies) eg: P implies Q or if P then Q.
TRUTH TABLES FOR 5 LOGICAL CONNECTIVES
STANDARD LOGICAL EQUIVALENCES
REASONING PATTERNS IN PROPOSITIONAL LOGIC • Patterns of inference are called inference rules. The best known rule is called Modus Ponens (α ⇒ β), α β The notation means that whenever any sentences of the form α ⇒ β and α are given the sentence β will be inferred. And-Elimination, which says that , from a conjunction any of the conjucts can be inferred α˄β α
CONJUNCTIVE NORMAL FORM(CNF) • A sentence expressed as a conjunction of disjunctions of literals is said to be in conjunctive normal form or CNF. Steps of CNF: 1. Eliminate ⇔, replacing (α ⇔ β) with ((α ⇒ β) ˄ (( β ⇒ α ) 2. Eliminate ⇒ , replacing (α ⇒ β) with (¬ α˅ β) 3. ¬(¬a) ≡ a a double – negation elimination ¬(α ˄ β) ≡ (¬ α ˅ ¬ β) De Morgan ¬(α ˅ β) ≡ (¬ α ˄ ¬ β) De Morgan
THANK YOU!!!
- Slides: 24