You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lean4game/server/nng/NNG/Tactic/Rfl.lean

32 lines
791 B
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import Mathlib.Lean.Expr.Basic
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