Professional Documents
Culture Documents
KNOWLEDGE_AND_REPRESENTATION-UPDATE1[1]
KNOWLEDGE_AND_REPRESENTATION-UPDATE1[1]
Knowledge and Representation are distinct entities that play a central but distinguishable roles in
intelligent system. Knowledge is a description of the world. It determines a system's competence
by what it knows. Representation is the way knowledge is encoded. It defines the performance of
a system in doing something.
KNOWLEDGE
In general, we seem to mean three things by our use of the word "knowledge."
First, we use it to refer to a state of knowing, by which we also mean to be acquainted or
familiar with, to be aware of, to recognize or apprehend facts, methods, principles,
techniques and so on. This common usage corresponds to what is often referred to as "know
about."
Second, we use the word "knowledge" to refer to what Peter Senge calls "the capacity for
action," an understanding or grasp of facts, methods, principles and techniques sufficient to
apply them in the course of making things happen. This corresponds to "know how."
Third, we use the term "knowledge" to refer to codified, captured and accumulated facts,
methods, principles, techniques and so on. When we use the term this way, we are referring
to a body of knowledge that has been articulated and captured in the form of books, papers,
formulas, procedure manuals, computer code and so on.
KNOWLEDGE PROGRESSION
Knowledge is a progression that starts with data. By organizing or analyzing the data, we
understand what the data means, and this becomes information. The interpretation or evaluation
of information yield knowledge. An understanding of the principles embodied within the
knowledge is wisdom.
The distinctions between data, information, knowledge, and wisdom are not very discrete.
Data and information deal with the past; they are based on the gathering of facts and adding
context.
Knowledge deals with the present that enable us to perform.
Wisdom deals with the future, acquire vision for what will be, rather than for what is or was.
This is knowledge about how to do something. i.e These explains what to do in order to reach a
certain conclusion.
KNOWLEDGE REPRESENTATION
Humans are best at understanding, reasoning, and interpreting knowledge. Human knows things,
which is knowledge and as per their knowledge they perform various actions in the real world.
But how machines do all these things comes under knowledge representation.
The knowledge that needs to be presented in artificial intelligence systems can include:
Objects: Facts about objects in our world. e.g. Guitars have string trumpets are brass
instruments.
Events: Actions that occur in our world.e.g. Steve Vai played the guitar in Frank Zappas
Band.
Performance: A behavior like playing guitar involves knowledge about how to do
things.
Meta-knowledge: Knowledge about what we know.e.g. Bob’s Robot who plans a trip. I
know that it can read street signs along a way to find out where it is. Thus in solving
problems in AI we must represent knowledge and there are two entities to deal with.
Facts: Truth about the real world and what we represent. This can be regarded as the
knowledge level.
Both nodes and arcs are generally labeled. This representation consists of basically two types of
relations:
Inheritance is one of the main kind of reasoning done in semantic nets. Properties are inherited
through IS-A and A-KIND-OF relationship, any member of a set inherits the properties of that
set.
IS-A relation is often used to link a class and its superclass. Some links (e.g. haspart) are
inherited along ISA paths
Example 2
The data in semantic nets can be reasoned about in order to produce systems that have
knowledge about a particular domain. For example if you wanted to know whether a particular
animal was a mammal you could consult a semantic network to see if it was connected to the
concept of mammals. If it was then you could reasonably conclude that the animal was a
mammal.
DISADVANTAGES
1. Semantic networks do not have any standard definition for the link names.
2. Semantic networks take more computational time at runtime as we need to traverse the
complete network tree to answer some questions. It might be possible in the worst case
scenario that after traversing the entire tree, we find that the solution does not exist in this
network.
3. Semantic networks try to model human-like memory (Which has 1015 neurons and links)
to store the information, but in practice, it is not possible to build such a vast semantic
network.
4. These types of representations are inadequate as they do not have any equivalent
quantifier, e.g., for all, for some, none, etc.
5. These networks are not intelligent and depend on the creator of the system.
(ii) Frames
A frame is also known as slot-filter knowledge representation in artificial intelligence. Frames
are derived from semantic networks and later evolved into our modern-day classes and objects.
A single frame is not much useful. Frames system consist of a collection of frames which are
connected. For example
A frame is a composite data structure which consists of three components frame name ,attributes
(slots) and values (fillers: list of values, range, string, etc.)
Book Frame
Slot Filler
• Year 2003
ADVANTAGES
Makes programming easier by grouping related knowledge
Easily understood by non-developers
Expressive power
Easy to set up slots for new properties and relations
Easy to include default information and detect missing values
DISADVANTAGES
1. A set of rules- set of production rules of the form a condition→ action. The condition
determines when a given rule is applied, and the action determines what happens when it
is applied.
Example:
IF (at bus stop AND bus arrives) THEN action (get into the bus)
IF (on the bus AND paid AND empty seat) THEN action (sit down).
Action part is also called THEN part, conclusion, consequent, succeedent, or the right
side of the rule. Actions are executed when conditions are true and the rule is fired.
2. Working memory- a working memory contains a description of the current state of the
world in a reasoning process. This description is a pattern that is matched against the
condition part of a production to select appropriate problem-solving actions.
3. The recognize–act cycle – The control structure for a production system is simple:
working memory is initialized with the beginning problem description. The current state
of the problem-solving is maintained as a set of patterns in working memory. These
patterns are matched against the conditions of the production rules; this produces a subset
of the production rules, called the conflict set, whose conditions match the patterns in
working memory. The productions in the conflict set are said to be enabled
Recognize-Act Cycle
Typically, our production systems will have a rule interpreter that takes the form of a Recognize-
Act Cycle. This cycle has four stages:
i. Match the condition/premise patterns in the rules against the elements in the working
memory to identify the set of applicable rules.
ii. If there is more than one rule that can be ‘fired’ (i.e. that can be applied), then use a
Conflict Resolution strategy to choose which one to apply. If no rules are applicable, then
stop.
iii. Apply the chosen rule, which may result in adding new items to the working memory, or
in deleting old ones.
iv. Check if the terminating condition is fulfilled. If it is, then stop. Otherwise, return to
stage 1.
Forward chaining and backward chaining are very important concepts of search that is done
with production system. The inference engine is a component of the intelligent system that
applies logical rules to the knowledge base to infer new information from known facts and uses
the two modes of forward and backward chaining.
Forward chaining or data-driven inference works by repeatedly: starting from the current state,
matching the premises of the rules (the IF parts/ antecedent), and performing the corresponding
actions (the THEN parts/ consequent) that usually update the knowledge base or working
memory. The process continues until no more rules can be applied, or some cycle limit is met.
1. The process of forward chaining may be time-consuming. It may take a lot of time to
eliminate and synchronize available data. Many rules may be applicable at each stage – so
how should we choose which one to apply next at each stage.
2. Unlike backward chaining, the explanation of facts or observations for this type of chaining
is not very clear. The whole process is not directed towards a goal, so how do we know when
to stop applying the rules. The backward chaining uses a goal-driven method that arrives at
conclusions efficiently
3. Forward chaining is only good to be used on problems that have a single starting point and
multiple possible endpoints. It becomes rather inefficient when used on problems that have
several starting points and just a single endpoint.
Notes prepared by Peninah J. Limo Page 13
Example 1
Suppose that the goal is to conclude the color of a pet named Fritz, given that he croaks and eats
flies, and that the rule base contains the following four rules:
Let us illustrate forward chaining by following the pattern of a computer as it evaluates the rules.
Assume the following facts:
Fritz croaks
With forward reasoning, the inference engine can derive that Fritz is green in a series of steps:
1. Since the base facts indicate that "Fritz croaks" and "Fritz eats flies", the antecedent of rule #1
is satisfied by substituting Fritz for X, and the inference engine concludes: Fritz is a frog
2. The antecedent of rule #3 is then satisfied by substituting Fritz for X, and the inference engine
concludes: Fritz is green
Example 2
Rule 3: If B Then E
Rule 4: If G Then D
Problem
Backward chaining or goal-driven inference works towards a final state by looking at the
working memory to see if the sub-goal states already exist there. If not, the actions (the THEN
parts/ consequent) of the rules that will establish the sub-goals are identified, and new sub-goals
are set up for achieving the premises of those rules (the IF parts/ antecedent).
In goal-oriented terminology we can say that the mechanism starts from a general goal, and
decomposes that general goal into subgoals (or problems to be solved) until it stumbles on some
The search is goal directed, so we only apply the rules that are necessary to achieve the goal.
Example1
For example, suppose a new pet, Fritz, is delivered in an opaque box along with two facts about
Fritz:
Fritz croaks
The goal is to decide whether Fritz is green, based on a rule base containing the following four
rules using backward chaining:
solution
With backward reasoning, an inference engine can determine whether Fritz is green in four steps.
To start, the query is phrased as a goal assertion that is to be proved:
"Fritz is green".
1. Fritz is substituted for X in rule #3 to see if its consequent matches the goal, so rule #3
becomes:
Since the consequent matches the goal ("Fritz is green"), the rules engine now needs to see if the
antecedent ("Fritz is a frog") can be proved. The antecedent therefore becomes the new goal:
Fritz is a frog
Since the consequent matches the current goal ("Fritz is a frog"), the inference engine now needs
to see if the antecedent ("Fritz croaks and eats flies") can be proved. The antecedent therefore
becomes the new goal:
3. Since this goal is a conjunction of two statements, the inference engine breaks it into two sub-
goals, both of which must be proved
Fritz croaks
4. To prove both of these sub-goals, the inference engine sees that both of these sub-goals were
given as initial facts. Therefore, the conjunction is true:
therefore the antecedent of rule #1 is true and the consequent must be true:
Fritz is a frog
therefore the antecedent of rule #3 is true and the consequent must be true:
Fritz is green
This derivation therefore allows the inference engine to prove that Fritz is green. Rules #2 and #4
were not used.
Example 2
Rule 4: If G Then D
Problem
Solution
1) The exploration of knowledge has different mechanisms in forward and backward chaining.
Backward chaining is more focused and tries to avoid exploring unnecessary paths of reasoning.
Forward chaining, on the other hand is like an exhaustive search .
2) Backward chaining systems are good for diagnostic and classification tasks, but they are not
good for planning, design, process monitoring, and quite a few other tasks. Forward chaining
systems can handle all these tasks.
4) Lots of output Hypothesis + Lots of data up front => Use Forward Chaining Fewer output
Hypothesis + Must query for data=> Use Backward Chaining
5) Backward chaining engines query for new facts, whereas forward chaining relies on the
application asserting facts to the rule engine.
6) In backward chaining, the search is goal directed, so rules can be applied that are necessary to
achieve the goal. But in forward chaining the whole process is not directed towards goal, so
when to stop the rules in not known
7) If the facts that has to be established lead to a large number of conclusion, but the number of
ways to reach that particular conclusion is small, then there is more information out rather than
information in, then backward chaining should be used. On the other hand, if the number of ways
to reach a particular conclusion is large, but the number of conclusions likely to be reach using
the facts is small, then forward chaining is preferred.
1. Refractoriness - Once a given rule fires then that same rule will be disallowed for
subsequent firing.( Avoid applying a rule more than once for the same situation )
2. Recency - Rules that apply to the most recently working elements are chosen in preference
to those which apply to older working elements.
3. Specificity - Rules which have more conditions on the left hand side are chosen in
preference to those with fewer conditions.
4. Rank rules according to "firing desirability " a priority.
5. Give priority to those rules which are least recently used.
6. Choose the rules that have the largest number of consequents, with the assumption that more
is better.
R1: IF: engine does not turn AND battery is not flat
If the initial facts are “engine does not turn” and “battery is not flat”, the conflict set is:
{ 〈 R1, engine does not turn, battery is not flat 〉, 〈 R4, engine does not turn 〉 } We can see that
our general conflict resolution strategy 4 would work well here.
Production rule system does not exhibit any learning capabilities, as it does not store the
result of the problem for the future uses.
During the execution of the program, many rules may be active hence rule-based
production systems are inefficient.
(iv) LOGIC
Logic is a classical approach of representing Knowledge. It was developed by philosophers and
mathematicians as a calculus of the process of making inferences from facts. Logic is concerned
with the truth of statements about the world. It includes: Syntax, Semantics and Inference
Procedure.
“2+5=5” “false” No
This argument is valid, but it isn’t very meaningful since P and Q are not true.
Logical Connectives
Logical connectives are used to build complex propositions from simpler ones. In Propositional
logic, we have the following five connectives at our disposal:
conjunction: ∧ (and)
disjunction: ∨ (or)
implication: → (if then)
bi-implication: ↔ (if and only if)
negation: ¬ (not)
TRUTH TABLES
Truth tables represent the relationship between the truth values of propositions and compound
propositions formed from those propositions.
(i) AND
Any two propositions can be combined to form a third proposition called the conjunction of the
original propositions.
Definition: If p and q are arbitrary propositions, then the conjunction of p and q is written
P^Q and will be true iff both p and q are true.
F F F
F T F
T F F
T T T
(ii) OR
Any two propositions can be combined by the word ‘or’ to form a third proposition called the
disjunction of the originals.
Definition: If p and q are arbitrary propositions, then the disjunction of P and Q is written
P∨Q and will be true iff either P is true, or Q is true, or both P and Q are true.
The operation of ∨ is summarised in the following truth table:
P Q P ∨ Q
F F F
F T T
T F T
T T T
(iii) IF THEN
Many statements, particularly in mathematics, are of the form:
if P is true then Q is true.
Another way of saying the same thing is to write:
P implies Q.
In propositional logic, we have a connective that combines two propositions into a new
proposition called the conditional, or implication of the originals, that attempts to capture the
sense of such a statement.
Definition: If P and Q are arbitrary propositions, then the conditional of p and q is written:
P→Q and will be true iff either P is false or Q is true.
P Q P→Q
F F T
F T T
T F F
T T T
F F T
F T F
T F F
T T T
If p ↔ q is true, then p and q are said to be logically equivalent. They will be true under exactly
the same circumstances.
(v) NOT
All of the connectives we have considered so far have been binary: they have taken two
variables. The final connective we consider here is unary. It only takes one variables. Any
proposition can be prefixed by the word ‘not’ to form a second proposition called the negation of
the original.
Definition: If p is an arbitrary proposition then the negation of p is written;
P ¬P
F T
T F
FORMULA
More complex sentences are formed using connectives. Sentences formed in this way can be
called Well-Formed Formula (WFF). Parentheses can be used to indicate precedence.
If p; q; r; s and t are atomic propositions, then all of the following are formulae:
P^Q→R
P ^ (Q → R)
(P ^ (Q → R)) ∨ S
((P ^ (Q → R)) ∨ S) ^ T
whereas none of the following is:
P^
P ^ Q)
P¬
Complex sentences evaluate to true or false.
A formula is a tautology iff it is true under every valuation;
A formula is consistent iff it is true under at least one valuation;
A formula is inconsistent iff it is not made true under any valuation.
Further study(homework)
1. Make short notes on clause and clausal notation
2. Resolution and prove using resolution
A sentence in first-order logic is written in the form Px or P(x), where P is the predicate and x is
the term/subject, represented as a variable. e.g Red(car23), student(x), married(John,Ann)
Example
Existential Quantification allows us to state that an object does exist (without naming it):
Existential quantification takes the format ∃x: a. p read “there exist an x such that p holds”
where:
a - is universe of discourse
x - is a member of the domain of discourse
p - is a statement about x
Example 2
Example 3
Example 4
Every man is mortal
Representation of statement in predicate form
− “x is a man” and “man(x),
− x is mortal” by mortal(x)
Every man is mortal :
x: man(x) mortal(x)
Further examples
Further examples
Examples 2
All animals eat the food they like
solution
(x) ∃ (y): animal(x) ∧ food(y) ∧ like(x,y) eat(x,y)
Properties of Quantifiers:
Example 1
∃x∀yLoves(x, y)
∀y∃xLoves(x, y)