Skip to content

Propositional and Predicate Logic

A proposition is a statement that is either true or false. Propositional logic deals with Propositions and their combinations using logical connectives.

Basic connectives:

SymbolNameMeaning
¬\negNegationNOT
∧\landConjunctionAND
∨\lorDisjunctionOR
  ⟹  \impliesImplicationIF…THEN
  ⟺  \iffBiconditionalIF AND ONLY IF

Truth tables. The implication p  ⟹  qp \implies q is false only when pp is true and qq is false.

Logical equivalence. Two propositions are logically equivalent (≡\equiv) if they have the Same truth value for all assignments.

Important equivalences:

  • ¬(p∧q)≡¬p∨¬q\neg(p \land q) \equiv \neg p \lor \neg q (De Morgan)
  • ¬(p∨q)≡¬p∧¬q\neg(p \lor q) \equiv \neg p \land \neg q (De Morgan)
  • p  ⟹  q≡¬p∨qp \implies q \equiv \neg p \lor q
  • p  ⟺  q≡(p  ⟹  q)∧(q  ⟹  p)p \iff q \equiv (p \implies q) \land (q \implies p)
  • ¬(p  ⟹  q)≡p∧¬q\neg(p \implies q) \equiv p \land \neg q

Predicates extend propositional logic with variables and quantifiers.

  • Universal quantifier: ∀x P(x)\forall x\, P(x) — ”P(x)P(x) holds for all xx.”
  • Existential quantifier: ∃x P(x)\exists x\, P(x) — “there exists xx such that P(x)P(x) holds.”

Negation of quantifiers:

¬∀x P(x)≡∃x ¬P(x)\neg \forall x\, P(x) \equiv \exists x\, \neg P(x)

¬∃x P(x)≡∀x ¬P(x)\neg \exists x\, P(x) \equiv \forall x\, \neg P(x)

Nested quantifiers must be read carefully. The order matters:

∀x ∃y P(x,y)≢∃y ∀x P(x,y)\forall x\, \exists y\, P(x, y) \not\equiv \exists y\, \forall x\, P(x, y)

The first says “for every xx there is a (possibly different) yy.” The second says “there exists a Single yy that works for all xx.“

A formula is valid (a tautology) if it is true under all interpretations. A formula is satisfiable if it is true under at least one interpretation.

Theorem 1.1. A formula is valid if and only if its negation is unsatisfiable.

For a propositional formula with nn distinct variables, the truth table has 2n2^n rows (one per Assignment). Two systematic methods ensure no assignment is missed.

Method 1: Binary counting. Treat the first variable as the most significant bit. Enumerate all Binary nn-tuples from (0,…,0)(0, \ldots, 0) to (1,…,1)(1, \ldots, 1). The first variable changes most slowly (only every 2n−12^{n-1} rows), while the last variable alternates every row.

Method 2: Recursive splitting. For nn variables, the table splits into two blocks of 2n−12^{n-1} Rows: the top block has the first variable as TTThe bottom as FF. Recurse on the remaining n−1n - 1 variables within each block.

Worked Example. Construct the truth table for (p  ⟹  q)∧(q  ⟹  r)(p \implies q) \land (q \implies r).

Solution

With 3 variables we have 23=82^3 = 8 rows.

ppqqrrp  ⟹  qp \implies qq  ⟹  rq \implies rϕ\phi
TTTTTT
TTFTFF
TFTFTF
TFFFTF
FTTTTT
FTFTFF
FFTTTT
FFFTTT

The formula is satisfiable (e.g., p=F,q=F,r=Tp = F, q = F, r = T) but not a tautology (e.g., p=T,q=T,r=Fp = T, q = T, r = F).

Worked Example. Verify that hypothetical syllogism (p  ⟹  q)∧(q  ⟹  r)  ⟹  (p  ⟹  r)(p \implies q) \land (q \implies r) \implies (p \implies r) is a tautology.

Solution

Extending the table above:

ppqqrrϕ\phip  ⟹  rp \implies rϕ  ⟹  (p  ⟹  r)\phi \implies (p \implies r)
TTTTTT
TTFFFT
TFTFTT
TFFFFT
FTTTTT
FTFFTT
FFTTTT
FFFTTT

The final column is all TTConfirming the tautology.

Natural deduction is a …/1-number-and-algebra/3proof-and-logic system that mirrors ordinary mathematical reasoning. Each connective Has introduction rules (how to _derive a formula with that connective) and elimination rules (how to use a formula with that connective).

Rules of inference:

