Professional Documents
Culture Documents
and Reasoning
The AI Cycle
Almost all AI systems have the following
components in general:
Perception
Learning
Knowledge Representation and
Reasoning
Planning
Execution
The AI Cycle
Towards Representation
There are multiple approaches and schemes that come
to mind when we begin to think about representation.
Pictures and symbols This is how the earliest humans
represented knowledge when sophisticated linguistic
systems had not yet evolved.
Graphs and Networks
Numbers
Numbers
Numbers are an integral part of knowledge
representation used by humans.
Numbers translate easily to computer
representation.
Eventually,
as
we
know,
every
representation we use gets translated to
numbers in the computers internal
representation.
Example
Example
Using a description in words
For the family above, we could say in
words
Tariq is Monas Father
Ayesha is Monas Mother
Mona is Tariq and Ayeshas Daughter
Example
This example demonstrates the fact that
each knowledge representation scheme
has its own strengths and weaknesses.
Formal KR techniques
Facts
Facts are a basic block of knowledge (the atomic units of
knowledge).
They represent declarative knowledge (they declare knowledge
about objects).
A proposition is the statement of a fact.
Each proposition has an associated truth value. It may be either
true or false.
Formal KR techniques
Uncertain Facts
Sometimes we need to represent uncertain
information in facts. These facts are called
uncertain facts, e.g. it will probably be sunny
today.
We may chose to store numerical certainty
values with such facts that tell us how much
uncertainty there is in the fact.
Fuzzy Facts
Fuzzy facts are ambiguous in nature, e.g. the
book is heavy/light.
Here it is unclear what heavy means because it is a
subjective description.
Rules
Rules are another form of knowledge
representation.
Durkin defines a rule as A knowledge
structure that relates some known
information to other information that can
be concluded or inferred to be true.
Components of a Rule
A Rule consists of two components
Antecedent or premise or the IF part
Consequent or conclusion or the THEN part
Compound Rules
Multiple premises or antecedents may be joined
using AND (conjunctions) and OR (disjunctions),
e.g.
IF it is raining AND I have an umbrella THEN I will go
to school.
IF it is raining OR it is snowing THEN I will not go to
school.
Types of rules
Relationship
Relationship rules are used to express a direct
occurrence relationship between two events, e.g.
IF you hear a loud sound THEN the silencer is not working
Recommendation
Recommendation rules offer a recommendation on
the basis of some known information, e.g.
IF it is raining THEN bring an umbrella
Types of rules
Directive
Directive rules are like recommendations rule but they
offer a specific line of action, as opposed to the
advice of a recommendation rule, e.g.
IF it is raining AND you dont have an umbrella THEN wait for
the rain to stop
Types of rules
Variable Rule
If the same type of rule is to be applied to multiple
objects, we use variable rules, i.e. rules with
variables, e.g.
If X is a Student AND Xs GPA>3.7 THEN place X on honor
roll.
Types of rules
Uncertain Rules
Uncertain rules introduce uncertain facts into the
system, e.g.
IF you have never won a match THEN you will
most probably not win this time.
Meta Rules
Meta rules describe how to use other rules, e.g.
IF you are coughing AND you have chest
congestion THEN use the set of respiratory
disease rules.
Semantic networks
Semantic networks are graphs, with nodes
representing objects and arcs representing
relationships between objects.
Various types of relationships may be defined
using semantic networks.
The two most common types of relationships are
IS-A (Inheritance relation)
HAS (Ownership relation)
Semantic networks
Lets consider an example semantic
network to demonstrate how knowledge in
a semantic network can be used
Semantic networks
Semantic networks
Network Operation
To infer new information from semantic networks, we can
ask questions from nodes
Ask node vehicle: How do you travel?
This node looks at arc and replies: road
Ask node Suzuki: How do you travel?
This node does not have a link to travel therefore it
asks other nodes linked by the IS-A link
Asks node Car (because of IS-A relationship)
Asks node Vehicle (IS-A relationship)
Node Vehicle Replies: road
Frames
Frames are data structures for representing
stereotypical knowledge of some concept or
object according to Durkin, a frame is like a
schema, as we would call it in a database
design.
They were developed from semantic networks
and later evolved into our modern-day Classes
and Objects.
Frames
For example, to represent a student, we make
use of the following frame:
Frames
Frames
Facets
A slot in a frame can hold more that just a value, it
consists of metadata and procedures also.
Logic
Just like algebra is a type of formal logic
that deals with numbers, e.g. 2+4 = 6,
propositional logic and predicate calculus
are forms of formal logic for dealing with
propositions. We will consider two basic
logic representation techniques:
Propositional Logic
Predicate Calculus
Logic
Propositional logic
A proposition is the statement of a fact. We usually
assign a symbolic variable to represent a proposition,
e.g.
p = It is raining
q = I carry an umbrella
A proposition is a sentence whose truth values may be
determined. So, each proposition has a truth value, e.g.
The proposition A rectangle has four sides is true
The proposition The world is a cube is false.
Logic
Compound statements
Different propositions may be logically related
and we can form compound statements of
propositions using logical connectives. Common
logical connectives are:
Logic
Truth Table of Binary Logical Connectives
Logic
Limitations of propositional logic
Propositions can only represent knowledge as
complete sentences, e.g. a = the balls color is blue.
Cannot analyze the internal structure of the sentence.
No quantifiers are available, e.g. for-all, there-exists
Propositional logic provides no framework for proving
statements such as:
All humans are mortal
All women are humans
Therefore, all women are mortals
Predicate calculus
Predicate Calculus is an extension of propositional logic
that allows the structure of facts and sentences to be
defined. With predicate logic, we can use expressions like
Color( ball, blue)
This allows the relationship of sub-sentence units to be
expressed, e.g. the relationship between color, ball and
blue in the above example.
Due to its greater representational power, predicate
calculus provides a mechanism for proving statements and
can be used as a logic system for proving logical theorems.
Logic
Quantifiers
Predicate Logic
You already have done sufficient work.
Lets just have a look at an example.
PROPOSITIONAL
CALCULUS
48
PROPOSITIONAL
CALCULUS
49
PROPOSITIONAL
CALCULUS
50
PROPOSITIONAL
CALCULUS
it is sunny
A proposition:
If it is raining, then it is not sunny
P Q
51
PREDICATE
CALCULUS
52
PREDICATE CALCULS
In Propositional Calculus, a single
propsitional symbol P may denote the entire
sentence it rained on Tuesday.
it rained on Tuesday =P
In Predicate Calculus, a predicate weather
may be created, that describes a relationship
between a day and the weather:
weather(tuesday,rain)
53
PREDICATE CALCULS
Predicate Calculus also allows
expressions to contain variables.
For example:
For all values of X, where X is a day of the
week, the statement weather(X,rain) is
true:
i.e. it rains every day.
54
PREDICATE CALCULS
55
PREDICATE CALCULS
Symbols are used to denote objects,
properties or relations in the world of discourse.
The use of words that suggest the symbols
intended meaning assists programmers in
understanding program code.
Thus, l ( g , k ) = like (george , kate )
Both are formally equal in predicate calculus.
But later can be a great help, for humans, in
relationship the expression represents.
indicating the
formal
56
PREDICATE CALCULS
Improper Symbols. Followings are
used to form well formed expressions.
These are called Improper Symbols.
Parentheses ( )
Commas ,
Periods .
57
PREDICATE CALCULS
Predicate Calculus Term
A predicate calculus term is either
Constants
Variables
Functions
Predicates
58
PREDICATE CALCULS
Constants
Used to name specific objects or properties in
the world.
Constant symbols must begin with a
lowercase
letter.
Examples
george
tree
tall
bLUe
aRT
true and false are constants, they are
reserved as truth symbols.
59
PREDICATE CALCULS
Variables
Variable symbols represent general
classes of objects or properties in the world.
Variable symbols must begin with an
uppercase letter.
Examples
George
Tree
Tall
BLUe
ART
60
PREDICATE CALCULS
Functions
A function expression is a function symbol
followed by its argument.
functionsymbol ( argument )
Function symbol begins with a lowercase
letter.
A function expression consists of a function
constant of arity n, followed by n terms,
t1,t2,,tn, enclosed in parentheses and
separated by commas.
func ( t1,t2,t3,,tn )
61
PREDICATE CALCULS
Functions
goerge ( likes,kate ) george is a
function constant of arity 2, and there
are two terms of argument.
Examples of Functions
f(X,Y)
father(david)
price(banana)
plus(2,3)
62
PREDICATE CALCULS
63
PREDICATE CALCULS
Predicate Calculus Symbols
A predicate name a relationship between
none (zero) or more objects in the world.
Number of objects so related is the arity
(argument number) of the predicate.
Predicate symbols begin with lowercase
letters.
64
PREDICATE CALCULS
Predicate Calculus Symbols
An atomic sentence in Predicate Calculus
is a predicate of arity n followed by n terms
enclosed in parentheses and separated by
commas.
65
PREDICATE CALCULS
Structure of Atomic Sentence
likes ( goerge, kate )
Predicate of arity 2
two terms enclosed in parentheses
PREDICATE CALCULS
Examples of Atomic Sentences
likes(george,kate)
likes(george ,susie)
friends(bill,goerge)
helps(bill,george)
likes(X,george)
likes(X,X)
friends(father(david),father(andrew))
67
PREDICATE CALCULS
Likes, friends, help are predicate symbols.
Predicates with the same names but
different
arities are considered different.
Bill, george, kate etc are constant symbols
and represent objects in the problem domain.
The arguments to a predicate are terms and
may also include variables or function
expressions. For` example:friends(father(david),father(andrew))
68
PREDICATE CALCULS
Atomic sentences are also called
atomic
expressions, atoms or
propositions.
Atomic sentences may be combined
with connectives:
, , , ,
A variable in the sentence refers to
unspecified objects in the domain.
69
PREDICATE CALCULS
Predicate calculus includes two symbols that
defines the meaning of a sentence containing a
variable. These are variable quantifiers:
PREDICATE CALCULS
A quantifier is followed by a variable and a
sentence, such that:
Y friends(Y,peter): A few elements of
the
domain are friends of
Peter.
X likes(X,ice_cream): All elements of
the
domain like ice cream.
71
PREDICATE CALCULS
A few examples of sentences represented in
predicate calculus:
If it doesnt rain tomorrow, Aslam will go to the
mountains.
weather (rain , tomorrow) go (aslam , mountains)
All basketball players are tall.
X (basketball_player (X) tall(X))
72
PREDICATE CALCULS
Some people like bananas.
X (person (X) likes ( X, bananas)).
Nobody likes taxes.
X likes (X , taxes)
73
so is its negation s.
77
friends(george,susie)
friends(george,kate)
80
81
INTERPRETATION
Let the domain D be a nonempty set. An
interpretation over D is an assignment of the
entities of D to each of the constant, variable,
predicate and function symbols of a predicate
calculus expression, such that:
Each constant is assigned an element of D.
Each variable is assigned to a nonempty subset of
D. These are the allowable substitutions for that
variable.
82
INTERPRETATION
Each function f of arity m is defined on m
arguments of D. defines a mapping from Dm
into D.
Each predicate p of arity n is defined on n
arguments from D defines a mapping from Dn
into { T, F}.
83
INTERPRETATION
Sentence:
friends (father_of (david), father_of (andrew) )
Functions:
father_of(david)
father_of(andrew)
Semantics of expression:
friends(george, allen)
84
INFERENCE RULES
The ability to infer new correct expressions
from a set of true assertions is an
important feature of predicate calculus.
These new expressions are correct in that
they are consistent with all previous
interpretations of the original set of
expressions.
85
INFERENCE RULES
An interpretation that makes a sentence
true is said to satisfy that sentence.
An interpretation that satisfy every
member
satisfy
the set.
86
INFERENCE RULES
An expression X logically follows from a set
of predicate calculus expressions S if every
interpretation that satisfy S also satisfy X.
The function of logical inference is to produce
new sentences that logically follow a set of
predicate calculus sentences.
87
INFERENCE RULES
An inference rule is essentially a mechanical
means of producing new predicate calculus
sentences from other sentences.
S 1: X human (X) mortal (X)
I: all human die.
DEFINITIONS
SATISFY, MODEL, VALID, INCONSISTENT
For a predicate calculus expression X and an
interpretation I:
If X has a value of T under I and a
particular variable assignment, then I is
said to satisfy X.
If I satisfies X for all variable assignments,
then I is a model of X.
89
DEFINITIONS
SATISFY, MODEL, VALID, INCONSISTENT
For a predicate calculus expression X and an
interpretation I:
X is satisfiable if and only if there exist an
interpretation and variable assignment that
satisfy it. Otherwise, it is unsatisfiable.
90
DEFINITIONS
SATISFY, MODEL, VALID, INCONSISTENT
A set of expressions is satisfiable if and only if
there exist an interpretation and variable
assignment that satisfy every element.
If a set of expression is not satisfiable, it is said
to be inconsistent.
If X has a value T for all possible interpretations,
X is said to be valid.
91
DEFINITIONS
LOGICALLY FOLLOWS, SOUND AND
COMPLETE
DEFINITIONS
LOGICALLY FOLLOWS, SOUND AND
COMPLETE
An inference rule is complete if, given a
set S of predicate calculus expressions, the
rule can infer every expression that
logically follows from S.
93
INFERENCE RULES
If the sentences P and P Q are known to be
true, then inference rule Modus Ponens lets us
infer Q.
Under the inference rule Modus Tollen,
if P Q is known to be false, we can infer P.
94
INFERENCE RULES
AND Elimination allows us to infer the truth of
either of the conjuncts from the truth of a
conjunctive sentence. For instance, P Q lets us
conclude P and Q are true.
95
INFERENCE RULES
AND Introduction lets us infer the truth of a
conjunction from the truth of its conjuncts, for
instance, if P and Q are true, then P Q is true.
96
UNIFICATION
To apply inference rules such as modus
ponens, an inference system must be able to
determine when two expressions are the
SAME or MATCHING.
Unification is an algorithm for determining
the substitutions needed to replace the
variables, in order to make two predicate
calculus expressions MATCH.
97
UNIFICATION
Unification and inference rules such as modus
ponens allow us to make inferences on a set of
logical assertions. To do this the logical database
must be expressed in an appropriate form: All variables be universally quantified.
Existentially quantified variables may be eliminated from
sentences in the database by replacing them with the
constants that make the sentence true.
98
UNIFICATION
A variable may be replaced by any term: Other variables.
Function expressions.
For example a few instances of the expression
foo (X, a, goo (Y)):Instances
Substitutions or Unifications
foo (fred, a, goo (Z))
{fred / X, Z / Y}
foo(W, a, goo(jack))
{W / X, jack / Y}
foo (Z, a, goo(moo(Z)))
{Z / X, moo (Z) / Y}
99
UNIFICATION
A variable is said to be BOUND to the value
substituted for it. Therefore substitutions are also
referred to be BINDINGS.
100
Reasoning
Now that we have looked at knowledge representation,
we will look at mechanisms to reason on the knowledge
once we have represented it using some logical scheme.
Reasoning is the process of deriving logical conclusions
from given facts.
Durkin defines reasoning as the process of working with
knowledge, facts and problem solving strategies to draw
conclusions.
Types of reasoning
Deductive reasoning
Inductive reasoning
Abductive reasoning
Analogical reasoning
Common-sense reasoning
Non-Monotonic reasoning
Deductive reasoning
Deductive reasoning, as the name implies, is based on
deducing new information from logically related known
information.
A deductive argument offers assertions that lead
automatically to a conclusion, e.g.
If there is dry wood, oxygen and a spark, there will be
a fire
Given: There is dry wood, oxygen and a spark
We can deduce: There will be a fire.
Inductive Reasoning
inducing
Observation: All the crows that I have seen in my life are black.
Conclusion: All crows are black
Abductive reasoning
Deduction is exact in the sense that deductions follow in
a logically provable way from the axioms. Abduction is a
form of deduction that allows for plausible inference, i.e.
the conclusion might be wrong, e.g.
Implication: She carries an umbrella if it is raining
Axiom: she is carrying an umbrella
Conclusion: It is raining
Analogical reasoning
Analogical reasoning works by drawing
analogies between two situations, looking
for similarities and differences, e.g.
when you say driving a truck is just like driving
a car, by analogy you know that there are
some similarities in the driving mechanism,
but you also know that there are certain other
distinct characteristics of each.
Common-sense reasoning
Common-sense reasoning is an informal form of
reasoning that uses rules gained through experience or
what we call rules-of-thumb.
It operates on heuristic knowledge and heuristic rules.
Non-Monotonic reasoning
Non-Monotonic reasoning is used when the facts of the
case are likely to change after some time, e.g.
Rule: IF the wind blows
THEN the curtains sway