Sei sulla pagina 1di 24

4

Knowledge Representation
Knowledge can be defined as the body of facts and principles accumulated by
humankind or the act, or state of knowing.
Knowledge is having a familiarity with language, concepts, procedures, rules, ideas,
abstractions, places, customs, facts and associations coupled with an ability to use these
notions effectively in modeling different aspects of the world. Without this ability, the facts
and concepts are meaningless and therefore, worthless.
In biological organisms, knowledge is stored as complex structures of
interconnected neurons. The structures correspond to symbolic representations of the
knowledge possessed by the organism, the facts, rules, and so on. The average human brain
weights about 3.3 pounds and contains an estimated number of 10 12 neurons.
In computers, knowledge is also stored as symbolic structures, but in the form of
collections of magnetic spots and voltage states.
A common way to represent knowledge is in the form of written language.
For example,
1. John is tall.
2. Ram likes Sekhar.
3. Sam has learned to use recursion to manipulate linked lists in several
programming languages.
To truly understand and make use of the knowledge of one world, a person needs
other world knowledge and the ability to reason with it.
Knowledge may be declarative or procedural. Declarative knowledge is passive
knowledge expressed as statements of facts about the world. Procedural knowledge is
compiled knowledge related to the performance of some task.
Heuristic Knowledge
 A special type of knowledge used to solve complex problems.
 Heuristics are the knowledge used to make good judgments, strategies,
tricks, or “rules of thumb” used to the solution of problems.
 Heuristics are acquired with much experience.
Thus, knowledge includes and requires the use of data and information. But it is
more. It combines relationships, correlations, dependencies.
Belief
It is any meaningful and coherent expression that can be represented. It can be true
or false.
Hypothesis
It is a justified belief that is not known to be true. It is a belief which is backed up
with some evidence, but it may still be false.
Thus, knowledge can be defined as true justified belief.

http://rajakishor.co.cc Page 2
Epistemology
It is the study of the nature of knowledge.
Metaknowledge
It is knowledge about knowledge, that is, knowledge about what we know.

K nowledge-based S ystems

The real power of an expert system comes from the knowledge it possesses rather
than the particular inference schemes and other formalisms it employs.
Knowledge-based systems get their power from the expert knowledge that has been
coded into facts, rules, heuristics, and procedures.
Components of knowledge-based systems

Here, the knowledge is stored in a knowledge base, which is separate from the
control and inferencing components. This makes it possible to add new knowledge or
refine existing knowledge without recompiling the control and inferencing programs.

http://rajakishor.co.cc Page 3
K nowledge R epresentation

Levels of knowledge representation.

Ex: Card game.


Representing the suits and face values.

Knowledge and reasoning are important for artificial agents because they enable
successful behaviors that would be very hard to achieve otherwise.
The knowledge of problem-solving agents is, however, very specific and inflexible.
Knowledge-based agents can benefit from knowledge expressed in very general forms,
combining and recombining information to suit myriad (a great number of) purposes.
Knowledge and reasoning play a crucial role in dealing with partially observable
environments. A knowledge-based agent can combine general knowledge with current
percepts to infer hidden aspects of the current state prior to selecting actions.
For example, a physician diagnoses a patient infers a disease state that is not
directly observable, prior to choosing a treatment. Some of the knowledge that the
physician uses in the form of rules learned from textbooks and teachers, and some is in the
form of patterns of association that the physician may not be able to consciously describe.
If it is inside the physician's head, it counts as knowledge.

http://rajakishor.co.cc Page 4
K nowledge-based A gents

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


Informally, a knowledge base is a set of statements. Each statement is expressed in a
language called a knowledge representation language and represents some assertion about
the world.
There must be a way to add new statements to the knowledge base and a way to
query what is known. The standard names for these tasks are TELL and ASK, respectively.
Both tasks may involve inference, that is, deriving new sentences from old.
In logical agents, inference must obey the fundamental requirement that when one
asks a question of the knowledge base, the answer should follow from what has been told
to the knowledge base previously.
An outline of a knowledge-based agent is shown below:
function KB-AGENT( percept) returns an action
static: KB, a knowledge base
t, a counter, initially 0, indicating time
TELL( KB, MAKE-PERCEPT-STATEMENT( percept, t))
action  ASK(KB, MAKE-ACTION-QUERY(t))
TELL(KB, MAKE-ACTION-STATEMENT(action, t))
T  t+1
return action

