1) Find the bitwise OR, bitwise AND and bitwise XOR of each of these pairs of bit strips?
(a)
00 0111 0001 (b) 11 1111 1111
10 0100 1000 00 0000 0000
(a)
0 0 0 1 1 1 0 0 0 1
1 0 0 1 0 0 1 0 0 0
OR 1 0 0 1 1 1 1 0 0 1
AND 0 0 0 1 0 0 0 0 0 0
XOR 1 0 0 0 1 1 1 0 0 1
(b)
1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0
OR 1 1 1 1 1 1 1 1 1 1
AND 0 0 0 0 0 0 0 0 0 0
XOR 1 1 1 1 1 1 1 1 1 1
Note:
X Y XY XY XY
0 0 0 0 0
0 1 0 1 1
1 0 0 1 1
1 1 1 1 0
2) Translate the given statements into propositional logic using the propositions provided:
(a) You cannot edit a protected site entry unless you are an administrator.
Let p be the proposition statement “You can edit a protected site”, and q
be the proposition statement “You are the administrator”.
q→p
(IF you are the administrator, THEN you can edit a protected site)
1
(b) You can graduate if you have completed the requirements of your course and you do not owe
money to the university and you do not have an overdue library loan.
Let p be the proposition statement “You can graduate”,
q be the proposition statement “You owe money to the university”,
r be the proposition statement “You have completed the requirements of your course”, and s
be the proposition statement “You have an overdue library book”.
(r ¬ q ¬ s) → p
(IF you have completed the requirement of your course AND you do NOT own the
money to the university AND you do NOT have any overdue library load, THEN you
can graduate)
(c) You are eligible to be the President of the USA if and only if you are at least 35 years old,
were born in the USA, or at the time of your birth, both of your parents were citizens and
you have lived at least 14 years in the country.
Let p be the proposition statement “You are eligible to be the president”, q be
the proposition statement “You are at least 35 years old”,
r be the proposition statement “You were born in the USA”,
s be the proposition statement “At the time of your birth, both of your parents were
citizens ”,
t be the proposition statement “lived at least 14 years in the country”.
p (q (r s) t)
You are eligible to the president IF AND ONLY IF you are at least 35 years old
AND, you were born in the USA OR at the time of your birth, both of your parents
were citizens, AND you have lived at least 14 years in the country.
2
3) Use truth tables to verify the Commutative laws:
(a) (p q) (q p) (b) (p q) (q p)
(a)
p q pq qp
T T T T
T F T T
F T T T
F F F F
(b)
p q pq qp
T T T T
T F F F
F T F F
F F F F
Note:
Commutative Law states that the interchanging of the order of operands in a Boolean equation
does not change its result, i.e. you can swap the operands around the operator, and still get the
same result (logically equivalent)
4) Use truth tables to verify the Distributive law:
p (q r) (p q) (p r)
p q r qr p (q r) pq pr (p q) (p r)
T T T T T T T T
T T F T T T F T
T F T T T F T T
F T T T F F F F
F F T T F F F F
F T F T F F F F
T F F F F F F F
F F F F F F F F
Note:
Distributive Law states that the multiplication of two variables and adding the result with a variable will result
in the same value as multiplication of addition of the variable with individual variables. For example,
p (q r) (p q) (p r)
p (q r) (p q) (p r)
3
5) Use De Morgan’s laws to find the negation of each of the following statements:
(a) Sam is rich and happy
(b) Carlos will run or bicycle tomorrow
(a)
p: Sam is rich
q: Sam is happy
Negation of p q
Sam is NOT (rich AND happy) = Sam is NOT rich, OR Sam is NOT happy
(b)
p: Carlos will run tomorrow
q: Carlos will bicycle tomorrow
Negation of p q
Carlos will NOT (run OR bicycle) tomorrow = Carlos will NOT run AND he will NOT
bicycle tomorrow.
Note:
De Morgan’s law:
¬ (p q) = ¬ p ¬ q
¬ (p q) = ¬ p ¬ q
6) Show that each of these conditional statements is a tautology by using truth tables:
(a) (p q)q (d) (p q)(pq)
(b) p(p q) (e) ¬(pq)p
(c) ¬p(pq) (f) ¬(pq)¬q
p q (p q) → q p → (p q) ¬p → (p → q) (p q) → (p ¬(p → q) → ¬(p → q) → ¬q
→ q) p
T T T T T T T T
T F T T T T T T
F T T T T T T T
F F T T T T T T
Note:
A tautology is a proposition which is always true.
7) (a) Show that p q and (p q) (¬p ¬q) are logically equivalent.
(b) Show that ¬p(qr) and q(p r) are logically equivalent.
(a)
4
p q p→q q→p p q pq ¬p ¬q (p q) (¬p ¬q)
T T T T T T F T
T F F T F F F F
F T T F F F F F
F F T T T F T T
(b)
p q r ¬p q→r ¬p → (q → r) pr q → (p r)
T T T F T T T T
T T F F F T T T
T F T F T T T T
F T T T T T T T
F F T T T T T T
F T F T F F F F
T F F F T T T T
F F F T T T F T
8) (a) List the members of these sets:
(i)
x x is a real number such that x 1
2
(ii)
x x is a positive integer less than12
(i)
S={-1, 1}
(ii)
S={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
(b)Use set builder notation to give a description of each of these sets:
(i) S={0,3,6,9,12}
{x | x is a positive multiple of 3 equal or less than 12}
(ii) S={-3,-2,-1,0,1,2,3}
{x | x is an integer and -3 <=x <=3 }