Skip to content

Commit

Permalink
basic (untested) version of tags
Browse files Browse the repository at this point in the history
  • Loading branch information
goens committed Apr 29, 2024
1 parent 2552c77 commit 4f86d51
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions Lean/Egg.lean
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ import Egg.Tactic.Explanation
import Egg.Tactic.Guides
import Egg.Tactic.Premises
import Egg.Tactic.Trace
import Egg.Tactic.Tags
25 changes: 25 additions & 0 deletions Lean/Egg/Tactic/Tags.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Lean

open Lean

initialize eggXtension : SimplePersistentEnvExtension Name NameSet ←
registerSimplePersistentEnvExtension {
addEntryFn := NameSet.insert
addImportedFn := fun es => mkStateFromImportedEntries NameSet.insert {} es
}

syntax (name := insertEgg) "insert_egg " ident : command
syntax (name := showEgg) "show_gg_set" : command

open Lean.Elab
open Lean.Elab.Command

@[command_elab insertEgg] def elabInsertEgg : CommandElab := fun stx => do
IO.println s!"inserting {stx[1].getId}"
modifyEnv fun env => eggXtension.addEntry env stx[1].getId

@[command_elab showEgg] def elabShowBla : CommandElab := fun _ => do
IO.println s!"egg set: {eggXtension.getState (← getEnv) |>.toList}"

initialize eggTag : TagAttribute ←
registerTagAttribute `egg "Tag for marking lemmas used for equality saturation"

0 comments on commit 4f86d51

Please sign in to comment.