test1soln ejercicios

download test1soln ejercicios

of 3

Transcript of test1soln ejercicios

  • 7/27/2019 test1soln ejercicios

    1/3

    PMATH 330 Mathematical Logic, Solutions to the Midterm

    [3] 1: Determine whether the following string X is a formula and, if so, make a derivation for it.

    X = (((P Q) (R (P Q)) (R S)))

    Solution: This is not a formula. The second open bracket is followed by the formula (P Q) which isfollowed by the binary connective then by the formula (R (P Q)), and this must be followed by theclose bracket symbol, but it is followed by the symbol .

    [3] 2: Convert the following formula F into prefix notation.

    F = ((((P Q) (R S)) (P R)) Q)

    Solution: In prefix notation, this becomes

    PQ RS P RQ

    [3] 3: Determine whether the following string X is a list of formulas in prefix notation and, if so, convert it tostandard notation.

    X = P Q R Q P Q S P R .

    Solution: This is a list of two formulas in prefix notation. In standard notation, it becomes

    (P (Q R)) (Q ((P Q) S))

    , (P R)

    [3] 4: List all of the formulas that can be obtained by inserting brackets into the following string.

    P Q R

    Solution: We must insert two pairs of brackets. The inner pair can be placed in the following 5 ways:

    P (Q R) , P (Q R) , (P Q) R , (P Q) R , (P Q) R

    For each of these 5 ways, it is not hard to list all the ways of inserting the outer pair of brackets. We obtainthe following 12 formulas:

    (P (Q R)) , (P (Q R)) , (P (Q R))

    (P (Q R)) , (P (Q R)) , (P (Q R))

    ((P Q) R) , ((P Q) R) , ((P Q) R)

    ((P Q) R) , ((P Q) R) , ((P Q) R)

    [3] 5: Let F =

    ((P Q) R) (Q R)

    . Determine whether F is a tautology.

    Solution: We make a truth-table.

    P Q R P (P Q) ((P Q) R) R (Q R) F

    1 1 1 0 1 1 0 0 11 1 0 0 1 0 1 1 1

    1 0 1 0 1 1 0 1 11 0 0 0 1 0 1 1 10 1 1 1 1 1 0 0 10 1 0 1 1 0 1 1 10 0 1 1 0 0 0 1 10 0 0 1 0 1 1 1 1

    We see that F is true on every row, so F is a tautology.

    1

  • 7/27/2019 test1soln ejercicios

    2/3

    [3] 6: Let F = ((P Q) R), G = ((P Q) R) and H = (P (R Q)). Determine whether {F,G,H} issatisfiable.

    Solution: We make a truth-table.

    P Q R (P Q) F (P Q) G P (R Q) H

    1 1 1 1 1 1 1 0 1 0

    1 1 0 1 0 1 0 0 1 01 0 1 0 0 0 1 0 0 01 0 0 0 1 0 1 0 1 00 1 1 0 0 1 1 1 1 10 1 0 0 1 1 0 1 1 10 0 1 1 1 1 1 1 0 00 0 0 1 0 1 0 1 1 1

    We see that there is no row where F, G and H are all true, so {F,G,H} is not satisfiable.

    [3] 7: Let F and G be formulas. Make a derivation for the following truth-equivalence. Provide justification ateach step.

    (F G) ((F G) H)

    treq

    F (G H))

    Solution: Here is one possible derivation.1. ((F G) ((F G) H))2. ((F G) ((F G) H)) Implication3. ((F G) ((F G) H)) Implication4. ((F G) (F (G H))) Associativity5. (F (G (G H))) Distributivity6. (F ((G G) (G H))) Distibutivity7. (F ((G H) (G G))) Commutativity8. (F ((G H) (G G))) Commutativity9. (F (G H)) Tautology10. (F (G H)) Implication

    [4] 8: Let F = (P (QR)), G = (P R) and K = ((PQ)R). Use truth-equivalences to put ((FG) K)

    into DNF, and hence determine whether {F, G} |= K.Solution: We have

    ((F G) K) = ((P (Q R)) (P R)) ((P Q) R)

    treq ((P (Q R)) (P R) (R P)) ((P Q) R)

    treq ((P (Q R)) (P R) (R P)) ((P Q) R)

    treq ((P (Q R)) (P R) (R P)) (P Q) (R)

    treq (P (Q R)) (P R) (R P)

    (P Q) (R)

    treq (P (Q R)) (P R) (P Q) (R)

    treq (P Q) (P R)

    (P R) (P Q) (R)

    treq (P Q R) (P Q R) (P Q R) (P Q R) (P Q R)

    (P Q R) (P Q R)

    (P Q R)

    (P Q R) (P Q R)

    treq (P Q R) (P Q R) (P Q R) (P Q R)

    (P Q R) (P Q R) (P Q R) (P Q R)

    Since the DNF formula contains all 8 constituents, we have |= ((F G) K) and hence {F, G} |= K.

    2

  • 7/27/2019 test1soln ejercicios

    3/3

    [3] 9: Determine the number of DNF formulas F on {P, Q} such that

    either F |= P or F |= Q

    Solution: There are 6. They are the 6 DNF formulas F1, , F6 with the following truth-table columns.

    P Q F1 F2 F3 F4 F5 F6

    1 1 1 1 0 0 1 01 0 1 0 1 0 0 0

    0 1 0 0 0 0 1 10 0 0 0 0 0 0 0

    Indeed, in order to have F |= P, the truth-table column for F must have a 0 in rows 3 and 4, so F must beone of the formulas F1, F2, F3, F4, and in order to have F |= Q, the column for F must have a 0 in rows 2and 4, so F must be one of F2, F4, F5, F6. To be explicit, the DNF formulas are F1 = (P Q) (P Q),F2 = (P Q), F3 = (P Q), F4 = , F5 = (P Q) (P Q) and F6 = (P Q).

    [4] 10: Let and be binary connectives with (F G) treq (F G) and (F G) treq (F G). Determinewhether {} is adequate, and determine whether {} is adequate. Explain your answers.

    Solution: The set {} is adequate since F treq (F F) treq (F F) and (F G) treq (F G)treq ((F F) (G G)), and so the connectives and can both be expressed in terms of (up to

    truth-equivalence) and we know that {, } is adequate.On the other hand, the set {} is not adequate since every formula which only uses the connective

    has a 0 in the last row of its truth-table column. Indeed, let be the truth-evaluation with (P) = 0 forevery propositional variable P. Then if F = P where P is a propositional variable then (F) = (P) = 0,and if F = (G H) where G and H are formulas with (G) = (H) = 0 then we have (F) = (G H) =((G H)) = 0, and so by induction on formulas which only use , we have (F) = 0 for every suchformula F.

    [4] 11: Apply the DPP to determine whether the following clause set S is satisfiable and, if so, find every truth-evaluation on {P,Q,R,S} which satisfies S.

    S =

    {P,Q, R}, {P, Q, S}, {P,R, S}, {P, R}, {P, S}, {Q,R,S}, {Q, S}

    Solution: We resolve on P and clean up to get

    S1 = {Q, R}, {Q, R, S} , {Q, R, S} , {Q, S}, {Q,R,S}, {Q, S} .Next we resolve on Q to get

    S2 =

    {R, S}, {R, S}, {R, S}

    .

    Although it is easy to see that this clause set is satisfiable, the DPP instructs us to resolve on R to get

    S3 =

    {S}

    .

    This is satisfiable. Let us find every truth-evaluation which satisfies S. From the clause {S} is S3, wemust have (S) = 1; from the clause {R, S} in S2 we must have (R) = 0; from the clause {Q, S} inS1 we must have (Q) = 0; and from the clause {P,R, S} in S we must have (P) = 1. Thus the onlytruth-evaluation which satisfies S is the one given by the following table

    P Q R S

    1 0 0 1

    [4] 12: Determine, with proof, whether the following statement is true, for all formulas F, G, H.

    If (F G) |= H then F |= (G H) .

    Solution: The statement is true, and we give a proof. Suppose that (F G) |= H. Let be a truth-evaluation. Suppose that (F) = 1.

    We must show that (G H) = 1

    . Suppose that (G) = 1.

    Now

    we must show that (H) = 1

    . Since (F) = (G) = 1 we have (F G) = 1. Since (F G) = 1 and(F G) |= H we have (H) = 1 as required.

    3