The agent maintains a knowledge base, KB, which may initially contain some
background knowledge. 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. In the process of answering this query, extensive reasoning may
be done about the current state of the world, about the outcomes of possible action
sequences; and so on. Once the action is chosen, the agent records its choice with TELL and
executes the action. The second TELL is necessary to let the knowledge base know that the
hypothetical action has actually been executed.

T L he ogic

Knowledge bases consist of statements. These statements are expressed according


to the syntax of the representation language, which specifies all the statements that are
well formed.
The notion of syntax is clear enough in ordinary arithmetic: "x + y = 4" is a well-
formed statement, whereas "x2y+ =" is not.

http://rajakishor.co.cc Page 5
In any case, statements in an agent’s knowledge base are real physical
configurations of the agent. Reasoning will involve generating and manipulating those
configurations.
A logic must also define the semantics of the language. The semantics refers to the
"meaning" of sentences. In logic, the definition is more precise. The semantics of the
language defines the truth of each sentence with respect to each possible world.
For example, the usual semantics adopted for arithmetic specifies that the sentence
"x + y =4" is true in a world where x is 2 and y is 2, but false in a world where x is 1 and y is
1. In standard logics, every statement must be either true or false in each possible world -
there is no "in between.”
The logical reasoning involves the relation of logical entailment between
statements. In mathematics, we write it as P  Q, which means that the statement P entails
the statement Q, that is, the statement Q logically follows the statement P. This says that
whenever P is true Q must also be true.

F ormalized S ymbolic L ogic


The first representation scheme of knowledge is First Order Predicate Logic (FOPL).
The application logic as a practical means of representing and manipulating
knowledge in a computer was not demonstrated until the early 1960s.
Today, FOPL or Predicate Calculus has assumed one of the most important roles in
AI for the representation of the knowledge.
Logic is a formal method for reasoning. Many concepts which can be verbalized can
be translated into symbolic representations, which closely approximate the meaning of
these concepts. These symbolic structures can then be manipulated in programs to deduce
various facts, to carry out a form of automated reasoning.
In FOPL, statements from a natural language like English are translated into
symbolic structures comprised of predicates, functions, variables, constants, quantifiers,
and logical connectives. The symbols form the basic building blocks for the knowledge, and
their combination into valid structures is accomplished using the syntax (rules of
combination) for FOPL. Once structures have been created to represent basic facts,
inference rules may then be applied to compare, combine and transform these structures
into new structures. This is how automated reasoning or inferencing is performed.
For example,
The statement
“All employees of the AI-software company are programmers”.
might be written as
(  x) (AI-SOFTWARE-CO-EMPLOYEE(x)  PROGRAMMER(x))

http://rajakishor.co.cc Page 6
S yntax and S emantics for P ropositional L ogic

Syntax refers to the grammatic structure of a sentence in a language.


Semantics refers to the meaning of the information that is intended in a sentence.

Valid statements or sentences in predicate logic (PL) are determined according to


the rules of propositional syntax. This syntax governs the combination of basic building
blocks such as propositions and logical connectives. Propositions are elementary atomic
sentences. We shall also use the term “formals” or “well-formed formulas” (WFFs) in place
of sentences. Propositions may be either true or false but may take on no other value.
Simple propositions:
 It is raining.
 My car is painted blue.
 Snow is white. People live on the moon.
Compound propositions:
These are formed from atomic formulas using the logical connectives not, and, or, if
… then, and if and only if.
For example,
 It is raining and the wind is blowing.
 The moon is made of green cheese or it is not.
 If you study hard you will be rewarded.
 The sum of 10 and 20 is not 50.

http://rajakishor.co.cc Page 7
Symbols used for logical connectives:

Symbol Meaning
~ For not or negation
& For AND or conjunction
V For OR or disjunction
 For if … then or implies
 For if and only if or double implication

