Exercises
Exercises
Exercises
58
(a) p (q r)
(b) p (q r)
(c) (p q) (p r)
(d) (p q) (p r)
(e) (p q) (q r)
(f) (p q) (q r)
7. Formalise the following and, by writing truth tables for the premises and conclusion,
determine whether the arguments are valid.
(a)
(b)
8. Use truth tables to determine which of the following are equivalent to each other:
(a) P
(b) P
(c) P F
(d) P T
(e) F P
(f) T P
(g) P
9. Use truth tables to determine which of the following are equivalent to each other:
(a) (P
(b) P
(c) (P
Q) (P
Q)
P )
Q) (Q
(d) (P
(e) (Q
P ) P
Q)
10. Imagine that a logician puts four cards on the table in front of you. Each card has a
number on one side and a letter on the other. On the uppermost faces, you can see
E, K, 4, and 7. He claims that if a card has a vowel on one side, then it has an even
number on the other. How many cards do you have to turn over to check this?
11. Give a truth-table definition of the ternary boolean operation if P then Q else R.
12. Given the truth table for an arbitrary n-ary function f (p1 , .., pn ) (from n propositional
variables p1 , .., pn to {T , F }), describe how one can build a proposition, using only
p1 , .., pn and the connectives , , and , that has the same truth table as f . (Hint:
first consider each line of the truth table separately, and then how to combine them.)
13. Show, by equational reasoning from the axioms in the notes, that (P (Q R S )) iff
P (Q R S )
59
z .y + z = 100)
60
1. Consider the set A = {{}, {{}}, {{{}}}}. If x A, how many elements might x have?
2. Prove that if A B then A B = B
3. Prove that if A A# and B B # then A B A# B #
4. What can you say about sets A and B if you know that
(a) A B = A
(b) A B = A
(c) A B = A
(d) A B = B A
(e) A B = B A
5. Draw the Hasse diagram for the subset relation among the sets A
def
def
def
= {2, 4, 6},
def
61
(a)
1
(b)
(d)
(c)
(e) a
4
2
11. Give a table showing, for each of the following relations over N, whether it is reflexive,
symmetric, transitive, or functional.
def
(a) n R m = n = 2m
def
(b) n R m = 2n = m
def
takew
takew
dropw
dropw
p
p
p
p
[] = []
(x::xs) = if p x then x :: takew p xs else []
[] = []
(x::xs) = if p x then dropw p xs else x::xs
Prove (takew p xs) @ (dropw p xs) = xs using induction. (Assume that function
p always terminates.) [Software Engineering II, 2001, p.2, q.9b]
6. Consider the following two ML functions:
fun
|
fun
|
sumfiv [] = 0
sumfiv (x::xs) = 5*x + sumfiv xs
summing z [] = z
summing z (x::xs) = summing (z + x) xs
Prove that sumfiv xs is equal to 5 * summing 0 xs. [Software Engineering II, 1999,
p.2, q.9c]
63