This is an internal implementation file of the hash map. Users of the hash map should not rely on the contents of this file.
In this file we define functions for manipulating a hash map based on operations defined in terms of their buckets. Then we give "model implementations" of the hash map operations in terms of these basic building blocks and show that the actual operations are equal to the model implementations T his means that later we will be able to prove properties of the operations by proving general facts about the basic building blocks.
Setting up the infrastructure #
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.bucket self h k = match Std.DHashMap.Internal.mkIdx self.size h (hash k) with | ⟨i, h⟩ => self[i]
Instances For
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.updateBucket self h k f = match Std.DHashMap.Internal.mkIdx self.size h (hash k) with | ⟨i, h⟩ => self.uset i (f self[i]) h
Instances For
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.updateAllBuckets self f = Array.map f self
Instances For
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.withComputedSize self = { size := Std.DHashMap.Internal.computeSize self, buckets := self }
Instances For
This is the general theorem used to show that access operations are correct.
This is the general theorem used to show that access operations involving a proof (like get
)
are correct.
This is the general theorem to show that modification operations are correct.
This is the general theorem to show that mapping operations (like map
and filter
) are
correct.
IsHashSelf #
This is the general theorem to show that modification operations preserve well-formedness of buckets.
Definition of model functions #
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
Instances For
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
Instances For
Internal implementation detail of the hash map
Equations
- m.get?ₘ a = Std.DHashMap.Internal.AssocList.getCast? a (Std.DHashMap.Internal.bucket m.val.buckets ⋯ a)
Instances For
Internal implementation detail of the hash map
Equations
- m.containsₘ a = Std.DHashMap.Internal.AssocList.contains a (Std.DHashMap.Internal.bucket m.val.buckets ⋯ a)
Instances For
Internal implementation detail of the hash map
Equations
- m.getₘ a h = Std.DHashMap.Internal.AssocList.getCast a (Std.DHashMap.Internal.bucket m.val.buckets ⋯ a) h
Instances For
Internal implementation detail of the hash map
Equations
- m.getDₘ a fallback = (m.get?ₘ a).getD fallback
Instances For
Internal implementation detail of the hash map
Equations
- m.get!ₘ a = (m.get?ₘ a).get!
Instances For
Internal implementation detail of the hash map
Equations
Instances For
Internal implementation detail of the hash map
Instances For
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
Instances For
Internal implementation detail of the hash map
Instances For
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
Instances For
Internal implementation detail of the hash map
Equations
- m.mapₘ f = ⟨{ size := m.val.size, buckets := Std.DHashMap.Internal.updateAllBuckets m.val.buckets (Std.DHashMap.Internal.AssocList.map f) }, ⋯⟩
Instances For
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
Instances For
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.Raw₀.Const.get?ₘ m a = Std.DHashMap.Internal.AssocList.get? a (Std.DHashMap.Internal.bucket m.val.buckets ⋯ a)
Instances For
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.Raw₀.Const.getₘ m a h = Std.DHashMap.Internal.AssocList.get a (Std.DHashMap.Internal.bucket m.val.buckets ⋯ a) h
Instances For
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.Raw₀.Const.getDₘ m a fallback = (Std.DHashMap.Internal.Raw₀.Const.get?ₘ m a).getD fallback
Instances For
Internal implementation detail of the hash map