mk

Mathematics → Logic

Logic

Mathematical logic is the study of formal reasoning — the rules by which conclusions follow necessarily from premises. It underlies every proof in mathematics and every program in computer science.


Propositions

A proposition is a declarative statement that is either true or false, but not both. We denote propositions with letters like p,q,rp, q, r and their truth values with TT (true) or FF (false).

"7 is prime" — proposition (true). "x + 1 = 5" — not a proposition (truth depends on x). "Read this!" — not a proposition (imperative).

Logical Connectives

Propositions are combined using connectives to form compound propositions:

¬p\lnot p
Negation
True when p is false.
p∧qp \land q
Conjunction
True when both p and q are true.
p∨qp \lor q
Disjunction
True when at least one is true.
p→qp \to q
Implication
False only when p is true and q is false.
p↔qp \leftrightarrow q
Biconditional
True when p and q have the same truth value.

The implication p→qp \to q is often the most counterintuitive: a false hypothesis makes the whole statement vacuously true. "If the moon is made of cheese, then 2+2=5" is a true implication.

Truth Tables

A truth table lists all possible truth values for a compound proposition. For nn variables there are 2n2^n rows.

Implication

pqp → qp ↔ q
TTTT
TFFF
FTTF
FFTT

Converse, Inverse, Contrapositive

Given p→qp \to q, three related implications arise — only the contrapositive is logically equivalent to the original:

Converse

q→pq \to p

Not equivalent

Inverse

¬p→¬q\lnot p \to \lnot q

Not equivalent

Contrapositive

¬q→¬p\lnot q \to \lnot p

Logically equivalent ✓

Original

p→qp \to q

Logical Equivalence

Definition — Logical Equivalence

Two propositions PP and QQ are logically equivalent, written P≡QP \equiv Q, if they have identical truth values for every assignment of truth values to their variables.

Key equivalences

Double Negation

¬¬p≡p\lnot\lnot p \equiv p

Contrapositive

(p→q)≡(¬q→¬p)(p \to q) \equiv (\lnot q \to \lnot p)

De Morgan 1

¬(p∧q)≡¬p∨¬q\lnot(p \land q) \equiv \lnot p \lor \lnot q

De Morgan 2

¬(p∨q)≡¬p∧¬q\lnot(p \lor q) \equiv \lnot p \land \lnot q

Implication

(p→q)≡(¬p∨q)(p \to q) \equiv (\lnot p \lor q)

Absorption

p∨(p∧q)≡pp \lor (p \land q) \equiv p

A proposition that is always true is a tautology (e.g. p∨¬pp \lor \lnot p). One that is always false is a contradiction (e.g. p∧¬pp \land \lnot p).

Predicate Logic

Propositional logic treats propositions as atomic. Predicate logic (first-order logic) adds variables, predicates, and quantifiers — allowing statements about entire domains.

A predicate P(x)P(x) is a proposition-valued function: P(x)=“x is prime”P(x) = \text{``}x \text{ is prime''} is true for x=7x=7, false for x=9x=9.

Quantifiers

∀x P(x)\forall x\, P(x)
Universal
"For all x, P(x)." True if P(x) holds for every x in the domain.
∃x P(x)\exists x\, P(x)
Existential
"There exists an x such that P(x)." True if P(x) holds for at least one x.
∃!x P(x)\exists! x\, P(x)
Unique existence
"There exists exactly one x such that P(x)."

Negating quantifiers

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

"Not all integers are even" is the same as "there exists an integer that is not even."

Rules of Inference

A rule of inference is a valid argument form — a pattern that guarantees the conclusion is true whenever the premises are true.

Modus Ponens

p,p→q  ⊢  qp,\quad p \to q \;\vdash\; q

Modus Tollens

¬q,p→q  ⊢  ¬p\lnot q,\quad p \to q \;\vdash\; \lnot p

Hypothetical Syl.

p→q,q→r  ⊢  p→rp \to q,\quad q \to r \;\vdash\; p \to r

Disjunctive Syl.

p∨q,¬p  ⊢  qp \lor q,\quad \lnot p \;\vdash\; q

Addition

p  ⊢  p∨qp \;\vdash\; p \lor q

Simplification

p∧q  ⊢  pp \land q \;\vdash\; p

The symbol ⊢\vdash means "therefore." Modus Ponens is the most fundamental rule: if we know pp is true, and we know p→qp \to q, we can conclude qq.


Next: Number Theory →