3 - Logic

Statements

A statement is a declarative sentence that has a truth value (or claim)

P,Q, and R are commonly used to represent statements, though any symbol will do.

Assign letters to a symbols using a : not a =

For example:

P: 2 is an even number

Sentences involving unknown variables, such as x, are not considered statements.

Complex Statements

P ∧ Q is like P and Q in Python or P && Q in Javascript.

Screen Shot 2023-09-11 at 10.04.12 AM.png

P V Q is like P || Q in Javascript or P or Q in Python. It is read P and Q.

Screen Shot 2023-09-11 at 10.04.32 AM.png

You can say "not P". Similar to ! in JS or not in Python. Used with a whole statement you can say "it is not the case that" + P

Screen Shot 2023-09-11 at 10.04.51 AM.png

Implications & Conditional Statements

Screen Shot 2023-09-11 at 10.05.41 AM.png

If P is false (and Q is false or true), then the statement is true.

If P is true AND Q is true, the statement is true.

If P is true AND Q is false, the statement is false.

Biconditional Statements

Screen Shot 2023-09-11 at 10.06.18 AM.png

If P And Q are both true or are both false, the statement is true. Otherwise, it is false.

P ⇔Q is the same as saying that P ⇒Q and Q ⇒ P.

A logical connective is an operation that modifies or combines statements into more complex statements. Examples of logical connectives are ∧, ∨, ¬, ⇒, and ⇔.

Screen Shot 2023-09-11 at 10.06.36 AM.png

A compound statement is a statement that has been built by applying at least one logical connective to one or more statements. For example, ((P ∨Q)∧(R∨¬(S)))⇒(P ∧R).

Logical Equivalence

Two compound statements are logically equivalent if they have the same truth value. If R and S are compound statements that are logically equivalent, we write R ≡ S.
Screen Shot 2023-09-11 at 10.22.21 AM.png
Each of the logical equivalences in Theorem 3.26 can be proved by constructing a truth table.

In other words, if two columns have different values, they are NOT logically equivalent.

Tautologies and Contradictions

Contradiction

A compound statement that is false for every possible combination of truth values of its components is called a contradiction.

For example P(¬P)

P ¬P P ∧ (¬P )
F T F
T F F

Tautology

A compound statement that is true for every possible combination of truth values of its components is called a tautology.

For example PP

Example of a compound statement that is a tautology: (P(PQ))Q.

Screen Shot 2023-09-11 at 10.09.59 AM.png

All contradictions are logically equivalent to each other. Similarly, all tautologies are logically equivalent to each other.



Exercises - HW3

E 3.1
a) It is a statement. It's true.
b) It is not a statement.
c) It is not a statement.
d) It is a statement. It's false.
e) It is a statement. It's false.
f) It is a statement. It seems to be false.

E3.2
a)

P Q P ∧ Q (P ∧ Q) ⇒ P .
T T T T
F T F T
T F F F
F F F T

b)

P Q P ∨ Q P ⇒ (P ∨ Q).
T T T T
F T T T
T F T T
F F F T

c)

P Q P ⇒ Q ¬(P ⇒Q) ¬P ¬(P ⇒Q)∧(¬P)
T T T F F F
F T T F T F
T F F T F F
F F T F T F


d)

P Q R P ∨ Q (P ∨ Q) ∧ R
T T T T T
T T F T F
T F T T T
T F F T F
F T T T T
F T F T F
F F T F F
F F F F F

e)

P Q R Q ∧ R P ∨ (Q ∧ R)
T T T T T
T T F F T
T F T F T
T F F F T
F T T T T
F T F F F
F F T F F
F F F F F

E 3.3
a)

P Q P ∧ Q ¬(P ∧ Q) ¬P ¬Q (¬P ) ∨ (¬Q)
T T T F F F F
T F F T F T T
F T F T T F T
F F F T T T T

Since the columns containing (¬P)(¬Q) and ¬(PQ) are equivalent, the two expressions are logically equivalent. The statement ¬(PQ)(¬P)(¬Q) is true.

b)

P Q P ⇒Q ¬P (¬P)∨Q
T T T F T
T F F F F
F T T T T
F F T T T

Since the columns containing PQ and (¬P)Q are equivalent, the two expressions are logically equivalent. The statement PQ(¬P)Q is true.

c)

P Q R P ∨ Q (P ∨ Q) ⇒ R P ⇒ R Q ⇒ R (P ⇒R)∧(Q⇒R)
T T T T T T T T
T T F T F F F F
T F T T T T T T
T F F T F F T F
F T T T T T T T
F T F T F T F F
F F T F T T T T
F F F F T T T T

Since the columns containing (PQ)R and (PR)(QR) are equivalent, the two expressions are logically equivalent. The statement (PQ)R(PR)(QR) is true.



