mathlib4 icon indicating copy to clipboard operation
mathlib4 copied to clipboard

feat: recover as a tactic combinator

Open siddhartha-gadgil opened this issue 3 years ago • 0 comments
trafficstars

Following a suggestion of @digama0 recover is implemented as wrapping tactics so that if goals are closed incorrectly they are reopened. Below are examples (test suggested by @gebner). Some code is from Aesop.

/-- problematic tactic for testing recovery -/
elab "this" "is" "a" "problem" : tactic =>
  Lean.Elab.Tactic.setGoals []

/- The main test-/
example : 1 = 1 := by
  recover this is a problem
  rfl

/- Tests that recover does no harm -/
example : 3 < 4 := by
    recover decide

example : 1 = 1 := by
    recover skip ; rfl

example : 2 = 2 := by
    recover skip
    rfl

siddhartha-gadgil avatar Jul 20 '22 07:07 siddhartha-gadgil