You are on page 1of 19

Module 3 : Knowledge, Reasoning And

Planning: Knowledge Based Agents


Syllabus :

Module 3 : Knowledge, Reasoning and Planning: Knowledge


based agents
 3.1 First order logic - syntax and Semantic, Knowledge Engineering in FOL.
 3.2 Inference in FOL - Unification, Forward Chaining, Backward Chaining
and Resolution, Planning Agent.
 3.3 Types of Planning - Partial Order, Hierarchical Order, Conditional

Order.

2
Knowledge :

 Knowledge refers to stored information or models used by a person or


machine to interpret, predict and appropriately respond to the outside
world.

 The primary characteristics of knowledge representation are,


1. What information is actually made explicit.
2. How the information is physically encoded for subsequent use.

 Knowledge of world consists of two kinds of info. :


1. Prior information
2. Observations of the world

3
Knowledge-based Agents :

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


A knowledge base is a set of sentences.
 Each sentence is expressed in a language called a knowledge representation
language and represents some assertion about the world.
 Sometimes we dignify a sentence with the name axiom, when the sentence is
taken as given without being derived from other sentences.
 There must be a way to add new sentences to the knowledge base and a way to
query what is known.
 The standard names for these operations are TELL and ASK, respectively. Both
operations may involve inference—that is, deriving new sentences from old.

4
Logic :

 knowledge bases consist of sentences.

 These sentences are expressed according to the syntax of the representation


language, which specifies all the sentences that are well formed.

 A logic must also define the semantics or meaning of sentences. The semantics
defines the truth of each sentence with respect to each possible world.

 In standard logics, every sentence must be either true or false in each possible
world - there is no “in between.”

5
Propositional Logic: A Very Simple Logic

 The syntax of propositional logic defines the allowable sentences. The atomic
sentences consist of a single proposition symbol.

 Each such symbol stands for a proposition that can be true or false.

 A proposition can be indicated by symbols that start with an uppercase letter and
may contain other letters or subscripts, for example: P, Q, R, W1,3 and North.

 The semantics defines the rules for determining the truth of a sentence with respect
to a particular model. In propositional logic, a model simply fixes the truth value -
true or false - for every proposition symbol.
6
Propositional Logic: A Very Simple Logic

 Propositional logic is a declarative language because its semantics is based on a truth


relation between sentences and possible worlds.

 It also has sufficient expressive power to deal with partial information, using
disjunction and negation.

 Propositional logic has a third property that is desirable in representation languages,


namely, compositionality.
 In a compositional language, the meaning of a sentence is a function of the meaning
of its parts.

7
First-order logic :

 First-order logic is also called first-order predicate calculus, sometimes abbreviated


as FOL or FOPC.

 A sentence expressed as a conjunction of clauses is said to be in conjunctive normal


form or CNF

 In a first-order logic reasoning system that uses CNF, it can seen that the linguistic
form “¬(A ∨ B)” and “¬A ∧ ¬B” are the same because we can look inside the system
and see that the two sentences are stored as the same canonical CNF form.

8
First-order logic :

 Using the foundation of propositional logic (i.e., a declarative, compositional


semantics is context-independent and unambiguous) lets build a more expressive
logic on that foundation, borrowing representational ideas from natural language
while avoiding its drawbacks.
 While looking at the syntax of natural language, the most obvious elements are nouns
and noun phrases that refer to objects (squares, pits, wumpuses), verbs and verb
phrases that refer to relations among objects (is breezy, is adjacent to, shoots).
 Some of these relations are functions - relations in which there is only one “value” for
a given “input.”
 Example : “One plus two equals three.”
 Objects: one, two, three, one plus two; Relation: equals; Function: plus.
9
First-order logic :

 The primary difference between propositional and first-order logic lies in the ontological
commitment made by each language - that is, what it assumes about the nature of
reality.
 Propositional logic assumes that there are facts that either hold or do not hold in the
