Skip to content

Commit

Permalink
add decide tactic hack to Game/Tactic
Browse files Browse the repository at this point in the history
  • Loading branch information
kbuzzard committed Nov 12, 2023
1 parent f5e9e29 commit 2500632
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Game/MyNat/DecidableEq.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ import Game.MyNat.Addition-- makes simps work?
import Game.MyNat.PeanoAxioms
import Game.Levels.Algorithm.L07succ_ne_succ
import Mathlib.Tactic
import Game.Tactic.decide

namespace MyNat

-- to get numerals of type MyNat to reduce to MyNat.succ (MyNat.succ ...)
@[MyNat_decide]
lemma ofNat_succ : (OfNat.ofNat (Nat.succ n) : ℕ) = MyNat.succ (OfNat.ofNat n) := _root_.rfl

macro "decide" : tactic => `(tactic|(
try simp only [MyNat_decide]
try decide
))

instance instDecidableEq : DecidableEq MyNat
| 0, 0 => isTrue <| by
show 0 = 0
Expand Down
9 changes: 9 additions & 0 deletions Game/Tactic/decide.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/- modified `decide` tactic which first runs a custom
simp call to reduce numerals like `1 + 1` to
`MyNat.succ (MyNat.succ MyNat.zero)
-/

macro "decide" : tactic => `(tactic|(
try simp only [MyNat_decide]
try decide
))

0 comments on commit 2500632

Please sign in to comment.