Converting arbitrary wffs to CNF - PowerPoint PPT Presentation

About This Presentation
Title:

Converting arbitrary wffs to CNF

Description:

Converting arbitrary wffs to CNF ... At this stage there is no remaining ... The composition of and a, denoted by a, is the substitution consisting of the ... – PowerPoint PPT presentation

Number of Views:188
Avg rating:3.0/5.0
Slides: 11
Provided by: Syste98
Category:

less

Transcript and Presenter's Notes

Title: Converting arbitrary wffs to CNF


1
Converting arbitrary wffs to CNF
  • A wff is in prenex form iff it consists of a
    string of quantifiers (called a prefix) followed
    by a quantifier free formula called a matrix.
  • 5. Convert to Prenex Form
  • At this stage there is no remaining existential
    quantifiers and each universal quantifier has its
    own variable symbol.
  • We may now move all of the universal quantifiers
    to the front of the wff and let the scope of each
    quantifier include the entirety of the wff
    following it. The resulting wff is in
  • prenex form.
  • From (1) ?X(?P(X) v ?Y((? P(Y) v P(f(X, Y))) ?
    Q(X, h(X)) ? ?P(h(X))))
  • ?X ?Y(?P(X) v ((? P(Y) v P(f(X, Y))) ? Q(X, h(X))
    ? ?P(h(X))))

2
Converting arbitrary wffs to CNF
  • 6. Eliminate universal quantifiers
  • Since all the variables in the wff we use must be
    within the scope of a quantifier, we are assured
    that all the variables remaining at this step are
    universally quantified.
  • Furthermore, the order of universal
    quantification is unimportant, so we may
    eliminate the explicit occurrence of universal
    quantifiers and assume, by convention, that
  • all variables in the matrix are universally
    quantified.

3
Converting arbitrary wffs to CNF
  • 7. Put the Matrix in CNF
  • Distribute ? over v
  • (A ? B) v C becomes (A v C) ? (B v C)
  • Flatten nested conjunctions and disjunctions
  • (A v B) v C becomes (A v B v C)
  • (A ? B) ? C becomes (A ? B ? C)
  • At this point we have a conjunction of clauses
  • We must have a set of clauses!
  • separate the conjuncts

4
Substitution
  • A substitution ? is a set of ordered pairs
  • ? X1 / t1 ,...., Xn / tn
  • where Xi is a variable and ti is a term such that
    all Xi are distinct.
  • A simple expression is either an atom or a term.
  • Example E1 P(X, X, Y), ? X / bill, Y / Z
  • E1 ? P(bill, bill , Z)
  • Means that for each pair xi / ti , the term ti
    is substituted simultaneoulsy for every
    occurrence of the variable xi throughout the
    scope of the substitution (E1)

5
Composition
  • Let ? X1 / s1 ,...., Xm / sm and a Y1 /
    t1 ,...., Yn / tn be substitutions.
  • The composition of ? and a, denoted by ?a, is the
    substitution consisting of the bindings in the
    resulting sequence
  • a) consider the sequence of bindings (apply a to
    the terms of ? and concatenate the result with a)
  • X1 / (s1 a),...., Xm / (sm a) , Y1 / t1 ,...., Yn
    / tn
  • b)delete from this sequence
  • any binding Xi / (si a) for which Xi (si a) and
  • any binding Yj / tj for which Yj ? X1 ,...., Xm
    .

6
Composition
  • Examples
  • 1) Let ? X / f(Y), Z / U and a Y / b, U
    / Z,
  • then ?a X / f(b) , Y / b , U / Z
  • 2) Let ? X / Y and a X / a, Y / a,
  • then ?a X / a, Y /a

7
Unification
  • Let S be a finite set of simple expressions.
  • A unifier for the set S E1 , E2 is a
    substitution ? such that S? is a singleton
  • E1 ? E2 ?
  • S is said to be unifiable iff there exists such
    ?.
  • If ? is a unifier for S, and if for any unifier a
    for S there exists a substitution f such that a
    ? f,
  • then ? is called a most general unifier (mgu).
  • A mgu is unique except for variables renaming
    (alphabetic variants).

8
Unification
  • Example Let S R(X, f(Y), B), R(Z, f(B), B).
  • Then ? X /Z , Y / B is a mgu for S.
  • Although X / A , Z / A, Y / B is a unifier for
    S it is not a mgu (the simplest) since there does
    not exist a substitution f such that
  • X /Z , Y / B X / A , Z / A, Y / B f
  • Notice that X / A , Z / A, Y / B X /Z , Y /
    BZ / A

9
Unification
  • Let S be a finite set of simple expressions.
  • The Disagreement set of S is defined as follows.
  • Locate the leftmost symbol position at which not
    all members of S have the same symbol, and
    extract from each expression in S the
    subexpression begining at that symbol position.
  • The set of all these subexpressions is the
    disagreement set.
  • Example let S be the set P(x, y) , P (x,
    f(g(a)))
  • then
  • D y , f(g(a))

10
Unification Algorithm
  • Input a finite set S of simple expressions
  • Output a mgu for S (if S is unifiable)
  • 1. Set k 0 and ?0 ?.
  • 2. If S?k is a singleton, then stop ?k is an
    mgu for S.
  • Else find the disagreement set Dk of S?k .
  • 3. If there exists X and t in Dk such that
  • X is a variable not occurring in t,
  • then set ?k1 ?k x / t, increment k by 1 and
    go to step 2.
  • Else report that S is not unifiable, and stop.
Write a Comment
User Comments (0)
About PowerShow.com