Documentation

Lean.Data.RBMap

inductive Lean.Rbcolor :
Type
Instances For
    inductive Lean.RBNode (α : Type u) (β : α → Type v) :
    Type (max u v)
    Instances For
      def Lean.RBNode.depth {α : Type u} {β : α → Type v} (f : Nat → Nat → Nat) :
      Lean.RBNode α β → Nat
      Equations
      def Lean.RBNode.min {α : Type u} {β : α → Type v} :
      Lean.RBNode α β → Option ((k : α) × β k)
      Equations
      def Lean.RBNode.max {α : Type u} {β : α → Type v} :
      Lean.RBNode α β → Option ((k : α) × β k)
      Equations
      @[specialize #[]]
      def Lean.RBNode.fold {α : Type u} {β : α → Type v} {σ : Type w} (f : σ → (k : α) → β k → σ) (init : σ) :
      Lean.RBNode α β → σ
      Equations
      @[specialize #[]]
      def Lean.RBNode.forM {α : Type u} {β : α → Type v} {m : Type → Type u_1} [inst : Monad m] (f : (k : α) → β k → m Unit) :
      Lean.RBNode α β → m Unit
      Equations
      @[specialize #[]]
      def Lean.RBNode.foldM {α : Type u} {β : α → Type v} {σ : Type w} {m : Type w → Type u_1} [inst : Monad m] (f : σ → (k : α) → β k → m σ) (init : σ) :
      Lean.RBNode α β → m σ
      Equations
      @[inline]
      def Lean.RBNode.forIn {α : Type u} {β : α → Type v} {σ : Type w} {m : Type w → Type u_1} [inst : Monad m] (as : Lean.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} [inst : Monad m] (f : (k : α) → β k → σ → m (ForInStep σ)) :
      Lean.RBNode α β → σ → m (ForInStep σ)
      Equations
      @[specialize #[]]
      def Lean.RBNode.revFold {α : Type u} {β : α → Type v} {σ : Type w} (f : σ → (k : α) → β k → σ) (init : σ) :
      Lean.RBNode α β → σ
      Equations
      @[specialize #[]]
      def Lean.RBNode.all {α : Type u} {β : α → Type v} (p : (k : α) → β k → Bool) :
      Lean.RBNode α β → Bool
      Equations
      @[specialize #[]]
      def Lean.RBNode.any {α : Type u} {β : α → Type v} (p : (k : α) → β k → Bool) :
      Lean.RBNode α β → Bool
      Equations
      def Lean.RBNode.singleton {α : Type u} {β : α → Type v} (k : α) (v : β k) :
      Equations
      @[inline]
      def Lean.RBNode.balance1 {α : Type u} {β : α → Type v} :
      Lean.RBNode α β → (a : α) → β a → Lean.RBNode α β → Lean.RBNode α β
      Equations
      • One or more equations did not get rendered due to their size.
      @[inline]
      def Lean.RBNode.balance2 {α : Type u} {β : α → Type v} :
      Lean.RBNode α β → (a : α) → β a → Lean.RBNode α β → Lean.RBNode α β
      Equations
      • One or more equations did not get rendered due to their size.
      def Lean.RBNode.isRed {α : Type u} {β : α → Type v} :
      Lean.RBNode α β → Bool
      Equations
      def Lean.RBNode.isBlack {α : Type u} {β : α → Type v} :
      Lean.RBNode α β → Bool
      Equations
      @[specialize #[]]
      def Lean.RBNode.ins {α : Type u} {β : α → Type v} (cmp : α → α → Ordering) :
      Lean.RBNode α β → (k : α) → β k → Lean.RBNode α β
      Equations
      def Lean.RBNode.setBlack {α : Type u} {β : α → Type v} :
      Lean.RBNode α β → Lean.RBNode α β
      Equations
      @[specialize #[]]
      def Lean.RBNode.insert {α : Type u} {β : α → Type v} (cmp : α → α → Ordering) (t : Lean.RBNode α β) (k : α) (v : β k) :
      Equations
      def Lean.RBNode.balance₃ {α : Type u} {β : α → Type v} (a : Lean.RBNode α β) (k : α) (v : β k) (d : Lean.RBNode α β) :
      Equations
      • One or more equations did not get rendered due to their size.
      def Lean.RBNode.setRed {α : Type u} {β : α → Type v} :
      Lean.RBNode α β → Lean.RBNode α β
      Equations
      def Lean.RBNode.balLeft {α : Type u} {β : α → Type v} :
      Lean.RBNode α β → (k : α) → β k → Lean.RBNode α β → Lean.RBNode α β
      Equations
      • One or more equations did not get rendered due to their size.
      def Lean.RBNode.balRight {α : Type u} {β : α → Type v} (l : Lean.RBNode α β) (k : α) (v : β k) (r : Lean.RBNode α β) :
      Equations
      • One or more equations did not get rendered due to their size.
      partial def Lean.RBNode.appendTrees {α : Type u} {β : α → Type v} :
      Lean.RBNode α β → Lean.RBNode α β → Lean.RBNode α β
      @[specialize #[]]
      def Lean.RBNode.del {α : Type u} {β : α → Type v} (cmp : α → α → Ordering) (x : α) :
      Lean.RBNode α β → Lean.RBNode α β
      Equations
      • One or more equations did not get rendered due to their size.
      • Lean.RBNode.del cmp x Lean.RBNode.leaf = Lean.RBNode.leaf
      @[specialize #[]]
      def Lean.RBNode.erase {α : Type u} {β : α → Type v} (cmp : α → α → Ordering) (x : α) (t : Lean.RBNode α β) :
      Equations
      @[specialize #[]]
      def Lean.RBNode.findCore {α : Type u} {β : α → Type v} (cmp : α → α → Ordering) :
      Lean.RBNode α β → α → Option ((k : α) × β k)
      Equations
      • One or more equations did not get rendered due to their size.
      • Lean.RBNode.findCore cmp Lean.RBNode.leaf _fun_discr = none
      @[specialize #[]]
      def Lean.RBNode.find {α : Type u} (cmp : α → α → Ordering) {β : Type v} :
      (Lean.RBNode α fun x => β) → α → Option β
      Equations
      • One or more equations did not get rendered due to their size.
      • Lean.RBNode.find cmp Lean.RBNode.leaf _fun_discr = none
      @[specialize #[]]
      def Lean.RBNode.lowerBound {α : Type u} {β : α → Type v} (cmp : α → α → Ordering) :
      Lean.RBNode α β → α → Option (Sigma β) → Option (Sigma β)
      Equations
      • One or more equations did not get rendered due to their size.
      • Lean.RBNode.lowerBound cmp Lean.RBNode.leaf _fun_discr _fun_discr = _fun_discr
      inductive Lean.RBNode.WellFormed {α : Type u} {β : α → Type v} (cmp : α → α → Ordering) :
      Lean.RBNode α β → Prop
      Instances For
        @[specialize #[]]
        def Lean.RBNode.mapM {α : Type v} {β : α → Type v} {γ : α → Type v} {M : Type v → Type v} [inst : Applicative M] (f : (a : α) → β a → M (γ a)) :
        Lean.RBNode α β → M (Lean.RBNode α γ)
        Equations
        • One or more equations did not get rendered due to their size.
        • Lean.RBNode.mapM f Lean.RBNode.leaf = pure Lean.RBNode.leaf
        @[specialize #[]]
        def Lean.RBNode.map {α : Type u} {β : α → Type v} {γ : α → Type v} (f : (a : α) → β a → γ a) :
        Lean.RBNode α β → Lean.RBNode α γ
        Equations
        def Lean.RBNode.toArray {α : Type u} {β : α → Type v} (n : Lean.RBNode α β) :
        Equations
        instance Lean.RBNode.instEmptyCollectionRBNode {α : Type u} {β : α → Type v} :
        Equations
        • Lean.RBNode.instEmptyCollectionRBNode = { emptyCollection := Lean.RBNode.leaf }
        def Lean.RBMap (α : Type u) (β : Type v) (cmp : α → α → Ordering) :
        Type (max u v)
        Equations
        @[inline]
        def Lean.mkRBMap (α : Type u) (β : Type v) (cmp : α → α → Ordering) :
        Lean.RBMap α β cmp
        Equations
        @[inline]
        def Lean.RBMap.empty {α : Type u} {β : Type v} {cmp : α → α → Ordering} :
        Lean.RBMap α β cmp
        Equations
        instance Lean.instEmptyCollectionRBMap (α : Type u) (β : Type v) (cmp : α → α → Ordering) :
        Equations
        instance Lean.instInhabitedRBMap (α : Type u) (β : Type v) (cmp : α → α → Ordering) :
        Inhabited (Lean.RBMap α β cmp)
        Equations
        def Lean.RBMap.depth {α : Type u} {β : Type v} {cmp : α → α → Ordering} (f : Nat → Nat → Nat) (t : Lean.RBMap α β cmp) :
        Equations
        @[inline]
        def Lean.RBMap.fold {α : Type u} {β : Type v} {σ : Type w} {cmp : α → α → Ordering} (f : σ → α → β → σ) (init : σ) :
        Lean.RBMap α β cmp → σ
        Equations
        @[inline]
        def Lean.RBMap.revFold {α : Type u} {β : Type v} {σ : Type w} {cmp : α → α → Ordering} (f : σ → α → β → σ) (init : σ) :
        Lean.RBMap α β cmp → σ
        Equations
        @[inline]
        def Lean.RBMap.foldM {α : Type u} {β : Type v} {σ : Type w} {cmp : α → α → Ordering} {m : Type w → Type u_1} [inst : Monad m] (f : σ → α → β → m σ) (init : σ) :
        Lean.RBMap α β cmp → m σ
        Equations
        @[inline]
        def Lean.RBMap.forM {α : Type u} {β : Type v} {cmp : α → α → Ordering} {m : Type u_1 → Type u_2} [inst : Monad m] (f : α → β → m PUnit) (t : Lean.RBMap α β cmp) :
        Equations
        @[inline]
        def Lean.RBMap.forIn {α : Type u} {β : Type v} {σ : Type w} {cmp : α → α → Ordering} {m : Type w → Type u_1} [inst : Monad m] (t : Lean.RBMap α β cmp) (init : σ) (f : α × β → σ → m (ForInStep σ)) :
        m σ
        Equations
        instance Lean.RBMap.instForInRBMapProd {α : Type u} {β : Type v} {cmp : α → α → Ordering} {m : Type u_1 → Type u_2} :
        ForIn m (Lean.RBMap α β cmp) (α × β)
        Equations
        • Lean.RBMap.instForInRBMapProd = { forIn := fun {β} [Monad m] => Lean.RBMap.forIn }
        @[inline]
        def Lean.RBMap.isEmpty {α : Type u} {β : Type v} {cmp : α → α → Ordering} :
        Lean.RBMap α β cmp → Bool
        Equations
        • Lean.RBMap.isEmpty _fun_discr = match _fun_discr with | { val := Lean.RBNode.leaf, property := property } => true | x => false
        @[specialize #[]]
        def Lean.RBMap.toList {α : Type u} {β : Type v} {cmp : α → α → Ordering} :
        Lean.RBMap α β cmp → List (α × β)
        Equations
        @[inline]
        def Lean.RBMap.min {α : Type u} {β : Type v} {cmp : α → α → Ordering} :
        Lean.RBMap α β cmp → Option (α × β)

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

        Equations
        • One or more equations did not get rendered due to their size.
        @[inline]
        def Lean.RBMap.max {α : Type u} {β : Type v} {cmp : α → α → Ordering} :
        Lean.RBMap α β cmp → Option (α × β)

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

        Equations
        • One or more equations did not get rendered due to their size.
        instance Lean.RBMap.instReprRBMap {α : Type u} {β : Type v} {cmp : α → α → Ordering} [inst : Repr α] [inst : Repr β] :
        Repr (Lean.RBMap α β cmp)
        Equations
        @[inline]
        def Lean.RBMap.insert {α : Type u} {β : Type v} {cmp : α → α → Ordering} :
        Lean.RBMap α β cmp → α → β → Lean.RBMap α β cmp
        Equations
        • One or more equations did not get rendered due to their size.
        @[inline]
        def Lean.RBMap.erase {α : Type u} {β : Type v} {cmp : α → α → Ordering} :
        Lean.RBMap α β cmp → α → Lean.RBMap α β cmp
        Equations
        • One or more equations did not get rendered due to their size.
        @[specialize #[]]
        def Lean.RBMap.ofList {α : Type u} {β : Type v} {cmp : α → α → Ordering} :
        List (α × β) → Lean.RBMap α β cmp
        Equations
        @[inline]
        def Lean.RBMap.findCore? {α : Type u} {β : Type v} {cmp : α → α → Ordering} :
        Lean.RBMap α β cmp → α → Option ((_ : α) × β)
        Equations
        @[inline]
        def Lean.RBMap.find? {α : Type u} {β : Type v} {cmp : α → α → Ordering} :
        Lean.RBMap α β cmp → α → Option β
        Equations
        @[inline]
        def Lean.RBMap.findD {α : Type u} {β : Type v} {cmp : α → α → Ordering} (t : Lean.RBMap α β cmp) (k : α) (v₀ : β) :
        β
        Equations
        @[inline]
        def Lean.RBMap.lowerBound {α : Type u} {β : Type v} {cmp : α → α → Ordering} :
        Lean.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 : Lean.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) :
        Lean.RBMap α β cmp
        Equations
        @[inline]
        def Lean.RBMap.fromArray {α : Type u} {β : Type v} (l : Array (α × β)) (cmp : α → α → Ordering) :
        Lean.RBMap α β cmp
        Equations
        @[inline]
        def Lean.RBMap.all {α : Type u} {β : Type v} {cmp : α → α → Ordering} :
        Lean.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} :
        Lean.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 : Lean.RBMap α β cmp) :

        The number of items in the RBMap.

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

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

        Equations
        • One or more equations did not get rendered due to their size.
        def Lean.RBMap.mergeBy {α : Type u} {β : Type v} {cmp : α → α → Ordering} (mergeFn : α → β → β → β) (t₁ : Lean.RBMap α β cmp) (t₂ : Lean.RBMap α β cmp) :
        Lean.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₁ : Lean.RBMap α β cmp) (t₂ : Lean.RBMap α γ cmp) :
        Lean.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.rbmapOf {α : Type u} {β : Type v} (l : List (α × β)) (cmp : α → α → Ordering) :
        Lean.RBMap α β cmp
        Equations