Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Logic and Truth Tables: A Comprehensive Guide for CSE 215, Assignments of Computer Science

A detailed explanation of logic and truth tables, covering various concepts such as logical equivalence, truth value assignments, and the analysis of arguments. It includes numerous examples and truth tables to illustrate the concepts and demonstrate their application in solving logical problems. Suitable for students studying logic and computer science, particularly those enrolled in cse 215.

Typology: Assignments

2024/2025

Uploaded on 03/13/2025

joe-anne
joe-anne 🇺🇸

1 document

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Nayonika Singla
CSE 215
HOMEWORK 1
1. Truth table for (A → B)→ [((B → C) ~C) → ~A]
2. Statement A - Ring is in Jar A
Statement B - Ring is not in Jar A
Statement C - Ring is not in Jar C
We know only one of the statements is correct, and the other two are incorrect.
Case 1:
If Statement A is true,
Statement B would be false - the ring is in Jar A.
Statement C would be false - the ring is in Jar C.
Therefore, Statement A and C are contradicting each other as each says the ring
is in the respective jars. And hence, Statement A cannot be true.
Case 2:
If Statement B is true,
Statement A would be false - the ring is not in Jar A.
Statement C would be false - the ring is in Jar C.
Therefore, the ring is in Jar C, as Statement A and B support each other.
Case 3:
If Statement C is true,
Statement A would be false - the ring is not in Jar A.
Statement B would be false - the ring is in Jar A.
Therefore, Statement A and B are contradicting each other. And hence, Statement
C cannot be true.
1
A
B
C
~A
~C
A→B
B→C
(B→C)~C
(B→C)~C)→~A
T
T
T
F
F
T
T
F
T
T
T
F
F
T
T
F
F
T
T
F
T
F
F
F
T
F
T
T
F
F
F
T
F
T
T
F
F
T
T
T
F
T
T
F
T
F
T
F
T
T
T
F
F
T
F
F
T
T
F
T
T
F
T
F
F
F
T
T
T
T
T
T
pf3
pf4
pf5

Partial preview of the text

Download Logic and Truth Tables: A Comprehensive Guide for CSE 215 and more Assignments Computer Science in PDF only on Docsity!

CSE 215

HOMEWORK 1

  1. Truth table for (A → B)→ [((B → C)~C) → ~A]
  2. Statement A - Ring is in Jar A Statement B - Ring is not in Jar A Statement C - Ring is not in Jar C

We know only one of the statements is correct, and the other two are incorrect.

Case 1: If Statement A is true, Statement B would be false - the ring is in Jar A. Statement C would be false - the ring is in Jar C. Therefore, Statement A and C are contradicting each other as each says the ring is in the respective jars. And hence, Statement A cannot be true.

Case 2: If Statement B is true, Statement A would be false - the ring is not in Jar A. Statement C would be false - the ring is in Jar C. Therefore, the ring is in Jar C, as Statement A and B support each other.

Case 3: If Statement C is true, Statement A would be false - the ring is not in Jar A. Statement B would be false - the ring is in Jar A. Therefore, Statement A and B are contradicting each other. And hence, Statement C cannot be true.

A B C ~A ~C A→B B→C (B→C) ∧ ~C (B→C) ∧ ~C)→~A (A→B)→[((B→C) ∧ ~C)→~A]

T T T F F T T F T T

T T F F T T F F T T

T F T F F F T F T T

T F F F T F T T F T

F T T T F T T F T T

F T F T T T F F T T

F F T T F T T F T T

F F F T T T T T T T

CSE 215

  1. Truth table for pq(~p~q) and p ↔ q

p q ~p ~q pq ~p~q pq(~p~q) p ↔ q

T T F F T F T T

T F F T F F F F

F T T F F F F F

F F T T F T T T

Since “ pq(~p~q) ” and “ p ↔ q ” have the same truth values they are logically equivalent.

  1. Assuming, ((p1→q)(p2→q)) is True, we must prove ((p1p2) → q) is true as well. If ((p1→q)(p2→q)) is True, then (p1→q) and (p2→q) are also both true. Since, (p1→q) is True, then if p1 is true then q must also be True and similarly, (p2→q) is True, then if p2 is true then q must also be True. Furthermore, since (p1p2) is True, then p1 and p2 must also be True, thus the above assumption is correct. Concluding, since (p1p2) is True, then q must also be true. This implies that ((p1p2) → q) is true. Hence, ((p1→q)(p2→q)) and ((p1p2) → q) are logically equivalent since they have the same truth values.
  2. U: None of us is a knight. V: At least three of us are knights. W: At most three of us are knights. X: Exactly five of us are knights. Y: Exactly two of us are knights. Z: Exactly one of us is a knight.

Case 1: If U is telling the truth, then there are no knights that means even U cannot be a knight. Hence, U is lying and is a knave.

Case 2: If V is telling the truth then U, W, Y, and Z are lying and are knaves. That means less than 3 people are knights which contradicts V’s statement.

Case 3: If W is telling the truth then U, W, and X are lying and are knaves. That means either Y or Z are telling the truth thus less than 3 are knights - supporting W’s statement.

CSE 215

q~r : I was cooking breakfast or I did not leave my glasses on the kitchen table. ~p : I was not reading the newspaper.

From premise 3 we can say that if r is false then in statement 1 p must also be false for a false r, hence the conclusion should be that p is false. Therefore, it is a valid statement.

  1. A. Truth table for A(AB) and A:

A B A ∨ B A ∧ (A ∨

B)

A

T T T T T

T F T T T

F T T F F

F F F F F

Since “ A(AB) ” and “ A ” have the same truth values they are logically equivalent.

B. Truth table for ~(A~B)~B and BA:

A B ~B A ∨ ~B ~(A ∨ ~B) ~(A ∨ ~B) →

~B

B → A

T T F T F T T

T F T T F T T

F T F F T F F

F F T T F T T

Since “ ~(A~B)~B ” and “ BA ” have the same truth values they are logically equivalent.

C. Truth table for (P(PQ)) → Q and P(PQ):

P Q P → Q P ∧ (P → Q) (P ∧ (P → Q)) → Q P ↔ Q P → (P ↔ Q)

T T T T T T T

T F F F T F F

F T T F T F T

CSE 215

F F T F T T T

Since “ (P(PQ)) → Q ” and “ P(PQ) ” do not have the same truth values; they are not logically equivalent.

D. Truth table for ~(~PQ)(PR)(Q~R) and True:

Since “ ~(~PQ)(PR)(Q~R) ” and “ True ” have the same truth values; they are not logically equivalent.

  1. The statement is True.

P Q R ~P ~R ~PQ ~(~PQ) PR Q~R (~PQ)(PR)(Q~R True

T T T F F F T T F T T

T T F F T F T T T T T

T F T F F F T T F T T

T F F F T F T T F T T

F T T T F T F T F T T

F T F T T T F F T T T

F F T T F F T T F T T

F F F T T F T F F T T