world. Each fact can be in one of two states: true or false, and each model assigns true
or false to each proposition symbol.
 First-order logic assumes more; namely, that the world consists of objects with certain
relations among them that do or do not hold. The formal models are correspondingly
more complicated than those for propositional logic.
 Special-purpose logics make still further ontological commitments;
for example, temporal logic assumes that facts hold at particular times and that
those times (which may be points or intervals) are ordered.
10
First-order logic :

 A logic can also be characterized by its epistemological commitments - the possible


states of knowledge that it allows with respect to each fact.

11
Models for first-order logic :

 The models of a logical language are the formal structures that constitute the
possible worlds under consideration.

 Each model links the vocabulary of the logical sentences to elements of the possible
world, so that the truth of any sentence can be determined. Thus, models for
propositional logic link proposition symbols to predefined truth values.

 Models for first-order logic have objects in them. The domain of a model is the set of
objects or domain elements it contains. The domain is required to be nonempty -
every possible world must contain at least one object.

12
Example model :

 Objects :
 Richard the Lionheart, King of England from 1189 to 1199;
 his younger brother, the evil King John, who ruled from 1199 to 1215;
 the left legs of Richard and John; and
 a crown.

 The objects in the model may be related in


various ways.
 A relation is just the set of tuples of objects
that are related.
 Thus, the brotherhood relation in this model is the
set
{ (Richard the Lionheart, King John), (King John,
Richard the Lionheart) } 13
Example model :

 The crown is on King John’s head, so the “on head” relation contains just one tuple,
(the crown, King John).
 The “brother” and “on head” relations are binary relations - that is, they relate pairs of
objects.

 The model also contains unary relations, or


properties:
 the “person” property is true of both Richard and
John;
 the “king” property is true only of John (presumably
because Richard is dead at this point); and
 the “crown” property is true only of the crown.

14
Example model :

 Certain kinds of relationships are best considered as functions, in that a given object
must be related to exactly one object in this way.
 For example, each person has one left leg, so the model has a unary “left leg” function
that includes the following mappings:
 <Richard the Lionheart> → Richard’s left leg
 <King John > → John’s left leg
 Models in the first-order logic require total
functions, that is, there must be a value for
every input tuple.
 Thus, the crown must have a left leg and so
must each of the left legs.
15
Symbols and interpretations :

 The basic syntactic elements of first-order logic are the symbols that stand for objects,
relations, and functions.

 The symbols, therefore, are of three kinds:


 constant symbols, which stand for objects; Richard and John
 predicate symbols, which stand for relations; Brother, OnHead, Person, King, and Crown
 function symbols, which stand for functions. LeftLeg

 In addition to its objects, relations, and functions, each model includes an


interpretation that specifies exactly which objects, relations and functions are
referred to by the constant, predicate, and function symbols.
16
The syntax of first-
order logic

17
Symbols and interpretations :

 Atomic sentences : An atomic sentence (or atom for short) is formed from a predicate
symbol optionally followed by a parenthesized list of terms, such as
Brother (Richard , John)

 Complex sentences : Use of logical connectives to construct more complex


sentences, with the same syntax and semantics as in propositional calculus.

 Terms : A term is a logical expression that refers to an object. Constant symbols are
therefore terms, but it is not always convenient to have a distinct symbol to name
every object. For example, in English we might use the expression “King John’s left
leg” rather than giving a name to his leg.
18
Symbols and interpretations :

 Quantifiers : Quantifiers express properties of entire collections of objects, instead of


enumerating the objects by name do this. First-order logic contains two standard
quantifiers, called universal and existential.
 The sentence ∀ x King(x) ∧ Person(x) would be equivalent to asserting
 Richard the Lionheart is a king ∧ Richard the Lionheart is a person,
 King John is a king ∧ King John is a person,
 Richard’s left leg is a king ∧ Richard’s left leg is a person,

 King John has a crown on his head, can be written as,


∃ x Crown(x) ∧ OnHead(x, John)

19

You might also like