Docsity

Practice Exam II for Mathematical Basis for Computing | CSE 607, Exams of Engineering

Toggle sidebar
bg1
CSE/CIS 607 Mathematical Basis of Computing
Practice Exam II
Question 1: Is the following argument valid? Explain.
Given: Clark comes from a place called Krypton or Lex retired.
Conclusion: If Clark does not come from a place called Krypton, then
the moon is made of cheese or Lex retired.
Answer: Let Kbe “Clark comes from a place called Krypton”. Let Lbe “Lex
retired”. Let Cbe “The moon is made of cheese”. The argument has the form:
premise: K∨L
conclusion: ¬K⊃(C∨L)
By Gentzen’s method, we can see that if we try to falsify the conclusion whole holding
the premise true, it must be that ¬Kis true, but C∨Lis false. Therefore, Kis
false and Lis false. Therefore the K∨Lis false, which contradicts that K∨Lis
true. Thus the conclusion must be true if the premise is true. Hence, the argument
is valid.
Question 2: Give a formal tableau proof that shows that the following tableau is
valid.
g1.(P⊃(Q⊃R)) ⊃((P∧ ¬R)⊃ ¬Q) given
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Practice Exam II for Mathematical Basis for Computing | CSE 607 and more Exams Engineering in PDF only on Docsity!

CSE/CIS 607 Mathematical Basis of Computing

Practice Exam II

Question 1: Is the following argument valid? Explain.

Given: Clark comes from a place called Krypton or Lex retired. Conclusion: If Clark does not come from a place called Krypton, then the moon is made of cheese or Lex retired.

Answer: Let K be “Clark comes from a place called Krypton”. Let L be “Lex retired”. Let C be “The moon is made of cheese”. The argument has the form:

premise: K ∨ L conclusion: ¬K ⊃ (C ∨ L)

By Gentzen’s method, we can see that if we try to falsify the conclusion whole holding the premise true, it must be that ¬K is true, but C ∨ L is false. Therefore, K is false and L is false. Therefore the K ∨ L is false, which contradicts that K ∨ L is true. Thus the conclusion must be true if the premise is true. Hence, the argument is valid.

Question 2: Give a formal tableau proof that shows that the following tableau is valid. g1. (P ⊃ (Q ⊃ R)) ⊃ ((P ∧ ¬R) ⊃ ¬Q) given

Answer:

g1. (P ⊃ (Q ⊃ R)) ⊃ ((P ∧ ¬R) ⊃ ¬Q) given a1. P ⊃ (Q ⊃ R) g1 if-split g2. (P ∧ ¬R) ⊃ ¬Q g1 if-split a2. P ∧ ¬R g2 if-split g3. ¬Q g2 if-split a3. P a3 ∧-split a4. ¬R a3 ∧-split a5. False ∨ (True ⊃ (Q ⊃ R)) a1, a3 AA a6. Q ⊃ R a5 rew a7. (Q ⊃ False) ∨ ¬True a6, a4 AA a8. ¬Q a7 rew g4. ¬False ∧ True a8, g3 AG g5. True g4 rew

Question 3: What’s wrong with the following proposed inference rule? Let P be a common subformula of assertion A and goal G, occurring at least once in each of these formulas. Then

From goal G 1 and goal G 2 derive goal G 1 [P 7 → F alse] ∨ G 2 [P 7 → T rue]

(This is similar to, but not the same as, GG-resolution.)

Answer: The following solution is due fundamentally to Robert C. Grant, and has the virtue of conforming to the polarity strategy.

g1. ¬P given g2. P ∧ False g2 if-split

This tableau is not valid since the tableau’s corresponding formula is not valid:

¬P ∨ (P ∧ False)

is not valid. The formula is not valid since it can be falsified by assigning T to P. However, if we apply the proposed inference rule to the tableau, we obtain

g1. ¬P given g2. P ∧ False g2 if-split g3. ¬False ∨ (True ∧ False) g1, g g4. True g3 rew

