ai - knowledge representation

24
 4 K R

Upload: girish-kumar-nistala

Post on 08-Apr-2018

234 views

Category:

Documents


0 download

TRANSCRIPT

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 1/24

 

4

KnowledgeRepresentation

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 2/24

 

http://rajakishor.co.cc  Page 2

Knowledge can be defined as the body of facts and principles accumulated byhumankind 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 thesenotions 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 theknowledge possessed by the organism, the facts, rules, and so on. The average human brainweights about 3.3 pounds and contains an estimated number of 1012 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 severalprogramming languages.

To truly understand and make use of the knowledge of one world, a person needsother world knowledge and the ability to reason with it.

Knowledge may be declarative or procedural. Declarative knowledge is passiveknowledge expressed as statements of facts about the world. Procedural knowledge iscompiled 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 ismore. It combines relationships, correlations, dependencies.

Belief 

It is any meaningful and coherent expression that can be represented. It can be trueor false.

Hypothesis

It is a justified belief that is not known to be true. It is a belief which is backed upwith some evidence, but it may still be false.

Thus, knowledge can be defined as true justified belief.

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 3/24

 

http://rajakishor.co.cc  Page 3

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 ratherthan the particular inference schemes and other formalisms it employs.

Knowledge-based systems get their power from the expert knowledge that has beencoded into facts, rules, heuristics, and procedures.

Components of knowledge-based systems

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

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 4/24

 

http://rajakishor.co.cc  Page 4

K nowledgeRepresentation

Levels of knowledge representation.

Ex: Card game.Representing the suits and face values.

Knowledge and reasoning are important f or artificial agent s because they enablesuccessf ul behaviors that would be very hard to achieve otherwise.

The k nowledge of problem-solving agent s is, however, very specif ic and inflexible.Knowledge-based agent s can benefit  f rom knowledge expressed in very general forms,combining and recombining information t o 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 thephysician uses in the form of rules learned from textbooks and teachers, and some is in theform 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.

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 5/24

 

http://rajakishor.co.cc  Page 5

K nowledge-based Agents

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 alanguage called a knowledge representation language and represents some assertion about the world.

There must be a way t o add new statements to the knowledge base and a way toquery what is k nown. The st andard names for these tasks are T E LL and ASK , respectively.Bot h tasks may involve inference, that is, deriving new sentences f rom old.

In logi c al agent  s, inference must obey the fundamental requirement that when oneasks a question of t he knowledge base, t he answer should f ollow from what has been t oldto t he k nowledge base previously.

An outline of a knowledge-based agent is shown below: 

function KB-AGENT( percept) returns an actionstatic: KB, a knowledge base

t, a counter, initially 0, indicating timeTELL( 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 maybe done about the current state of the world, about the outcomes of possible actionsequences; and so on. Once the action is chosen, the agent records its choice with TELL andexecutes the action. The second TELL is necessary to let the knowledge base know that thehypothetical action has actually been executed.

T he Logic

Knowledge bases consist of statements. These statements are expressed accordingto the syntax of the representation language, which specifies all the statements that arewell formed.

The notion of syntax is clear enough in ordinary arithmetic: "x + y = 4" is a well-formed statement, whereas "x2y+ =" is not.

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 6/24

 

http://rajakishor.co.cc  Page 6

In any case, statements in an agent ’s knowledge base are real physicalconfigurations of the agent. Reasoning will involve generating and manipulating thoseconfigurations.

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 is1. 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 betweenstatements. In mathematics, we write it as P Q, which means that the statement P entailsthe 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 Logic 

The first representation scheme of knowledge is First Order Predicate Logic (FOPL).

The application logic as a practical means of representing and manipulatingknowledge in a computer was not demonstrated until the early 1960s.

Today, FOPL or Predicate Calculus has assumed one of the most important roles inAI for the representation of the knowledge.

Logic is a formal method for reasoning. Many concepts which can be verbalized canbe translated into symbolic representations, which closely approximate the meaning of these concepts. These symbolic structures can then be manipulated in programs to deducevarious facts, to carry out a form of automated reasoning.

In FOPL, statements from a natural language like English are translated intosymbolic structures comprised of predicates, functions, variables, constants, quantifiers,and logical connectives. The symbols form the basic building blocks for the knowledge, andtheir 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 structuresinto 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))

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 7/24

 

http://rajakishor.co.cc  Page 7

 S yntax and S emantics for P ropositional Logic 

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 tothe rules of propositional syntax. This syntax governs the combination of basic buildingblocks such as propositions and logical connectives. Propositions are elementary atomicsentences. 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.

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 8/24

 

http://rajakishor.co.cc  Page 8

 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 valuestrue 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 truthvalue 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 bedetermined.

If A is any statement, t and t’ denote any true statements, and f and f’ denote anyfalse statements – the semantic rules are summarized below:

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 9/24

 

http://rajakishor.co.cc  Page 9

Rule No. True statement False statement 

1. T F

2. ~f ~t 

3. t & t ’ f & A

4. t v A A & f 

