| Lean | Paperproof |
|---|---|
| **apply** | |
| ```lean theorem apply (a b: ℝ) : a = b := by apply le_antisymm ``` |
|
| **have** | ```lean theorem have (a b: ℝ) (h1: a ≤ b) (h2: b ≤ a) : True := by have hi := le_antisymm h1 h2 ``` |
|
| **intro** | |
| ```lean theorem intro : ∀ (N: ℕ), ∃ M, N + N = M := by intro n ``` |
|
| **rw** | |
| ```lean theorem rw (a b: ℕ) (h1: a = b) : (10 * a = 666) := by rw [h1] ``` |
|
| **by_contra** | |
| ```lean theorem by_contra (m: ℕ) : 2 ≤ m := by by_contra h ``` |
|
| **use** | |
| ```lean theorem use : ∃ x: ℕ, x = 5 := by use 42 ``` |
|
| **induction** | |
| ```lean theorem induction (n: ℕ) : Nat.mul 0 n = 0 := by induction' n with k ih ``` |
|
| **cases** | |
| ```lean theorem casesN (n: ℕ) : Nat.mul 0 n = 0 := by cases' n with m ``` |
|
| ```lean theorem casesAnd (A B C: Prop) (h: A ∧ B) : C := by cases' h with a b ``` |
|
| ```lean theorem casesOr (A B C: Prop) (h: A ∨ B) : C := by cases' h with a b ``` |
|
| ```lean inductive Random where | hi: ℕ → String → Random | hello: (2 + 2 = 4) → Random | wow: Random theorem casesRandom (C: Prop) (h: Random) : C := by cases' h with a b c ``` |
|
|
**Mathematics in Lean (Jeremy Avigad, Patrick Massot)** ([mathematics_in_lean/MIL/C05_Elementary_Number_Theory/solutions/Solutions_S03_Infinitely_Many_Primes.lean:155](https://github.com/leanprover-community/mathematics_in_lean/blob/4bc81ddea0a62c3bbd33cbfc4b4b501d2d0dfb03/MIL/C05_Elementary_Number_Theory/solutions/Solutions_S03_Infinitely_Many_Primes.lean#L155)) |
|
|
|
**Mathlib** ([mathlib4/Mathlib/Algebra/Field/Power.lean:30](https://github.com/leanprover-community/mathlib4/blob/9893bbd22fdca4005b93c8dbff16c1d2de21bc1a/Mathlib/Algebra/Field/Power.lean#L30)) |
|
|
|
**Hitchhiker's Guide to Logical Verification** **(Anne Baanen, Alexander Bentkamp, Jasmin Blanchette, Johannes Hölzl, Jannis Limperg)** ([logical_verification_2023/blob/main/lean/LoVe/LoVe05_FunctionalProgramming_Demo.lean:316](https://github.com/blanchette/logical_verification_2023/blob/f709e20d2cd515d4ede3e7d2db30103d4f58aaca/lean/LoVe/LoVe05_FunctionalProgramming_Demo.lean#L316)) |
|
|
| Lean | Paperproof |
|---|---|
|
Hypotheses are displayed as green nodes, goals are displayed as red nodes, tactics are displayed as transparent nodes with dashed borders. |
|
|
|
|
|
A proof should be read "towards the middle". So, hypotheses should be read from top to bottom; and goals should be read bottom up. |
|
|
|
|
|
To zoom in on a particular dark box, you can click on it. Hint: these boxes represent variable scopes. Don't overthink this however, we'll always highlight the available hypotheses as you're writing the proof, consider these boxes a visual hint that will eventually become second nature. |
|
|
|
|