Equations
- Lean.HashMapBucket α β = { b : Array (Lean.AssocList α β) // Nat.isPowerOfTwo (Array.size b) }
Instances For
def
Lean.HashMapBucket.update
{α : Type u}
{β : Type v}
(data : Lean.HashMapBucket α β)
(i : USize)
(d : Lean.AssocList α β)
(h : USize.toNat i < Array.size data.val)
:
Equations
- Lean.HashMapBucket.update data i d h = { val := Array.uset data.val i d h, property := (_ : Nat.isPowerOfTwo (Array.size (Array.uset data.val i d h))) }
Instances For
- size : Nat
- buckets : Lean.HashMapBucket α β
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[inline]
def
Lean.HashMapImp.reinsertAux
{α : Type u}
{β : Type v}
(hashFn : α → UInt64)
(data : Lean.HashMapBucket α β)
(a : α)
(b : β)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[inline]
def
Lean.HashMapImp.foldBucketsM
{α : Type u}
{β : Type v}
{δ : Type w}
{m : Type w → Type w}
[Monad m]
(data : Lean.HashMapBucket α β)
(d : δ)
(f : δ → α → β → m δ)
:
m δ
Equations
- Lean.HashMapImp.foldBucketsM data d f = Array.foldlM (fun (d : δ) (b : Lean.AssocList α β) => Lean.AssocList.foldlM f d b) d data.val 0
Instances For
@[inline]
def
Lean.HashMapImp.foldBuckets
{α : Type u}
{β : Type v}
{δ : Type w}
(data : Lean.HashMapBucket α β)
(d : δ)
(f : δ → α → β → δ)
:
δ
Equations
- Lean.HashMapImp.foldBuckets data d f = Id.run (Lean.HashMapImp.foldBucketsM data d f)
Instances For
@[inline]
def
Lean.HashMapImp.foldM
{α : Type u}
{β : Type v}
{δ : Type w}
{m : Type w → Type w}
[Monad m]
(f : δ → α → β → m δ)
(d : δ)
(h : Lean.HashMapImp α β)
:
m δ
Equations
- Lean.HashMapImp.foldM f d h = Lean.HashMapImp.foldBucketsM h.buckets d f
Instances For
@[inline]
def
Lean.HashMapImp.fold
{α : Type u}
{β : Type v}
{δ : Type w}
(f : δ → α → β → δ)
(d : δ)
(m : Lean.HashMapImp α β)
:
δ
Equations
- Lean.HashMapImp.fold f d m = Lean.HashMapImp.foldBuckets m.buckets d f
Instances For
@[inline]
def
Lean.HashMapImp.forBucketsM
{α : Type u}
{β : Type v}
{m : Type w → Type w}
[Monad m]
(data : Lean.HashMapBucket α β)
(f : α → β → m PUnit)
:
m PUnit
Equations
- Lean.HashMapImp.forBucketsM data f = Array.forM (fun (b : Lean.AssocList α β) => Lean.AssocList.forM f b) data.val 0
Instances For
@[inline]
def
Lean.HashMapImp.forM
{α : Type u}
{β : Type v}
{m : Type w → Type w}
[Monad m]
(f : α → β → m PUnit)
(h : Lean.HashMapImp α β)
:
m PUnit
Equations
- Lean.HashMapImp.forM f h = Lean.HashMapImp.forBucketsM h.buckets f
Instances For
def
Lean.HashMapImp.findEntry?
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
(m : Lean.HashMapImp α β)
(a : α)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lean.HashMapImp.find?
{α : Type u}
{β : Type v}
[beq : BEq α]
[Hashable α]
(m : Lean.HashMapImp α β)
(a : α)
:
Option β
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lean.HashMapImp.contains
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
(m : Lean.HashMapImp α β)
(a : α)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lean.HashMapImp.moveEntries
{α : Type u}
{β : Type v}
[Hashable α]
(i : Nat)
(source : Array (Lean.AssocList α β))
(target : Lean.HashMapBucket α β)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lean.HashMapImp.expand
{α : Type u}
{β : Type v}
[Hashable α]
(size : Nat)
(buckets : Lean.HashMapBucket α β)
:
Lean.HashMapImp α β
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[inline]
def
Lean.HashMapImp.insert
{α : Type u}
{β : Type v}
[beq : BEq α]
[Hashable α]
(m : Lean.HashMapImp α β)
(a : α)
(b : β)
:
Lean.HashMapImp α β × Bool
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lean.HashMapImp.erase
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
(m : Lean.HashMapImp α β)
(a : α)
:
Lean.HashMapImp α β
Equations
- One or more equations did not get rendered due to their size.
Instances For
inductive
Lean.HashMapImp.WellFormed
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
:
Lean.HashMapImp α β → Prop
- mkWff: ∀ {α : Type u} {β : Type v} [inst : BEq α] [inst_1 : Hashable α] (n : Nat), Lean.HashMapImp.WellFormed (Lean.mkHashMapImp n)
- insertWff: ∀ {α : Type u} {β : Type v} [inst : BEq α] [inst_1 : Hashable α] (m : Lean.HashMapImp α β) (a : α) (b : β), Lean.HashMapImp.WellFormed m → Lean.HashMapImp.WellFormed (Lean.HashMapImp.insert m a b).fst
- eraseWff: ∀ {α : Type u} {β : Type v} [inst : BEq α] [inst_1 : Hashable α] (m : Lean.HashMapImp α β) (a : α), Lean.HashMapImp.WellFormed m → Lean.HashMapImp.WellFormed (Lean.HashMapImp.erase m a)
Instances For
Equations
- Lean.HashMap α β = { m : Lean.HashMapImp α β // Lean.HashMapImp.WellFormed m }
Instances For
def
Lean.mkHashMap
{α : Type u}
{β : Type v}
[BEq α]
[Hashable α]
(capacity : optParam Nat 8)
:
Lean.HashMap α β
Equations
- Lean.mkHashMap capacity = { val := Lean.mkHashMapImp capacity, property := (_ : Lean.HashMapImp.WellFormed (Lean.mkHashMapImp capacity)) }
Instances For
instance
Lean.HashMap.instInhabitedHashMap
{α : Type u_1}
{β : Type u_2}
[BEq α]
[Hashable α]
:
Inhabited (Lean.HashMap α β)
Equations
- Lean.HashMap.instInhabitedHashMap = { default := Lean.mkHashMap }
instance
Lean.HashMap.instEmptyCollectionHashMap
{α : Type u_1}
{β : Type u_2}
[BEq α]
[Hashable α]
:
EmptyCollection (Lean.HashMap α β)
Equations
- Lean.HashMap.instEmptyCollectionHashMap = { emptyCollection := Lean.mkHashMap }
def
Lean.HashMap.insert
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashMap α β → α → β → Lean.HashMap α β
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lean.HashMap.insert'
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashMap α β → α → β → Lean.HashMap α β × Bool
Similar to insert
, but also returns a Boolean flad indicating whether an existing entry has been replaced with a -> b
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[inline]
def
Lean.HashMap.erase
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashMap α β → α → Lean.HashMap α β
Equations
- Lean.HashMap.erase m a = match m with | { val := m, property := hw } => { val := Lean.HashMapImp.erase m a, property := (_ : Lean.HashMapImp.WellFormed (Lean.HashMapImp.erase m a)) }
Instances For
@[inline]
def
Lean.HashMap.findEntry?
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashMap α β → α → Option (α × β)
Equations
- Lean.HashMap.findEntry? m a = match m with | { val := m, property := property } => Lean.HashMapImp.findEntry? m a
Instances For
@[inline]
def
Lean.HashMap.find?
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashMap α β → α → Option β
Equations
- Lean.HashMap.find? m a = match m with | { val := m, property := property } => Lean.HashMapImp.find? m a
Instances For
@[inline]
def
Lean.HashMap.findD
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashMap α β → α → β → β
Equations
- Lean.HashMap.findD m a b₀ = Option.getD (Lean.HashMap.find? m a) b₀
Instances For
@[inline]
def
Lean.HashMap.find!
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → [inst : Inhabited β] → Lean.HashMap α β → α → β
Equations
- One or more equations did not get rendered due to their size.
Instances For
instance
Lean.HashMap.instGetElemHashMapOptionTrue
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → GetElem (Lean.HashMap α β) α (Option β) fun (x : Lean.HashMap α β) (x : α) => True
Equations
- Lean.HashMap.instGetElemHashMapOptionTrue = { getElem := fun (m : Lean.HashMap α β) (k : α) (x_1 : True) => Lean.HashMap.find? m k }
@[inline]
def
Lean.HashMap.contains
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashMap α β → α → Bool
Equations
- Lean.HashMap.contains m a = match m with | { val := m, property := property } => Lean.HashMapImp.contains m a
Instances For
@[inline]
Equations
- Lean.HashMap.foldM f init h = match h with | { val := h, property := property } => Lean.HashMapImp.foldM f init h
Instances For
@[inline]
def
Lean.HashMap.fold
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → {δ : Type w} → (δ → α → β → δ) → δ → Lean.HashMap α β → δ
Equations
- Lean.HashMap.fold f init m = match m with | { val := m, property := property } => Lean.HashMapImp.fold f init m
Instances For
@[inline]
Equations
- Lean.HashMap.forM f h = match h with | { val := h, property := property } => Lean.HashMapImp.forM f h
Instances For
@[inline]
def
Lean.HashMap.size
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashMap α β → Nat
Equations
- Lean.HashMap.size m = match m with | { val := { size := sz, buckets := buckets }, property := property } => sz
Instances For
@[inline]
def
Lean.HashMap.isEmpty
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashMap α β → Bool
Equations
- Lean.HashMap.isEmpty m = decide (Lean.HashMap.size m = 0)
Instances For
def
Lean.HashMap.toList
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashMap α β → List (α × β)
Equations
- Lean.HashMap.toList m = Lean.HashMap.fold (fun (r : List (α × β)) (k : α) (v : β) => (k, v) :: r) [] m
Instances For
def
Lean.HashMap.toArray
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashMap α β → Array (α × β)
Equations
- Lean.HashMap.toArray m = Lean.HashMap.fold (fun (r : Array (α × β)) (k : α) (v : β) => Array.push r (k, v)) #[] m
Instances For
def
Lean.HashMap.numBuckets
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashMap α β → Nat
Equations
- Lean.HashMap.numBuckets m = Array.size m.val.buckets.val
Instances For
def
Lean.HashMap.ofList
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → List (α × β) → Lean.HashMap α β
Builds a HashMap
from a list of key-value pairs. Values of duplicated keys are replaced by their respective last occurrences.
Equations
- Lean.HashMap.ofList l = List.foldl (fun (m : Lean.HashMap α β) (p : α × β) => Lean.HashMap.insert m p.fst p.snd) Lean.HashMap.empty l
Instances For
def
Lean.HashMap.ofListWith
{α : Type u}
{β : Type v}
:
{x : BEq α} → {x_1 : Hashable α} → List (α × β) → (β → β → β) → Lean.HashMap α β
Variant of ofList
which accepts a function that combines values of duplicated keys.
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Array.groupByKey
{α : Type u_1}
{β : Type u_2}
[BEq α]
[Hashable α]
(key : β → α)
(xs : Array β)
:
Lean.HashMap α (Array β)
Groups all elements x
, y
in xs
with key x == key y
into the same array
(xs.groupByKey key).find! (key x)
. Groups preserve the relative order of elements in xs
.
Equations
- One or more equations did not get rendered due to their size.