RulePremisesConclusion
∧\land-IAA, BBA∧BA \land B
∧\land-E1_1A∧BA \land BAA
∧\land-E2_2A∧BA \land BBB
∨\lor-I1_1AAA∨BA \lor B
∨\lor-I2_2BBA∨BA \lor B
∨\lor-EA∨BA \lor B, A⊢CA \vdash C, B⊢CB \vdash CCC
→\to-I[A]⊢B[A] \vdash BA→BA \to B
→\to-EAA, A→BA \to BBB
¬\neg-I[A]⊢⊥[A] \vdash \bot¬A\neg A
¬\neg-EAA, ¬A\neg A⊥\bot
DNE¬¬A\neg\neg AAA
RAA[¬A]⊢⊥[\neg A] \vdash \botAA

Square brackets [A][A] denote an assumption that is discharged after the rule is applied.

Worked Example. Prove: p→q⊢¬q→¬pp \to q \vdash \neg q \to \neg p (contraposition).

Solution
  1. p→qp \to q. Premise
  2. [¬q][\neg q]. Assumption (for →\to-I)
  3. [p][p]. Assumption (for ¬\neg-I)
  4. qq — →\to-E on 1, 3
  5. ⊥\bot — ¬\neg-E on 4, 2
  6. ¬p\neg p — ¬\neg-I on 3—5, discharging [p][p]
  7. ¬q→¬p\neg q \to \neg p — →\to-I on 2—6, discharging [¬q][\neg q]

■\blacksquare

Worked Example. Prove: p∨q,¬p⊢qp \lor q, \neg p \vdash q (disjunctive syllogism).

Solution
  1. p∨qp \lor q. Premise
  2. ¬p\neg p. Premise
  3. [p][p]. Assumption (left case for ∨\lor-E)
  4. ⊥\bot — ¬\neg-E on 3, 2
  5. qq. Ex falso on 4
  6. [q][q]. Assumption (right case for ∨\lor-E)
  7. qq. Reiterate 6
  8. qq — ∨\lor-E on 1, 3—5, 6—7

■\blacksquare

Worked Example. Prove: p∧(q∨r)⊢(p∧q)∨(p∧r)p \land (q \lor r) \vdash (p \land q) \lor (p \land r) (distribution).

Solution
  1. p∧(q∨r)p \land (q \lor r). Premise
  2. pp — ∧\land-E1_1 on 1
  3. q∨rq \lor r — ∧\land-E2_2 on 1
  4. [q][q]. Assumption (left case for ∨\lor-E on 3)
  5. p∧qp \land q — ∧\land-I on 2, 4
  6. (p∧q)∨(p∧r)(p \land q) \lor (p \land r) — ∨\lor-I1_1 on 5
  7. [r][r]. Assumption (right case for ∨\lor-E on 3)
  8. p∧rp \land r — ∧\land-I on 2, 7
  9. (p∧q)∨(p∧r)(p \land q) \lor (p \land r) — ∨\lor-I2_2 on 8
  10. (p∧q)∨(p∧r)(p \land q) \lor (p \land r) — ∨\lor-E on 3, 4—6, 7—9

■\blacksquare

:::caution Common Pitfall In natural deduction, always track which assumptions are discharged. A common mistake is to use a Discharged assumption in a later step. Each discharged assumption is only valid within the scope Indicated by the rule that discharges it. :::

A literal is a propositional variable or its negation. A clause is a disjunction of literals. A term (or cube) is a conjunction of literals.

  • Disjunctive Normal Form (DNF): a disjunction of terms, e.g. (p∧¬q)∨(¬p∧r)(p \land \neg q) \lor (\neg p \land r).
  • Conjunctive Normal Form (CNF): a conjunction of clauses, e.g. (p∨¬q)∧(¬p∨r)(p \lor \neg q) \land (\neg p \lor r).

Theorem 1.2. Every propositional formula is equivalent to a formula in CNF and to a formula in DNF.

Conversion to CNF:

  1. Eliminate   ⟺  \iff and   ⟹  \implies: A  ⟹  B≡¬A∨BA \implies B \equiv \neg A \lor BAnd A  ⟺  B≡(¬A∨B)∧(A∨¬B)A \iff B \equiv (\neg A \lor B) \land (A \lor \neg B).
  2. Push ¬\neg inward using De Morgan”s laws and double negation (¬¬A≡A\neg\neg A \equiv A) until every ¬\neg applies to a single variable.
  3. Distribute ∨\lor over ∧\land: A∨(B∧C)≡(A∨B)∧(A∨C)A \lor (B \land C) \equiv (A \lor B) \land (A \lor C).

