1 / 10

Converting arbitrary wffs to CNF

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

jacob
Download Presentation

Converting arbitrary wffs to CNF

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 α = {Y1 / t1 ,...., Yn / tn } be substitutions. The composition of  and α, denoted by α, is the substitution consisting of the bindings in the resulting sequence: a) consider the sequence of bindings (apply α to the terms of  and concatenate the result with α) X1 / (s1 α),...., Xm / (sm α),Y1 / t1 ,...., Yn / tn b)delete from this sequence: any binding Xi / (si α) for which Xi = (si α) and any binding Yj / tj for which Yj є {X1 ,...., Xm }.

  6. Composition Examples: 1) Let  = { X / f(Y), Z / U} and α = {Y / b, U / Z}, then α = {X / f(b) , Y / b , U / Z} 2) Let  = { X / Y } and α = {X / a, Y / a}, then α = {X / a, Y /a}

  7. Unification Let Σ be a finite set of simple expressions. A unifier for the set Σ = {E1 , E2} is a substitution  such that Σ is a singleton: E1 = E2  Σ is said to be unifiable iff there exists such . If  is a unifier for Σ, and if for any unifier α for Σ there exists a substitution φ such that α =  φ, then  is called a most general unifier (mgu). A mgu is unique except for variables renaming (alphabetic variants).

  8. Unification Example: Let Σ = {R(X, f(Y), B), R(Z, f(B), B)}. Then  = {X /Z , Y / B} is a mgu for Σ. Although {X / A , Z / A, Y / B} is a unifier for Σ it is not a mgu (the simplest) since there does not exist a substitution φ such that {X /Z , Y / B} = {X / A , Z / A, Y / B} φ Notice that {X / A , Z / A, Y / B} = {X /Z , Y / B}{Z / A}

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

  10. Unification Algorithm Input: a finite set Σ of simple expressions Output: a mgu for Σ (if Σ is unifiable) 1. Set k = 0 and 0= . 2. If Σkis a singleton, then stop: kis an mgu for Σ. Else find the disagreement set Dkof Σk. 3. If there exists X and t in Dk such that X is a variable not occurring in t, then set k+1 = k{x / t}, increment k by 1 and go to step 2. Else report that Σ is not unifiable, and stop.

More Related