0% found this document useful (0 votes)
14 views

Chapter 4 AI

Knowledge and Reasoning

Uploaded by

Fro Abera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Chapter 4 AI

Knowledge and Reasoning

Uploaded by

Fro Abera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 19

FUNDAMENTALS OF

ARTIFICIAL INTELLIGENCE

CHAPTER FOUR –KNOWLEDGE AND


REASONING
2 CONTENTS

 Introduction
 Logical Agents
 Propositional Logic
 Predicate (First-Order) Logic
 Inference in First-Order Logic
 Knowledge Representation
 Knowledge-based Systems
3 INTRODUCTION

 A logical, knowledge-based agent begins with some knowledge of the world and of its own
actions.
 It uses logical reasoning to maintain a description of the world as new percepts arrive, and to
deduce a course of action that will achieve its goals.
 The knowledge-based approach is a particularly powerful way of constructing an agent
program.
 It aims to implement a view of agents in which they can be seen as knowing about their world,
and reasoning about their possible courses of action.
4 INTRODUCTION

 Knowledge-based agents are able to accept new tasks in the form of explicitly described goals;
 They can achieve competence quickly by being told or learning new knowledge about the
environment;
 And they can adapt to changes in the environment by updating the relevant knowledge.
 A knowledge-based agent needs to know many things:
 the current state of the world;
 how to infer unseen properties of the world from percepts;
 how the world evolves over time; what it wants to achieve;
 and what its own actions do in various circumstances.
5 A KNOWLEDGE-BASED AGENT

 Knowledge-based agents are agents that know about their world and reason about their courses
of action.
 A knowledge-based agent consists of two parts:
 A knowledge base and
 An inference engine

Knowledge base  domain-specific content

Inference engine  domain-independent algorithms

 The central component of a knowledge-based agent is its knowledge base, or KB.


 Informally, a knowledge base is a set of representations of facts about the world.
 Each individual representation is called a sentence.
6 A KNOWLEDGE-BASED AGENT

 Inference Engine (IE) = reasons with knowledge to produce new knowledge.


 There must be a way to add new sentences to the knowledge base, and a way to query what is
known.
 How to interact with KB?
 Tell it what it needs to know.
 Ask itself what to do - answers should follow from the KB.
 Each time the agent program is called, it does two things.
 First, it TELLS the knowledge base what it perceives.
 Second, it ASKS the knowledge base what action it should perform.
7 A KNOWLEDGE-BASED AGENT

 The sentences in the KB must therefore contain a range of information.


 The agent must be able to:
 Represent and update states of the environment,
 Represent its own actions, Incorporate new precepts into the KB,
 Update internal representations of the world,
 Deduce hidden properties of the environment and
 Deduce what the ‘right’ action is at any given time.
 In addition, the KB must contain the goal(s) of the agent.
8 A KNOWLEDGE-BASED AGENT

 Entailment means that one thing follows from another:


 One sentence follows from another.
 The symbol for entailment is ‘╞’. KB ╞ α
 Knowledge base KB entails sentence α if and only if α is true in all worlds where KB is true.
 E.g., the KB containing “Leqa won” and “Gimbi won” entails “Either Leqa won or Gimbi
won”
 E.g., x+y=4 entails 4=x+y
 Entailment is a relationship between sentences (i.e., syntax) that is based on semantics.
9 A KNOWLEDGE-BASED AGENT

 We said that it is possible to understand the operation of a knowledge-based agent in terms of


what it knows.
 It is possible to construct a knowledge-based agent by TELLing it what it needs to know.
 The agent's initial program, before it starts to receive percepts, is built by adding one by one
the sentences that represent the designer's knowledge of the environment.
 Provided that the representation language makes it easy to express this knowledge in the form
of sentences, this simplifies the construction problem enormously.
 This is called the declarative approach to system building.
 Also, one can design learning mechanisms that output general knowledge about the
environment given a series of percepts.
10 REPRESENTATION, REASONING, AND LOGIC

 The object of knowledge representation is to express knowledge in computer-tractable form,


such that it can be used to help agents perform well.
 A knowledge representation language is defined by two aspects:
 The syntax:
 describes the possible configurations that can constitute sentences.
 describe syntax in terms of how sentences are represented on the printed page, but the real
