Docsity

Exam with Solution - Discrete Structures Computer Science | CSE 260, Exams of Discrete Structures and Graph Theory

Toggle sidebar
bg1
CSE 260, Fall 2011 Name/PID: 1
1. (10 points)
Assume the universe of discourse is the set of rational numbers. For each logic formula below, indicate if it
is true or false by circling the correct response.
True False ¬∃w(w=w+ 1) ANS: T
True False ∃w∀z(wz =z)ANS: T
True False ∀w∃z(w=z2)ANS: F
True False ∀w∃z(z=w2)ANS: T
True False ∀w∀z(w > z →(w−z)(w+z)>0) ANS: F
2. (10 points)
Let jrange over all jobs in some workflow and nrange over all possible priority levels. Define the predicate
Pas follows
P(j, n): “The priority level of job jis n.”
Translate the following statements into predicate logic formulas.
(a) The priority level of every job in the workflow is at least 3.
ANS1: ∀j∀n(P(j, n)→n≥3)
ANS2: ¬∃j∃n(P(j, n)∧n < 3)
(b) Some job has the highest priority level (i.e., a priority level higher than that of any other job).
ANS: ∃j∃n∀k∀m(L(j, n)∧(L(k, m)→m < n))
pf3
pf4
pf5

Partial preview of the text

Download Exam with Solution - Discrete Structures Computer Science | CSE 260 and more Exams Discrete Structures and Graph Theory in PDF only on Docsity!

1. (10 points)

Assume the universe of discourse is the set of rational numbers. For each logic formula below, indicate if it

is true or false by circling the correct response.

True False ¬∃w (w = w + 1) ANS: T

True False ∃w∀z (wz = z) ANS: T

True False ∀w∃z (w = z^2 ) ANS: F

True False ∀w∃z (z = w^2 ) ANS: T

True False ∀w∀z (w > z → (w − z)(w + z) > 0) ANS: F

2. (10 points)

Let j range over all jobs in some workflow and n range over all possible priority levels. Define the predicate

P as follows

P (j, n): “The priority level of job j is n.”

Translate the following statements into predicate logic formulas.

(a) The priority level of every job in the workflow is at least 3.

ANS1: ∀j ∀n(P (j, n) → n ≥ 3) ANS2: ¬∃j∃n (P (j, n) ∧ n < 3)

(b) Some job has the highest priority level (i.e., a priority level higher than that of any other job).

ANS: ∃j ∃n ∀k ∀m (L(j, n) ∧ (L(k, m) → m < n))

3. (10 points)

For each of the following arguments, determine if the reasoning is valid. Additionally, justify your answer

by either indicating the rule(s) of inference used, if the reasoning is valid; or showing that the conclusion is

not a logical consequence of the premises, otherwise. Use the names in the handout for identifying rules of

inference.

(a) The program does not execute the print statement at line 100 if the input file is not readable or if the

program executes an infinite loop. The program did not execute an infinite loop. But it also did not

execute the print statement at line 100. Therefore, the input file is not readable.

ANS: Invalid. The form of the argument is: (¬r ∨ l) → ¬p and ¬l and ¬p; therefore ¬r. But ((¬r ∨ l) → ¬p) ∧ ¬l ∧ ¬p) → ¬r is not a tautology. For example, if r is true and both p and l are false, it is false. This answer formalizes that, although you may know two reasons why a program might not execute some statement, there could be other reasons (e.g., a run-time error could occur before execution reaches that statement).

(b) No job in the print queue that was submitted by a student has been there for more than 5 ms. Jill,

who is a CSE senior, has a job in the print queue. Therefore, some job has been in the print queue for

no more than 5 ms.

ANS: It is valid. The rules used: Universal instantiation, modus ponens, and existential generalization.

4. (5 points)

Rewrite the following formula so that negations apply only to predicates (that is, so that no negation is

outside a quantifier or an expression involving logical connectives).

¬∀y ∃x (¬R(y) → [Q(x, y) ∨ ¬R(x)])

ANS: ∃y ∀x (¬R(y) ∧ [¬Q(x, y) ∧ R(x)])

7. (10 points)

Prove that (q → ¬p) ∧ (r → ¬q) and ¬q ∨ (¬p ∧ ¬r) are logically equivalent using the derivation method,

in which you derive one of the formulas from the other. For each step in your derivation, indicate the

equivalences that you used to justify the step. (Refer to the sheet for the names of the equivalences. You

may abbreviate names by leaving out ”Law” and by shortening long names to the first 5 letters.)

ANS:

(q → ¬p) ∧ (r → ¬q) ≡ (¬q ∨ ¬p) ∧ (¬r ∨ ¬q) Conseq. (twice) & double negation ≡ (¬q ∧ (¬r ∨ ¬q)) ∨ (¬p ∧ (¬r ∨ ¬q)) Distributive ≡ (¬q ∧ ¬r) ∨ (¬q ∧ ¬q) ∨ (¬p ∧ ¬r) ∨ (¬p ∧ ¬q) Distributive (twice), associative ≡ [(¬q ∧ ¬r) ∨ ¬q] ∨ (¬p ∧ ¬r) ∨ (¬p ∧ ¬q) Idempotent, assoc. ≡ ¬q ∨ (¬p ∧ ¬r) ∨ (¬p ∧ ¬q) Absorption ≡ (¬q ∨ (¬p ∧ ¬q)) ∨ (¬p ∧ ¬r) Commutative, assoc. ≡ ¬q ∨ (¬p ∧ ¬r) Absorption

Ques. No. Points poss. Points earned

Total 63