E 3.4
a)

P Q P ⇒ Q ¬(P ⇒ Q)
T T T F
T F F T
F T T F
F F T F
P Q ¬Q P ∧ (¬Q)
T T F F
T F T T
F T F F
F F T F

Since the truth values for any values P and Q are the same for P ∧ (¬Q) and ¬(P ⇒ Q), the two expressions are logically equivalent.

b)

P Q R P ∧ Q (P ∧ Q) ⇒ R
T T T T T
T T F T F
T F T F T
T F F F T
F T T F T
F T F F T
F F T F T
F F F F T
P Q R ¬Q ¬Q ∨ R P ⇒ (¬Q ∨ R)
T T T F T T
T T F F F F
T F T T T T
T F F T T T
F T T F T T
F T F F F T
F F T T T T
F F F T T T

Since the truth values for any values P and Q are the same for P ⇒ (¬Q ∨ R) and (P ∧ Q) ⇒ R, the two expressions are logically equivalent.



c)

P Q R Q ∨ R P ⇒ (Q ∨ R)
T T T T T
T T F T T
T F T T T
T F F F F
F T T T T
F T F T T
F F T T T
F F F F T
P Q R ¬Q P ∧ ¬Q (P ∧ ¬Q) ⇒ R
T T T F F T
T T F F F T
T F T T T T
T F F T T F
F T T F F T
F T F F F T
F F T T F T
F F F T F T

Since the truth values for any values P and Q are the same for (P ∧ ¬Q) ⇒ R and P ⇒ (Q ∨ R), the two expressions are logically equivalent.

d)

P Q R P ∨ Q (P ∨ Q) ⇒ R
T T T T T
T T F T F
T F T T T
T F F T F
F T T T T
F T F T F
F F T F T
F F F F T
P Q R ¬R ¬R∧P ¬Q (¬R∧P)⇒(¬Q)
T T T F F F T
T T F T T F F
T F T F F T T
T F F T T T T
F T T F F F T
F T F T F F T
F F T F F T T
F F F T F T T

The two expressions are NOT logically equivalent because some values of P and Q result in different truth values for the expressions. For example, when P is false and Q is true, (PQ)R is false while (¬RP)(¬Q) is true.

e)

P Q P ⇔Q
T T T
T F F
F T F
F F T
P Q P ⇒Q Q⇒P (P ⇒Q)∧(Q⇒P)
T T T T T
T F F T F
F T T F F
F F T T T

Since the truth values for any values P and Q are the same for P ⇔ Q and (P ⇒Q)∧(Q⇒P), the two expressions are logically equivalent.



E 3.5

a)

P Q P ⇒ Q ¬Q (P ⇒ Q) ∧ (¬Q) ¬P ((P ⇒ Q) ∧ (¬Q)) ⇒ (¬P )
T T T F F F T
T F F T F F T
F T T F F T T
F F T T T T T

The statement ((PQ)(¬Q))(¬P) is a tautology since every possible combination of P & Q results in true.

b)

P Q ¬P P ∨ Q (P ∨ Q) ∧ (¬P) ((P ∨ Q) ∧ (¬P)) ⇒ Q
T T F T F T
T F F T F T
F T T T T T
F F T F F T

The statement ((PQ)(¬P))Q is a tautology since every possible combination of P & Q results in true.

c)

P Q R P ⇒ Q P ⇒ R (P ⇒ Q) ⇒ (P ⇒ R)
T T T T T T
T T F T F F
T F T F T T
T F F F F T
F T T T T T
F T F T T T
F F T T T T
F F F T T T

This statement is neither a tautology nor a contradiction since not all values result in true or false.



d)

P Q ¬P ¬Q (¬Q)⇒(¬P) P ∧ (¬Q) ((¬Q)⇒(¬P)) ∧ P ∧ (¬Q)
T T F F T F F
T F F T F T F
F T T F T F F
F F T T T F F

The expression ((¬Q) ⇒ (¬P)) ∧ P ∧ (¬Q) is false for all combinations of P and Q; therefore, it is a contradiction.

E 3.6

a)

P Q P ⇒ Q
T T T
T F F
F T T
F F T
P Q
Q ⇒ P
T T T
T F T
F T F
F F T

Since the two tables right columns are not identical, the statements are not logically equivalent.

b)

Statement P: "It is raining." Statement Q: "The ground is wet."

P ⇒ Q: "If it is raining, then the ground is wet." This is (typically) true because rain typically makes the ground wet.

Q ⇒ P: "If the ground is wet, then it is raining." This is not necessarily true because there could be other reasons for the ground to be wet, such as BYU's awful sprinklers, a spilled drink, etc.

Truth value of P ⇒ Q: True
Truth value of Q ⇒ P: False