0% found this document useful (0 votes)
143 views3 pages

HOME WORK - 2-Solution

The document summarizes the solutions to homework 2 of CSE 20. It contains examples of translating sentences to predicate logic and determining if logical statements are contingent, tautologies, or contradictions. It also analyzes the domains where logical statements are true, such as integers, rationals, or sets. Finally, it uses inference rules to prove that a Boolean expression is a tautology.

Uploaded by

vrsafe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views3 pages

HOME WORK - 2-Solution

The document summarizes the solutions to homework 2 of CSE 20. It contains examples of translating sentences to predicate logic and determining if logical statements are contingent, tautologies, or contradictions. It also analyzes the domains where logical statements are true, such as integers, rationals, or sets. Finally, it uses inference rules to prove that a Boolean expression is a tautology.

Uploaded by

vrsafe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CSE 20 Homework 2: Solutions

1. Let P (x) = “x is a prime” and Q(x) = “x is divisible by 4” defined over the universe of integers.

Answers:

(a) There exists an integer which is divisible by 4: ∃ x Q(x)

(b) If an integer is divisible by 4, it is not prime: ∀ x (Q(x) → ¬P (x)).

(c) The product of two prime numbers is not prime: ∀ x ∀ y ((P (x) ∧ P (y)) → ¬P (x · y)).

2. For each of the following sentences, do the following:


(i) Translate the sentence into logic using the predicates defined below and
(ii) Negate the translated sentence.
Answers:
(a) Some courses require some prerequisite but don’t require all courses as prerequisites. PREREQ(a,b) means a
requires b as a prerequisite.

(i) ∃ x ((∃ y PREREQ(x, y)) ∧ ¬(∀ z PREREQ(x, z))).

(ii)

¬(∃ x ((∃ y PREREQ(x, y)) ∧ ¬(∀ z PREREQ(x, z))))


≡ ∀ x ¬((∃ y PREREQ(x, y)) ∧ ¬(∀ z PREREQ(x, z))) (De Morgan’s law for quantifiers)
≡ ∀ x (¬(∃ y PREREQ(x, y)) ∨ ¬¬(∀ z PREREQ(x, z))) (De Morgan’s law)
≡ ∀ x ((∀ y ¬PREREQ(x, y)) ∨ ¬¬(∀ z PREREQ(x, z))) (De Morgan’s law for quantifiers)
≡ ∀ x ((∀ y ¬PREREQ(x, y)) ∨ (∀ z PREREQ(x, z))) (Double negation)

(b) You can satisfy some people all of the time, and all of the people some of the time, but you cannot satisfy all of
the people all of the time. CANSATISFY(p,t) means you can satisfy person p at time t.

(i) (∃ p ∀ t CANSATISFY(p, t)) ∧ (∀ p ∃t CANSATISFY(p, t)) ∧ ¬(∀ p ∀ t CANSATISFY(p, t)).

(ii)

¬((∃ p ∀ t CANSATISFY(p, t)) ∧ (∀ p ∃t CANSATISFY(p, t)) ∧ ¬(∀ p ∀ t CANSATISFY(p, t)))


≡ ¬(∃ p ∀ t CANSATISFY(p, t)) ∨ ¬(∀ p ∃t CANSATISFY(p, t)) ∨ ¬¬(∀ p ∀ t CANSATISFY(p, t)) (De Morgan’s law)
≡ ¬(∃ p ∀ t CANSATISFY(p, t)) ∨ ¬(∀ p ∃t CANSATISFY(p, t)) ∨ (∀ p ∀ t CANSATISFY(p, t)) (Double negation)
≡ (∀ p ¬(∀ t CANSATISFY(p, t))) ∨ ¬(∀ p ∃t CANSATISFY(p, t)) ∨ (∀ p ∀ t CANSATISFY(p, t))
≡ (∀ p ∃ t ¬CANSATISFY(p, t)) ∨ ¬(∀ p ∃t CANSATISFY(p, t)) ∨ (∀ p ∀ t CANSATISFY(p, t))
≡ (∀ p ∃ t ¬CANSATISFY(p, t)) ∨ (∃ p ¬(∃t CANSATISFY(p, t))) ∨ (∀ p ∀ t CANSATISFY(p, t))
≡ (∀ p ∃ t ¬CANSATISFY(p, t)) ∨ (∃ p ∀t ¬CANSATISFY(p, t)) ∨ (∀ p ∀ t CANSATISFY(p, t))

