Replaces `@[eliminator]` with two attributes `@[induction_eliminator]` and `@[cases_eliminator]` for defining custom eliminators for the `induction` and `cases` tactics, respectively. Adds `Nat.recAux` and `Nat.casesAuxOn`, which are eliminators that are defeq to `Nat.rec` and `Nat.casesOn`, but these use `0` and `n + 1` rather than `Nat.zero` and `Nat.succ n`. For example, using `induction` to prove that the factorial function is positive now has the following goal states (thanks also to #3616 for the goal state after unfolding). ```lean example : 0 < fact x := by induction x with | zero => decide | succ x ih => /- x : Nat ih : 0 < fact x ⊢ 0 < fact (x + 1) -/ unfold fact /- ... ⊢ 0 < (x + 1) * fact x -/ simpa using ih ``` Thanks to @adamtopaz for initial work on splitting the `@[eliminator]` attribute.
8 lines
420 B
Text
8 lines
420 B
Text
{"textDocument": {"uri": "file:///goalIssue.lean"},
|
|
"position": {"line": 2, "character": 12}}
|
|
{"rendered": "```lean\nx : Nat\nthis : x + x = x + x\n⊢ 0 + x = x\n```",
|
|
"goals": ["x : Nat\nthis : x + x = x + x\n⊢ 0 + x = x"]}
|
|
{"textDocument": {"uri": "file:///goalIssue.lean"},
|
|
"position": {"line": 8, "character": 12}}
|
|
{"rendered": "```lean\ncase zero\n⊢ 0 + 0 = 0\n```",
|
|
"goals": ["case zero\n⊢ 0 + 0 = 0"]}
|