Equations
- Lean.HashSetBucket α = { b : Array (List α) // b.size.isPowerOfTwo }
Instances For
def
Lean.HashSetBucket.update
{α : Type u}
(data : Lean.HashSetBucket α)
(i : USize)
(d : List α)
(h : i.toNat < data.val.size)
:
Equations
- data.update i d h = ⟨data.val.uset i d h, ⋯⟩
Instances For
@[simp]
theorem
Lean.HashSetBucket.size_update
{α : Type u}
(data : Lean.HashSetBucket α)
(i : USize)
(d : List α)
(h : i.toNat < data.val.size)
:
(data.update i d h).val.size = data.val.size
@[deprecated Std.HashSet.Raw.empty]
Equations
- Lean.mkHashSetImp capacity = { size := 0, buckets := ⟨mkArray (Nat.nextPowerOfTwo (capacity * 4 / 3)) [], ⋯⟩ }
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 | ⟨i, h⟩ => data.update 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
Instances For
@[inline]
def
Lean.HashSetImp.foldBuckets
{α : Type u}
{δ : Type w}
(data : Lean.HashSetBucket α)
(d : δ)
(f : δ → α → δ)
:
δ
Equations
- Lean.HashSetImp.foldBuckets data d f = (Lean.HashSetImp.foldBucketsM data d f).run
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 α) => as.forM f) data.val
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
- { size := size, buckets := buckets }.find? a = match Lean.HashSetImp.mkIdx (hash a) ⋯ with | ⟨i, h⟩ => List.find? (fun (a' : α) => a == a') buckets.val[i]
Instances For
Equations
- { size := size, buckets := buckets }.contains a = match Lean.HashSetImp.mkIdx (hash a) ⋯ with | ⟨i, h⟩ => buckets.val[i].contains a
Instances For
@[irreducible]
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
- Lean.HashSetImp.expand size buckets = { size := size, buckets := Lean.HashSetImp.moveEntries 0 buckets.val ⟨mkArray (buckets.val.size * 2) [], ⋯⟩ }
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.mkHashSetImp n).WellFormed
- insertWff: ∀ {α : Type u} [inst : BEq α] [inst_1 : Hashable α] (m : Lean.HashSetImp α) (a : α), m.WellFormed → (m.insert a).WellFormed
- eraseWff: ∀ {α : Type u} [inst : BEq α] [inst_1 : Hashable α] (m : Lean.HashSetImp α) (a : α), m.WellFormed → (m.erase a).WellFormed
Instances For
@[deprecated Std.HashSet]
Equations
- Lean.HashSet α = { m : Lean.HashSetImp α // m.WellFormed }
Instances For
@[deprecated Std.HashSet.empty]
Equations
- Lean.mkHashSet capacity = ⟨Lean.mkHashSetImp capacity, ⋯⟩
Instances For
Equations
- Lean.HashSet.instInhabited = { default := Lean.mkHashSet }
Equations
- Lean.HashSet.instEmptyCollection = { emptyCollection := Lean.mkHashSet }
@[inline]
Equations
- Lean.HashSet.insert ⟨m_2, hw⟩ a = ⟨m_2.insert a, ⋯⟩
Instances For
@[inline]
Equations
- Lean.HashSet.erase ⟨m_2, hw⟩ a = ⟨m_2.erase a, ⋯⟩
Instances For
@[inline]
def
Lean.HashSet.find?
{α : Type u}
{x✝ : BEq α}
{x✝¹ : Hashable α}
(m : Lean.HashSet α)
(a : α)
:
Option α
Equations
- Lean.HashSet.find? ⟨m_2, hw⟩ a = m_2.find? a
Instances For
@[inline]
def
Lean.HashSet.contains
{α : Type u}
{x✝ : BEq α}
{x✝¹ : Hashable α}
(m : Lean.HashSet α)
(a : α)
:
Equations
- Lean.HashSet.contains ⟨m_2, hw⟩ a = m_2.contains a
Instances For
@[inline]
def
Lean.HashSet.foldM
{α : Type u}
{x✝ : BEq α}
{x✝¹ : Hashable α}
{δ : Type w}
{m : Type w → Type w}
[Monad m]
(f : δ → α → m δ)
(init : δ)
(h : Lean.HashSet α)
:
m δ
Equations
- Lean.HashSet.foldM f init ⟨m_2, hw⟩ = Lean.HashSetImp.foldM f init m_2
Instances For
@[inline]
def
Lean.HashSet.fold
{α : Type u}
{x✝ : BEq α}
{x✝¹ : Hashable α}
{δ : Type w}
(f : δ → α → δ)
(init : δ)
(m : Lean.HashSet α)
:
δ
Equations
- Lean.HashSet.fold f init ⟨m_2, hw⟩ = Lean.HashSetImp.fold f init m_2
Instances For
@[inline]
def
Lean.HashSet.forM
{α : Type u}
{x✝ : BEq α}
{x✝¹ : Hashable α}
{m : Type w → Type w}
[Monad m]
(h : Lean.HashSet α)
(f : α → m PUnit)
:
m PUnit
Equations
- Lean.HashSet.forM ⟨m_2, hw⟩ f = Lean.HashSetImp.forM f m_2
Instances For
@[inline]
Equations
- Lean.HashSet.size ⟨{ size := sz, buckets := buckets }, property⟩ = sz
Instances For
@[inline]
Instances For
Equations
- m.toList = Lean.HashSet.fold (fun (r : List α) (a : α) => a :: r) [] m
Instances For
Equations
- m.toArray = Lean.HashSet.fold (fun (r : Array α) (a : α) => r.push a) #[] m
Instances For
Equations
- m.numBuckets = m.val.buckets.val.size
Instances For
def
Lean.HashSet.insertMany
{α : Type u}
{x✝ : BEq α}
{x✝¹ : Hashable α}
{ρ : Type u_1}
[ForIn Id ρ α]
(s : Lean.HashSet α)
(as : ρ)
:
Insert many elements into a HashSet.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[inline]
O(|t|)
amortized. Merge two HashSet
s.
Equations
- s.merge t = Lean.HashSet.fold (fun (s : Lean.HashSet α) (a : α) => s.insert a) s t