The last four lines use De Morgan’s law for quantifiers.

1
3. For each of the following decide if it is a CNF, a DNF, neither, or both.

Answers:

(a) ¬p ∧ q: both

(b) ¬(p ∨ q): neither

(c) ¬(p ∨ q) ∨ ¬r: neither

(d) (p ∨ ¬r) ∧ (p ∨ q) ∧ (¬p ∨ q ∨ ¬r): CNF

(e) (¬p ∨ q) ∧ ((¬p ∨ q) ∧ (s ∧ ¬r)): neither

4. For each of the following Boolean expressions:

(i) Recall from class that each predicate can be written as both a CNF and a DNF. Decide which one is more efficient
(requires fewer connectives) for this Boolean expression and rewrite it in the more efficient form. If both require the
same number of connectives, rewrite it as either.
(ii) Is this a tautology? A contradiction?

Answers:

(a) ¬(q → ¬p) → (¬p ∨ ¬q).

(i) Writing out the truth table:

p q ¬(q → ¬p) ¬p ∨ ¬q ¬(q → ¬p) → (¬p ∨ ¬q)


F F F T T
F T F T T
T F F T T
T T T F F

There are more T’s in the tables than F’s. Therefore, it is more efficient to represent the statement as a CNF: ¬p ∨ ¬q.

(ii) This is neither a tautology nor a contradiction.

(b) (q → p) → (p → q).

(i) Writing out the truth table:

p q q→p p→q (q → p) → (p → q)
F F T T T
F T F T T
T F T F F
T T T T T

There are more T’s in the tables than F’s. Therefore, it is more efficient to represent the statement as a CNF: ¬p ∨ q.

(ii) This is neither a tautology nor a contradiction.

2
5. For each statement, indicate in which of these domains the statement is true:

(i) integers,

(ii) rationals,
(iii) real numbers,
(iv) prime numbers,
(v) {0, 1, 2}.

Answers:

(a) ∀ z ∀ x ∀ y (x 6= y ∧ y 6= z ∧ x 6= z) → (z 6= x · y).

(i) Does not hold for integers. Counterexample: x = 2, y = 3, z = 6.

(ii) Does not hold for rationals. Counterexample: x = 2, y = 3, z = 6.

(iii) Does not hold for real numbers. Counterexample: x = 2, y = 3, z = 6.

(iv) Does hold for prime numbers. If x, y, z are all different primes, then z cannot be equal to x · y by definition.

(v) Does hold for {0, 1, 2}. If x, y, z are all different, then either z or x · y is 0, but not both.

(b) ∀ z z 6= 0 → (∀ x ∃ y z = xy )

(i) Does not hold for integers. Counterexample: z = 2, x = 3. Then there is no integer y such that z = xy .

(ii) Does not hold for rationals. Counterexample: z = 1, x = 0. Then there is no rational y such that z = xy .

(iii) Does not hold for real numbers. Counterexample: z = 1, x = 0. Then there is no real number y such that z = xy .

(iv) Does not hold for prime numbers. Counterexample: z = 2, x = 3. Then there is no prime number y such that
z = xy .

(v) Does not hold for {0, 1, 2}. Counterexample: z = 1, x = 0. Then there is no number y ∈ {0, 1, 2} such that z = xy .

6. Use inference rules to show the following Boolean expression is always true (a tautology).

Answer:

[(p ∧ ¬(¬p ∨ q)) ∨ (p ∧ q)] → p ≡ [(p ∧ (¬¬p ∧ ¬q)) ∨ (p ∧ q)] → p (De Morgan’s law)
≡ [(p ∧ (p ∧ ¬q)) ∨ (p ∧ q)] → p (Double negation)
≡ [((p ∧ p) ∧ ¬q) ∨ (p ∧ q)] → p (Associative law)
≡ [(p ∧ ¬q) ∨ (p ∧ q)] → p (Idempotent law)
≡ [p ∧ (¬q ∨ q)] → p (Distributive law)
≡ [p ∧ T ] → p (Complement law)
≡p→p (Identity law)
≡ ¬p ∨ p (Conditional identity)
≡T (Complement law)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy