1. Consider these lines of code from a C program:
if (!(x != 1 && x*y < 0) && (x == 1 || y/x
≥ 5)
printf (
);
else
printf (
);
a.
Express the code in this statement as a compound statement using the logical
connectives ¬, , , , and these predicates:
P(x)
: x = 1
Q(x,y): x*y < 0
R(x,y): y/x ≥ 5
W(z): z is assigned to printf
where
x and y are integers and z is a Boolean variable (with values True and False)
b. Use the laws of propositional logic to simplify the statement by expressing it in a
simpler form.
c. Translate the answer in part (b) back into C codes.
2.
Given: Prove �� → ��∨ ��using the Proof by Contradiction method.
[Hint: Use a combination of Equivalence Laws and Rules of Inference to solve this
question]