Syntax:
The syntax of propositional logic is defined recursively as follows:
T and F are formals.
If P and Q are formals, the following are formals:
(~P)
(P & Q)
(P v Q)
(P  Q)
(P  Q)
All formals are generated from a finite number of the above operations.
The precedence given to the connectives from highest to lowest is ~, &, v,  and  .
Semantics:
The semantics or meaning of a sentence is just the value true or false. The values
true and false are not same as the truth values T and F that appear in a sentence.
An interpretation for a sentence or group of sentences is an assignment of a truth
value to each propositional symbol. For the sentence (P & ~Q), there can be four distinct
interpretations.
Once an interpretation has been given to a statement, its true value can be
determined.
If A is any statement, t and t’ denote any true statements, and f and f’ denote any
false statements – the semantic rules are summarized below:

http://rajakishor.co.cc Page 8
Rule No. True statement False statement
1. T F
2. ~f ~t
3. t&t’ f&A
4. tvA A&f
5. Avt fvf’
6. At tf
7. fA tf
8. T  t’ ft
9. f  f’

Example: Let an interpretation I assigns true to P, false to Q and false to R in the


statement ((P & ~Q)  R) v Q.
Determine if the compound statement is true or false.
((P & ~Q)  R) v Q
 ((P & T)  R) v Q : by rule 2
 (T  R) v Q : by rule 3
 FvQ : by rule 6
F : by rule 5
Thus, the statement value is false.

http://rajakishor.co.cc Page 9
P roperties of S tatements

S.No. Property Description Example


1. Satisfiable A statement is satisfiable if P is satisfiable but not valid since an
there is some interpretation interpretation that assigns false to
for which it is true. P assigns false to the sentence P.
2. Contradiction A sentence is contradictory P & ~P is a contradiction since
(unsatisfiable) if there is no every interpretation results in a
interpretation for which it is value of false for (P & ~P).
true.
3. Valid A sentence is valid if it is true P v ~P is valid since every
for every interpretation. Valid interpretation results in a value of
sentences are called true for (P v ~P).
tautologies.
4. Equivalence Two sentences are equivalent P and ~(~P) are equivalent since
if they have the same truth each has the same truth values
value under every under every interpretation.
interpretation.
5. Logical A sentence is a logical P is a logical consequence of (P & Q)
consequences consequence of another if it is since any interpretation for which
satisfied by all interpretations (P & Q) is true, P is also true.
which satisfy the first.

Theorem: The sentence S is a logical consequence of S1, S2, …, Sn if and only if S1 & S2
& … & Sn  S is valid.
Equivalence Laws:
1. Idempotency
PvP=P
P^P=P
2. Associativity
(P v Q) v R = P v (Q v R)
(P & Q) & R = P & (Q & R)
3. Commutativity
PvQ=QvP
P&Q=Q&P
PQQ P

http://rajakishor.co.cc Page 10
4. Distributivity
P & (Q v R) = (P & Q) v (P & R)
P v (Q & R) = (P v Q) & (P v R)
5. De Morgan’s Laws
( P  Q)  P  Q
( P  Q)  P  Q
6. Conditional elimination
P  Q  P  Q
7. Bi-conditional elimination
P  Q  ( P  Q)  (Q  P )

Theorem: The sentence S is a logical consequence of S1, S2, …, Sn if and only if S1 & S2
& … Sn & ¬S is inconsistent.
Proof:
We have,
S is a logical consequence of S1, S2, …, Sn if and only if
S1 & S2 & … Sn  S is valid.
That is, ¬(S1 & S2 & … Sn  S) is inconsistent.
But,
¬(S1 & S2 & … Sn  S) = ¬(¬ (S1 & S2 & … Sn) v S) [by conditional elimination]
= ¬(¬ (S1 & S2 & … Sn)) & ¬S
= S1 & S2 & … Sn & ¬S which is inconsistent.
Hence the theorem.
One way to determine the equivalence of two sentences is by using truth tables.
Ex: Show that
(i) P  Q is equivalent to ¬P v Q.
(ii) P Q is equivalent to ( P  Q)  (Q  P) .

