def
Std.HashSetBucket.update
{α : Type u}
(data : Std.HashSetBucket α)
(i : USize)
(d : List α)
(h : USize.toNat i < Array.size data.val)
:
Equations
- Std.HashSetBucket.update data i d h = { val := Array.uset data.val i d h, property := (_ : Array.size (Array.uset data.val i d h) > 0) }
Equations
- One or more equations did not get rendered due to their size.
@[inline]
def
Std.HashSetImp.reinsertAux
{α : Type u}
(hashFn : α → UInt64)
(data : Std.HashSetBucket α)
(a : α)
:
Equations
- One or more equations did not get rendered due to their size.
@[inline]
def
Std.HashSetImp.foldBucketsM
{α : Type u}
{δ : Type w}
{m : Type w → Type w}
[inst : Monad m]
(data : Std.HashSetBucket α)
(d : δ)
(f : δ → α → m δ)
:
m δ
Equations
- Std.HashSetImp.foldBucketsM data d f = Array.foldlM (fun d as => List.foldlM f d as) d data.val 0 (Array.size data.val)
@[inline]
def
Std.HashSetImp.foldBuckets
{α : Type u}
{δ : Type w}
(data : Std.HashSetBucket α)
(d : δ)
(f : δ → α → δ)
:
δ
Equations
- Std.HashSetImp.foldBuckets data d f = Id.run (Std.HashSetImp.foldBucketsM data d f)
@[inline]
def
Std.HashSetImp.foldM
{α : Type u}
{δ : Type w}
{m : Type w → Type w}
[inst : Monad m]
(f : δ → α → m δ)
(d : δ)
(h : Std.HashSetImp α)
:
m δ
Equations
- Std.HashSetImp.foldM f d h = Std.HashSetImp.foldBucketsM h.buckets d f
@[inline]
Equations
- Std.HashSetImp.fold f d m = Std.HashSetImp.foldBuckets m.buckets d f
def
Std.HashSetImp.find?
{α : Type u}
[inst : BEq α]
[inst : Hashable α]
(m : Std.HashSetImp α)
(a : α)
:
Option α
Equations
- One or more equations did not get rendered due to their size.
def
Std.HashSetImp.contains
{α : Type u}
[inst : BEq α]
[inst : Hashable α]
(m : Std.HashSetImp α)
(a : α)
:
Equations
- One or more equations did not get rendered due to their size.
def
Std.HashSetImp.moveEntries
{α : Type u}
[inst : Hashable α]
(i : Nat)
(source : Array (List α))
(target : Std.HashSetBucket α)
:
Equations
- One or more equations did not get rendered due to their size.
def
Std.HashSetImp.expand
{α : Type u}
[inst : Hashable α]
(size : Nat)
(buckets : Std.HashSetBucket α)
:
Equations
- One or more equations did not get rendered due to their size.
def
Std.HashSetImp.insert
{α : Type u}
[inst : BEq α]
[inst : Hashable α]
(m : Std.HashSetImp α)
(a : α)
:
Equations
- One or more equations did not get rendered due to their size.
def
Std.HashSetImp.erase
{α : Type u}
[inst : BEq α]
[inst : Hashable α]
(m : Std.HashSetImp α)
(a : α)
:
Equations
- One or more equations did not get rendered due to their size.
inductive
Std.HashSetImp.WellFormed
{α : Type u}
[inst : BEq α]
[inst : Hashable α]
:
Std.HashSetImp α → Prop
- mkWff: ∀ {α : Type u} [inst : BEq α] [inst_1 : Hashable α] (n : Nat), Std.HashSetImp.WellFormed (Std.mkHashSetImp n)
- insertWff: ∀ {α : Type u} [inst : BEq α] [inst_1 : Hashable α] (m : Std.HashSetImp α) (a : α), Std.HashSetImp.WellFormed m → Std.HashSetImp.WellFormed (Std.HashSetImp.insert m a)
- eraseWff: ∀ {α : Type u} [inst : BEq α] [inst_1 : Hashable α] (m : Std.HashSetImp α) (a : α), Std.HashSetImp.WellFormed m → Std.HashSetImp.WellFormed (Std.HashSetImp.erase m a)
Equations
- Std.mkHashSet nbuckets = { val := Std.mkHashSetImp nbuckets, property := (_ : Std.HashSetImp.WellFormed (Std.mkHashSetImp nbuckets)) }
@[inline]
Equations
- Std.HashSet.empty = Std.mkHashSet
instance
Std.HashSet.instInhabitedHashSet
{α : Type u_1}
[inst : BEq α]
[inst : Hashable α]
:
Inhabited (Std.HashSet α)
Equations
- Std.HashSet.instInhabitedHashSet = { default := Std.mkHashSet }
Equations
- Std.HashSet.instEmptyCollectionHashSet = { emptyCollection := Std.mkHashSet }
@[inline]
def
Std.HashSet.insert
{α : Type u}
:
{x : BEq α} → {x_1 : Hashable α} → Std.HashSet α → α → Std.HashSet α
Equations
- Std.HashSet.insert m a = match m with | { val := m, property := hw } => { val := Std.HashSetImp.insert m a, property := (_ : Std.HashSetImp.WellFormed (Std.HashSetImp.insert m a)) }
@[inline]
def
Std.HashSet.erase
{α : Type u}
:
{x : BEq α} → {x_1 : Hashable α} → Std.HashSet α → α → Std.HashSet α
Equations
- Std.HashSet.erase m a = match m with | { val := m, property := hw } => { val := Std.HashSetImp.erase m a, property := (_ : Std.HashSetImp.WellFormed (Std.HashSetImp.erase m a)) }
@[inline]
Equations
- Std.HashSet.find? m a = match m with | { val := m, property := property } => Std.HashSetImp.find? m a
@[inline]
Equations
- Std.HashSet.contains m a = match m with | { val := m, property := property } => Std.HashSetImp.contains m a
@[inline]
def
Std.HashSet.foldM
{α : Type u}
:
{x : BEq α} →
{x_1 : Hashable α} → {δ : Type w} → {m : Type w → Type w} → [inst : Monad m] → (δ → α → m δ) → δ → Std.HashSet α → m δ
Equations
- Std.HashSet.foldM f init h = match h with | { val := h, property := property } => Std.HashSetImp.foldM f init h
@[inline]
def
Std.HashSet.fold
{α : Type u}
:
{x : BEq α} → {x_1 : Hashable α} → {δ : Type w} → (δ → α → δ) → δ → Std.HashSet α → δ
Equations
- Std.HashSet.fold f init m = match m with | { val := m, property := property } => Std.HashSetImp.fold f init m
@[inline]
Equations
- Std.HashSet.size m = match m with | { val := { size := sz, buckets := buckets }, property := property } => sz
@[inline]
Equations
- Std.HashSet.isEmpty m = decide (Std.HashSet.size m = 0)
Equations
- Std.HashSet.toList m = Std.HashSet.fold (fun r a => a :: r) [] m
Equations
- Std.HashSet.toArray m = Std.HashSet.fold (fun r a => Array.push r a) #[] m
Equations
- Std.HashSet.numBuckets m = Array.size m.val.buckets.val