Files
NNG/Game/Tactic/Rfl.lean
2023-08-06 23:28:11 +02:00

32 lines
789 B
Lean4
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import Lean.Meta.Tactic.Refl
import Lean.Elab.Tactic.Basic
/-! # `rfl` tactic
Added `withReducible` to prevent `rfl` proving stuff like `n + 0 = n`.
-/
namespace MyNat
open Lean Meta Elab Tactic
-- @[match_pattern] def MyNat.rfl {α : Sort u} {a : α} : Eq a a := Eq.refl a
/-- Modified `rfl` tactic.
`rfl` closes goals of the form `A = A`.
Note that the version for this game is somewhat weaker than the real one. -/
syntax (name := rfl) "rfl" : tactic
@[tactic MyNat.rfl] def evalRfl : Tactic := fun _ =>
liftMetaTactic fun mvarId => do withReducible <| mvarId.refl; pure []
-- TODO: `rfl` should be able to prove `R ↔ R`!
-- @[tactic MyNat.rfl] def evalRfl : Tactic := fun _ =>
-- liftMetaTactic fun mvarId => do mvarId.refl; pure []
-- (with_reducible rfl)
end MyNat