← back to discrete math

Symbolic Logic

Oscar Levin · CC BY-SA 4.0 · Discrete Mathematics: An Open Introduction, Ch. 3

Logic is the grammar of proof. Propositions are sentences that are true or false. Connectives combine them. Quantifiers range over domains. Logical equivalence lets you rewrite statements without changing their truth, which is the entire engine of formal proof.

P Q P → Q T T T T F F F T T F F T only false when the premise is true and conclusion is false

Propositions and connectives

A proposition is a statement that is either true or false. The five connectives: negation (not), conjunction (and), disjunction (or), implication (if-then), biconditional (if and only if). Every compound proposition is built from these.

Scheme

Logical equivalences

Two propositions are logically equivalent if they have the same truth value in every row of their truth table. De Morgan's laws, double negation, contrapositive, and distribution are the workhorses. These are the rewrite rules of formal reasoning.

Scheme

Predicate logic and quantifiers

A predicate is a proposition with a variable: P(x). The universal quantifier "for all x, P(x)" asserts P holds everywhere. The existential quantifier "there exists x such that P(x)" asserts at least one witness. Negating a universal gives an existential, and vice versa.

Scheme

Proof methods

Direct proof: assume P, derive Q. Contrapositive: assume not-Q, derive not-P. Contradiction: assume P and not-Q, derive a contradiction. Each is valid because the underlying logical equivalences guarantee it. The choice of method is a matter of convenience, not truth.

Scheme

Notation reference

Math Scheme Python Meaning
P ∧ Q(and p q)p and qConjunction
P ∨ Q(or p q)p or qDisjunction
P → Q(impl p q)impl(p, q)Implication
∀x P(x)(for-all pred lst)all(pred(x) ...)Universal quantifier
∃x P(x)(exists pred lst)any(pred(x) ...)Existential quantifier
Neighbors

Other chapter pages

  • Milewski Ch.23 โ€” topoi have internal logic: subobject classifiers generalize truth values
  • Levin Ch.2 โ€” induction is the proof method that matches recurrence relations

Foundations (Wikipedia)

Translation notes

Levin's logic chapter covers proof techniques that are inherently human activities. Programs can verify instances but cannot produce proofs. The Scheme implementations model propositions as booleans and quantifiers as folds over finite domains. Real logic quantifies over infinite domains, which requires axioms, not loops. The implication connective is the one that surprises newcomers: "false implies anything" is vacuously true.