Some compound statements are true in every case, and some pairs of statements always have the same value. These ideas let us simplify and compare statements.

Conditional Statements

From a conditional p → q we can form three related statements. The converse is q → p, the inverse is ¬p → ¬q, and the contrapositive is ¬q → ¬p. A conditional is always equivalent to its contrapositive, and the converse is equivalent to the inverse, but a conditional is not equivalent to its converse. For "If it rains, the ground is wet", the contrapositive "If the ground is not wet, it did not rain" means the same, while the converse "If the ground is wet, it rained" does not, since the ground may be wet for another reason. The conditional p → q is also equivalent to ¬p ∨ q.

Tautology, Contradiction and Contingency

A tautology is a compound statement that is true for every assignment of truth values, such as p ∨ ¬p. A contradiction is one that is false for every assignment, such as p ∧ ¬p. A contingency is one that is neither, being true in some rows and false in others, such as p → q. To classify a statement, we build its truth table and look at the final column: all T means a tautology, all F means a contradiction, and a mix means a contingency.

Definition: Tautology. A compound proposition that is true for every possible assignment of truth values to its atomic propositions.

Logical Equivalence

Two statements P and Q are logically equivalent, written P ≡ Q, if they have the same truth value in every row, that is, if P ↔ Q is a tautology. Equivalence may be shown by a truth table or by applying known laws. The main laws are the identity laws p ∧ T ≡ p and p ∨ F ≡ p, the domination laws p ∨ T ≡ T and p ∧ F ≡ F, the idempotent laws p ∨ p ≡ p, the double negation law ¬¬p ≡ p, the commutative, associative and distributive laws, the absorption laws p ∨ (p ∧ q) ≡ p, and De Morgan's laws: ¬(p ∧ q) ≡ ¬p ∨ ¬q and ¬(p ∨ q) ≡ ¬p ∧ ¬q.

Table 1.2: Important logical equivalences

Law Form 1 Form 2
De Morgan ¬(p ∧ q) ≡ ¬p ∨ ¬q ¬(p ∨ q) ≡ ¬p ∧ ¬q
Distributive p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r) p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)
Conditional p → q ≡ ¬p ∨ q p → q ≡ ¬q → ¬p
Absorption p ∨ (p ∧ q) ≡ p p ∧ (p ∨ q) ≡ p

Example 1.2: Proving an equivalence by laws

Problem: Show that ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q.

Solution:

  1. By De Morgan: ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬(¬p ∧ q).
  2. By De Morgan again: ≡ ¬p ∧ (¬¬p ∨ ¬q) ≡ ¬p ∧ (p ∨ ¬q).
  3. By distribution: ≡ (¬p ∧ p) ∨ (¬p ∧ ¬q).
  4. Since ¬p ∧ p ≡ F: ≡ F ∨ (¬p ∧ ¬q) ≡ ¬p ∧ ¬q.

Result: The two statements are logically equivalent.

from itertools import product
ok = all((not (p or ((not p) and q))) == ((not p) and (not q))
         for p, q in product([True, False], repeat=2))
print("equivalent:", ok)

Output

equivalent: True

Common mistakes

  • Treating the converse as equivalent to the original conditional.
  • Applying De Morgan's law without changing ∧ to ∨ or ∨ to ∧.
  • Calling a statement a tautology after checking only some rows.

Key takeaways

  • A conditional is equivalent to its contrapositive, not to its converse.
  • A tautology is always true, a contradiction always false, a contingency sometimes true.
  • P ≡ Q means P ↔ Q is a tautology.
  • De Morgan: ¬(p ∧ q) ≡ ¬p ∨ ¬q, ¬(p ∨ q) ≡ ¬p ∧ ¬q.

Practice questions

  1. Give the contrapositive of p → q.
  2. Is p ∨ ¬p a tautology?
  3. State De Morgan's laws.

Answers to the practice questions

  1. ¬q → ¬p.
  2. Yes, it is true for every value of p.
  3. ¬(p ∧ q) ≡ ¬p ∨ ¬q, and ¬(p ∨ q) ≡ ¬p ∧ ¬q.

Sources

  • Official BCA syllabus Mathematics Foundations to Computer Science II, course code 25BCA402DS01, Unit I