Conversion to Conjunctive Normal Form

Post on 30-Dec-2015

34 views 4 download

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

Transcript of Conversion to Conjunctive Normal Form

11

Conversion to Conjunctive Conversion to Conjunctive Normal FormNormal 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.

33

Expressed in FOPLExpressed in FOPL

))(_)((

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

),((

)),()(((

XgreekwishXromanX

YXthinkcrazyZYhateZY

caesarXhate

marcusXknowXromanX

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)

55

GivingGiving

)()))(()(( VPTSRQP

66

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

BABA

)))(()(( TSRQP

So

becomes

)))(()( TSRQP

77

Applied to the Original Applied to the Original ExpressionExpression

))(_)((

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

),((

)),()((

XgreekwishXromanX

YXthinkcrazyZYhateZY

caesarXhate

marcusXknowXromanX

Now eliminate the second =>

))(()( TSRQP

88

Applied to the original Applied to the original expressionexpression

))(_)((

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

),((

)),()((

XgreekwishXromanX

YXthinkcrazyZYhateZY

caesarXhate

marcusXknowXromanX

99

Eliminating the Third ImplicationEliminating the Third ImplicationGivesGives

))(_)((

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

),((

)),()((

XgreekwishXromanX

YXthinkcrazyZYhateZY

caesarXhate

marcusXknowXromanX

1010

Step 2: Invoke deMorganStep 2: Invoke deMorgan

))(_)((

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

),((

)),()(((

XgreekwishXromanX

YXthinkcrazyZYhateZY

caesarXhate

marcusXknowXromanX

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

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

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.

.

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

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.

1616

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

),(_( PQthangreaterQPBecomes

)),((_( PPgetthangreaterP

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

1818

GivingGiving

)))(_)((

)),())(,((

),((

),()(((

(

WgreekwishWroman

YXthinkcrazyYpickYhate

caesarXhate

marcusXknowXroman

WYX

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

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

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

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

2323