http://rajakishor.co.cc Page 11
I nference R ules
The inference rules of propositional logic provide the means to perform logical
proofs and deductions.
1. Modus Ponens
From P and P  Q infer Q. This is written as
P
PQ
----------
Q
Ex:
given: Raj Likes fruits
and : (Raj likes fruits)  (Raj likes mangoes)
conclusion: Raj likes mangoes
2. Chain Rule
From P  Q and Q  R, infer P  R.
That is
PQ
QR
---------
PR
Ex:
given: (programmer likes C)  (programmer hates COBOL)
and : (programmer hates COBOL)  (programmer likes recursion)
conclusion: (programmer likes C)  (programmer likes recursion)
3. Substitution
If s is a valid sentence, and s’ derived from s by consistent substitution of
proposition in s, then s’ is also valid.
Ex:
P v ¬P is valid; therefore Q v ¬Q is also valid.
4. Simplification
From P & Q infer P.
5. Conjunction
From P and from Q, infer P & Q.
6. Transposition
From P  Q, infer ¬Q  ¬P

http://rajakishor.co.cc Page 12
F ormal S ystems
A formal system is a set of axioms S and a set of inference rules L from which new
statements can be logically derived. We will denote a formal system as <S, L> or simply as a
KB (knowledge base).
Soundness:
Let <S, L> be a formal system. We say that the inference procedures L are sound if
and only if any statement s that can be derived from <S, L> is a logical consequence of <S,
L>.
Completeness:
Let <S, L> be formal system. Then the inference procedure L is a complete if and
only if any sentence s logically implied by <S, L> can be derived using that procedure.
Example:
Suppose S = {P, PQ} and L is the modus ponens rule. Then <S, L> is a formal
system, since Q can be derived from the system. Also, the system is both sound and
complete.

S yntax and S emantics for F OPL


FOPL was developed by logicians to extend the expressiveness of propositional
logic. It is a generalization of propositional logic that permits reasoning about world
objects as relational entities as well as classes or of objects.
Syntax of FOPL:
1. Connectives:
There are five connective symbols:
¬, &, v, , 
2. Quantifiers:
There are two quantifiers
(i) Universal quantifiers (  )
 x or  xyz
(ii) Existential quantifiers (  )
x

http://rajakishor.co.cc Page 13
3. Constants:
Numbers, words etc.
4. Variables:
Those that can be assigned any value.
5. Functions:
These denote relations defined on a domain D. They map n elements (n ≥ 0)
to a single element of the domain. An n-ary function is written a f(t1, t2, …, tn).
A 0-ary function is a constant.
6. Predicates:
Predicate symbols denote relations or functional mappings from the
elements of a domain D to the values TRUE or FALSE.
For example, P, Q, R, EQUAL etc.
Like functions, predicates may have n (n ≥ 0) terms for arguments written as
P(t1, t2, …, tn), where the terms ti are defined over some domain.
Constants, variables and functions are referred to as “terms” and predicates are
referred to as “atomic formulas” or “literals”.
Examples:
E1: All employees earning $1400 or more per year pay taxes.
E2: Some employees are sick today.
E3: No employee earns more than the president.
To represent such expressions in FOPL, we must define abbreviations for the
predicates and functions.

Abbreviation Meaning
E(X) X is an employee
P(X) X is president
i(x) Income of X
GE(u, v) u is greater than or equal to v
S(X) X is sick today
T(X) X pays tax

http://rajakishor.co.cc Page 14
Using the above abbreviations, we can represent E1, E2, and E3 as
E1' : x (( E ( x) & GE (i ( x),1400))  T ( x))
E 2 ' : x ( E ( x)  S ( y ))
E 3' : xy (( E ( x) & P( y ))  GE (i ( x), i ( y )))
Steps:
1. Indentify all atomic propositions in the given sentence.
2. Define symbols, predicates or functions for each such proposition.
3. Formulate compound predicate with the atomic predicates using logical
connectives.
The expressions E1’, E2’ and E3’ are known as well-formed formulas or WFFs.
WFFs are defined recursively as follows:
An atomic formula is a WFF.
If P and Q are WFFs, then ¬P, P & Q, P v Q, P  Q, P  Q,,  x P(x),  x P(x) are
WFFs.
WFFs are formed only by applying the above rules a finite number of times.
Some examples of WFFs:
MAN(John)
Pilot(father-of(Bill))
xyz (( FATHER( x, y ) & FATHER( y, z ))  GRANDFATHER( x, z ))
x NUMBER( x)  (y GREATER  THAN ( y , x ))
Some examples of statements that are not WFFs:
P P( x)  Q( x)
MAN (John)
father  of (Q( x))
MARRIED( MAN , WOMAN )
Note: We use Upper case letters to denote predicates and lower case letters to
denote functions.

