
Discrete math with computers_3
.pdfC.6. PROPOSITIONAL LOGIC |
401 |
•Since P Q and P R are WFFs, (P Q) (P R) is a WFF.
•Since (P Q) (P R) and P (Q R) are WFFs, (P Q) (P R) ↔ P (Q R) is a WFF.
P |
Q |
R |
P Q |
P R |
|
Q R |
(P Q) (P R) |
|
|
True |
True |
True |
True |
True |
|
True |
True |
|
|
True |
True |
False |
True |
True |
|
True |
True |
|
|
True |
False |
True |
True |
True |
|
True |
True |
|
|
True |
False |
False |
True |
True |
|
False |
True |
|
|
False |
True |
True |
True |
True |
|
True |
True |
|
|
False |
False |
True |
False |
True |
|
True |
False |
|
|
False |
False |
False |
False |
False |
|
False |
False |
|
|
|
|
|
|
|
|||||
P |
Q |
R |
P (Q R) |
(P Q) (P R) ↔ P (Q R) |
|||||
True |
True |
True |
True |
|
|
True |
|
|
|
True |
True |
False |
True |
|
|
True |
|
|
|
True |
False |
True |
True |
|
|
True |
|
|
|
True |
False |
False |
False |
|
|
False |
|
|
|
False |
True |
True |
False |
|
|
False |
|
|
|
False |
False |
True |
False |
|
|
True |
|
|
|
False |
False |
False |
False |
|
|
True |
|
|
|
|
|
|
|
|
|
|
|
|
|
The proposition is satisfiable but not a tautology.
6.
•P and Q are WFFs.
•Since P and Q are WFFs, ¬P and ¬Q are WFFs.
• Since P , Q, ¬P and ¬Q are WFFs, P ¬Q and Q ¬P are WFFs.
•Since P and Q are WFFs, P ↔ Q is a WFF.
•Since P ↔ Q is a WFF, ¬(P ↔ Q) is a WFF.
•Since P ¬Q and Q ¬P are WFFs, (P ¬Q) (Q ¬P ) is a WFF.
• Since (P ¬Q) (Q ¬P ) and ¬(P ↔ Q) are WFFs, ((P ¬Q) (Q ¬P )) → ¬(P ↔ Q) is a WFF.
P |
Q |
¬P |
¬Q |
P ¬Q |
Q ¬P |
True |
True |
False |
False |
False |
False |
True |
False |
False |
True |
True |
False |
False |
True |
True |
False |
False |
True |
False |
False |
True |
True |
False |
False |
|
|
|
|
|
|


404 |
APPENDIX C. SOLUTIONS TO SELECTED EXERCISES |
15.
PQ
{ I}
QP Q
{→I}
Q → P Q
18.
PQ
{ I}
P Q
{ IL}
(P Q) (Q R)
19. We prove that True True → True and then that True → True True, without translating True into False → False.
True True
{ ER}
True
{→I}
True True → True
True True
{ I}
True True
{→I}
True → True True
20. We prove that True False → True and then that True → False True.
|
True |
False |
|
|
|||
|
|
{ID} |
|
{CTR} |
|
|
|
True False True |
True |
E |
|
||||
|
|
|
|
|
{ |
|
} |
True
{→I}
True False → True
True
{ IL}
True False
{→I}
True → True False
23.
•P is represented by P
•Q FALSE is represented by Or Q FALSE
406 APPENDIX C. SOLUTIONS TO SELECTED EXERCISES
(¬A B) (A ¬B) = { over }
((¬A B) A) ((¬A B) ¬B) = { comm}
(A (¬A B)) (¬B (¬A B)) = { over }
((A ¬A) (A B)) ((¬B ¬A) (¬B B)) = { comm}
((A ¬A) (A B)) ((¬B ¬A) (B ¬B)) = { compl }
(True (A B)) ((¬B ¬A) True) = { comm}
((A B) True) ((¬B ¬A) True)
={ identityappliedtwice}
(A B) (¬B ¬A)
={DM }
(A B) ¬(B A) = { comm}
(A B) ¬(A B)
32. The problem is solved by equational reasoning:
¬(A B)
={double negationappliedtwice} ¬(¬¬A ¬¬B)
={DM }
¬(¬(¬A ¬B))
= {double negation} ¬A ¬B
33. Solution by equational reasoning.
(A B) (¬A C) (B C) = { identity}
(A B) (¬A C) ((B C) False) = { compl }
(A B) (¬A C) ((B C) (A ¬A))
= { over }
(A B) (¬A C) ((B C A) (B C ¬A)) = { comm}
(A B) (¬A C) ((A B C) (¬A B C))
= { comm}
(¬A C) (A B) ((A B C) (¬A B C)) = { assoc}
(¬A C) ((A B) (A B C)) (¬A B C)



