diff --git a/src/Lean/Meta/DiscrTree.lean b/src/Lean/Meta/DiscrTree.lean index 933ff041199c..f206c9d33f86 100644 --- a/src/Lean/Meta/DiscrTree.lean +++ b/src/Lean/Meta/DiscrTree.lean @@ -421,20 +421,20 @@ where vs.push v termination_by loop i => vs.size - i -private partial def insertAux [BEq α] (keys : Array Key) (v : α) (config : WhnfCoreConfig) : Nat → Trie α → Trie α +private partial def insertAux [BEq α] (keys : Array Key) (v : α) : Nat → Trie α → Trie α | i, .node vs cs => if h : i < keys.size then let k := keys.get ⟨i, h⟩ let c := Id.run $ cs.binInsertM (fun a b => a.1 < b.1) - (fun ⟨_, s⟩ => let c := insertAux keys v config (i+1) s; (k, c)) -- merge with existing + (fun ⟨_, s⟩ => let c := insertAux keys v (i+1) s; (k, c)) -- merge with existing (fun _ => let c := createNodes keys v (i+1); (k, c)) (k, default) .node vs c else .node (insertVal vs v) cs -def insertCore [BEq α] (d : DiscrTree α) (keys : Array Key) (v : α) (config : WhnfCoreConfig) : DiscrTree α := +def insertCore [BEq α] (d : DiscrTree α) (keys : Array Key) (v : α) : DiscrTree α := if keys.isEmpty then panic! "invalid key sequence" else let k := keys[0]! @@ -443,12 +443,12 @@ def insertCore [BEq α] (d : DiscrTree α) (keys : Array Key) (v : α) (config : let c := createNodes keys v 1 { root := d.root.insert k c } | some c => - let c := insertAux keys v config 1 c + let c := insertAux keys v 1 c { root := d.root.insert k c } def insert [BEq α] (d : DiscrTree α) (e : Expr) (v : α) (config : WhnfCoreConfig) : MetaM (DiscrTree α) := do let keys ← mkPath e config - return d.insertCore keys v config + return d.insertCore keys v private def getKeyArgs (e : Expr) (isMatch root : Bool) (config : WhnfCoreConfig) : MetaM (Key × Array Expr) := do let e ← reduceDT e root config diff --git a/src/Lean/Meta/Instances.lean b/src/Lean/Meta/Instances.lean index 27d6a5538c9c..953e5e1c59dd 100644 --- a/src/Lean/Meta/Instances.lean +++ b/src/Lean/Meta/Instances.lean @@ -76,8 +76,8 @@ def tcDtConfig : WhnfCoreConfig := {} def addInstanceEntry (d : Instances) (e : InstanceEntry) : Instances := match e.globalName? with - | some n => { d with discrTree := d.discrTree.insertCore e.keys e tcDtConfig, instanceNames := d.instanceNames.insert n e, erased := d.erased.erase n } - | none => { d with discrTree := d.discrTree.insertCore e.keys e tcDtConfig } + | some n => { d with discrTree := d.discrTree.insertCore e.keys e, instanceNames := d.instanceNames.insert n e, erased := d.erased.erase n } + | none => { d with discrTree := d.discrTree.insertCore e.keys e } def Instances.eraseCore (d : Instances) (declName : Name) : Instances := { d with erased := d.erased.insert declName, instanceNames := d.instanceNames.erase declName } diff --git a/src/Lean/Meta/Tactic/Simp/SimpTheorems.lean b/src/Lean/Meta/Tactic/Simp/SimpTheorems.lean index c88466c782c1..284f4be2975b 100644 --- a/src/Lean/Meta/Tactic/Simp/SimpTheorems.lean +++ b/src/Lean/Meta/Tactic/Simp/SimpTheorems.lean @@ -171,9 +171,9 @@ def simpDtConfig : WhnfCoreConfig := { iota := false, proj := .no } def addSimpTheoremEntry (d : SimpTheorems) (e : SimpTheorem) : SimpTheorems := if e.post then - { d with post := d.post.insertCore e.keys e simpDtConfig, lemmaNames := updateLemmaNames d.lemmaNames } + { d with post := d.post.insertCore e.keys e, lemmaNames := updateLemmaNames d.lemmaNames } else - { d with pre := d.pre.insertCore e.keys e simpDtConfig, lemmaNames := updateLemmaNames d.lemmaNames } + { d with pre := d.pre.insertCore e.keys e, lemmaNames := updateLemmaNames d.lemmaNames } where updateLemmaNames (s : PHashSet Origin) : PHashSet Origin := s.insert e.origin diff --git a/src/Lean/Meta/UnificationHint.lean b/src/Lean/Meta/UnificationHint.lean index 49bbe0331ed4..d08e1e953578 100644 --- a/src/Lean/Meta/UnificationHint.lean +++ b/src/Lean/Meta/UnificationHint.lean @@ -29,7 +29,7 @@ instance : ToFormat UnificationHints where def UnificationHints.config : WhnfCoreConfig := { iota := false, proj := .no } def UnificationHints.add (hints : UnificationHints) (e : UnificationHintEntry) : UnificationHints := - { hints with discrTree := hints.discrTree.insertCore e.keys e.val config } + { hints with discrTree := hints.discrTree.insertCore e.keys e.val } builtin_initialize unificationHintExtension : SimpleScopedEnvExtension UnificationHintEntry UnificationHints ← registerSimpleScopedEnvExtension {