well formed formulas in toc

Upload: rajendranbehappy

Post on 10-Mar-2016

17 views

Category:

Documents


0 download

DESCRIPTION

Theory of Computation , Well Formed Formulas

TRANSCRIPT

  • Chapter 1: Propositions and Predicates !Oil 11

    1.2 NORMAL FORMS OF WELL-FORMED FORMULASWe have seen various well-fonned fonnulas in tenns of two propositionalvariables, say, P and Q. We also know that two such fonnulas are equivalentif and only if they have the same truth table. The number of distinct truthtables for fonnulas in P and Q is 24. (As the possible combinations of truthvalues of P and Q are IT, TF, FT, FF, the truth table of any fonnula in Pand Q has four rows. So the number of distinct truth tables is 24.) Thus thereare only 16 distinct (nonequivalent) fonnulas, and any fonnula in P and Q isequivalent to one of these 16 fonnulas.

    In this section we give a method of reducing a given fonnula to anequivalent fonn called the 'nonnal fonn'. We also use 'sum' for disjunction,'product' for conjunction, and 'literal' either for P or for -, P, where P is anypropositional variable.

    DefInition 1.6 An elementary product is a product of literals. An elementarysum is a sum of literals. For example, P 1\ -, Q, -, P 1\ -, Q, P 1\ Q, -, P 1\ Qare elementary products. And P v -, Q, P v -, R are elementary sums.DefInition 1.7 A fonnula is in disjunctive nonnal fonn if it is a sum ofelementary products. For example, P v (Q 1\ R) and P v (-, Q 1\ R) are indisjunctive nonnal fonn. P 1\ (Q v R) is not in disjunctive nonnal fonn.

    1.2.1 CONSTRUCTION TO OBTAIN A ~CTIVE NORMALFORM OF A GIVEN FORMULA ~

    Step 1 Eliminate ~ and :::} using logical identities. (We can use I 1e, l.e.P ~ Q == (-, P v Q).)Step 2 Use DeMorgan's laws (/6) to eliminate -, before sums or products.The resulting fonnula has -, only before the propositional variables, i.e. itinvolves sum, product and literals.Step 3 Apply distributive laws (/4) repeatedly to eliminate the product ofsums. The resulting fonnula will be a sum of products of literals, i.e. sum ofelementary products.

    EXAMPLE 1.11

    Obtain a disjunctive nonnal fonn ofP v (-,P ~ (Q v (Q ~ -,R)

    SolutionP v (--, P ~ (Q v (Q ~ -, R)

    == P v (--, P ~ (Q v (--, Q v -, R)== P v (P v (Q v (--, Q v -, R)

    (step 1 using In)(step 1 using 112 and h)

    http://engineeringbooks.net

  • 12 ~ Theory ofComputer Science

    == P v P v Q v -, Q v -, R by using 13== P v Q v -, Q v -, R by using Ii

    Thus, P v Q v -, Q v -, R is a disjunctive normal form of the given formula.

    EXAMPLE 1.12Obtain the disjunctive normal form of

    (P ;\ -, (Q ;\ R)) v (P =} Q)

    Solution(P ;\ -, (Q ;\ R)) v (P =} Q)

    == (P ;\ -, (Q ;\ R) v (---, P v Q) (step 1 using 1d== (P ;\ (-, Q v -, R)) v (---, P v Q) (step 2 using 17)== (P ;\ -, Q) v (P ;\ -, R) v -, P v Q (step 3 using 14 and 13)

    Therefore, (P ;\ -, Q) v (P ;\ -, R) v -, P v Q is a disjunctive normal formof the given formula.

    For the same formula, we may get different disjunctive normal forms. Forexample, (P ;\ Q ;\ R) v (P ;\ Q ;\ -, R) and P ;\ Q are disjunctive normalforms of P ;\ Q. SO. we introduce one more normal form, called the principaldisjunctive nomwl form or the sum-of-products canonical form in the nextdefinition. The advantages of constructing the principal disjunctive normalform are:

    (i) For a given formula, its principal disjunctive normal form is unique.(ii) Two formulas are equivalent if and only if their principal disjunctive

    normal forms coincide.

    Definition 1.8 A minterm in n propositional variables p], .,', P/1 isQI ;\ Q2 ' " ;\ Q/l' where each Qi is either Pi or -, Pi'

    For example. the minterms in PI and P2 are Pi ;\ P 2, -, p] ;\ P 2,p] ;\ -, P'J -, PI ;\ -, P2, The number of minterms in n variables is 2/1.Definition 1.9 A formula ex is in principal disjunctive normal form if ex isa sum of minterms.

    1.2.2 CONSTRUCTION TO OBTAIN THE PRINCIPALDISJUNCTIVE NORMAL FORM OF A GIVEN FORMULA

    Step 1 Obtain a disjunctive normal form.Step 2 Drop the elementary products which are contradictions (such asP ;\ -, P),Step 3 If Pi and -, Pi are missing in an elementary product ex, replace ex by(ex;\ P) v (ex;\ -,PJ

    http://engineeringbooks.net

  • Chapter 1: Propositions and Predicates g, 13

    Step 4 Repeat step 3 until all the elementary products are reduced to sumof minterms. Use the idempotent laws to avoid repetition of minterms.

    EXAMPLE 1.13Obtain the canonical sum-of-products form (i.e. the principal disjunctivenormal form) of

    ex = P v (-, P ;\ -, Q ;\ R)

    SolutionHere ex is already in disjunctive normal form. There are no contradictions. Sowe have to introduce the missing variables (step 3). -, P ;\ -, Q ;\ R in ex isalready a minterm. Now,

    P == (P ;\ Q) v (P ;\ -, Q)== ((P ;\ Q ;\ R) v (P ;\ Q ;\ -, R)) v (P ;\ -, Q ;\ R) v (P ;\ -, Q ;\ -, R)== ((P ;\ Q ;\ R) v (P ;\ Q ;\ -, R)) v ((P ;\ -, Q ;\ R) v (P ;\ -, Q ;\ -, R))

    Therefore. the canonical sum-of-products form of ex isif;\Q;\mvif;\Q;\-,mvif;\-,Q;\m

    v (P ;\ -, Q ;\ -, R) v (-, P ;\ -, Q ;\ R)

    EXAMPLE 1.14Obtain the principal disjunctive normal form of

    ex = (-, P v -, Q) ::::} (-, P ;\ R)Solutionex = (-, P v -, Q) ::::} (-, P ;\ R)

    == hh P v -, Q)) v h P ;\ R) by using 1\2== (P ;\ Q) v h P ;\ R) by using DeMorgan's law== ((P ;\ Q ;\ R) v (P ;\ Q ;\ -, R)) v (h P ;\ R ;\ Q) v h P ;\ R ;\ -, Q))==if;\Q;\mvif;\Q;\-,mvhP;\Q;\mv(-,p;\-,Q;\m

    So, the principal disjunctive normal form of ex isif;\Q;\mvif;\Q;\-,mvhP;\Q;\mVhP;\-,QAm

    A minterm of the form Ql ;\ Q2 A ... A Qn can be represented by(11(12 .. (I", where (Ii = 0 if Qi = -, Pi and (Ii = 1 if Qi = Pi' So the principaldisjunctive normal form can be represented by a 'sum' of binary strings. ForL;.ample, (P ;\ Q ;\ R) v (P ;\ Q A -, R) v (-, P ;\ -, Q ;\ R) can be representedby 111 v 110 v 001.

    The minterms in the two variables P and Q are 00, 01, 10, and 11, Eachwff is equivalent to its principal disjunctive normal form. Every principaldisjunctive normal form corresponds to the minterms in it, and hence to a

    http://engineeringbooks.net

  • 14 ~ Theory ofComputer Science

    subset of {OO, 01, 10, 11}. As the number of subsets is 24, the number ofdistinct formulas is 16. (Refer to the remarks made at the beginning of thissection.)

    The truth table and the principal disjunctive normal form of a are closelyrelated. Each minterm corresponds to a particular assignment of truth valuesto the variables yielding the truth value T to a. For example, P 1\ Q 1\ --, Rcorresponds to the assignment of T, T, F to P, Q and R, respectively. So, ifthe truth table of a is given. then the minterms are those which correspondto the assignments yielding the truth value T to ex.

    EXAMPLE 1.1 5

    For a given formula a, the truth values are given in Table 1.12. Find theprincipal disjunctive normal form.

    TABLE 1.12 Truth Table of Example 1.15

    P Q R a

    T T T TT T F FT F T FT F F TF T T TF T F FF F T FF F F T

    SolutionWe have T in the a-column corresponding to the rows 1, 4, 5 and 8. Theminterm corresponding to the first row is P 1\ Q 1\ R.

    Similarly, the mintem1S corresponding to rows 4, 5 and 8 are respectivelyP 1\ --, Q 1\ ---, R, --, P 1\ Q 1\ Rand --, P 1\ ---, Q 1\ --, R. Therefore, the principaldisjunctive normal form of ex isifI\Ql\mvifl\--,QI\--,mvbPI\Ql\mvbPI\--,QI\--,mWe can form the 'dual' of the disjunctive normal form which is termed theconjunctive normal form.DefInition 1.10 A formula is in conjunctive normal form if it is a productof elementary sums.

    If a is in disjunctive normal form, then --, a is in conjunctive normalform. (This can be seen by applying the DeMorgan's laws.) So to obtain theconjunctive normal form of a, we construct the disjunctive normal form of--, a and use negation.

    Deimition 1.11 A maxterm in n propositional variables PI, P2, . , Pn isQl V Q2 V ... V QII' where each Qi is either Pi or --, Pi'

    http://engineeringbooks.net

  • Chapter 1: Propositions and Predicates J;;I, 15

    DefInition 1.12 A formula ex is in principal conjunctive normal form if exis a product of maxterms. For obtaining the principal conjunctive normal formof ex, we can construct the principal disjunctive normal form of -, ex and applynegation.

    EXAMPLE 1.16Find the principal conjunctive normal form of ex = P v (Q :::::} R).Solution

    -, ex= -,(P v (Q:::::} R))== -, (P v (-, Q v R)) by using 112== -, P 1\ (-, (-, Q v R)) by using DeMorgan' slaw== -, P 1\ (Q 1\ -, R) by using DeMorgan's law and 17

    -, P /\ Q 1\ -, R is the principal disjunctive normal form of -, ex. Hence,the principal conjunctive normal form of ex is

    -, (-, P 1\ Q 1\ -, R) = P v -, Q v R

    The logical identities given in Table 1.11 and the normal forms of well-formedformulas bear a close resemblance to identities in Boolean algebras and normalforms of Boolean functions. Actually, the propositions under v, 1\ and -, forma Boolean algebra if the equivalent propositions are identified. T and F act asbounds (i.e. 0 and 1 of a Boolean algebra). Also, the statement formulas forma Boolean algebra under v, 1\ and -, if the equivalent formulas are identified.

    The normal forms of \vell-formed formulas correspond to normal formsof Boolean functions and we can 'minimize' a formula in a similar manner.

    The rules of inference are simply tautologies in the form of implication(i.e. P :::::} Q). For example. P :::::} (P v Q) is such a tautology, and it is a rule

    Pof inference. We write this in the form Q . Here P denotes a premise.

    . ".PvThe proposition below the line. i.e. P v Q is the conclusion.

    http://engineeringbooks.net

    Well formed formulas.pdfBinder1scan0001

    Well formed formulas2.pdfBinder1scan0001

    Well formed formulas3.pdfBinder1scan0001

    Well formed formulas4.pdfBinder1scan0001

    Well formed formulas5.pdfBinder1scan0001