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 ```
15 lines
328 B
Text
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
|