Semantics for FOPL:


When considering specific WFFs, we always have in mind some domain D.
When an assignment of values is given to each term and each predicate symbol in a
WFF, we say an interpretation is given to the WFF.

http://rajakishor.co.cc Page 15
If the truth values for two different WFFs are the same under every interpretation,
they are said to be equivalent.
A predicate (or WFF) that has no variable is called a “ground atom”.
When determining the truth value of a compound expression, we must be careful in
evaluating predicates that have variable arguments, since they evaluate to true only if they
are true for the appropriate values of the variables.
For example,
(i) In the predicate  x P(x), P(x) is true only if it is true for every value of x in the
domain D.
(ii) The P(x) in  x P(x) is true if it is true for at least one value of x in D.
If the above conditions are not satisfied, the predicate evaluates to false.

C onversion to C lausal F orm


One method of mechanical inference by programs using symbolic FOPL expressions
is resolution. It requires that all statements be converted into a normalized clausal form.
A clause is the disjunction of a number of literals. A ground clause is one in which
no variables occur in the expression. A horn clause is a clause with at most one positive
literal.
To transform a sentence into clausal form requires the following steps:
1. Eliminate all implication and equivalence symbols.
2. Move negation symbols individual atoms.
3. Rename variables if necessary so that all remaining quantifiers have different
variable assignments.
4. Replace existentially quantified variables with special functions and eliminate the
corresponding quantifiers.
5. Drop all universal quantifiers and put the remaining expression into conjunctive
normal form (CNF). (Disjunctions are moved down to literals).
6. Drop all conjunction symbols writing each clause previously connected by the
conjunctions on a separate line.
Clausal Conversion Procedure (Example)
Step1: Eliminate all implications and equivalence connectives.
For example,
Use ¬P v Q in place of P  Q
and (¬P v Q) & (¬Q v P) in place of P  Q.

http://rajakishor.co.cc Page 16
Step2: Move all negations into individual atoms.
For example,
Use P in place of ¬(¬P)
and De Morgan’s laws
x F ( x) in place of (x) F ( x)
and x F ( x) in place of (x) F ( x) .
Step3: Rename variables if necessary so that all remaining quantifiers have different
variable assignments.
For example,
Replace x ( P( x)  (x Q( x)))

by x ( P( x)  (y Q( y))) .
Step4: Replace existentially quantified variables with special functions and
eliminate the corresponding quantifiers.
Step5: Drop all universal quantifiers and put the remaining expression into
conjunctive normal form (CNF). (Disjunctions are moved down to literals).
Step6: Drop all conjunction symbols writing each clause previously connected by
the conjunctions on a separate line.

I nference R ules
A key inference rule in FOPL is modus ponens.
Example:
If ‘a’ has a property P and all objects that have property P also have property Q, we
conclude that ‘a’ has property Q.
Assertion : P(a)
Implication:  x P(x)  Q(x)
-----------------------------
Conclusion: Q(a)
Note:
1. We can substitute a for x.
2. Substitution helps in simplifying the expressions.
3. The above can be written as P(a)  Q(a).
4. If z can be substituted for y, it can be denoted as z/y.

http://rajakishor.co.cc Page 17
U nification (matching)
Bound – value has been assigned to variables.
Free – value not been assigned to variables.
Two predicates are said to unify (match) if the following three conditions are
satisfied:
1. They have same predicate value.
2. They have same number of arguments.
3. All pairs of corresponding arguments match.
The unification algorithm is based on condition 3. To check the 3 rd condition, we use
unification algorithm.
Unification Algorithm:
Step 1: Take the first pair of corresponding arguments.
Step 2: if both are constants
If the two constants are the same
then they match. Go to step-5.
Else, they do not match. Go to step-7.
Step 3: if both are variables
(a) If both are free
then bind them two each other.
Now, they match. Goto step-5.
(b) If both are bound
If two bound values are same
then they match. Goto step-5.
Else, they do not match. Goto step-7.
(c) If one is bound and the other is free
Bind the free variable to the same value of the bound variable.
Now, they match. Goto Step-5.
Step 4: if one is a constant and other is a variable
(a) If variable is free
Bind the variable to the constant.
Now, they match. Goto step-5.
(b) If variable is bound
If bounded value and the constant are same,
then they match. Goto step-5.
Else, they do not match. Goto step-7.

