Documentation

Lean.Data.RBMap

inductive Lean.RBColor :
inductive Lean.RBNode (α : Type u) (β : αType v) :
Type (max u v)
Instances For
def Lean.RBNode.depth {α : Type u} {β : αType v} (f : NatNatNat) :
RBNode α βNat
Equations
def Lean.RBNode.min {α : Type u} {β : αType v} :
RBNode α βOption ((k : α) × β k)
Equations
def Lean.RBNode.max {α : Type u} {β : αType v} :
RBNode α βOption ((k : α) × β k)
Equations
@[specialize #[]]
def Lean.RBNode.fold {α : Type u} {β : αType v} {σ : Type w} (f : σ(k : α) → β kσ) (init : σ) :
RBNode α βσ
Equations
@[specialize #[]]
def Lean.RBNode.forM {α : Type u} {β : αType v} {m : TypeType u_1} [Monad m] (f : (k : α) → β km Unit) :
RBNode α βm Unit
Equations
@[specialize #[]]
def Lean.RBNode.foldM {α : Type u} {β : αType v} {σ : Type w} {m : Type w → Type u_1} [Monad m] (f : σ(k : α) → β km σ) (init : σ) :
RBNode α βm σ
Equations
@[inline]
def Lean.RBNode.forIn {α : Type u} {β : αType v} {σ : Type w} {m : Type w → Type u_1} [Monad m] (as : RBNode α β) (init : σ) (f : (k : α) → β kσm (ForInStep σ)) :
m σ
Equations
@[specialize #[]]
def Lean.RBNode.forIn.visit {α : Type u} {β : αType v} {σ : Type w} {m : Type w → Type u_1} [Monad m] (f : (k : α) → β kσm (ForInStep σ)) :
RBNode α βσm (ForInStep σ)
Equations
@[specialize #[]]
def Lean.RBNode.revFold {α : Type u} {β : αType v} {σ : Type w} (f : σ(k : α) → β kσ) (init : σ) :
RBNode α βσ
Equations
@[specialize #[]]
def Lean.RBNode.all {α : Type u} {β : αType v} (p : (k : α) → β kBool) :
RBNode α βBool
Equations
@[specialize #[]]
def Lean.RBNode.any {α : Type u} {β : αType v} (p : (k : α) → β kBool) :
RBNode α βBool
Equations
@[inline]
def Lean.RBNode.balance1 {α : Type u} {β : αType v} :
RBNode α β(a : α) → β aRBNode α βRBNode α β
Equations
@[inline]
def Lean.RBNode.balance2 {α : Type u} {β : αType v} :
RBNode α β(a : α) → β aRBNode α βRBNode α β
Equations
def Lean.RBNode.isRed {α : Type u} {β : αType v} :
RBNode α βBool
Equations
def Lean.RBNode.isBlack {α : Type u} {β : αType v} :
RBNode α βBool
Equations
@[specialize #[]]
def Lean.RBNode.ins {α : Type u} {β : αType v} (cmp : ααOrdering) :
RBNode α β(k : α) → β kRBNode α β
Equations
def Lean.RBNode.setBlack {α : Type u} {β : αType v} :
RBNode α βRBNode α β
Equations
@[specialize #[]]
def Lean.RBNode.insert {α : Type u} {β : αType v} (cmp : ααOrdering) (t : RBNode α β) (k : α) (v : β k) :
RBNode α β
Equations
def Lean.RBNode.setRed {α : Type u} {β : αType v} :
RBNode α βRBNode α β
Equations
def Lean.RBNode.balLeft {α : Type u} {β : αType v} :
RBNode α β(k : α) → β kRBNode α βRBNode α β
Equations
def Lean.RBNode.balRight {α : Type u} {β : αType v} (l : RBNode α β) (k : α) (v : β k) (r : RBNode α β) :
RBNode α β
Equations
def Lean.RBNode.size {α : Type u} {β : αType v} :
RBNode α βNat

The number of nodes in the tree.

Equations
@[irreducible]
def Lean.RBNode.appendTrees {α : Type u} {β : αType v} :
RBNode α βRBNode α βRBNode α β
Equations
@[specialize #[]]
def Lean.RBNode.del {α : Type u} {β : αType v} (cmp : ααOrdering) (x : α) :
RBNode α βRBNode α β
Equations
@[specialize #[]]
def Lean.RBNode.erase {α : Type u} {β : αType v} (cmp : ααOrdering) (x : α) (t : RBNode α β) :
RBNode α β
Equations
@[specialize #[]]
def Lean.RBNode.findCore {α : Type u} {β : αType v} (cmp : ααOrdering) :
RBNode α β(k : α) → Option ((k : α) × β k)
Equations
@[specialize #[]]
def Lean.RBNode.find {α : Type u} (cmp : ααOrdering) {β : Type v} :
(RBNode α fun (x : α) => β)αOption β
Equations
@[specialize #[]]
def Lean.RBNode.lowerBound {α : Type u} {β : αType v} (cmp : ααOrdering) :
RBNode α βαOption (Sigma β)Option (Sigma β)
Equations
inductive Lean.RBNode.WellFormed {α : Type u} {β : αType v} (cmp : ααOrdering) :
RBNode α βProp
@[specialize #[]]
def Lean.RBNode.mapM {α : Type v} {β γ : αType v} {M : Type v → Type v} [Applicative M] (f : (a : α) → β aM (γ a)) :
RBNode α βM (RBNode α γ)
Equations
@[specialize #[]]
def Lean.RBNode.map {α : Type u} {β γ : αType v} (f : (a : α) → β aγ a) :
RBNode α βRBNode α γ
Equations
def Lean.RBNode.toArray {α : Type u} {β : αType v} (n : RBNode α β) :
Equations
instance Lean.RBNode.instEmptyCollection {α : Type u} {β : αType v} :
Equations
@[inline]
def Lean.mkRBMap (α : Type u) (β : Type v) (cmp : ααOrdering) :
RBMap α β cmp
Equations
@[inline]
def Lean.RBMap.empty {α : Type u} {β : Type v} {cmp : ααOrdering} :
RBMap α β cmp
Equations
instance Lean.instEmptyCollectionRBMap (α : Type u) (β : Type v) (cmp : ααOrdering) :
Equations
instance Lean.instInhabitedRBMap (α : Type u) (β : Type v) (cmp : ααOrdering) :
Inhabited (RBMap α β cmp)
Equations
def Lean.RBMap.depth {α : Type u} {β : Type v} {cmp : ααOrdering} (f : NatNatNat) (t : RBMap α β cmp) :
Equations
def Lean.RBMap.isSingleton {α : Type u} {β : Type v} {cmp : ααOrdering} (t : RBMap α β cmp) :
Equations
@[inline]
def Lean.RBMap.fold {α : Type u} {β : Type v} {σ : Type w} {cmp : ααOrdering} (f : σαβσ) (init : σ) :
RBMap α β cmpσ
Equations
@[inline]
def Lean.RBMap.revFold {α : Type u} {β : Type v} {σ : Type w} {cmp : ααOrdering} (f : σαβσ) (init : σ) :
RBMap α β cmpσ
Equations
@[inline]
def Lean.RBMap.foldM {α : Type u} {β : Type v} {σ : Type w} {cmp : ααOrdering} {m : Type w → Type u_1} [Monad m] (f : σαβm σ) (init : σ) :
RBMap α β cmpm σ
Equations
@[inline]
def Lean.RBMap.forM {α : Type u} {β : Type v} {cmp : ααOrdering} {m : Type u_1 → Type u_2} [Monad m] (f : αβm PUnit) (t : RBMap α β cmp) :
Equations
@[inline]
def Lean.RBMap.forIn {α : Type u} {β : Type v} {σ : Type w} {cmp : ααOrdering} {m : Type w → Type u_1} [Monad m] (t : RBMap α β cmp) (init : σ) (f : α × βσm (ForInStep σ)) :
m σ
Equations
instance Lean.RBMap.instForInProd {α : Type u} {β : Type v} {cmp : ααOrdering} {m : Type u_1 → Type u_2} :
ForIn m (RBMap α β cmp) (α × β)
Equations
@[inline]
def Lean.RBMap.isEmpty {α : Type u} {β : Type v} {cmp : ααOrdering} :
RBMap α β cmpBool
Equations
@[specialize #[]]
def Lean.RBMap.toList {α : Type u} {β : Type v} {cmp : ααOrdering} :
RBMap α β cmpList (α × β)

Returns a List of the key/value pairs in order.

Equations
@[specialize #[]]
def Lean.RBMap.toArray {α : Type u} {β : Type v} {cmp : ααOrdering} :
RBMap α β cmpArray (α × β)

Returns an Array of the key/value pairs in order.

Equations
@[inline]
def Lean.RBMap.min {α : Type u} {β : Type v} {cmp : ααOrdering} :
RBMap α β cmpOption (α × β)

Returns the kv pair (a,b) such that a ≤ k for all keys in the RBMap.

Equations
@[inline]
def Lean.RBMap.max {α : Type u} {β : Type v} {cmp : ααOrdering} :
RBMap α β cmpOption (α × β)

Returns the kv pair (a,b) such that a ≥ k for all keys in the RBMap.

Equations
instance Lean.RBMap.instRepr {α : Type u} {β : Type v} {cmp : ααOrdering} [Repr α] [Repr β] :
Repr (RBMap α β cmp)
Equations
@[inline]
def Lean.RBMap.insert {α : Type u} {β : Type v} {cmp : ααOrdering} :
RBMap α β cmpαβRBMap α β cmp
Equations
@[inline]
def Lean.RBMap.erase {α : Type u} {β : Type v} {cmp : ααOrdering} :
RBMap α β cmpαRBMap α β cmp
Equations
@[specialize #[]]
def Lean.RBMap.ofList {α : Type u} {β : Type v} {cmp : ααOrdering} :
List (α × β)RBMap α β cmp
Equations
@[inline]
def Lean.RBMap.findCore? {α : Type u} {β : Type v} {cmp : ααOrdering} :
RBMap α β cmpαOption ((_ : α) × β)
Equations
@[inline]
def Lean.RBMap.find? {α : Type u} {β : Type v} {cmp : ααOrdering} :
RBMap α β cmpαOption β
Equations
@[inline]
def Lean.RBMap.findD {α : Type u} {β : Type v} {cmp : ααOrdering} (t : RBMap α β cmp) (k : α) (v₀ : β) :
β
Equations
@[inline]
def Lean.RBMap.lowerBound {α : Type u} {β : Type v} {cmp : ααOrdering} :
RBMap α β cmpαOption ((_ : α) × β)

(lowerBound k) retrieves the kv pair of the largest key smaller than or equal to k, if it exists.

Equations
@[inline]
def Lean.RBMap.contains {α : Type u} {β : Type v} {cmp : ααOrdering} (t : RBMap α β cmp) (a : α) :

Returns true if the given key a is in the RBMap.

Equations
@[inline]
def Lean.RBMap.fromList {α : Type u} {β : Type v} (l : List (α × β)) (cmp : ααOrdering) :
RBMap α β cmp
Equations
@[inline]
def Lean.RBMap.fromArray {α : Type u} {β : Type v} (l : Array (α × β)) (cmp : ααOrdering) :
RBMap α β cmp
Equations
@[inline]
def Lean.RBMap.all {α : Type u} {β : Type v} {cmp : ααOrdering} :
RBMap α β cmp(αβBool)Bool

Returns true if the given predicate is true for all items in the RBMap.

Equations
@[inline]
def Lean.RBMap.any {α : Type u} {β : Type v} {cmp : ααOrdering} :
RBMap α β cmp(αβBool)Bool

Returns true if the given predicate is true for any item in the RBMap.

Equations
def Lean.RBMap.size {α : Type u} {β : Type v} {cmp : ααOrdering} (m : RBMap α β cmp) :

The number of items in the RBMap.

Equations
def Lean.RBMap.maxDepth {α : Type u} {β : Type v} {cmp : ααOrdering} (t : RBMap α β cmp) :
Equations
@[inline]
def Lean.RBMap.min! {α : Type u} {β : Type v} {cmp : ααOrdering} [Inhabited α] [Inhabited β] (t : RBMap α β cmp) :
α × β
Equations
@[inline]
def Lean.RBMap.max! {α : Type u} {β : Type v} {cmp : ααOrdering} [Inhabited α] [Inhabited β] (t : RBMap α β cmp) :
α × β
Equations
@[inline]
def Lean.RBMap.find! {α : Type u} {β : Type v} {cmp : ααOrdering} [Inhabited β] (t : RBMap α β cmp) (k : α) :
β

Attempts to find the value with key k : α in t and panics if there is no such key.

Equations
def Lean.RBMap.mergeBy {α : Type u} {β : Type v} {cmp : ααOrdering} (mergeFn : αβββ) (t₁ t₂ : RBMap α β cmp) :
RBMap α β cmp

Merges the maps t₁ and t₂, if a key a : α exists in both, then use mergeFn a b₁ b₂ to produce the new merged value.

Equations
  • One or more equations did not get rendered due to their size.
def Lean.RBMap.intersectBy {α : Type u} {β : Type v} {cmp : ααOrdering} {γ : Type v₁} {δ : Type v₂} (mergeFn : αβγδ) (t₁ : RBMap α β cmp) (t₂ : RBMap α γ cmp) :
RBMap α δ cmp

Intersects the maps t₁ and t₂ using mergeFn a b₁ b₂ to produce the new value.

Equations
  • One or more equations did not get rendered due to their size.
def Lean.RBMap.filter {α : Type u} {β : Type v} {cmp : ααOrdering} (f : αβBool) (m : RBMap α β cmp) :
RBMap α β cmp

filter f m returns the RBMap consisting of all "key/val"-pairs in m where f key val returns true.

Equations
def Lean.RBMap.filterMap {α : Type u} {β : Type v} {cmp : ααOrdering} {γ : Type u_1} (f : αβOption γ) (m : RBMap α β cmp) :
RBMap α γ cmp

filterMap f m filters an RBMap and simultaneously modifies the filtered values.

It takes a function f : α → β → Option γ and applies f k v to the value with key k. The resulting entries with non-none value are collected to form the output RBMap.

Equations
def Lean.rbmapOf {α : Type u} {β : Type v} (l : List (α × β)) (cmp : ααOrdering) :
RBMap α β cmp
Equations