C.6. PROPOSITIONAL LOGIC |
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
||||||||||||||||||
39. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A A → False |
|
|
|
|
|
|
|
|
|
|
||||||
|
|
|
A A → False |
E |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
E |
|
|
|
|
|
|
|||||
|
|
|
|
{→ |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{→ |
|
} |
|
|
|
|
|
||
|
|
|
False |
|
|
|
{CTR} |
|
|
|
|
False |
|
|
|
|
|
{CTR} |
|
|
|
|||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||
|
|
|
B |
|
|
|
|
|
|
|
¬B |
|
|
|
|
|
|
|
|
|||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
I |
|
|
|
|
|
|
|
|
|
|
I |
|
|
|
|||||
|
|
|
A → B |
|
|
|
|
|
|
{→ |
} |
|
|
|
A → ¬B |
|
|
{→ |
} |
I |
|
|||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ |
} |
41. |
|
|
|
|
|
(A → B) (A → ¬B) |
|
|
|
|
|
|
|
|
||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||
|
|
|
|
|
|
|
P Q |
|
|
|
|
R S |
|
|
|
|
|
|
|
|
|
|
||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ I} |
|
|
{ I} |
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||
|
|
|
|
|
|
|
|
|
|
|
P Q |
|
|
|
|
R S |
|
|
|
I |
|
|
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
(P Q) (R S) |
|
{ |
} |
|
|
|
|
|
|||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
42. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
P Q |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ EL} |
|
P → R |
|
|
|
|
|
|
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
P |
|
|
|
|
E |
|
|
|
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{→ |
|
|
} |
|
|
|
|
|
|
|
R
{→I}
PQ → R
43.We prove that True True → True and then that True → True True.
|
True |
True |
|
|
|||
|
|
{ID} |
|
{ID} |
|
|
|
|
|
|
|
|
|||
True True True |
True |
E |
|
||||
|
True |
|
|
{ |
|
} |
|
|
|
|
|
|
|
{→I}
True True → True
True
{ IL}
True True
{→I}
True → True True
45. A list comprehension can generate a truth table for you.
logicExprValue1 = [((a,b),logicExpr1 a b) | a <- [False,True],
b <- [False,True]
]
logicExprValue2 = [((a,b),logicExpr2 a b) | a <- [False,True],
b <- [False,True]
]
410 |
APPENDIX C. SOLUTIONS TO SELECTED EXERCISES |
46.
logicExprValue3 = [((a,b,c),logicExpr3 a b c) | a <- [False,True],
b <- [False,True], c <- [False,True]
]
logicExprValue4 = [((a,b,c),logicExpr4 a b c) | a <- [False,True],
b <- [False,True], c <- [False,True]
]
47.
distribute :: Logic -> Logic
distribute (And a (Or b c)) = Or (And a b) (And a c) distribute (Or a (And b c)) = And (Or a b) (Or a c)
deMorgan :: Logic -> Logic
deMorgan (Not (Or a b)) = And (Not a) (Not b) deMorgan (Not (And a b)) = Or (Not a) (Not b) deMorgan (And (Not a) (Not b)) = Not (Or a b) deMorgan (Or (Not a) (Not b)) = Not (And a b)
48.
(C A B) C |
{ commutative} |
= C (C A B) |
|
= (C C) (C A) (C B) |
{ distributes over } |
= C (C A) (C B) |
{ idempotent} |
= C ((C A) (C B)) |
{ associative} |
= C (C (A B)) |
{ distributes over } |
49.
C (A (B C)) |
{ distributes over } |
= C ((A B) (A C)) |
|
= C ((A C) (A B)) |
{ commutative} |
= (C (A C)) (A B) |
{ associative} |
= ((C A) (C C)) (A B)) |
{ distributes over } |
= ((C A) C) (A B) |
{ idempotent} |