http://rajakishor.co.cc Page 18
Step 5: if no more arguments
The two predicates unify. End.
Step 6: if there are more arguments
Take the next pair of corresponding arguments. Goto step-2.
Step 7: The two predicates do not unify.
End.

T R he esolution P rinciple
The resolution principle is a systematic inference procedure which, when applied to
a set of clauses, determines if the set is unsatisfiable.
The process
 is an inference process in predicate logic.
 uses the method of proof by contradiction (reduction ad absurdum).
 requires all facts to be in clausal form.
Principle:
If it is possible to draw conclusions from a given set of facts, all those facts are TRUE.
If it is unable to draw the conclusion, one or more facts are FALSE.
Process of resolution:
1. Let C1 and C2 be two clauses with no variables in common.
2. Let L1 and L2 are literals in C1 and C2 respectively.
3. L1 is a complement of L2.
4. Delete both L1 and L2.
5. Form a disjuncted C from the remaining reduced clauses.
6. The new clause C is called the resolution of C1 and C2.

http://rajakishor.co.cc Page 19
Resolution is the process of generating these resolvents from a set of clauses.
Example:
To resolve the two clauses
(¬P v Q) and (¬Q v R)
we write
¬P v Q , ¬Q v R
--------------------
¬P v R
¬P v Q is true and ¬Q v R is true, then ¬P v R is also true.

Types of resolution
1. Binary resolution
Two clauses having complementary literals are combined as disjuncts to produce a
single clause after deleting the complementary literals.
Example:
¬P(x, a) v Q(x) and ¬Q(b) v R(x)
 ¬P(x, a) v Q(b) and ¬Q(b) v R(x)
[b is substituted for x as Q and ¬Q are complementaries]
 ¬P(b, a) v Q(b) and ¬Q(b) v R(b)
[b is substituted for x]
 ¬P(b, a) v R(b) [by deleting the complementary literals]

2. Unit resulting (UR) resolution


A number of clauses are resolved simultaneously to produce a unit clause. All except
one of the clauses are unit clauses and that one clause has exactly one more literal than the
total number of unit clauses.
Example:
{¬MARRIED(x, y) v ¬MOTHER(x, z) v FATHER(y, z),
MARRIED(SUE, JOE),
¬FATHER(JOE, BILL)
}
By using the substitution
 = {SUE/x, JOE/y, BILL/z}
the resultant unit clause is
¬MOTHER(SUE, BILL)

http://rajakishor.co.cc Page 20
3. Linear resolution
When each resolved clause Ci is a parent to the clause Ci+1 (i = 1, 2, …, n-1) the
process is called linear resolution.
Example:
Given a set S of clauses with C0  S.
Cn is derived by a sequence of resolutions.
C1 is derived from C0 with some clause B0.
C2 is derived from C1 with some clause B1 and so on ... until Cn is derived.

4. Linear input resolution


If one of the parents in linear resolutions is always from the original set of clauses
(the Bi), we have linear input resolution.
Example:
Given the set of clauses
S = {P v Q , ¬P v Q , P v ¬Q , ¬P v ¬Q}
Let C0 = (P v Q)
Choosing B0 = ¬P v Q from S and resolving this with C0, we obtain the
resolvent Q = C1.
B1 must now be chosen from S and the resolvent of C1 and B1 becomes C2, and
so on …

S Set-of- upport S trategy


Procedure:
Step1: Let P be the statement whose truth value is to be proved.
Step2: Write all known truths in clausal form and add ¬P in clausal form to this set.
Step3: Take any two facts from the set and resolve.
The resolvent is the disjunction of the two facts.
If any predicate appears in negated as well as in non-negated form do not
include it in the resolvent.
Step4: Add the resolvent to the set of facts.
Step5: Repeat steps 3 & 4 until
(a) A null resolvent is reached

