Converted with pandoc 3.7 (markdown → org), all 17 files: - README, references, 15 tutorial units - Internal file links updated from .md to .org - Source code blocks (#+begin_src lean) preserved - Tables, math notation, links intact For the Emacs workflow.
2.8 KiB
2.8 KiB
Unit 3 — Propositions and Proofs
Tutorial 1: Lean 4 Fundamentals · ← Back to README
Goals
- Understand propositions as types (Curry-Howard)
- Write basic proofs using
exampleandtheorem - Use the tactic language:
intro,apply,exact,have
Source
Theorem Proving in Lean 4 (TPIL), Chapters 2–3 → https://leanprover.github.io/theorem_proving_in_lean4/
Concepts
| Concept | Lean |
|---|---|
| Proposition | P : Prop — a type whose terms are proofs |
Implication P → Q |
Function from proofs of P to proofs of Q |
Conjunction P ∧ Q |
And.intro (constructor), .left / .right (projections) |
Disjunction P ∨ Q |
Or.inl / Or.inr |
Negation ¬ P |
P → False |
| Tactics | intro, apply, exact, have, assumption |
Exercises
Exercise 3.1 — Implicational logic
-- (a) Identity
theorem id_prop (A : Prop) : A → A :=
by
intro h
exact h
-- (b) Composition
theorem compose (A B C : Prop) : (A → B) → (B → C) → (A → C) :=
by
sorry
-- (c) Currying
theorem curry (A B C : Prop) : (A → B → C) → (A ∧ B → C) :=
by
sorry
Exercise 3.2 — Conjunction and disjunction
-- (a) Swap conjuncts
theorem and_comm (A B : Prop) : A ∧ B → B ∧ A :=
by
sorry
-- (b) Disjunction is symmetric
theorem or_comm (A B : Prop) : A ∨ B → B ∨ A :=
by
sorry
-- (c) Forward reasoning with `have`
theorem forward_example (A B C : Prop) (h1 : A → B) (h2 : B → C) (ha : A) : C :=
by
have hb : B := h1 ha
sorry
Exercise 3.3 — Negation
-- (a) Contradiction
theorem contrapositive (A B : Prop) : (A → B) → (¬ B → ¬ A) :=
by
sorry
-- (b) Double negation introduction
theorem double_neg_intro (A : Prop) : A → ¬ ¬ A :=
by
sorry
-- (c) Ex falso quodlibet
theorem ex_falso (A : Prop) : False → A :=
by
sorry
← Previous: Unit 2 · Next: Unit 4 — Quantifiers and Equality