Conversion to DNF: Same steps 1—2; in step 3 distribute ∧\land over ∨\lor instead.

Worked Example. Convert (p∧q)∨(¬p∧r)(p \land q) \lor (\neg p \land r) to CNF.

Solution

Step 1: No   ⟹  \implies or   ⟺  \iff to eliminate.

Step 2: No ¬\neg to push inward.

Step 3: Distribute ∨\lor over ∧\land:

(p∧q)∨(¬p∧r)≡(p∨¬p)∧(p∨r)∧(q∨¬p)∧(q∨r)(p \land q) \lor (\neg p \land r) \equiv (p \lor \neg p) \land (p \lor r) \land (q \lor \neg p) \land (q \lor r).

Since p∨¬pp \lor \neg p is a tautology we may simplify to (p∨r)∧(¬p∨q)∧(q∨r)(p \lor r) \land (\neg p \lor q) \land (q \lor r).

Worked Example. Convert ¬(p  ⟹  q)∨r\neg(p \implies q) \lor r to CNF.

Solution

Step 1: Eliminate   ⟹  \implies: ¬(¬p∨q)∨r\neg(\neg p \lor q) \lor r.

Step 2: Push ¬\neg inward: (p∧¬q)∨r(p \land \neg q) \lor r.

Step 3: Distribute ∨\lor over ∧\land: (p∨r)∧(¬q∨r)(p \lor r) \land (\neg q \lor r).

This is in CNF.

:::caution Common Pitfall Distributing ∨\lor over ∧\land can cause exponential blowup. A DNF formula with nn terms can Produce up to 2n2^n clauses when converted to CNF. This exponential growth underlies the hardness Of many satisfiability problems. :::

The resolution rule is a single inference rule that is refutation-complete for propositional Logic.

Resolution rule. From clauses (A∨x)(A \lor x) and (B∨¬x)(B \lor \neg x)Derive the resolvent (A∨B)(A \lor B)Where AA and BB are (possibly empty) sets of literals and xx is a propositional Variable.

Resolution refutation. To show that clauses {C1,…,Ck}\{C_1, \ldots, C_k\} entail clause CC:

  1. Add ¬C\neg C to the clause set.
  2. Repeatedly apply the resolution rule to derive new clauses.
  3. If the empty clause ⊥\bot is derived, the entailment holds.

Theorem 1.3 (Refutation completeness). If a set of clauses is unsatisfiable, the empty clause Can be derived by resolution.

Worked Example. Show that {p∨q,  ¬p∨r,  ¬q∨¬r}\{p \lor q,\; \neg p \lor r,\; \neg q \lor \neg r\} entails ¬r\neg r.

Solution

Add the negation of the conclusion: clause (4) rr.

Clauses: (1) p∨qp \lor q; (2) ¬p∨r\neg p \lor r; (3) ¬q∨¬r\neg q \lor \neg r; (4) rr.

Resolve (2) and (4) on rr: (5) ¬p\neg p. Resolve (1) and (5) on pp: (6) qq. Resolve (3) and (6) on qq: (7) ¬r\neg r. Resolve (7) and (4) on rr: (8) ⊥\bot.

Since ⊥\bot is derived, the entailment holds. ■\blacksquare

The Boolean satisfiability problem (SAT) asks: given a propositional formula ϕ\phiIs there a Truth assignment that makes ϕ\phi true?

Definition. An instance of SAT is a propositional formula. The answer is YES if ϕ\phi is Satisfiable, NO otherwise.

k-SAT. A restricted version where the formula is in CNF and every clause has exactly kk Literals.

  • 1-SAT: solvable in linear time (each clause is a single literal).
  • 2-SAT: solvable in O(n+m)O(n + m) time using the implication graph and strongly connected components, where nn is the number of variables and mm the number of clauses.
  • 3-SAT: NP-complete (Cook—Levin theorem, 1971). This was the first problem proven NP-complete.

Theorem 1.4 (Cook—Levin). SAT is NP-complete. Consequently, 3-SAT is also NP-complete.

SAT solvers (DPLL, CDCL) are widely deployed in hardware verification, software model checking, and AI planning. Modern solvers routinely handle instances with millions of variables.

:::caution Common Pitfall Do not confuse satisfiability with validity. A formula is satisfiable if it is true under some Assignment; it is valid (a tautology) if true under all assignments. Checking validity is Co-NP-complete, not NP-complete.

:::