Equations
- Lean.HashSetBucket α = { b : Array (List α) // Nat.isPowerOfTwo (Array.size b) }
Instances For
def
Lean.HashSetBucket.update
{α : Type u}
(data : Lean.HashSetBucket α)
(i : USize)
(d : List α)
(h : USize.toNat i < Array.size data.val)
:
Equations
- Lean.HashSetBucket.update data i d h = { val := Array.uset data.val i d h, property := ⋯ }
Instances For
- size : Nat
- buckets : Lean.HashSetBucket α
Instances For
Equations
- Lean.mkHashSetImp capacity = { size := 0, buckets := { val := mkArray (Nat.nextPowerOfTwo (capacity * 4 / 3)) [], property := ⋯ } }
Instances For
@[inline]
def
Lean.HashSetImp.reinsertAux
{α : Type u}
(hashFn : α → UInt64)
(data : Lean.HashSetBucket α)
(a : α)
:
Equations
- Lean.HashSetImp.reinsertAux hashFn data a = match Lean.HashSetImp.mkIdx (hashFn a) ⋯ with | { val := i, property := h } => Lean.HashSetBucket.update data i (a :: data.val[i]) h
Instances For
@[inline]
def
Lean.HashSetImp.foldBucketsM
{α : Type u}
{δ : Type w}
{m : Type w → Type w}
[Monad m]
(data : Lean.HashSetBucket α)
(d : δ)
(f : δ → α → m δ)
:
m δ
Equations
- Lean.HashSetImp.foldBucketsM data d f = Array.foldlM (fun (d : δ) (as : List α) => List.foldlM f d as) d data.val 0
Instances For
@[inline]
def
Lean.HashSetImp.foldBuckets
{α : Type u}
{δ : Type w}
(data : Lean.HashSetBucket α)
(d : δ)
(f : δ → α → δ)
:
δ
Equations
- Lean.HashSetImp.foldBuckets data d f = Id.run (Lean.HashSetImp.foldBucketsM data d f)
Instances For
@[inline]
def
Lean.HashSetImp.foldM
{α : Type u}
{δ : Type w}
{m : Type w → Type w}
[Monad m]
(f : δ → α → m δ)
(d : δ)
(h : Lean.HashSetImp α)
:
m δ
Equations
- Lean.HashSetImp.foldM f d h = Lean.HashSetImp.foldBucketsM h.buckets d f
Instances For
@[inline]
def
Lean.HashSetImp.fold
{α : Type u}
{δ : Type w}
(f : δ → α → δ)
(d : δ)
(m : Lean.HashSetImp α)
:
δ
Equations
- Lean.HashSetImp.fold f d m = Lean.HashSetImp.foldBuckets m.buckets d f
Instances For
@[inline]
def
Lean.HashSetImp.forBucketsM
{α : Type u}
{m : Type w → Type w}
[Monad m]
(data : Lean.HashSetBucket α)
(f : α → m PUnit)
:
m PUnit
Equations
- Lean.HashSetImp.forBucketsM data f = Array.forM (fun (as : List α) => List.forM as f) data.val 0
Instances For
@[inline]
def
Lean.HashSetImp.forM
{α : Type u}
{m : Type w → Type w}
[Monad m]
(f : α → m PUnit)
(h : Lean.HashSetImp α)
:
m PUnit
Equations
- Lean.HashSetImp.forM f h = Lean.HashSetImp.forBucketsM h.buckets f
Instances For
def
Lean.HashSetImp.find?
{α : Type u}
[BEq α]
[Hashable α]
(m : Lean.HashSetImp α)
(a : α)
:
Option α
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lean.HashSetImp.moveEntries
{α : Type u}
[Hashable α]
(i : Nat)
(source : Array (List α))
(target : Lean.HashSetBucket α)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lean.HashSetImp.expand
{α : Type u}
[Hashable α]
(size : Nat)
(buckets : Lean.HashSetBucket α)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
- mkWff: ∀ {α : Type u} [inst : BEq α] [inst_1 : Hashable α] (n : Nat), Lean.HashSetImp.WellFormed (Lean.mkHashSetImp n)
- insertWff: ∀ {α : Type u} [inst : BEq α] [inst_1 : Hashable α] (m : Lean.HashSetImp α) (a : α), Lean.HashSetImp.WellFormed m → Lean.HashSetImp.WellFormed (Lean.HashSetImp.insert m a)
- eraseWff: ∀ {α : Type u} [inst : BEq α] [inst_1 : Hashable α] (m : Lean.HashSetImp α) (a : α), Lean.HashSetImp.WellFormed m → Lean.HashSetImp.WellFormed (Lean.HashSetImp.erase m a)
Instances For
Equations
- Lean.HashSet α = { m : Lean.HashSetImp α // Lean.HashSetImp.WellFormed m }
Instances For
Equations
- Lean.mkHashSet capacity = { val := Lean.mkHashSetImp capacity, property := ⋯ }
Instances For
Equations
- Lean.HashSet.instInhabitedHashSet = { default := Lean.mkHashSet }
Equations
- Lean.HashSet.instEmptyCollectionHashSet = { emptyCollection := Lean.mkHashSet }
@[inline]
def
Lean.HashSet.insert
{α : Type u}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashSet α → α → Lean.HashSet α
Equations
- Lean.HashSet.insert m a = match m with | { val := m, property := hw } => { val := Lean.HashSetImp.insert m a, property := ⋯ }
Instances For
@[inline]
def
Lean.HashSet.erase
{α : Type u}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashSet α → α → Lean.HashSet α
Equations
- Lean.HashSet.erase m a = match m with | { val := m, property := hw } => { val := Lean.HashSetImp.erase m a, property := ⋯ }
Instances For
@[inline]
def
Lean.HashSet.find?
{α : Type u}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashSet α → α → Option α
Equations
- Lean.HashSet.find? m a = match m with | { val := m, property := property } => Lean.HashSetImp.find? m a
Instances For
@[inline]
def
Lean.HashSet.contains
{α : Type u}
:
{x : BEq α} → {x_1 : Hashable α} → Lean.HashSet α → α → Bool
Equations
- Lean.HashSet.contains m a = match m with | { val := m, property := property } => Lean.HashSetImp.contains m a
Instances For
@[inline]
Equations
- Lean.HashSet.foldM f init h = match h with | { val := h, property := property } => Lean.HashSetImp.foldM f init h
Instances For
@[inline]
def
Lean.HashSet.fold
{α : Type u}
:
{x : BEq α} → {x_1 : Hashable α} → {δ : Type w} → (δ → α → δ) → δ → Lean.HashSet α → δ
Equations
- Lean.HashSet.fold f init m = match m with | { val := m, property := property } => Lean.HashSetImp.fold f init m
Instances For
@[inline]
Equations
- Lean.HashSet.forM h f = match h with | { val := h, property := property } => Lean.HashSetImp.forM f h
Instances For
@[inline]
Equations
- Lean.HashSet.size m = match m with | { val := { size := sz, buckets := buckets }, property := property } => sz
Instances For
Equations
- Lean.HashSet.toList m = Lean.HashSet.fold (fun (r : List α) (a : α) => a :: r) [] m
Instances For
Equations
- Lean.HashSet.toArray m = Lean.HashSet.fold (fun (r : Array α) (a : α) => Array.push r a) #[] m
Instances For
Equations
- Lean.HashSet.numBuckets m = Array.size m.val.buckets.val
Instances For
def
Lean.HashSet.insertMany
{α : Type u}
:
{x : BEq α} → {x_1 : Hashable α} → {ρ : Type u_1} → [inst : ForIn Id ρ α] → Lean.HashSet α → ρ → Lean.HashSet α
Insert many elements into a HashSet.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[inline]
def
Lean.HashSet.merge
{α : Type u}
[BEq α]
[Hashable α]
(s : Lean.HashSet α)
(t : Lean.HashSet α)
:
O(|t|)
amortized. Merge two HashSet
s.
Equations
- Lean.HashSet.merge s t = Lean.HashSet.fold (fun (s : Lean.HashSet α) (a : α) => Lean.HashSet.insert s a) s t