diff --git a/src/Lean/Data/HashMap.lean b/src/Lean/Data/HashMap.lean index dc30823cb738..52328515f2bb 100644 --- a/src/Lean/Data/HashMap.lean +++ b/src/Lean/Data/HashMap.lean @@ -137,8 +137,10 @@ def erase [BEq α] [Hashable α] (m : HashMapImp α β) (a : α) : HashMapImp α | ⟨ size, buckets ⟩ => let ⟨i, h⟩ := mkIdx (hash a) buckets.property let bkt := buckets.val[i] - if bkt.contains a then ⟨size - 1, buckets.update i (bkt.erase a) h⟩ - else m + if bkt.contains a then + ⟨size - 1, buckets.update i (bkt.erase a) h⟩ + else + ⟨size, buckets⟩ inductive WellFormed [BEq α] [Hashable α] : HashMapImp α β → Prop where | mkWff : ∀ n, WellFormed (mkHashMapImp n) diff --git a/src/Lean/Data/HashSet.lean b/src/Lean/Data/HashSet.lean index 5bf16b14f747..927b6e10d682 100644 --- a/src/Lean/Data/HashSet.lean +++ b/src/Lean/Data/HashSet.lean @@ -112,8 +112,10 @@ def erase [BEq α] [Hashable α] (m : HashSetImp α) (a : α) : HashSetImp α := | ⟨ size, buckets ⟩ => let ⟨i, h⟩ := mkIdx (hash a) buckets.property let bkt := buckets.val[i] - if bkt.contains a then ⟨size - 1, buckets.update i (bkt.erase a) h⟩ - else m + if bkt.contains a then + ⟨size - 1, buckets.update i (bkt.erase a) h⟩ + else + ⟨size, buckets⟩ inductive WellFormed [BEq α] [Hashable α] : HashSetImp α → Prop where | mkWff : ∀ n, WellFormed (mkHashSetImp n)