http://rajakishor.co.cc Page 21
or
(b) Some predicate in the resolvent persists (does not get eliminated) even
after any iteration of steps 3 & 4 and unable to make progress.
Step6: If null resolvent (empty clause) is reached:
This is “contradiction”, i.e., unable to draw a conclusion.
This means, one or more facts in the given set are FALSE.
¬P is the only statement that can be FALSE.
Therefore, P must be TRUE.
Step7: If unable to progress:
We are able to draw conclusion from the given set of facts. So, all facts in that
set are TRUE, including ¬P.
Therefore, P must be FALSE.

Note: The empty clause [ ] is always false since no interpretation can satisfy it. It is derived
from combining contradictory clauses such as P and ¬P.

Example:
Known truths
1. One of Ravi, Raghu, Ramu and Rajesh is a spy.
2. Spies do not wear light-colored cloths and do not attract attention to themselves.
3. Ravi is not a spy.
4. Raghu likes wear light colored cloths.
5. Ramu was the main attraction in yesterday’s party.
Find out whether Rajesh is a spy using resolution.
Solution:
1. One of Ravi, Raghu, Ramu and Rajesh is a spy.
SPY(x): x is a spy.
SPY(Ravi) v SPY(Raghu) v SPY(Ramu) v SPY(Rajesh)
2. Spies do not wear light colored cloths and do not attract attention.
SPY(x): x is a spy
WLC(x): x wears light-colored clothes
AA(x): x attracts attention to himself.
Now, we have

http://rajakishor.co.cc Page 22
x SPY ( x)  (WLC ( x) & AA( x))
 x SPY ( x)  (WLC ( x) & AA( x))
 SPY ( x)  (WLC ( x) & AA( x ))
 (SPY ( x)  WLC ( x)) & (SPY ( x)  AA( x))

 (a) SPY ( x)  WLC( x)


(b) SPY ( y)  AA( y)
3. Ravi is not a spy.
¬SPY(Ravi)
4. Raghu likes to wear light-colored clothes.
WLC(Raghu)
5. Ramu was the main attraction in yesterday’s party.
AA(Ramu)
The known truths are
1. SPY(Ravi) v SPY(Raghu) v SPY(Ramu) v SPY(Rajesh)
2. ¬SPY(x) v ¬WLC(x)
3. ¬SPY(y) v ¬AA(y)
4. ¬SPY(Ravi)
5. WLC(Raghu)
6. AA(Ramu)
7. To prove SPY(Rajesh), we assume ¬SPY(Rajesh).

Now, from (1) and (7) we get


SPY(Ravi) v SPY(Raghu) v SPY(Ramu) v SPY(Rajesh) v ¬SPY(Rajesh)
 SPY(Ravi) v SPY(Raghu) v SPY(Ramu) --- (8)
[by eliminating complements]
From (4) and (8)
¬SPY(Ravi) v SPY(Ravi) v SPY(Raghu) v SPY(Ramu)
 SPY(Raghu) v SPY(Ramu) --- (9)
[by eliminating complements]
From (2) and (9)
SPY(Raghu) v SPY(Ramu) v ¬SPY(x) v ¬WLC(x)
Applying (x/Raghu)

http://rajakishor.co.cc Page 23
SPY(Raghu) v SPY(Ramu) v ¬SPY(Raghu) v ¬WLC(Raghu)
SPY(Ramu) v ¬WLC(Raghu) --- (10)
Form (10) and (5) we get
SPY(Ramu) v ¬WLC(Raghu) v WLC(Raghu)
SPY(Ramu) --- (11)
From (11) and (3), we get
SPY(Ramu) v ¬SPY(y) v ¬AA(y)
Applying (y/Ramu)
SPY(Ramu) v ¬SPY(Ramu) v ¬AA(Ramu)
 ¬AA(Ramu) --- (12)
From (12) and (6), we get
¬AA(Ramu) v AA(Ramu)
 []
The assumption ¬SPY(Rajesh) resulted in FALSE conclusion.
¬SPY(Rajesh) is false.
SPY(Rajesh) is true.
Rajesh is spy.

http://rajakishor.co.cc Page 24

Potrebbero piacerti anche