Files
NNG/Game/Tactic/Rfl.lean
Jon Eugster 2604c89284 big refactor
2023-05-15 15:12:35 +02:00

32 lines
793 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 Game.Tactic.LeanExprBasic
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 teh 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