inductive
Lean.PersistentHashMap.Entry
(α : Type u)
(β : Type v)
(σ : Type w)
:
Type (max (max u v) w)
- entry: {α : Type u} → {β : Type v} → {σ : Type w} → α → β → Lean.PersistentHashMap.Entry α β σ
- ref: {α : Type u} → {β : Type v} → {σ : Type w} → σ → Lean.PersistentHashMap.Entry α β σ
- null: {α : Type u} → {β : Type v} → {σ : Type w} → Lean.PersistentHashMap.Entry α β σ
Instances For
Equations
- Lean.PersistentHashMap.instInhabitedEntry = { default := Lean.PersistentHashMap.Entry.null }
- entries: {α : Type u} → {β : Type v} → Array (Lean.PersistentHashMap.Entry α β (Lean.PersistentHashMap.Node α β)) → Lean.PersistentHashMap.Node α β
- collision: {α : Type u} → {β : Type v} → (ks : Array α) → (vs : Array β) → ks.size = vs.size → Lean.PersistentHashMap.Node α β
Instances For
Equations
- Lean.PersistentHashMap.instInhabitedNode = { default := Lean.PersistentHashMap.Node.entries #[] }
@[reducible, inline]
Equations
Instances For
@[reducible, inline]
Equations
Instances For
@[reducible, inline]
Equations
Instances For
@[reducible, inline]
Equations
Instances For
Equations
- Lean.PersistentHashMap.mkEmptyEntriesArray = mkArray Lean.PersistentHashMap.branching.toNat Lean.PersistentHashMap.Entry.null
Instances For
- root : Lean.PersistentHashMap.Node α β
Instances For
Equations
- Lean.PersistentHashMap.empty = { root := Lean.PersistentHashMap.Node.entries Lean.PersistentHashMap.mkEmptyEntriesArray }
Instances For
def
Lean.PersistentHashMap.isEmpty
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
:
Lean.PersistentHashMap α β → Bool
Equations
- { root := root }.isEmpty = root.isEmpty
Instances For
Equations
- Lean.PersistentHashMap.instInhabited = { default := { root := Lean.PersistentHashMap.Node.entries Lean.PersistentHashMap.mkEmptyEntriesArray } }
Equations
- Lean.PersistentHashMap.mkEmptyEntries = Lean.PersistentHashMap.Node.entries Lean.PersistentHashMap.mkEmptyEntriesArray
Instances For
@[reducible, inline]
Equations
- Lean.PersistentHashMap.mul2Shift i shift = i.shiftLeft shift
Instances For
@[reducible, inline]
Equations
- Lean.PersistentHashMap.div2Shift i shift = i.shiftRight shift
Instances For
@[reducible, inline]
Equations
- Lean.PersistentHashMap.mod2Shift i shift = i.land (USize.shiftLeft 1 shift - 1)
Instances For
- mk: ∀ {α : Type u_1} {β : Type u_2} (keys : Array α) (vals : Array β) (h : keys.size = vals.size), Lean.PersistentHashMap.IsCollisionNode (Lean.PersistentHashMap.Node.collision keys vals h)
Instances For
@[reducible, inline]
Equations
Instances For
- mk: ∀ {α : Type u_1} {β : Type u_2} (entries : Array (Lean.PersistentHashMap.Entry α β (Lean.PersistentHashMap.Node α β))), Lean.PersistentHashMap.IsEntriesNode (Lean.PersistentHashMap.Node.entries entries)
Instances For
@[reducible, inline]
Equations
Instances For
partial def
Lean.PersistentHashMap.insertAtCollisionNodeAux
{α : Type u_1}
{β : Type u_2}
[BEq α]
:
Lean.PersistentHashMap.CollisionNode α β → Nat → α → β → Lean.PersistentHashMap.CollisionNode α β
def
Lean.PersistentHashMap.insertAtCollisionNode
{α : Type u_1}
{β : Type u_2}
[BEq α]
:
Lean.PersistentHashMap.CollisionNode α β → α → β → Lean.PersistentHashMap.CollisionNode α β
Equations
Instances For
Equations
- Lean.PersistentHashMap.getCollisionNodeSize ⟨Lean.PersistentHashMap.Node.collision keys vs h, property⟩ = keys.size
Instances For
def
Lean.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.
Instances For
partial def
Lean.PersistentHashMap.insertAux
{α : Type u_1}
{β : Type u_2}
[BEq α]
[Hashable α]
:
Lean.PersistentHashMap.Node α β → USize → USize → α → β → Lean.PersistentHashMap.Node α β
def
Lean.PersistentHashMap.insert
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
:
Lean.PersistentHashMap α β → α → β → Lean.PersistentHashMap α β
Equations
- { root := root }.insert x✝ x = { root := Lean.PersistentHashMap.insertAux root (hash x✝).toUSize 1 x✝ x }
Instances For
partial def
Lean.PersistentHashMap.findAux
{α : Type u_1}
{β : Type u_2}
[BEq α]
:
Lean.PersistentHashMap.Node α β → USize → α → Option β
def
Lean.PersistentHashMap.find?
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
:
Lean.PersistentHashMap α β → α → Option β
Equations
- { root := root }.find? x = Lean.PersistentHashMap.findAux root (hash x).toUSize x
Instances For
instance
Lean.PersistentHashMap.instGetElemOptionTrue
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
:
GetElem (Lean.PersistentHashMap α β) α (Option β) fun (x : Lean.PersistentHashMap α β) (x : α) => True
Equations
- Lean.PersistentHashMap.instGetElemOptionTrue = { getElem := fun (m : Lean.PersistentHashMap α β) (i : α) (x_1 : True) => m.find? i }
@[inline]
def
Lean.PersistentHashMap.findD
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
(m : Lean.PersistentHashMap α β)
(a : α)
(b₀ : β)
:
β
Equations
- m.findD a b₀ = (m.find? a).getD b₀
Instances For
@[inline]
def
Lean.PersistentHashMap.find!
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
[Inhabited β]
(m : Lean.PersistentHashMap α β)
(a : α)
:
β
Equations
- m.find! a = match m.find? a with | some b => b | none => panicWithPosWithDecl "Lean.Data.PersistentHashMap" "Lean.PersistentHashMap.find!" 171 14 "key is not in the map"
Instances For
partial def
Lean.PersistentHashMap.findEntryAux
{α : Type u_1}
{β : Type u_2}
[BEq α]
:
Lean.PersistentHashMap.Node α β → USize → α → Option (α × β)
def
Lean.PersistentHashMap.findEntry?
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
:
Lean.PersistentHashMap α β → α → Option (α × β)
Equations
- { root := root }.findEntry? x = Lean.PersistentHashMap.findEntryAux root (hash x).toUSize x
Instances For
partial def
Lean.PersistentHashMap.containsAux
{α : Type u_1}
{β : Type u_2}
[BEq α]
:
Lean.PersistentHashMap.Node α β → USize → α → Bool
def
Lean.PersistentHashMap.contains
{α : Type u_1}
{β : Type u_2}
[BEq α]
[Hashable α]
:
Lean.PersistentHashMap α β → α → Bool
Equations
- { root := root }.contains x = Lean.PersistentHashMap.containsAux root (hash x).toUSize x
Instances For
partial def
Lean.PersistentHashMap.isUnaryEntries
{α : Type u_1}
{β : Type u_2}
(a : Array (Lean.PersistentHashMap.Entry α β (Lean.PersistentHashMap.Node α β)))
(i : Nat)
(acc : Option (α × β))
:
def
Lean.PersistentHashMap.isUnaryNode
{α : Type u_1}
{β : Type u_2}
:
Lean.PersistentHashMap.Node α β → Option (α × β)
Equations
- One or more equations did not get rendered due to their size.
- Lean.PersistentHashMap.isUnaryNode (Lean.PersistentHashMap.Node.entries entries) = Lean.PersistentHashMap.isUnaryEntries entries 0 none
Instances For
partial def
Lean.PersistentHashMap.eraseAux
{α : Type u_1}
{β : Type u_2}
[BEq α]
:
Lean.PersistentHashMap.Node α β → USize → α → Lean.PersistentHashMap.Node α β
def
Lean.PersistentHashMap.erase
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
:
Lean.PersistentHashMap α β → α → Lean.PersistentHashMap α β
Equations
- { root := root }.erase x = { root := Lean.PersistentHashMap.eraseAux root (hash x).toUSize x }
Instances For
partial def
Lean.PersistentHashMap.foldlMAux
{m : Type w → Type w'}
[Monad m]
{σ : Type w}
{α : Type u_1}
{β : Type u_2}
(f : σ → α → β → m σ)
:
Lean.PersistentHashMap.Node α β → σ → m σ
def
Lean.PersistentHashMap.foldlM
{m : Type w → Type w'}
[Monad m]
{σ : Type w}
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
(map : Lean.PersistentHashMap α β)
(f : σ → α → β → m σ)
(init : σ)
:
m σ
Equations
- map.foldlM f init = Lean.PersistentHashMap.foldlMAux f map.root init
Instances For
def
Lean.PersistentHashMap.forM
{m : Type w → Type w'}
[Monad m]
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
(map : Lean.PersistentHashMap α β)
(f : α → β → m PUnit)
:
m PUnit
Equations
- map.forM f = map.foldlM (fun (x : PUnit) => f) PUnit.unit
Instances For
def
Lean.PersistentHashMap.foldl
{σ : Type w}
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
(map : Lean.PersistentHashMap α β)
(f : σ → α → β → σ)
(init : σ)
:
σ
Equations
- map.foldl f init = (map.foldlM f init).run
Instances For
def
Lean.PersistentHashMap.forIn
{m : Type w → Type w'}
{σ : Type w}
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
[Monad m]
(map : Lean.PersistentHashMap α β)
(init : σ)
(f : α × β → σ → m (ForInStep σ))
:
m σ
Equations
- One or more equations did not get rendered due to their size.
Instances For
instance
Lean.PersistentHashMap.instForInProd
{m : Type w → Type w'}
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
:
ForIn m (Lean.PersistentHashMap α β) (α × β)
partial def
Lean.PersistentHashMap.mapMAux
{α : Type u}
{β : Type v}
{σ : Type u}
{m : Type u → Type w}
[Monad m]
(f : β → m σ)
(n : Lean.PersistentHashMap.Node α β)
:
m (Lean.PersistentHashMap.Node α σ)
def
Lean.PersistentHashMap.mapM
{α : Type u}
{β : Type v}
{σ : Type u}
{m : Type u → Type w}
[Monad m]
{x✝ : BEq α}
{x✝¹ : Hashable α}
(pm : Lean.PersistentHashMap α β)
(f : β → m σ)
:
m (Lean.PersistentHashMap α σ)
Equations
- pm.mapM f = do let root ← Lean.PersistentHashMap.mapMAux f pm.root pure { root := root }
Instances For
def
Lean.PersistentHashMap.map
{α : Type u}
{β : Type v}
{σ : Type u}
{x✝ : BEq α}
{x✝¹ : Hashable α}
(pm : Lean.PersistentHashMap α β)
(f : β → σ)
:
Equations
- pm.map f = (pm.mapM f).run
Instances For
def
Lean.PersistentHashMap.stats
{α : Type u_1}
{β : Type u_2}
{x✝ : BEq α}
{x✝¹ : Hashable α}
(m : Lean.PersistentHashMap α β)
:
Equations
- m.stats = Lean.PersistentHashMap.collectStats m.root { numNodes := 0, numNull := 0, numCollisions := 0, maxDepth := 0 } 1
Instances For
Equations
- One or more equations did not get rendered due to their size.