5. A v t  f v f ’ 

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 thestatement ((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

F v Q : by rule 6

F : by rule 5

Thus, the statement value is false.

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 10/24

 

http://rajakishor.co.cc  Page 10

P roperties of  S tatements

S.No. Property Description Example1. Satisfiable A statement is satisfiable if 

there is some interpretationfor which it is true.

P is satisfiable but not valid since aninterpretation that assigns false toP assigns false to the sentence P.

2. Contradiction A sentence is contradictory(unsatisfiable) if there is nointerpretation for which it istrue.

P & ~P is a contradiction sinceevery interpretation results in avalue of false for (P & ~P).

3. Valid A sentence is valid if it is truefor every interpretation. Validsentences are calledtautologies.

P v ~P is valid since everyinterpretation results in a value of true for (P v ~P).

4. Equivalence Two sentences are equivalent if they have the same truthvalue under everyinterpretation.

P and ~(~P) are equivalent sinceeach has the same truth valuesunder every interpretation.

5. Logicalconsequences

A sentence is a logicalconsequence of another if it issatisfied by all interpretationswhich satisfy the first.

P is a logical consequence of (P & Q)since any interpretation for which(P & Q) is true, P is also true.

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 

P v P = PP ^ P = P

 2.   Associativity 

(P v Q) v R = P v (Q v R)

(P & Q) & R = P & (Q & R)3.  Commutativity 

P v Q = Q v PP & Q = Q & PP Q Q P  

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 11/24

 

http://rajakishor.co.cc  Page 11

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 . 

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 12/24

 

http://rajakishor.co.cc  Page 12

I nference Rules 

The inference rules of propositional logic provide the means to perform logicalproofs and deductions.

1.  Modus Ponens

From P and P Q infer Q. This is written as

PP Q----------Q

Ex:

given: Raj Likes fruitsand : (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 QQ 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

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 13/24

 

http://rajakishor.co.cc  Page 13

F ormal S ystems 

A formal system is a set of axioms S and a set of inference rules L from which newstatements can be logically derived. We will denote a formal system as <S, L> or simply as aKB (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 andonly if any sentence s logically implied by <S, L> can be derived using that procedure.

Example:

Suppose S = {P, PQ} and L is the modus ponens rule. Then <S, L> is a formalsystem, since Q can be derived from the system. Also, the system is both sound andcomplete.

 S yntax and S emantics for F OPL

FOPL was developed by logicians to extend the expressiveness of propositionallogic. It is a generalization of propositional logic that permits reasoning about worldobjects 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

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 14/24

 

http://rajakishor.co.cc  Page 14

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(t 1, t 2, …, t n).A 0-ary function is a constant.

6.  Predicates:

Predicate symbols denote relations or functional mappings from theelements 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 asP(t 1, t 2, …, t n), where the terms t i are defined over some domain.

Constants, variables and functions are referred to as “terms” and predicates arereferred 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 thepredicates 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 todayT(X) X pays tax

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 15/24

 

http://rajakishor.co.cc  Page 15

Using the above abbreviations, we can represent E1, E2, and E3 as

1' : (( ( ) & ( ( ),1400)) ( ))

2 ' : ( ( ) ( ))

3' : (( ( ) & ( )) ( ( ), ( )))

  E x E x GE i x T x

 E x E x S y

  E 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 logicalconnectives.

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) areWFFs.

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 todenote 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 aWFF, we say an interpretation is given to the WFF.

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 16/24

 

http://rajakishor.co.cc  Page 16

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 theyare 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 thedomain 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 expressionsis 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 whichno variables occur in the expression. A horn clause is a clause with at most one positiveliteral.

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 thecorresponding quantifiers.

5.  Drop all universal quantifiers and put the remaining expression into conjunctivenormal form (CNF). (Disjunctions are moved down to literals).

6.  Drop all conjunction symbols writing each clause previously connected by theconjunctions 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.

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 17/24

 

http://rajakishor.co.cc  Page 17

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 andeliminate the corresponding quantifiers.

Step5: Drop all universal quantifiers and put the remaining expression intoconjunctive normal form (CNF). (Disjunctions are moved down to literals).

Step6: Drop all conjunction symbols writing each clause previously connected bythe conjunctions on a separate line.

I nference Rules 

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, weconclude 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.

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 18/24

 

http://rajakishor.co.cc  Page 18

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 3rd condition, we useunification 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 boundIf 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 freeBind 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.

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 19/24

 

http://rajakishor.co.cc  Page 19

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 he Resolution 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.

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 20/24

 

http://rajakishor.co.cc  Page 20

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 asingle 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 thetotal 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)

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 21/24

 

http://rajakishor.co.cc  Page 21

3.  Linear resolution

When each resolved clause Ci is a parent to the clause Ci+1  (i = 1, 2, …, n-1) theprocess 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 theresolvent Q = C1.

B1 must now be chosen from S and the resolvent of C1 and B1 becomes C2, andso on … 

 S et-of- S 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

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 22/24

 

http://rajakishor.co.cc  Page 22

or

(b) Some predicate in the resolvent persists (does not get eliminated) evenafter 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 derivedfrom 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

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 23/24

 

http://rajakishor.co.cc  Page 23

( ) ( ( ) & ( ))

( ) ( ( ) & ( ))

( ) ( ( ) & ( ))

( ( ) ( )) & ( ( ) ( ))

  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)

8/6/2019 AI - Knowledge Representation

http://slidepdf.com/reader/full/ai-knowledge-representation 24/24

 

http://rajakishor co cc Page 24

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.