Documentation

Std.Lean.HashSet

instance Lean.HashSet.instSingleton_std {α : Type u_1} [BEq α] [Hashable α] :
Equations
  • Lean.HashSet.instSingleton_std = { singleton := fun (x : α) => Lean.HashSet.empty.insert x }
instance Lean.HashSet.instInsert_std {α : Type u_1} [BEq α] [Hashable α] :
Equations
  • Lean.HashSet.instInsert_std = { insert := fun (a : α) (s : Lean.HashSet α) => s.insert a }
@[specialize #[]]
def Lean.HashSet.anyM {α : Type u_1} [BEq α] [Hashable α] {m : TypeType} [Monad m] (s : Lean.HashSet α) (f : αm Bool) :

O(n). Returns true if f returns true for any element of the set.

Equations
  • One or more equations did not get rendered due to their size.
@[inline]
def Lean.HashSet.any {α : Type u_1} [BEq α] [Hashable α] (s : Lean.HashSet α) (f : αBool) :

O(n). Returns true if f returns true for any element of the set.

Equations
  • s.any f = (s.anyM f).run
@[specialize #[]]
def Lean.HashSet.allM {α : Type u_1} [BEq α] [Hashable α] {m : TypeType} [Monad m] (s : Lean.HashSet α) (f : αm Bool) :

O(n). Returns true if f returns true for all elements of the set.

Equations
  • One or more equations did not get rendered due to their size.
@[inline]
def Lean.HashSet.all {α : Type u_1} [BEq α] [Hashable α] (s : Lean.HashSet α) (f : αBool) :

O(n). Returns true if f returns true for all elements of the set.

Equations
  • s.all f = (s.allM f).run
instance Lean.HashSet.instBEq_std {α : Type u_1} [BEq α] [Hashable α] :
Equations
  • Lean.HashSet.instBEq_std = { beq := fun (s t : Lean.HashSet α) => (s.all fun (x : α) => t.contains x) && t.all fun (x : α) => s.contains x }
@[inline]
def Lean.HashSet.insert' {α : Type u_1} [BEq α] [Hashable α] (s : Lean.HashSet α) (a : α) :

O(1) amortized. Similar to insert, but also returns a Boolean flag indicating whether an existing entry has been replaced with a => b.

Equations
  • s.insert' a = let oldSize := s.size; let s := s.insert a; (s, s.size == oldSize)
@[inline]
def Lean.HashSet.ofArray {α : Type u_1} [BEq α] [Hashable α] (as : Array α) :

O(n). Obtain a HashSet from an array.

Equations
@[inline]
def Lean.HashSet.ofList {α : Type u_1} [BEq α] [Hashable α] (as : List α) :

O(n). Obtain a HashSet from a list.

Equations