representation is inside the computer:
 The semantics:
 determines the facts in the world to which the sentences refer.
11 REPRESENTATION, REASONING, AND LOGIC

 We want to generate new sentences that are necessarily true, given that the old sentences are
true.
 This relation between sentences is called entailment.
 An inference procedure that generates only entailed sentences is called sound or truth-
preserving.
 Once a sentence is given an interpretation by the semantics, the sentence says that the world is
this way and not that way.
 Note that truth depends both on the interpretation of the sentence and on the actual state of the
world.
 The terms "reasoning" and "inference" are generally used to cover any process by which
conclusions are reached.
12 REPRESENTATION, REASONING, AND LOGIC

 A logic is deduction or derivation of new true statements from assumptions.


 Syntax defines the sentences in the language.
 Define formal structure of sentences.
 Semantics define the "meaning" of sentences;
 Define truth of a sentence in a world.
 E.g., the language of arithmetic
 x+2 ≥ y is a sentence; x2+y > {} is not a sentence
 x+2 ≥ y is true if the number x+2 is not less than the number y
13 PROPOSITIONAL LOGIC

 Propositional logic- Ways of combining or altering statements or propositions to form more


complicated statements.
 Propositional logic (also known as Boolean logic):
 Consists

 symbols P1, P2

 connectives, ,,, , which can be used to combine propositions into


more complex sentences.
The syntax of propositional logic can be summarized as follows:
If S is a sentence, S is a sentence (negation)
If S1 and S2 are sentences, S1  S2 is a sentence (conjunction)
If S1 and S2 are sentences, S1  S2 is a sentence (disjunction)
If S1 and S2 are sentences, S1  S2 is a sentence (implication)
If S1 and S2 are sentences, S1  S2 is a sentence (biconditional)
14 PROPOSITIONAL LOGIC

 Truth tables for connectives


15 PROPOSITIONAL LOGIC

 Two sentences are logically equivalent if they are true in the same models: α ≡ ß if α╞ β and
β╞ α.
16 PROPOSITIONAL LOGIC

 A sentence is valid if it is true in all models


 e.g., True A A, A  A,
 Validity is connected to inference via the Deduction Theorem:
 KB ╞ α if and only if (KB α) is valid
 A sentence is satisfiable if it is true in some model,

 e.g., e.g., A,A B,


 A sentence is unsatisfiable if it is true in no models

e.g.,AA, can never be true;


17 PROOF BY APPLYING INFERENCE RULES

 Instead of enumerating truth tables, can do proof by successively applying sound inference
rules:
 Inference is the processing of finding what sentences are entailed.
 inference: deriving sentences from other sentences.
 Modus Ponens:

 Modus Tollens: The Modus Tollens rule state that if P→ Q is true and ¬ Q is true, then ¬ P
will also true. It can be represented as:
18 PROOF BY APPLYING INFERENCE RULES

 Resolution is a sound and complete inference algorithm:


 whenever KB ⊧ α, it is also true that KB ⊢iα, Meaning "a is derived from KB by i" or “i
derives a from KB.“
 The Resolution rule state that if P ∨Q and ¬ P ∧R is true, then Q ∨R will also be true. It can be
represented as

 Resolution works best when the formula is of the special form: it is an ∧ of ∨s of (possibly
negated, ¬) variables (called literals ).

Uses Conjunctive Normal Form (CNF) conjunction of disjunctions of
literals, e.g., (A  B)  (B  C  D)
 Conjunctive normal form (CNF) is an important normal form for propositional logic. A logic
formula is in conjunctive normal form if it is a single conjunction of disjunctions of (possibly
negated) literals.
19 PROOF BY APPLYING INFERENCE RULES

 Conversion to CNF.
 B  (P  Q)
 Eliminate , replacing A  B with (A  B)  A)
 B  (P  Q) (P  Q)  B
 Eliminate , replacing A  B with  B
  (P  Q)) (P  Q)  B)
 Move inwards using de Morgan's rules and double-negation
 ( P  Q) P Q)  B)
 Apply distributive law ( over ):
 ( P  Q) P  B) Q  B) IN CNF.
 TRY This : (A∨B)  (C  D)

You might also like