lean4-htt/tests/lean/run/calcBug.lean
Leonardo de Moura 34d8ecc066 fix: use show .. from .. to implement calc
Recall that `show .. from ..` ensures that proof has exactly the type
provided by the user.
In the new test, `rw [ih]` without this change because the goal would
be
```
... |- 0 + succ n = succ n
```
2021-08-29 11:33:50 -07:00

15 lines
328 B
Text

namespace Hidden
open Nat
theorem zero_add (n : Nat) : 0 + n = n :=
Nat.recOn (motive := fun x => 0 + x = x)
n
(show 0 + 0 = 0 from rfl)
(fun (n : Nat) (ih : 0 + n = n) =>
show 0 + succ n = succ n from
calc
0 + succ n = succ (0 + n) := rfl
_ = succ n := by rw [ih])
end Hidden