inductive
Std.PersistentHashMap.Entry
(α : Type u)
(β : Type v)
(σ : Type w)
:
Type (max (max u v) w)
- entry: {α : Type u} → {β : Type v} → {σ : Type w} → α → β → Std.PersistentHashMap.Entry α β σ
- ref: {α : Type u} → {β : Type v} → {σ : Type w} → σ → Std.PersistentHashMap.Entry α β σ
- null: {α : Type u} → {β : Type v} → {σ : Type w} → Std.PersistentHashMap.Entry α β σ
instance
Std.PersistentHashMap.instInhabitedEntry
{α : Type u_1}
{β : Type u_2}
{σ : Type u_3}
:
Inhabited (Std.PersistentHashMap.Entry α β σ)
Equations
- Std.PersistentHashMap.instInhabitedEntry = { default := Std.PersistentHashMap.Entry.null }
- entries: {α : Type u} → {β : Type v} → Array (Std.PersistentHashMap.Entry α β (Std.PersistentHashMap.Node α β)) → Std.PersistentHashMap.Node α β
- collision: {α : Type u} → {β : Type v} → (ks : Array α) → (vs : Array β) → Array.size ks = Array.size vs → Std.PersistentHashMap.Node α β
Equations
- Std.PersistentHashMap.instInhabitedNode = { default := Std.PersistentHashMap.Node.entries #[] }
@[inline]
@[inline]
Equations
@[inline]
Equations
Equations
- Std.PersistentHashMap.mkEmptyEntriesArray = mkArray (USize.toNat Std.PersistentHashMap.branching) Std.PersistentHashMap.Entry.null
structure
Std.PersistentHashMap
(α : Type u)
(β : Type v)
[inst : BEq α]
[inst : Hashable α]
:
Type (max u v)
- root : Std.PersistentHashMap.Node α β
- size : Nat
@[inline]
Equations
- Std.PHashMap α β = Std.PersistentHashMap α β
Equations
- Std.PersistentHashMap.empty = { root := Std.PersistentHashMap.Node.entries Std.PersistentHashMap.mkEmptyEntriesArray, size := 0 }
def
Std.PersistentHashMap.isEmpty
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
[inst : Hashable α]
(m : Std.PersistentHashMap α β)
:
Equations
- Std.PersistentHashMap.isEmpty m = (m.size == 0)
instance
Std.PersistentHashMap.instInhabitedPersistentHashMap
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
[inst : Hashable α]
:
Equations
- Std.PersistentHashMap.instInhabitedPersistentHashMap = { default := { root := Std.PersistentHashMap.Node.entries Std.PersistentHashMap.mkEmptyEntriesArray, size := 0 } }
Equations
- Std.PersistentHashMap.mkEmptyEntries = Std.PersistentHashMap.Node.entries Std.PersistentHashMap.mkEmptyEntriesArray
@[inline]
Equations
- Std.PersistentHashMap.mul2Shift i shift = USize.shiftLeft i shift
@[inline]
Equations
- Std.PersistentHashMap.div2Shift i shift = USize.shiftRight i shift
@[inline]
Equations
- Std.PersistentHashMap.mod2Shift i shift = USize.land i (USize.shiftLeft 1 shift - 1)
inductive
Std.PersistentHashMap.IsCollisionNode
{α : Type u_1}
{β : Type u_2}
:
Std.PersistentHashMap.Node α β → Prop
- mk: ∀ {α : Type u_1} {β : Type u_2} (keys : Array α) (vals : Array β) (h : Array.size keys = Array.size vals), Std.PersistentHashMap.IsCollisionNode (Std.PersistentHashMap.Node.collision keys vals h)
@[inline]
inductive
Std.PersistentHashMap.IsEntriesNode
{α : Type u_1}
{β : Type u_2}
:
Std.PersistentHashMap.Node α β → Prop
- mk: ∀ {α : Type u_1} {β : Type u_2} (entries : Array (Std.PersistentHashMap.Entry α β (Std.PersistentHashMap.Node α β))), Std.PersistentHashMap.IsEntriesNode (Std.PersistentHashMap.Node.entries entries)
@[inline]
partial def
Std.PersistentHashMap.insertAtCollisionNodeAux
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
:
Std.PersistentHashMap.CollisionNode α β → Nat → α → β → Std.PersistentHashMap.CollisionNode α β
def
Std.PersistentHashMap.insertAtCollisionNode
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
:
Std.PersistentHashMap.CollisionNode α β → α → β → Std.PersistentHashMap.CollisionNode α β
Equations
Equations
- One or more equations did not get rendered due to their size.
def
Std.PersistentHashMap.mkCollisionNode
{α : Type u_1}
{β : Type u_2}
(k₁ : α)
(v₁ : β)
(k₂ : α)
(v₂ : β)
:
Equations
- One or more equations did not get rendered due to their size.
partial def
Std.PersistentHashMap.insertAux
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
[inst : Hashable α]
:
Std.PersistentHashMap.Node α β → USize → USize → α → β → Std.PersistentHashMap.Node α β
partial def
Std.PersistentHashMap.insertAux.traverse
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
[inst : Hashable α]
(depth : USize)
(keys : Array α)
(vals : Array β)
(heq : Array.size keys = Array.size vals)
(i : Nat)
(entries : Std.PersistentHashMap.Node α β)
:
def
Std.PersistentHashMap.insert
{α : Type u_1}
{β : Type u_2}
:
{x : BEq α} → {x_1 : Hashable α} → Std.PersistentHashMap α β → α → β → Std.PersistentHashMap α β
Equations
- One or more equations did not get rendered due to their size.
partial def
Std.PersistentHashMap.findAtAux
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
(keys : Array α)
(vals : Array β)
(heq : Array.size keys = Array.size vals)
(i : Nat)
(k : α)
:
Option β
partial def
Std.PersistentHashMap.findAux
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
:
Std.PersistentHashMap.Node α β → USize → α → Option β
def
Std.PersistentHashMap.find?
{α : Type u_1}
{β : Type u_2}
:
{x : BEq α} → {x_1 : Hashable α} → Std.PersistentHashMap α β → α → Option β
Equations
- Std.PersistentHashMap.find? _fun_discr _fun_discr = match _fun_discr, _fun_discr with | { root := n, size := size }, k => Std.PersistentHashMap.findAux n (UInt64.toUSize (hash k)) k
@[inline]
def
Std.PersistentHashMap.getOp
{α : Type u_1}
{β : Type u_2}
:
{x : BEq α} → {x_1 : Hashable α} → Std.PersistentHashMap α β → α → Option β
Equations
- Std.PersistentHashMap.getOp self idx = Std.PersistentHashMap.find? self idx
@[inline]
def
Std.PersistentHashMap.findD
{α : Type u_1}
{β : Type u_2}
:
{x : BEq α} → {x_1 : Hashable α} → Std.PersistentHashMap α β → α → β → β
Equations
- Std.PersistentHashMap.findD m a b₀ = Option.getD (Std.PersistentHashMap.find? m a) b₀
@[inline]
def
Std.PersistentHashMap.find!
{α : Type u_1}
{β : Type u_2}
:
{x : BEq α} → {x_1 : Hashable α} → [inst : Inhabited β] → Std.PersistentHashMap α β → α → β
Equations
- One or more equations did not get rendered due to their size.
partial def
Std.PersistentHashMap.findEntryAtAux
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
(keys : Array α)
(vals : Array β)
(heq : Array.size keys = Array.size vals)
(i : Nat)
(k : α)
:
partial def
Std.PersistentHashMap.findEntryAux
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
:
Std.PersistentHashMap.Node α β → USize → α → Option (α × β)
def
Std.PersistentHashMap.findEntry?
{α : Type u_1}
{β : Type u_2}
:
{x : BEq α} → {x_1 : Hashable α} → Std.PersistentHashMap α β → α → Option (α × β)
Equations
- Std.PersistentHashMap.findEntry? _fun_discr _fun_discr = match _fun_discr, _fun_discr with | { root := n, size := size }, k => Std.PersistentHashMap.findEntryAux n (UInt64.toUSize (hash k)) k
partial def
Std.PersistentHashMap.containsAtAux
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
(keys : Array α)
(vals : Array β)
(heq : Array.size keys = Array.size vals)
(i : Nat)
(k : α)
:
partial def
Std.PersistentHashMap.containsAux
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
:
Std.PersistentHashMap.Node α β → USize → α → Bool
def
Std.PersistentHashMap.contains
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
[inst : Hashable α]
:
Std.PersistentHashMap α β → α → Bool
Equations
- Std.PersistentHashMap.contains _fun_discr _fun_discr = match _fun_discr, _fun_discr with | { root := n, size := size }, k => Std.PersistentHashMap.containsAux n (UInt64.toUSize (hash k)) k
partial def
Std.PersistentHashMap.isUnaryEntries
{α : Type u_1}
{β : Type u_2}
(a : Array (Std.PersistentHashMap.Entry α β (Std.PersistentHashMap.Node α β)))
(i : Nat)
(acc : Option (α × β))
:
def
Std.PersistentHashMap.isUnaryNode
{α : Type u_1}
{β : Type u_2}
:
Std.PersistentHashMap.Node α β → Option (α × β)
Equations
- One or more equations did not get rendered due to their size.
partial def
Std.PersistentHashMap.eraseAux
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
:
Std.PersistentHashMap.Node α β → USize → α → Std.PersistentHashMap.Node α β × Bool
def
Std.PersistentHashMap.erase
{α : Type u_1}
{β : Type u_2}
:
{x : BEq α} → {x_1 : Hashable α} → Std.PersistentHashMap α β → α → Std.PersistentHashMap α β
Equations
- One or more equations did not get rendered due to their size.
@[specialize]
partial def
Std.PersistentHashMap.foldlMAux
{m : Type w → Type w'}
[inst : Monad m]
{σ : Type w}
{α : Type u_1}
{β : Type u_2}
(f : σ → α → β → m σ)
:
Std.PersistentHashMap.Node α β → σ → m σ
partial def
Std.PersistentHashMap.foldlMAux.traverse
{m : Type w → Type w'}
[inst : Monad m]
{σ : Type w}
{α : Type u_1}
{β : Type u_2}
(f : σ → α → β → m σ)
(keys : Array α)
(vals : Array β)
(heq : Array.size keys = Array.size vals)
(i : Nat)
(acc : σ)
:
m σ
@[specialize]
def
Std.PersistentHashMap.foldlM
{m : Type w → Type w'}
[inst : Monad m]
{σ : Type w}
{α : Type u_1}
{β : Type u_2}
:
{x : BEq α} → {x_1 : Hashable α} → Std.PersistentHashMap α β → (σ → α → β → m σ) → σ → m σ
Equations
- Std.PersistentHashMap.foldlM map f init = Std.PersistentHashMap.foldlMAux f map.root init
@[specialize]
def
Std.PersistentHashMap.forM
{m : Type w → Type w'}
[inst : Monad m]
{α : Type u_1}
{β : Type u_2}
:
{x : BEq α} → {x_1 : Hashable α} → Std.PersistentHashMap α β → (α → β → m PUnit) → m PUnit
Equations
- Std.PersistentHashMap.forM map f = Std.PersistentHashMap.foldlM map (fun x => f) PUnit.unit
@[specialize]
def
Std.PersistentHashMap.foldl
{σ : Type w}
{α : Type u_1}
{β : Type u_2}
:
{x : BEq α} → {x_1 : Hashable α} → Std.PersistentHashMap α β → (σ → α → β → σ) → σ → σ
Equations
- Std.PersistentHashMap.foldl map f init = Id.run (Std.PersistentHashMap.foldlM map f init)
def
Std.PersistentHashMap.toList
{α : Type u_1}
{β : Type u_2}
:
{x : BEq α} → {x_1 : Hashable α} → Std.PersistentHashMap α β → List (α × β)
Equations
- Std.PersistentHashMap.toList m = Std.PersistentHashMap.foldl m (fun ps k v => (k, v) :: ps) []
def
Std.PersistentHashMap.stats
{α : Type u_1}
{β : Type u_2}
:
{x : BEq α} → {x_1 : Hashable α} → Std.PersistentHashMap α β → Std.PersistentHashMap.Stats
Equations
- Std.PersistentHashMap.stats m = Std.PersistentHashMap.collectStats m.root { numNodes := 0, numNull := 0, numCollisions := 0, maxDepth := 0 } 1
Equations
- One or more equations did not get rendered due to their size.