feat: add environment extension for caching Simp.Context for splitIf

This commit is contained in:
Leonardo de Moura 2021-08-16 13:05:01 -07:00
parent 34b092700e
commit f59b9813fb
2 changed files with 35 additions and 0 deletions

View file

@ -23,6 +23,7 @@ structure Context where
congrLemmas : CongrLemmas := {}
parent? : Option Expr := none
dischargeDepth : Nat := 0
deriving Inhabited
def Context.mkDefault : MetaM Context :=
return { config := {}, simpLemmas := (← getSimpLemmas), congrLemmas := (← getCongrLemmas) }

View file

@ -0,0 +1,34 @@
/-
Copyright (c) 2021 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
import Lean.LazyInitExtension
import Lean.Meta.Tactic.Simp.Types
namespace Lean.Meta
namespace SplitIf
builtin_initialize ext : LazyInitExtension MetaM Simp.Context ←
registerLazyInitExtension do
let mut s : SimpLemmas := {}
s ← s.addConst ``if_pos
s ← s.addConst ``if_neg
s ← s.addConst ``dif_pos
s ← s.addConst ``dif_neg
return {
simpLemmas := s
congrLemmas := (← getCongrLemmas)
config.zeta := false
config.beta := false
config.eta := false
config.iota := false
config.proj := false
config.decide := false
}
def getSimpContext : MetaM Simp.Context :=
ext.get
end SplitIf
end Lean.Meta