23
1 Conversion to Conversion to Conjunctive Normal Conjunctive Normal Form Form

Conversion to Conjunctive Normal Form

Embed Size (px)

DESCRIPTION

Conversion to Conjunctive Normal Form. Assertion. All Romans who know Marcus either hate Caesar or think than anyone who hates anyone is crazy. All Romans wish they were Greeks. Expressed in FOPL. For the transformation, let’s simplify. Let P = roman(X) Q = know(X, marcus) - PowerPoint PPT Presentation

Citation preview

Page 1: Conversion to Conjunctive Normal Form

11

Conversion to Conjunctive Conversion to Conjunctive Normal FormNormal Form

Page 2: Conversion to Conjunctive Normal Form

22

AssertionAssertion

All Romans who know Marcus either All Romans who know Marcus either hate Caesar or think than anyone hate Caesar or think than anyone who hates anyone is crazy. All who hates anyone is crazy. All Romans wish they were Greeks.Romans wish they were Greeks.

Page 3: Conversion to Conjunctive Normal Form

33

Expressed in FOPLExpressed in FOPL

))(_)((

)))),(),((((

),((

)),()(((

XgreekwishXromanX

YXthinkcrazyZYhateZY

caesarXhate

marcusXknowXromanX

Page 4: Conversion to Conjunctive Normal Form

44

For the transformation, let’s For the transformation, let’s simplifysimplify

LetLet

P = roman(X)P = roman(X)

Q = know(X, marcus)Q = know(X, marcus)

R = hate(X, caesar)R = hate(X, caesar)

S = hate(Y,Z)S = hate(Y,Z)

T = thinkcrazy(X,Y)T = thinkcrazy(X,Y)

V = wish_greek(X)V = wish_greek(X)

Page 5: Conversion to Conjunctive Normal Form

55

GivingGiving

)()))(()(( VPTSRQP

Page 6: Conversion to Conjunctive Normal Form

66

Step 1: Eliminate implication using Step 1: Eliminate implication using the identitythe identity

BABA

)))(()(( TSRQP

So

becomes

)))(()( TSRQP

Page 7: Conversion to Conjunctive Normal Form

77

Applied to the Original Applied to the Original ExpressionExpression

))(_)((

)))),(),((((

),((

)),()((

XgreekwishXromanX

YXthinkcrazyZYhateZY

caesarXhate

marcusXknowXromanX

Now eliminate the second =>

))(()( TSRQP

Page 8: Conversion to Conjunctive Normal Form

88

Applied to the original Applied to the original expressionexpression

))(_)((

)))),(),((((

),((

)),()((

XgreekwishXromanX

YXthinkcrazyZYhateZY

caesarXhate

marcusXknowXromanX

Page 9: Conversion to Conjunctive Normal Form

99

Eliminating the Third ImplicationEliminating the Third ImplicationGivesGives

))(_)((

)))),(),((((

),((

)),()((

XgreekwishXromanX

YXthinkcrazyZYhateZY

caesarXhate

marcusXknowXromanX

Page 10: Conversion to Conjunctive Normal Form

1010

Step 2: Invoke deMorganStep 2: Invoke deMorgan

))(_)((

)))),(),((((

),((

)),()(((

XgreekwishXromanX

YXthinkcrazyZYhateZY

caesarXhate

marcusXknowXromanX

Page 11: Conversion to Conjunctive Normal Form

1111

Step 3: Standardize the quantifiers Step 3: Standardize the quantifiers so that each binds a unique so that each binds a unique

variablevariableFor ExampleFor Example

Given:Given:

)()( XXqXXp

We write:

)()( YYqXXp

Page 12: Conversion to Conjunctive Normal Form

1212

Step 4: Move all quantifiers to the Step 4: Move all quantifiers to the left without changing their order left without changing their order

Step 3 makes this legalStep 3 makes this legal

)))(_)((

)),(),((

),((

),()(((

(

WgreekwishWroman

YXthinkcrazyZYhate

caesarXhate

marcusXknowXroman

WZYX

Page 13: Conversion to Conjunctive Normal Form

1313

Step 5: Eliminate Existential Step 5: Eliminate Existential Quantifiers: SkolemizationQuantifiers: Skolemization

Type 1Type 1

Given Given ))(( XschoolXTells us that there is an individual assignment to X drawn from its domain under which school(X) is satisfied.

.

Page 14: Conversion to Conjunctive Normal Form

1414

So, invent a function that goes into the domain of X and picks out just that item that satisfies school.

Call it pick The original expression is transformed to:

school(pick()) Where

– Pick is a function with no arguments– That returns the value from the domain of X that

satisfies School– We might not know how to get the value.– But we give a name to the method that we know exists

Page 15: Conversion to Conjunctive Normal Form

1515

Type 2Type 2

Suppose we haveSuppose we have

),(_( PQthangreaterQP

Where P,Q are elements of the set of integers

In English, given an integer P, there is another integer Q, such that Q > P

We can’t invent a single function, because Q depends on P

Instead, invent a function whose single argument is the universally quantified variable.

Page 16: Conversion to Conjunctive Normal Form

1616

get(P) returns an get(P) returns an integer > Pinteger > P

),(_( PQthangreaterQPBecomes

)),((_( PPgetthangreaterP

Page 17: Conversion to Conjunctive Normal Form

1717

Our example has one instance of Our example has one instance of an existentially quantified variable an existentially quantified variable within the scope of a universally within the scope of a universally

quantified variablequantified variable

))...(,(...( YpickYhateY

Becomes

)...,(...( ZYhateZY

Page 18: Conversion to Conjunctive Normal Form

1818

GivingGiving

)))(_)((

)),())(,((

),((

),()(((

(

WgreekwishWroman

YXthinkcrazyYpickYhate

caesarXhate

marcusXknowXroman

WYX

Page 19: Conversion to Conjunctive Normal Form

1919

Step 6: Drop the remaining Step 6: Drop the remaining quantifiersquantifiers

Legal since everything is universally Legal since everything is universally quantifiedquantified

))(_)((

)),())(,((

),((

),()(((

WgreekwishWroman

YXthinkcrazyYpickYhate

caesarXhate

marcusXknowXroman

Page 20: Conversion to Conjunctive Normal Form

2020

Step 7: Rewrite the expression as a Step 7: Rewrite the expression as a conjunct of disjuncts using dist. And conjunct of disjuncts using dist. And

assoc. lawsassoc. lawsThis Gives:This Gives:

))(_)((

)),()(,(

),((

),()((

WgreekwishWroman

YXthinkcrazyYpickYhate

caesarXhate

marcusXknowXroman

Page 21: Conversion to Conjunctive Normal Form

2121

Step 8: Rewrite each conjunct as a Step 8: Rewrite each conjunct as a separate clause that are implicitly separate clause that are implicitly

andedanded

))(_)(.(2

),()(,(

),((

),()(.1

WgreekwishWroman

YXthinkcrazyYpickYhate

caesarXhate

marcusXknowXroman

Page 22: Conversion to Conjunctive Normal Form

2222

Step 9: Rename variables in Step 9: Rename variables in clauses so that no two clauses use clauses so that no two clauses use

the same variable namethe same variable nameThis is already the caseThis is already the case

The Expression is now in conjunctive The Expression is now in conjunctive normal form.normal form.

))(_)(.(2

),()(,(

),((

),()(.1

WgreekwishWroman

YXthinkcrazyYpickYhate

caesarXhate

marcusXknowXroman

Page 23: Conversion to Conjunctive Normal Form

2323