0% found this document useful (0 votes)
20 views

CS 228 Tut1 Sol

Uploaded by

Vistas Flamingo
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)
20 views

CS 228 Tut1 Sol

Uploaded by

Vistas Flamingo
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/ 7

Logic in CS Autumn 2024

Problem Sheet 1
S. Krishna

1. There are three suspects for a murder: A, B, and C.

• A says “I did not do it. The victim was an old acquaintance of B’s. But C hated him.”
• B states “I did not do it. I did not even know the guy. Besides I was out of town all
that week.”
• C says “I did not do it. I saw both A and B downtown with the victim that day; one of
them must have done it.”

Assume that the two innocent men are telling the truth, but that the guilty man might not
be. Who did it? Deduce the answer by encoding in propositional logic and finding a solution.

Solution

All three of them say, “I did not do it”. So, this does not give any useful information
to us. (Why?) Let us define the following propositions:

p1 : victim is acquaintance of B

p2 : B was out of town


Then, we can encode the statements of A, B, and C as a = p1 , b = ¬p1 ∧ p2 , and
c = ¬p2 respectively. Since we know at least two people tell the truth, the formula,
(a ∧ b) ∨ (b ∧ c) ∨ (c ∧ a) has to be true.

a ∧ b = (p1 ∧ (¬p1 ∧ p2 )) ≡ ⊥
b ∧ c = ((¬p1 ∧ p2 ) ∧ ¬p2 )) ≡ ⊥
Hence, c ∧ a is true ⇒ c is true and a is true ⇒ B is guilty

2. In an island, there are three tribes : the Knights, Knaves and Normals. The Knights always
speak truth, the Knaves always lie, while the Normals lie sometimes and speak truth some-
times. On a visit to this island, I met two inhabitants A and B. A told me that B is a knight
and B told me that A is a knave. Prove, using natural deduction, that one of them told the
truth but is not a knight, or that one of them told a lie but is not a knave.

Solution

Note that if B is a knight, then A must be a knave, which makes her statement that
B is a knight false, which contradicts the fact that B is a knight. Therefore B is not

1
a knight. This means A’s statement is false, which means A is also not a knight. So
both are either normals or knaves, and A’s statement is false. Let us take some cases
now:

(a) If A is a knave, then B’s statement is true, which means B must be a normal.
This means one of them (B) told the truth but is not a knight.

(b) If B is a knave, then A must be a normal. This means one of them (A) told a lie
but is not a knave.

(c) If both A and B are normals, then both their statements are false, which means
one of them (either) told a lie but is not a knave.

Therefore, by cases, we can say that one of them told the truth but is not a knight, or
that one of them told a lie but is not a knave.
This natural language proof can also be directly translated into a formal proof.

3. Let F , G and H be formulas and let S be a set of formulas. Which of the following statements
are true? Justify your answer.

(a) If F is unsatisfiable, then ¬F is valid.


(b) If F → G is satisfiable and F is satisfiable, then G is satisfiable.
(c) P1 → (P2 → (P3 → . . . (Pn → P1 ) . . .)) is valid.
(d) S |= F and S |= ¬F cannot both hold.
(e) If S |= F ∨ G, S ∪ {F } |= H and S ∪ {G} |= H, then S |= H.

Solution

(a) True. Let A be an arbitrary assignment. Since F is unsatisfiable we have A[[F ]] =


0 and thus A[[¬F ]] = 1.

(b) False. A counterexample is P → false for an atomic proposition P .

(c) True. Consider an assignment A. If A[[P1 ]] = 0 then the outermost implication


is true. If A[[P1 ]] = 1 then, arguing from the inside outwards, all the implication
subformulas are true.

(d) False. If S is unsatisfiable then S |= F and S |= ¬F for any F .

(e) True. Let A be a model of S. Since S |= F ∨ G, A is a model of F or a model


of G. In the first case, since S ∪ {F } |= H, A is a model of H. Likewise in the
second case, since S ∪ {G} |= H, A is a model of H. Since the two cases are
exhaustive, A is a model of H. Thus every model of S is a model of H.

2
4. The Pigeon Hole Principle states that if there are n + 1 pigeons sitting amongst n holes then
there is atleast one hole with more than one pigeon sitting in it. For i ∈ {1, 2, .., n + 1} and
j ∈ {1, 2, ..., n}, let the atomic proposition P (i, j) indicate that the i-th pigeon is sitting in
the j-th hole.
Write out a propositional logic formula that states the Pigeon Hole Principle.

Solution

Let P (i, j) represent the proposition that the ith pigeon is sitting in the j th hole, where
i ∈ {1 . . . n + 1} and j ∈ {1 . . . n}.
The Pigeonhole principle states that, if there are n + 1 pigeons and n holes, and every
pigeon sits in exactly one hole, then there is a hole occupied by more than one pigeon.
To convert this into a PL formula, let us convert each side of the implication into PL
first.
Every pigeon sits in at least one hole can be expressed in PL as:
n+1
^ _ n
P (i, j)
i=1 j=1

Here the inner disjunction refers to the ith pigeon sitting in some hole, and the outer
conjuction makes it so that every pigeon must sit in some hole. Call this condition F .
We also need no pigeon to sit in multiple holes. Say pigeon i sits in holes j and k with
j < k. The formula P (i, j) ∧ P (i, k) represents this scenario. There exists a pigeon
sitting in multiple holes therefore becomes:
n+1
_ n
_
(P (i, j) ∧ P (i, k))
i=1 j,k=1
j<k

Here, the inner disjunction refers to the ith pigeon sitting in multiple holes and the
outer disjunction refers to there existing a pigeon sitting in multiple holes.
Negating this, we get the condition for no pigeon to sit in multiple holes:
n+1
^ n
^
(¬P (i, j) ∨ ¬P (i, k))
i=1 j,k=1
j<k

Call this condition G.


Now, say hole k is occupied by pigeons i and j with i < j. We then have P (i, k)∧P (j, k).
There exists a hole occupied by more than one pigeon therefore becomes:
n n+1
_ _
(P (i, k) ∧ P (j, k))
k=1 i,j=1
i<j

Here, the inner disjunction refers to the k th hole being occupied by more than one
pigeon and the outer disjunction refers to there existing a hole occupied by multiple
pigeons. Call this condition H.
The Pigeonhole Principle therefore becomes:
F ∧ G =⇒ H

3
5. Prove formally ⊢ [(p → q) → q] → [(q → p) → p]

Solution

1. (p → q) → q assumption
2. q→p assumption
3. ¬p assumption
4. ¬q MT 2, 3
5. ¬(p → q) MT 1, 4
6. p assumption
7. ⊥ ⊥i 3, 6
8. q ⊥e 7
9. p→q → i 6-8
10. ⊥ ⊥i 5, 9
11. ¬¬p ¬i 3, 10
12. p ¬¬e 11
13. (q → p) → p → i 1-12
14. ((p → q) → q) → ((q → p) → p) → i 1-13

6. Let H be a given set of premises. If H ⊢ (A → B) and H ⊢ (C ∨ A), then show that


H ⊢ (B ∨ C) where A, B, C are wffs.

Solution

1. H premises
2. A→B as H ⊢ (A → B)
3. C ∨A as H ⊢ (C ∨ A)
4. C assumption
5. B∨C ∨i 3
6. A assumption
7. B MP 1, 5
8. B∨C ∨i 6
9. B∨C ∨e 2, 3-4, 5-7

7. Let H be a given set of premises. If H ⊢ (A → C) and H ⊢ (B → C), then show that


H ⊢ ((A ∨ B) → C). Here, A, B and C are wffs.

4
Solution

1. H premises
2. A→C as H ⊢ (A → C)
3. B→C as H ⊢ (B → C)
4. A∨B assumption
5. A assumption
6. C MP 1, 4
7. B assumption
8. C MP 2, 6
9. C ∨e 3, 4-5, 6-7
10. (A ∨ B) → C → i 3-8

8. Show that a truth assignment α satisfies the wff

(. . . (x1 ↔ x2 ) ↔ · · · ↔ xn )

iff α(xi ) = false for an even number of i’s, 1 ≤ i ≤ n.

Solution

Base Case. For n = 1, the wff will be (x1 ), which is true iff α(x1 ) = true.
Induction Hypothesis. Assume α satisfies the wff (. . . (x1 ↔ x2 ) ↔ · · · ↔ xn−1 ) iff
α(xi ) = false for an even number of i’s, 1 ≤ i ≤ n − 1.
Now consider (. . . (x1 ↔ x2 ) ↔ · · · ↔ xn ). Here, α(xn ) can be true or false.

• If α(xn ) = true, and the wff (. . . (x1 ↔ x2 ) ↔ · · · ↔ xn ) is true ⇔ (. . . (x1 ↔


x2 ) ↔ · · · ↔ xn−1 ) is true ⇔ α(xi ) = false for an even number of i’s, 1 ≤ i ≤
n − 1 ⇔ α(xi ) = false for an even number of i’s, 1 ≤ i ≤ n

• If α(xn ) = false, and the wff (. . . (x1 ↔ x2 ) ↔ · · · ↔ xn ) is true ⇔ (. . . (x1 ↔


x2 ) ↔ · · · ↔ xn−1 ) is false ⇔ α(xi ) = false for an odd number of i’s, 1 ≤ i ≤
n − 1 ⇔ α(xi ) = false for an even number of i’s, 1 ≤ i ≤ n

9. Of the following three formulae, which tautologically imply which?

(a) x ↔ y
(b) (¬((x ↔ y) → (¬y → x))))
(c) ((¬x ∨ y) ∧ (x ∨ ¬y))

5
Solution

A wff p is said to tautologically imply a wff q if there is no truth assignment α which


makes p true and q false. In this question, this can be seen by looking at the truth
tables of given formulae:

x y x ↔ y (¬((x ↔ y) → (¬y → x))) ((¬x ∨ y) ∧ (x ∨ ¬y))


1 1 1 0 1
1 0 0 0 0
0 1 0 0 0
0 0 1 1 1
Clearly, from the truth tables we can conclude that:

• x ↔ y tautologically implies ((¬x ∨ y) ∧ (x ∨ ¬y))

• ((¬x ∨ y) ∧ (x ∨ ¬y)) tautologically implies x ↔ y

• (¬((x ↔ y) → (¬y → x)))) tautologically implies x ↔ y

• (¬((x ↔ y) → (¬y → x)))) tautologically implies ((¬x ∨ y) ∧ (x ∨ ¬y))

10. Let L be a formulation of propositional logic in which the sole connectives are negation and
disjunction. The rules of natural deduction corresponding to disjunction and negation (also
includes double negation) are available. For any wffs A, B and C, let ¬(A ∨ B) ∨ (B ∨ C) be
an axiom of L. Show that any wff of L is a theorem of L.

Solution

An axiom of a proof system is a formula that can always be taken as true. A theorem
is a logical consequence of axioms, i.e a wff in a proof system is a theorem if it can be
derived from axioms using the proof rules of the system. Let P be any wff of L. We
shall apply the axiom by choosing A = ¬P , B = ⊥ and C = P .

6
1. ¬(¬P ∨ ⊥) ∨ (⊥ ∨ P ) premise (axiom)
2. ¬(¬P ∨ ⊥) assumption
3. ¬P assumption
4. ¬P ∨ ⊥ ∨i 3
5. ⊥ ⊥i 2, 4
6. ¬¬P ⊥e 3-5
7. P ¬¬e 6
8. (⊥ ∨ P ) assumption
9. ⊥ assumption
10. P ⊥e
11. P assumption
12. P ∨e 8, 9-10, 11
13. P ∨e 1, 2-7, 8-12

Notice that we can also derive any wff P, if we can derive ⊥.

11. Let P denote propositional logic. Suppose we add to P the axiom schema (A → B) for wffs
A, B of P. Comment on the consistency of the resulting logical system obtained. A logic
system P is inconsistent if it is capable of producing ⊥ using the rules of natural deduction.

Solution

The resulting logical system is inconsistent, since we can produce ⊥ as follows. Let φ be any
wff of P.

1. (φ ∨ ¬φ) → ⊥ premise (axiom)


2. φ ∨ ¬φ LEM
3. ⊥ MP 1, 2

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