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.
40 lines
2.1 KiB
Text
40 lines
2.1 KiB
Text
{"textDocument": {"uri": "file:///infoIssues.lean"},
|
|
"position": {"line": 3, "character": 2}}
|
|
{"rendered":
|
|
"```lean\nx y : Nat\nh : x = y\nthis : y = x\n⊢ 0 + x = y + 0\n```",
|
|
"goals": ["x y : Nat\nh : x = y\nthis : y = x\n⊢ 0 + x = y + 0"]}
|
|
{"textDocument": {"uri": "file:///infoIssues.lean"},
|
|
"position": {"line": 13, "character": 33}}
|
|
{"rendered":
|
|
"```lean\np : Prop\nn✝ : Nat\n⊢ n✝ + 1 = 0 + (0 + (n✝ + 1))\n```\n---\n```lean\np : Prop\nn✝ : Nat\n⊢ n✝ + 1 = 0 + (n✝ + 1)\n```\n---\n```lean\np : Prop\nn✝ : Nat\n⊢ n✝ + 1 = n✝ + 1\n```",
|
|
"goals":
|
|
["p : Prop\nn✝ : Nat\n⊢ n✝ + 1 = 0 + (0 + (n✝ + 1))",
|
|
"p : Prop\nn✝ : Nat\n⊢ n✝ + 1 = 0 + (n✝ + 1)",
|
|
"p : Prop\nn✝ : Nat\n⊢ n✝ + 1 = n✝ + 1"]}
|
|
{"textDocument": {"uri": "file:///infoIssues.lean"},
|
|
"position": {"line": 13, "character": 36}}
|
|
{"rendered":
|
|
"```lean\np : Prop\nn✝ : Nat\n⊢ n✝ + 1 = 0 + (0 + (n✝ + 1))\n```\n---\n```lean\np : Prop\nn✝ : Nat\n⊢ n✝ + 1 = 0 + (n✝ + 1)\n```",
|
|
"goals":
|
|
["p : Prop\nn✝ : Nat\n⊢ n✝ + 1 = 0 + (0 + (n✝ + 1))",
|
|
"p : Prop\nn✝ : Nat\n⊢ n✝ + 1 = 0 + (n✝ + 1)"]}
|
|
{"textDocument": {"uri": "file:///infoIssues.lean"},
|
|
"position": {"line": 15, "character": 2}}
|
|
{"rendered": "```lean\ncase right\np : Prop\nx : Nat\n⊢ p\n```",
|
|
"goals": ["case right\np : Prop\nx : Nat\n⊢ p"]}
|
|
{"textDocument": {"uri": "file:///infoIssues.lean"},
|
|
"position": {"line": 25, "character": 35}}
|
|
{"rendered":
|
|
"```lean\np : Prop\nx y : Nat\n⊢ y + 1 = 0 + (0 + (y + 1))\n```\n---\n```lean\np : Prop\nx y : Nat\n⊢ y + 1 = 0 + (y + 1)\n```",
|
|
"goals":
|
|
["p : Prop\nx y : Nat\n⊢ y + 1 = 0 + (0 + (y + 1))",
|
|
"p : Prop\nx y : Nat\n⊢ y + 1 = 0 + (y + 1)"]}
|
|
{"textDocument": {"uri": "file:///infoIssues.lean"},
|
|
"position": {"line": 25, "character": 9}}
|
|
{"rendered":
|
|
"```lean\np : Prop\nx y : Nat\n⊢ y + 1 = 0 + (0 + (0 + (y + 1)))\n```",
|
|
"goals": ["p : Prop\nx y : Nat\n⊢ y + 1 = 0 + (0 + (0 + (y + 1)))"]}
|
|
{"textDocument": {"uri": "file:///infoIssues.lean"},
|
|
"position": {"line": 27, "character": 2}}
|
|
{"rendered": "```lean\ncase right\np : Prop\nx : Nat\n⊢ p\n```",
|
|
"goals": ["case right\np : Prop\nx : Nat\n⊢ p"]}
|