| ← Equality reasoning | Index |
Key points. Prop is the type of statements, and a proof is just an
ordinary term of that type (Curry–Howard). ∧/∨/→/∀/∃ each have
their own introduction and elimination rule, mirrored directly by Lean
syntax: the anonymous constructor, Or.inl/Or.inr/match, fun/
application, and fun/anonymous-constructor again. rfl proves equality
by checking both sides reduce to the same normal form.
Socratic questions.
P ∧ QandP ∨ Qare both built from two propositions. Why does∧need only one constructor (the anonymous pair) while∨needs two (Or.inl,Or.inr)? A proof ofP ∧ Qmust supply both a proof ofPand a proof ofQat once — one shape suffices. A proof ofP ∨ Qsupplies only one of the two, so the proof itself must record which side was chosen — hence two distinct constructors rather than one.rflcloses2 + 2 = 4immediately. Why can it not, by the same reasoning, close∀ n, n + 0 = n?rflchecks that both sides already reduce to the same closed term —2 + 2and4both compute to the literal4. Butnis a free variable, not a number to compute with;n + 0 = nis true for everyn, yet no single reduction sequence turnsn + 0intonwithout first knowing whichnit is. That gap between “true” and “reduces to the same term” is exactly why proofs, not mere computation, exist.-
∃ n, n > 0was proved with a witness and a decided fact about it. What would go wrong trying to prove∀ n, n > 0the same way, by picking onenand checking it? A single witness proves only that somenworks — universal quantification demands the property hold for everynat once, which no finite number of individual checks can establish; it needs a genuine argument (an inductive proof, starting in Chapter 4) that works uniformly. - Prove
theorem and_comm_ex {P Q : Prop} (h : P ∧ Q) : Q ∧ P. - Prove
theorem or_comm_ex {P Q : Prop} (h : P ∨ Q) : Q ∨ P(hint: useOr.elimor pattern matching withmatch). - Prove
theorem exists_gt_zero : ∃ n : Nat, n > 0.
Solutions: Appendix, Chapter 3.
Next
Continue to Chapter 4: Tactics.
| ← Equality reasoning | Index | Table of contents | Ch. 4: Tactics → |