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.
pqp \land q
Conjunction
True when both p and q are true.
pqp \lor q
Disjunction
True when at least one is true.
pqp \to q
Implication
False only when p is true and q is false.
pqp \leftrightarrow q
Biconditional
True when p and q have the same truth value.

The implication pqp \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 pqp \to q, three related implications arise — only the contrapositive is logically equivalent to the original:

Converse

qpq \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

pqp \to q

Logical Equivalence

Definition — Logical Equivalence

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

Key equivalences

Double Negation

¬¬pp\lnot\lnot p \equiv p

Contrapositive

(pq)(¬q¬p)(p \to q) \equiv (\lnot q \to \lnot p)

De Morgan 1

¬(pq)¬p¬q\lnot(p \land q) \equiv \lnot p \lor \lnot q

De Morgan 2

¬(pq)¬p¬q\lnot(p \lor q) \equiv \lnot p \land \lnot q

Implication

(pq)(¬pq)(p \to q) \equiv (\lnot p \lor q)

Absorption

p(pq)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

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

Negating quantifiers

¬xP(x)    x¬P(x)\lnot\,\forall x\, P(x) \;\equiv\; \exists x\, \lnot P(x)
¬xP(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,pq    qp,\quad p \to q \;\vdash\; q

Modus Tollens

¬q,pq    ¬p\lnot q,\quad p \to q \;\vdash\; \lnot p

Hypothetical Syl.

pq,qr    prp \to q,\quad q \to r \;\vdash\; p \to r

Disjunctive Syl.

pq,¬p    qp \lor q,\quad \lnot p \;\vdash\; q

Addition

p    pqp \;\vdash\; p \lor q

Simplification

pq    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 pqp \to q, we can conclude qq.


Next: Number Theory →