tableau proof if is valid.)

a1. (J ∧ K) ⊃ L given a2. (J ⊃ L) ⊃ M given a3. ¬K ∨ N given g1. K ⊃ (M ∧ N ) given

Answer: The tableau is valid. The tableau would not be valid if all of its goals can be falsified while the assertions are true. Suppose K ⊃ (M ∧ N ) is false and the assertions are true. Then K is true and M ∧ N is false. Since ¬K ∨ N is true, but ¬K is false, N is true. Since, M ∧ N is false and N is true, M is false. Since (J ⊃ L) ⊃ M is true, but M is false, J ⊃ L is false. Since J ⊃ L is false, J is true and L is false. Since, (J ∧ K) ⊃ L is true, but L is false, J ∧ K is false. Since J ∧ K is false, and J is true, K is false. But K is true and we have a contradiction. Therefore if we suppose the tableau is not valid, a contradiction results.

Question 7: Give a formal tableau proof that shows that the following tableau is valid. a1. (A ∨ B) ⊃ (C ∧ D) given a2. ¬C given g1. ¬B given

Answer: a1. (A ∨ B) ⊃ (C ∧ D) given a2. ¬C given g1. ¬B given a3. ((A ∨ B) ⊃ (False ∧ D)) ∨ ¬True a1, a2 AA a4. ¬A ∧ ¬B a3 rew a5. ¬B a4 ∧-split g2. ¬False ∧ True a5, g2 AG g3. True g2 rew

Question 8: Give a formal tableau proof that shows that the following tableau is

valid. a1. Q ⊃ ¬P given a2. P ⊃ Q given g1. ¬P given

Answer: a1. Q ⊃ ¬P given a2. P ⊃ Q given g1. ¬P given g2. ¬(True ⊃ Q) ∧ ¬False g1, a2 GA g3. ¬Q g2 rew g4. ¬(True ⊃ ¬P ) ∧ ¬False g3, a1 GA g5. P g4 rew g6. ¬False ∧ True g1, g6 GG g7. True g6 rew

Question 9: What’s wrong with the following proposed inference rule? Let P be a common subformula of assertion A 1 and assertion A 2. Then

From assertion A 1 and assertion A 2 derive assertion A 1 [P 7 → F alse] ∧ A 2 [P 7 → T rue]

Question 10: Consider:

Assertion 1: If Alice doesn’t catch the bus, then Bob gambles away his money or Bob leaves town.

Assertion 2: If Alice catches the bus and Bob does not leave town, then Bob gambles away his money.

Assertion 3: If Bob gambles away his money, then Bob leaves town.

Goal: Bob leaves town.

Answer: a1. (P ∧ Q) ⊃ R given a2. P given a3. ¬Q ⊃ (¬P ∨ R) given g1. R given a4. ¬P ∨ ¬Q ∨ R a1 rew a5. ¬P ∨ Q ∨ R a3 rew a6. False ∨ (¬True ∨ ¬Q ∨ R a2, a4 AA a7. ¬Q ∨ R a6 rew a8. False ∨ (¬True ∨ Q ∨ R a2, a5 AA a9. Q ∨ R a2, a5 AA a10. False ∨ (¬True ∨ R) a9, a7 AA a11. R a10 rew g2. ¬False ∧ True a11, g2 AG g3. True g2 rew

Question 13: What’s wrong with the following proposed inference rule? Let P be a common subformula of assertion A and goal G, occurring at least once in each of these formulas. Then

From assertion A and goal G derive goal A[P 7 → F alse] ∧ G[P 7 → T rue]

(This is similar to, but not the same as, AG-resolution.)

Question 14: This question is optional - there will not be a question like it on the upcoming exam. BUT, making an effort to do the question will help you reinforce your understanding of propositional logic. The diagram below denotes a Toffoli gate. P, Q and R are Boolean-valued. The expression PQ + R in the diagram denotes the Boolean-value of the propositional formula (P ∧ Q) ⊕ R. (⊕ denotes exclusive-or.)

P Q R

P Q PQ + R

Notice that if the value of R is fixed at true, then the Toffoli gate acts as a NAND gate:

P Q true

P Q PQ + true

Show how to make the Toffoli gate act as an XOR gate. XOR(A,B) is equivalent to the propositional formula A ⊕ B

Question 15: Consider:

Assertion 1: If Alice sends an encrypted text to Bob, then Bob will be safe and Bob doesn’t leave town.

Assertion 2: If Alice does not send an encrypted text to Bob and Bob leaves town, then Bob will not be safe.

Assertion 3: Bob doesn’t leave town or Bob is safe.

Goal: Bob does not leave town.

Let A stand for “Alice sends an encrypted text to Bob.” Let B stand for “Bob will be safe.” Let L stand for “Bob leaves town.”

(1) Express the assertions and goal in our notation for propositional logic.

(2) Does the goal follow from the assertion? (Explain.)

Question 16: Is the following tableau valid? If it is, give a formal tableau proof. If

Question 18: This question is optional - there will not be a question like it on the upcoming exam. BUT, making an effort to do the question will help you reinforce your understanding of propositional logic. The diagram below denotes a Fredkin gate. P, Q and R are Boolean-valued. The expression PQ + PR in the diagram denotes the Boolean-value of the propositional formula (¬ P ∧ Q) ⊕ (P ∧ R). (⊕ denotes exclusive-or.)

P Q R

P PQ + PR PR + PQ

Notice that if the value of R is fixed at true, then the Fredkin gate acts as an OR gate:

P Q true

P PQ + P P + PQ

Show how to make the Fredkin gate act as an AND gate.

Question 19: Use the unification algorithm to determine whether there is a most

general unifying substitution that solves the equation

k(f (x, u, a), f (g(y), y, v)) = k(f (g(y), y, v), f (w, h(z), z))

In the preceding equation, a is a constant, and x, y, z, u, v and w are variables.

Answers: k(f (x, u, a), f (g(y), y, v)) = k(f (g(y), y, v), f (w, h(z), z))

f (x, u, a) = f (g(y), y, v) f (g(y), y, v) = f (w, h(z), z)

x = g(y)

u = y a = v g(y) = w y = h(z) v = z

x = g(h(z)) u = h(z) v = a w = g(h(z)) y = h(z) z = a

x = g(h(a)) u = h(a) v = a w = g(h(a)) y = h(a) z = a

k(f (g(h(a)), h(a), a), f (g(h(a)), h(a), a)) = k(f (g(h(a)), h(a), a), f (g(h(a)), h(a), a))

Question 20: Use the unification algorithm to determine whether there is a most

general unifying substitution that solves the equation

j(g(x, u, w), g(f (y), y, v)) = j(g(f (y), y, v), g(x, k(z), z))

In the preceding equation, x, y, z, u, v and w are variables.

Answer: j(g(x, u, w), g(f (y), y, v)) = j(g(f (y), y, v), g(x, k(z), z))

g(x, u, w) = g(f (y), y, v) g(f (y), y, v) = g(x, k(z), z)

Question 22: Let Ψ be a formula in which the subformula P ∨ ¬P has exactly one occurrence, and that occurrence has negative polarity in Ψ. Is the following formula valid? If it is valid, explain why. If it is not valid give a (simple) counterexample.

(Ψ[P ∨ ¬P ] ∧ Q) ⊃ (Ψ[P ∧ ¬P ] ∧ Q)

Question 23: Find a most general unifier of the two terms

g(g(w, g(b, z)), w) and g(g(y, g(b, u)), g(u, z)).

Answer: g(g(w, g(b, z)), w) = g(g(y, g(b, u)), g(u, z))

g(w, g(b, z)) = g(y, g(b, u)) w = g(u, z)

w = y g(b, z) = g(b, u) w = g(u, z)

w = y g(b, z) = g(b, u) y = g(u, z)

w = y b = b z = u y = g(u, z)

w = y z = u y = g(u, z)

w = y z = u

y = g(u, u)

w = g(u, u) z = u y = g(u, u)

g(g(g(u,u),g(b,u)),g(u,u)) = g(g(g(u,u),g(b,u)),g(u,u))

Question 24: Find a most general unifier of the two terms

g(x, y, f (x), z, u) and g(a, x, z, f (x), h(v, z)).

Answer: g(x, y, f (x), z, u) = g(a, x, z, f (x), h(v, z))

x = a y = x f (x) = z z = f (x) u = h(v, z)

x = a y = a f (a) = z z = f (a) u = h(v, z)

x = a y = a z = f (a) z = f (a) u = h(v, z)

x = a y = a

Question 26: Find a most general unifier of the two terms

f (h(y, x, g(v, x))), f (h(v, x, g(g(u, u), f (u)))).

Answer: f (h(y, x, g(v, x))) = f (h(v, x, g(g(u, u), f (u))))

h(y, x, g(v, x)) = h(v, x, g(g(u, u), f (u)))

y = v x = x g(v, x) = g(g(u, u), f (u))

y = v g(v, x) = g(g(u, u), f (u))

y = v v = g(u, u) x = f (u)

y = g(u, u) v = g(u, u) x = f (u)

f (h(g(u, u), f (u), g(g(u, u), f (u)))) = f (h(g(u, u), f (u), g(g(u, u), f (u))))

Question 27: Intentionally omitted

Question 28: Is the following tableau valid? If it is, give a formal tableau proof. If it is not, explain why. g1. (P ⊃ (Q ∧ R)) ⊃ ((P ⊃ Q) ⊃ (P ⊃ R)).

Answer: The tableau is valid.

g1. (P ⊃ (Q ∧ R)) ⊃ ((P ⊃ Q) ⊃ (P ⊃ R)) given g2. True g1 rew

(Seriously!)

Question 29: Is the following tableau valid? If it is, give a formal tableau proof. If it is not, explain why.

g1. ((P ⊃ Q) ⊃ (P ⊃ R)) ⊃ (P ⊃ (Q ∧ R)).

Answer: The tableau is not valid because the goal can be falsified while all of the assertions are true: Assign T to P and R and F to Q.

Question 30: Give a formal tableau proof that shows that the following tableau is valid. a1. P ⊃ (Q ≡ P ) given a2. ¬P ⊃ R given g1. R ∨ (Q ≡ P ) given

(Hint: You do not need to use the equivalence rule, and you do not need to eliminate the equivalances with rewrites.)

Answer: a1. P ⊃ (Q ≡ P ) given a2. ¬P ⊃ R given g1. R ∨ (Q ≡ P ) given a3. (¬False ⊃ R) ∨ (True ⊃ (Q ≡ P )) a2, a1 AA a4. R ∨ (Q ≡ P ) a3 rew g2. ¬False ∧ True a4, g1 AG g3. True g2 rew

a1. P ⊃ (Q ⊃ R) a2. (R ∧ S) ⊃ ¬U a3. ¬V ⊃ (S ∧ U ) g1. Q ⊃ (¬P ∨ ¬R)

Answer: The tableau is not valid. Let T be assigned to P , Q, R, S, and V , and let F be assigned to U. Then the goal is false, and the assertions are true.

Question 35: Suppose that subformula P occurs at least once in each of the formulas A and B. Explain why the following tableau is valid:

g1. (A ∧ B) ⊃ (A[P 7 → True] ∨ B[P 7 → False])

Answer:

g1. (A ∧ B) ⊃ (A[P 7 → T rue] ∨ B[P 7 → F alse]) given a1. A ∧ B g1 if-split g2. A[P 7 → True] ∨ B[P 7 → False] g1 if-split a2. A a1 ∧-split a3. B a1 ∧-split a4. A[P 7 → True] ∨ B[P 7 → False] a2, a3 AA g3. ¬False ∧ True a4, g2 AG g4. True g3 rew