Documentation

Std.Data.RBMap.Lemmas

Additional lemmas for Red-black trees #

def Std.RBNode.depth {α : Type u_1} :

O(n). depth t is the maximum number of nodes on any path to a leaf. It is an upper bound on most tree operations.

Equations
Instances For
    theorem Std.RBNode.size_lt_depth {α : Type u_1} (t : Std.RBNode α) :
    t.size < 2 ^ t.depth

    depthLB c n is the best upper bound on the depth of any balanced red-black tree with root colored c and black-height n.

    Equations
    Instances For

      depthUB c n is the best upper bound on the depth of any balanced red-black tree with root colored c and black-height n.

      Equations
      Instances For
        theorem Std.RBNode.Balanced.depth_le {α : Type u_1} {t : Std.RBNode α} {c : Std.RBColor} {n : Nat} :
        t.Balanced c nt.depth Std.RBNode.depthUB c n
        theorem Std.RBNode.Balanced.le_size {α : Type u_1} {t : Std.RBNode α} {c : Std.RBColor} {n : Nat} :
        t.Balanced c n2 ^ Std.RBNode.depthLB c n t.size + 1
        theorem Std.RBNode.Balanced.depth_bound {α : Type u_1} {t : Std.RBNode α} {c : Std.RBColor} {n : Nat} (h : t.Balanced c n) :
        t.depth 2 * (t.size + 1).log2
        theorem Std.RBNode.WF.depth_bound {α : Type u_1} {cmp : ααOrdering} {t : Std.RBNode α} (h : Std.RBNode.WF cmp t) :
        t.depth 2 * (t.size + 1).log2

        A well formed tree has t.depth ∈ O(log t.size), that is, it is well balanced. This justifies the O(log n) bounds on most searching operations of RBSet.

        @[simp]
        theorem Std.RBNode.min?_reverse {α : Type u_1} (t : Std.RBNode α) :
        t.reverse.min? = t.max?
        @[simp]
        theorem Std.RBNode.max?_reverse {α : Type u_1} (t : Std.RBNode α) :
        t.reverse.max? = t.min?
        @[simp]
        theorem Std.RBNode.mem_nil {α : Type u_1} {x : α} :
        ¬x Std.RBNode.nil
        @[simp]
        theorem Std.RBNode.mem_node {α : Type u_1} {y : α} {c : Std.RBColor} {a : Std.RBNode α} {x : α} {b : Std.RBNode α} :
        y Std.RBNode.node c a x b y = x y a y b
        theorem Std.RBNode.All_def {α : Type u_1} {p : αProp} {t : Std.RBNode α} :
        Std.RBNode.All p t ∀ (x : α), x tp x
        theorem Std.RBNode.Any_def {α : Type u_1} {p : αProp} {t : Std.RBNode α} :
        Std.RBNode.Any p t ∃ (x : α), x t p x
        theorem Std.RBNode.memP_def :
        ∀ {α : Type u_1} {cut : αOrdering} {t : Std.RBNode α}, Std.RBNode.MemP cut t ∃ (x : α), x t cut x = Ordering.eq
        theorem Std.RBNode.mem_def :
        ∀ {α : Type u_1} {cmp : ααOrdering} {x : α} {t : Std.RBNode α}, Std.RBNode.Mem cmp x t ∃ (y : α), y t cmp x y = Ordering.eq
        theorem Std.RBNode.mem_congr {α : Type u_1} {cmp : ααOrdering} {x : α} {y : α} [Std.TransCmp cmp] {t : Std.RBNode α} (h : cmp x y = Ordering.eq) :
        theorem Std.RBNode.isOrdered_iff' {α : Type u_1} {cmp : ααOrdering} {L : Option α} {R : Option α} [Std.TransCmp cmp] {t : Std.RBNode α} :
        Std.RBNode.isOrdered cmp t L R = true (∀ (a : α), a LStd.RBNode.All (fun (x : α) => Std.RBNode.cmpLT cmp a x) t) (∀ (a : α), a RStd.RBNode.All (fun (x : α) => Std.RBNode.cmpLT cmp x a) t) (∀ (a : α), a L∀ (b : α), b RStd.RBNode.cmpLT cmp a b) Std.RBNode.Ordered cmp t
        theorem Std.RBNode.isOrdered_iff {α : Type u_1} {cmp : ααOrdering} [Std.TransCmp cmp] {t : Std.RBNode α} :
        class Std.RBNode.IsCut {α : Sort u_1} (cmp : ααOrdering) (cut : αOrdering) :

        A cut is like a homomorphism of orderings: it is a monotonic predicate with respect to cmp, but it can make things that are distinguished by cmp equal. This is sufficient for find? to locate an element on which cut returns .eq, but there may be other elements, not returned by find?, on which cut also returns .eq.

        Instances
          theorem Std.RBNode.IsCut.le_lt_trans {α : Sort u_1} {cmp : ααOrdering} {cut : αOrdering} [self : Std.RBNode.IsCut cmp cut] {x : α} {y : α} [Std.TransCmp cmp] :
          cmp x y Ordering.gtcut x = Ordering.ltcut y = Ordering.lt

          The set {x | cut x = .lt} is downward-closed.

          theorem Std.RBNode.IsCut.le_gt_trans {α : Sort u_1} {cmp : ααOrdering} {cut : αOrdering} [self : Std.RBNode.IsCut cmp cut] {x : α} {y : α} [Std.TransCmp cmp] :
          cmp x y Ordering.gtcut y = Ordering.gtcut x = Ordering.gt

          The set {x | cut x = .gt} is upward-closed.

          theorem Std.RBNode.IsCut.lt_trans :
          ∀ {α : Sort u_1} {cmp : ααOrdering} {cut : αOrdering} {x y : α} [inst : Std.RBNode.IsCut cmp cut] [inst : Std.TransCmp cmp], cmp x y = Ordering.ltcut x = Ordering.ltcut y = Ordering.lt
          theorem Std.RBNode.IsCut.gt_trans :
          ∀ {α : Sort u_1} {cmp : ααOrdering} {cut : αOrdering} {x y : α} [inst : Std.RBNode.IsCut cmp cut] [inst : Std.TransCmp cmp], cmp x y = Ordering.ltcut y = Ordering.gtcut x = Ordering.gt
          theorem Std.RBNode.IsCut.congr :
          ∀ {α : Sort u_1} {cmp : ααOrdering} {cut : αOrdering} {x y : α} [inst : Std.RBNode.IsCut cmp cut] [inst : Std.TransCmp cmp], cmp x y = Ordering.eqcut x = cut y
          class Std.RBNode.IsStrictCut {α : Sort u_1} (cmp : ααOrdering) (cut : αOrdering) extends Std.RBNode.IsCut :

          IsStrictCut upgrades the IsCut property to ensure that at most one element of the tree can match the cut, and hence find? will return the unique such element if one exists.

          Instances
            theorem Std.RBNode.IsStrictCut.exact {α : Sort u_1} {cmp : ααOrdering} {cut : αOrdering} [self : Std.RBNode.IsStrictCut cmp cut] {x : α} {y : α} [Std.TransCmp cmp] :
            cut x = Ordering.eqcmp x y = cut y

            If cut = x, then cut and x have compare the same with respect to other elements.

            instance Std.RBNode.instIsStrictCut {α : Sort u_1} (cmp : ααOrdering) (a : α) :

            A "representable cut" is one generated by cmp a for some a. This is always a valid cut.

            Equations
            • =
            theorem Std.RBNode.find?_some_eq_eq {α : Type u_1} {x : α} {cut : αOrdering} {t : Std.RBNode α} :
            x Std.RBNode.find? cut tcut x = Ordering.eq
            theorem Std.RBNode.find?_some_mem {α : Type u_1} {x : α} {cut : αOrdering} {t : Std.RBNode α} :
            x Std.RBNode.find? cut tx t
            theorem Std.RBNode.find?_some_memP {α : Type u_1} {x : α} {cut : αOrdering} {t : Std.RBNode α} (h : x Std.RBNode.find? cut t) :
            theorem Std.RBNode.Ordered.memP_iff_find? {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {t : Std.RBNode α} [Std.TransCmp cmp] [Std.RBNode.IsCut cmp cut] (ht : Std.RBNode.Ordered cmp t) :
            Std.RBNode.MemP cut t ∃ (x : α), Std.RBNode.find? cut t = some x
            theorem Std.RBNode.Ordered.unique {α : Type u_1} {cmp : ααOrdering} {t : Std.RBNode α} {x : α} {y : α} [Std.TransCmp cmp] (ht : Std.RBNode.Ordered cmp t) (hx : x t) (hy : y t) (e : cmp x y = Ordering.eq) :
            x = y
            theorem Std.RBNode.Ordered.find?_some {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {t : Std.RBNode α} {x : α} [Std.TransCmp cmp] [Std.RBNode.IsStrictCut cmp cut] (ht : Std.RBNode.Ordered cmp t) :
            theorem Std.RBNode.lowerBound?_le' {α : Type u_1} {lb : Option α} {cut : αOrdering} {x : α} {t : Std.RBNode α} (H : ∀ {x : α}, x lbcut x Ordering.lt) :

            The value x returned by lowerBound? is less or equal to the cut.

            theorem Std.RBNode.lowerBound?_le {α : Type u_1} {cut : αOrdering} {x : α} {t : Std.RBNode α} :

            The value x returned by lowerBound? is less or equal to the cut.

            theorem Std.RBNode.All.lowerBound?_lb {α : Type u_1} {p : αProp} {lb : Option α} {cut : αOrdering} {x : α} {t : Std.RBNode α} (hp : Std.RBNode.All p t) (H : ∀ {x : α}, x lbp x) :
            Std.RBNode.lowerBound? cut t lb = some xp x
            theorem Std.RBNode.All.lowerBound? {α : Type u_1} {p : αProp} {cut : αOrdering} {x : α} {t : Std.RBNode α} (hp : Std.RBNode.All p t) :
            Std.RBNode.lowerBound? cut t none = some xp x
            theorem Std.RBNode.lowerBound?_mem_lb {α : Type u_1} {cut : αOrdering} {lb : Option α} {x : α} {t : Std.RBNode α} (h : Std.RBNode.lowerBound? cut t lb = some x) :
            x t x lb
            theorem Std.RBNode.lowerBound?_mem {α : Type u_1} {cut : αOrdering} {x : α} {t : Std.RBNode α} (h : Std.RBNode.lowerBound? cut t none = some x) :
            x t
            theorem Std.RBNode.lowerBound?_of_some {α : Type u_1} {cut : αOrdering} {y : α} {t : Std.RBNode α} :
            ∃ (x : α), Std.RBNode.lowerBound? cut t (some y) = some x
            theorem Std.RBNode.Ordered.lowerBound?_exists {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {t : Std.RBNode α} [Std.TransCmp cmp] [Std.RBNode.IsCut cmp cut] (h : Std.RBNode.Ordered cmp t) :
            (∃ (x : α), Std.RBNode.lowerBound? cut t none = some x) ∃ (x : α), x t cut x Ordering.lt
            theorem Std.RBNode.Ordered.lowerBound?_least_lb {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {t : Std.RBNode α} {lb : Option α} {x : α} {y : α} [Std.TransCmp cmp] [Std.RBNode.IsCut cmp cut] (h : Std.RBNode.Ordered cmp t) (hlb : ∀ {x : α}, lb = some xStd.RBNode.All (fun (x_1 : α) => Std.RBNode.cmpLT cmp x x_1) t) :
            Std.RBNode.lowerBound? cut t lb = some xy tcut x = Ordering.gtcmp x y = Ordering.ltcut y = Ordering.lt
            theorem Std.RBNode.Ordered.lowerBound?_least {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {t : Std.RBNode α} {x : α} {y : α} [Std.TransCmp cmp] [Std.RBNode.IsCut cmp cut] (ht : Std.RBNode.Ordered cmp t) (H : Std.RBNode.lowerBound? cut t none = some x) (hy : y t) (xy : cmp x y = Ordering.lt) (hx : cut x = Ordering.gt) :

            A statement of the least-ness of the result of lowerBound?. If x is the return value of lowerBound? and it is strictly less than the cut, then any other y > x in the tree is in fact strictly greater than the cut (so there is no exact match, and nothing closer to the cut).

            theorem Std.RBNode.Ordered.memP_iff_lowerBound? {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {t : Std.RBNode α} [Std.TransCmp cmp] [Std.RBNode.IsCut cmp cut] (ht : Std.RBNode.Ordered cmp t) :
            Std.RBNode.MemP cut t ∃ (x : α), Std.RBNode.lowerBound? cut t none = some x cut x = Ordering.eq
            theorem Std.RBNode.Ordered.lowerBound?_lt {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {t : Std.RBNode α} {x : α} {y : α} [Std.TransCmp cmp] [Std.RBNode.IsStrictCut cmp cut] (ht : Std.RBNode.Ordered cmp t) (H : Std.RBNode.lowerBound? cut t none = some x) (hy : y t) :
            cmp x y = Ordering.lt cut y = Ordering.lt

            A stronger version of lowerBound?_least that holds when the cut is strict.

            theorem Std.RBNode.foldr_cons {α : Type u_1} (t : Std.RBNode α) (l : List α) :
            Std.RBNode.foldr (fun (x : α) (x_1 : List α) => x :: x_1) t l = t.toList ++ l
            @[simp]
            theorem Std.RBNode.toList_nil {α : Type u_1} :
            Std.RBNode.nil.toList = []
            @[simp]
            theorem Std.RBNode.toList_node {α : Type u_1} {c : Std.RBColor} {a : Std.RBNode α} {x : α} {b : Std.RBNode α} :
            (Std.RBNode.node c a x b).toList = a.toList ++ x :: b.toList
            @[simp]
            theorem Std.RBNode.toList_reverse {α : Type u_1} (t : Std.RBNode α) :
            t.reverse.toList = t.toList.reverse
            @[simp]
            theorem Std.RBNode.mem_toList {α : Type u_1} {x : α} {t : Std.RBNode α} :
            x t.toList x t
            @[simp]
            theorem Std.RBNode.mem_reverse {α : Type u_1} {a : α} {t : Std.RBNode α} :
            a t.reverse a t
            theorem Std.RBNode.min?_eq_toList_head? {α : Type u_1} {t : Std.RBNode α} :
            t.min? = t.toList.head?
            theorem Std.RBNode.max?_eq_toList_getLast? {α : Type u_1} {t : Std.RBNode α} :
            t.max? = t.toList.getLast?
            theorem Std.RBNode.foldr_eq_foldr_toList {α : Type u_1} :
            ∀ {α_1 : Type u_2} {f : αα_1α_1} {init : α_1} {t : Std.RBNode α}, Std.RBNode.foldr f t init = List.foldr f init t.toList
            theorem Std.RBNode.foldl_eq_foldl_toList {α : Type u_1} :
            ∀ {α_1 : Type u_2} {f : α_1αα_1} {init : α_1} {t : Std.RBNode α}, Std.RBNode.foldl f init t = List.foldl f init t.toList
            theorem Std.RBNode.foldl_reverse {α : Type u_1} {β : Type u_2} {t : Std.RBNode α} {f : βαβ} {init : β} :
            Std.RBNode.foldl f init t.reverse = Std.RBNode.foldr (flip f) t init
            theorem Std.RBNode.foldr_reverse {α : Type u_1} {β : Type u_2} {t : Std.RBNode α} {f : αββ} {init : β} :
            Std.RBNode.foldr f t.reverse init = Std.RBNode.foldl (flip f) init t
            theorem Std.RBNode.forM_eq_forM_toList {m : Type u_1 → Type u_2} {α : Type u_3} {f : αm PUnit} [Monad m] [LawfulMonad m] {t : Std.RBNode α} :
            Std.RBNode.forM f t = t.toList.forM f
            theorem Std.RBNode.foldlM_eq_foldlM_toList {m : Type u_1 → Type u_2} {α : Type u_3} :
            ∀ {a : Type u_1} {f : aαm a} {init : a} [inst : Monad m] [inst_1 : LawfulMonad m] {t : Std.RBNode α}, Std.RBNode.foldlM f init t = List.foldlM f init t.toList
            theorem Std.RBNode.forIn_visit_eq_bindList {m : Type u_1 → Type u_2} {α : Type u_3} :
            ∀ {α_1 : Type u_1} {f : αα_1m (ForInStep α_1)} {init : α_1} [inst : Monad m] [inst_1 : LawfulMonad m] {t : Std.RBNode α}, Std.RBNode.forIn.visit f t init = ForInStep.bindList f t.toList (ForInStep.yield init)
            theorem Std.RBNode.forIn_eq_forIn_toList {m : Type u_1 → Type u_2} {α : Type u_3} :
            ∀ {α_1 : Type u_1} {init : α_1} {f : αα_1m (ForInStep α_1)} [inst : Monad m] [inst_1 : LawfulMonad m] {t : Std.RBNode α}, forIn t init f = forIn t.toList init f
            theorem Std.RBNode.Stream.foldr_cons {α : Type u_1} (t : Std.RBNode.Stream α) (l : List α) :
            Std.RBNode.Stream.foldr (fun (x : α) (x_1 : List α) => x :: x_1) t l = t.toList ++ l
            @[simp]
            theorem Std.RBNode.Stream.toList_nil {α : Type u_1} :
            Std.RBNode.Stream.nil.toList = []
            @[simp]
            theorem Std.RBNode.Stream.toList_cons {α : Type u_1} {x : α} {r : Std.RBNode α} {s : Std.RBNode.Stream α} :
            (Std.RBNode.Stream.cons x r s).toList = x :: r.toList ++ s.toList
            theorem Std.RBNode.Stream.foldr_eq_foldr_toList {α : Type u_1} :
            ∀ {α_1 : Type u_2} {f : αα_1α_1} {init : α_1} {s : Std.RBNode.Stream α}, Std.RBNode.Stream.foldr f s init = List.foldr f init s.toList
            theorem Std.RBNode.Stream.foldl_eq_foldl_toList {α : Type u_1} :
            ∀ {α_1 : Type u_2} {f : α_1αα_1} {init : α_1} {t : Std.RBNode.Stream α}, Std.RBNode.Stream.foldl f init t = List.foldl f init t.toList
            theorem Std.RBNode.Stream.forIn_eq_forIn_toList {m : Type u_1 → Type u_2} {α : Type u_3} :
            ∀ {α_1 : Type u_1} {init : α_1} {f : αα_1m (ForInStep α_1)} [inst : Monad m] [inst_1 : LawfulMonad m] {t : Std.RBNode α}, forIn t init f = forIn t.toList init f
            theorem Std.RBNode.toStream_toList' {α : Type u_1} {t : Std.RBNode α} {s : Std.RBNode.Stream α} :
            (t.toStream s).toList = t.toList ++ s.toList
            @[simp]
            theorem Std.RBNode.toStream_toList {α : Type u_1} {t : Std.RBNode α} :
            t.toStream.toList = t.toList
            theorem Std.RBNode.Stream.next?_toList {α : Type u_1} {s : Std.RBNode.Stream α} :
            Option.map (fun (x : α × Std.RBNode.Stream α) => match x with | (a, b) => (a, b.toList)) s.next? = s.toList.next?
            theorem Std.RBNode.ordered_iff {α : Type u_1} {cmp : ααOrdering} {t : Std.RBNode α} :
            theorem Std.RBNode.Ordered.toList_sorted {α : Type u_1} {cmp : ααOrdering} {t : Std.RBNode α} :
            theorem Std.RBNode.min?_mem {α : Type u_1} {a : α} {t : Std.RBNode α} (h : t.min? = some a) :
            a t
            theorem Std.RBNode.Ordered.min?_le {α : Type u_1} {cmp : ααOrdering} {a : α} {t : Std.RBNode α} [Std.TransCmp cmp] (ht : Std.RBNode.Ordered cmp t) (h : t.min? = some a) (x : α) (hx : x t) :
            theorem Std.RBNode.max?_mem {α : Type u_1} {a : α} {t : Std.RBNode α} (h : t.max? = some a) :
            a t
            theorem Std.RBNode.Ordered.le_max? {α : Type u_1} {cmp : ααOrdering} {a : α} {t : Std.RBNode α} [Std.TransCmp cmp] (ht : Std.RBNode.Ordered cmp t) (h : t.max? = some a) (x : α) (hx : x t) :
            @[simp]
            theorem Std.RBNode.setBlack_toList {α : Type u_1} {t : Std.RBNode α} :
            t.setBlack.toList = t.toList
            @[simp]
            theorem Std.RBNode.setRed_toList {α : Type u_1} {t : Std.RBNode α} :
            t.setRed.toList = t.toList
            @[simp]
            theorem Std.RBNode.balance1_toList {α : Type u_1} {l : Std.RBNode α} {v : α} {r : Std.RBNode α} :
            (l.balance1 v r).toList = l.toList ++ v :: r.toList
            @[simp]
            theorem Std.RBNode.balance2_toList {α : Type u_1} {l : Std.RBNode α} {v : α} {r : Std.RBNode α} :
            (l.balance2 v r).toList = l.toList ++ v :: r.toList
            @[simp]
            theorem Std.RBNode.balLeft_toList {α : Type u_1} {l : Std.RBNode α} {v : α} {r : Std.RBNode α} :
            (l.balLeft v r).toList = l.toList ++ v :: r.toList
            @[simp]
            theorem Std.RBNode.balRight_toList {α : Type u_1} {l : Std.RBNode α} {v : α} {r : Std.RBNode α} :
            (l.balRight v r).toList = l.toList ++ v :: r.toList
            theorem Std.RBNode.size_eq {α : Type u_1} {t : Std.RBNode α} :
            t.size = t.toList.length
            @[simp]
            theorem Std.RBNode.reverse_size {α : Type u_1} (t : Std.RBNode α) :
            t.reverse.size = t.size
            @[simp]
            theorem Std.RBNode.find?_reverse {α : Type u_1} (t : Std.RBNode α) (cut : αOrdering) :
            Std.RBNode.find? cut t.reverse = Std.RBNode.find? (fun (x : α) => (cut x).swap) t
            def Std.RBNode.setRoot {α : Type u_1} (v : α) :

            Auxiliary definition for zoom_ins: set the root of the tree to v, creating a node if necessary.

            Equations
            Instances For
              def Std.RBNode.delRoot {α : Type u_1} :

              Auxiliary definition for zoom_ins: set the root of the tree to v, creating a node if necessary.

              Equations
              • x.delRoot = match x with | Std.RBNode.nil => Std.RBNode.nil | Std.RBNode.node c a v b => a.append b
              Instances For

                The list of elements to the left of the hole. (This function is intended for specification purposes only.)

                Equations
                Instances For

                  The list of elements to the right of the hole. (This function is intended for specification purposes only.)

                  Equations
                  Instances For
                    @[reducible, inline]
                    abbrev Std.RBNode.Path.withList {α : Type u_1} (p : Std.RBNode.Path α) (l : List α) :
                    List α

                    Wraps a list of elements with the left and right elements of the path.

                    Equations
                    • p.withList l = p.listL ++ l ++ p.listR
                    Instances For
                      theorem Std.RBNode.Path.rootOrdered_iff {α : Type u_1} {cmp : ααOrdering} {v : α} {p : Std.RBNode.Path α} (hp : Std.RBNode.Path.Ordered cmp p) :
                      Std.RBNode.Path.RootOrdered cmp p v (∀ (a : α), a p.listLStd.RBNode.cmpLT cmp a v) ∀ (a : α), a p.listRStd.RBNode.cmpLT cmp v a
                      theorem Std.RBNode.Path.ordered_iff {α : Type u_1} {cmp : ααOrdering} {p : Std.RBNode.Path α} :
                      Std.RBNode.Path.Ordered cmp p List.Pairwise (Std.RBNode.cmpLT cmp) p.listL List.Pairwise (Std.RBNode.cmpLT cmp) p.listR ∀ (x : α), x p.listL∀ (y : α), y p.listRStd.RBNode.cmpLT cmp x y
                      theorem Std.RBNode.Path.zoom_zoomed₁ :
                      ∀ {α : Type u_1} {cut : αOrdering} {t : Std.RBNode α} {path : Std.RBNode.Path α} {t' : Std.RBNode α} {path' : Std.RBNode.Path α}, Std.RBNode.zoom cut t path = (t', path')Std.RBNode.OnRoot (fun (x : α) => cut x = Ordering.eq) t'
                      @[simp]
                      theorem Std.RBNode.Path.fill_toList {α : Type u_1} {t : Std.RBNode α} {p : Std.RBNode.Path α} :
                      (p.fill t).toList = p.withList t.toList
                      theorem Std.RBNode.zoom_toList {α : Type u_1} {cut : αOrdering} {t' : Std.RBNode α} {p' : Std.RBNode.Path α} {t : Std.RBNode α} (eq : Std.RBNode.zoom cut t = (t', p')) :
                      p'.withList t'.toList = t.toList
                      @[simp]
                      theorem Std.RBNode.Path.ins_toList {α : Type u_1} {t : Std.RBNode α} {p : Std.RBNode.Path α} :
                      (p.ins t).toList = p.withList t.toList
                      @[simp]
                      theorem Std.RBNode.Path.insertNew_toList {α : Type u_1} {v : α} {p : Std.RBNode.Path α} :
                      (p.insertNew v).toList = p.withList [v]
                      theorem Std.RBNode.Path.insert_toList {α : Type u_1} {t : Std.RBNode α} {v : α} {p : Std.RBNode.Path α} :
                      (p.insert t v).toList = p.withList (Std.RBNode.setRoot v t).toList
                      theorem Std.RBNode.Path.Balanced.insert {α : Type u_1} {c₀ : Std.RBColor} {n₀ : Nat} {c : Std.RBColor} {n : Nat} {t : Std.RBNode α} {v : α} {path : Std.RBNode.Path α} (hp : Std.RBNode.Path.Balanced c₀ n₀ path c n) :
                      t.Balanced c n∃ (c : Std.RBColor), ∃ (n : Nat), (path.insert t v).Balanced c n
                      theorem Std.RBNode.Path.Ordered.insert {α : Type u_1} {cmp : ααOrdering} {v : α} {path : Std.RBNode.Path α} {t : Std.RBNode α} :
                      theorem Std.RBNode.Path.Ordered.erase {α : Type u_1} {cmp : ααOrdering} {path : Std.RBNode.Path α} {t : Std.RBNode α} :
                      theorem Std.RBNode.Path.zoom_ins {α : Type u_1} {v : α} {path : Std.RBNode.Path α} {t' : Std.RBNode α} {path' : Std.RBNode.Path α} {t : Std.RBNode α} {cmp : ααOrdering} :
                      Std.RBNode.zoom (cmp v) t path = (t', path')path.ins (Std.RBNode.ins cmp v t) = path'.ins (Std.RBNode.setRoot v t')
                      theorem Std.RBNode.Path.insertNew_eq_insert :
                      ∀ {α : Type u_1} {cmp : ααOrdering} {t : Std.RBNode α} {path : Std.RBNode.Path α} {v : α}, Std.RBNode.zoom (cmp v) t = (Std.RBNode.nil, path)path.insertNew v = (Std.RBNode.insert cmp t v).setBlack
                      theorem Std.RBNode.Path.ins_eq_fill {α : Type u_1} {c₀ : Std.RBColor} {n₀ : Nat} {c : Std.RBColor} {n : Nat} {path : Std.RBNode.Path α} {t : Std.RBNode α} :
                      Std.RBNode.Path.Balanced c₀ n₀ path c nt.Balanced c npath.ins t = (path.fill t).setBlack
                      theorem Std.RBNode.Path.zoom_insert {α : Type u_1} {c : Std.RBColor} {n : Nat} {cmp : ααOrdering} {t' : Std.RBNode α} {v : α} {path : Std.RBNode.Path α} {t : Std.RBNode α} (ht : t.Balanced c n) (H : Std.RBNode.zoom (cmp v) t = (t', path)) :
                      (path.insert t' v).setBlack = (Std.RBNode.insert cmp t v).setBlack
                      theorem Std.RBNode.Path.zoom_del {α : Type u_1} {cut : αOrdering} {path : Std.RBNode.Path α} {t' : Std.RBNode α} {path' : Std.RBNode.Path α} {t : Std.RBNode α} :
                      Std.RBNode.zoom cut t path = (t', path')path.del (Std.RBNode.del cut t) (match t with | Std.RBNode.node c l v r => c | x => Std.RBColor.red) = path'.del t'.delRoot (match t' with | Std.RBNode.node c l v r => c | x => Std.RBColor.red)
                      def Std.RBNode.Path.AllL {α : Type u_1} (p : αProp) :

                      Asserts that p holds on all elements to the left of the hole.

                      Equations
                      Instances For
                        def Std.RBNode.Path.AllR {α : Type u_1} (p : αProp) :

                        Asserts that p holds on all elements to the right of the hole.

                        Equations
                        Instances For
                          theorem Std.RBNode.insert_toList_zoom {α : Type u_1} {c : Std.RBColor} {n : Nat} {cmp : ααOrdering} {t' : Std.RBNode α} {p : Std.RBNode.Path α} {v : α} {t : Std.RBNode α} (ht : t.Balanced c n) (e : Std.RBNode.zoom (cmp v) t = (t', p)) :
                          (Std.RBNode.insert cmp t v).toList = p.withList (Std.RBNode.setRoot v t').toList
                          theorem Std.RBNode.insert_toList_zoom_nil {α : Type u_1} {c : Std.RBColor} {n : Nat} {cmp : ααOrdering} {p : Std.RBNode.Path α} {v : α} {t : Std.RBNode α} (ht : t.Balanced c n) (e : Std.RBNode.zoom (cmp v) t = (Std.RBNode.nil, p)) :
                          (Std.RBNode.insert cmp t v).toList = p.withList [v]
                          theorem Std.RBNode.exists_insert_toList_zoom_nil {α : Type u_1} {c : Std.RBColor} {n : Nat} {cmp : ααOrdering} {p : Std.RBNode.Path α} {v : α} {t : Std.RBNode α} (ht : t.Balanced c n) (e : Std.RBNode.zoom (cmp v) t = (Std.RBNode.nil, p)) :
                          ∃ (L : List α), ∃ (R : List α), t.toList = L ++ R (Std.RBNode.insert cmp t v).toList = L ++ v :: R
                          theorem Std.RBNode.insert_toList_zoom_node {α : Type u_1} {c : Std.RBColor} {n : Nat} {cmp : ααOrdering} {c' : Std.RBColor} {l : Std.RBNode α} {v' : α} {r : Std.RBNode α} {p : Std.RBNode.Path α} {v : α} {t : Std.RBNode α} (ht : t.Balanced c n) (e : Std.RBNode.zoom (cmp v) t = (Std.RBNode.node c' l v' r, p)) :
                          (Std.RBNode.insert cmp t v).toList = p.withList (Std.RBNode.node c l v r).toList
                          theorem Std.RBNode.exists_insert_toList_zoom_node {α : Type u_1} {c : Std.RBColor} {n : Nat} {cmp : ααOrdering} {c' : Std.RBColor} {l : Std.RBNode α} {v' : α} {r : Std.RBNode α} {p : Std.RBNode.Path α} {v : α} {t : Std.RBNode α} (ht : t.Balanced c n) (e : Std.RBNode.zoom (cmp v) t = (Std.RBNode.node c' l v' r, p)) :
                          ∃ (L : List α), ∃ (R : List α), t.toList = L ++ v' :: R (Std.RBNode.insert cmp t v).toList = L ++ v :: R
                          theorem Std.RBNode.mem_insert_self {α : Type u_1} {c : Std.RBColor} {n : Nat} {v : α} {cmp : ααOrdering} {t : Std.RBNode α} (ht : t.Balanced c n) :
                          theorem Std.RBNode.mem_insert_of_mem {α : Type u_1} {c : Std.RBColor} {n : Nat} {v' : α} {cmp : ααOrdering} {v : α} {t : Std.RBNode α} (ht : t.Balanced c n) (h : v' t) :
                          v' Std.RBNode.insert cmp t v cmp v v' = Ordering.eq
                          theorem Std.RBNode.exists_find?_insert_self {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {c : Std.RBColor} {n : Nat} {v : α} [Std.TransCmp cmp] [Std.RBNode.IsCut cmp cut] {t : Std.RBNode α} (ht : t.Balanced c n) (ht₂ : Std.RBNode.Ordered cmp t) (hv : cut v = Ordering.eq) :
                          ∃ (x : α), Std.RBNode.find? cut (Std.RBNode.insert cmp t v) = some x
                          theorem Std.RBNode.find?_insert_self {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {c : Std.RBColor} {n : Nat} {v : α} [Std.TransCmp cmp] [Std.RBNode.IsStrictCut cmp cut] {t : Std.RBNode α} (ht : t.Balanced c n) (ht₂ : Std.RBNode.Ordered cmp t) (hv : cut v = Ordering.eq) :
                          theorem Std.RBNode.mem_insert {α : Type u_1} {cmp : ααOrdering} {c : Std.RBColor} {n : Nat} {v' : α} {v : α} [Std.TransCmp cmp] {t : Std.RBNode α} (ht : t.Balanced c n) (ht₂ : Std.RBNode.Ordered cmp t) :
                          v' Std.RBNode.insert cmp t v v' t Std.RBNode.find? (cmp v) t some v' v' = v
                          @[simp]
                          theorem Std.RBSet.val_toList {α : Type u_1} {cmp : ααOrdering} {t : Std.RBSet α cmp} :
                          t.val.toList = t.toList
                          @[simp]
                          theorem Std.RBSet.mkRBSet_eq {α : Type u_1} {cmp : ααOrdering} :
                          @[simp]
                          theorem Std.RBSet.empty_eq {α : Type u_1} {cmp : ααOrdering} :
                          Std.RBSet.empty =
                          @[simp]
                          theorem Std.RBSet.default_eq {α : Type u_1} {cmp : ααOrdering} :
                          default =
                          @[simp]
                          theorem Std.RBSet.empty_toList {α : Type u_1} {cmp : ααOrdering} :
                          .toList = []
                          @[simp]
                          theorem Std.RBSet.single_toList {α : Type u_1} {cmp : ααOrdering} {a : α} :
                          (Std.RBSet.single a).toList = [a]
                          theorem Std.RBSet.mem_toList {α : Type u_1} {cmp : ααOrdering} {x : α} {t : Std.RBSet α cmp} :
                          x t.toList x t.val
                          theorem Std.RBSet.mem_congr {α : Type u_1} {cmp : ααOrdering} {x : α} {y : α} [Std.TransCmp cmp] {t : Std.RBSet α cmp} (h : cmp x y = Ordering.eq) :
                          x t y t
                          theorem Std.RBSet.mem_iff_mem_toList {α : Type u_1} {cmp : ααOrdering} {x : α} {t : Std.RBSet α cmp} :
                          x t ∃ (y : α), y t.toList cmp x y = Ordering.eq
                          theorem Std.RBSet.mem_of_mem_toList {α : Type u_1} {cmp : ααOrdering} {x : α} [Std.OrientedCmp cmp] {t : Std.RBSet α cmp} (h : x t.toList) :
                          x t
                          theorem Std.RBSet.foldl_eq_foldl_toList {α : Type u_1} {cmp : ααOrdering} :
                          ∀ {α_1 : Type u_2} {f : α_1αα_1} {init : α_1} {t : Std.RBSet α cmp}, Std.RBSet.foldl f init t = List.foldl f init t.toList
                          theorem Std.RBSet.foldr_eq_foldr_toList {α : Type u_1} {cmp : ααOrdering} :
                          ∀ {α_1 : Type u_2} {f : αα_1α_1} {init : α_1} {t : Std.RBSet α cmp}, Std.RBSet.foldr f init t = List.foldr f init t.toList
                          theorem Std.RBSet.foldlM_eq_foldlM_toList {m : Type u_1 → Type u_2} {α : Type u_3} {cmp : ααOrdering} :
                          ∀ {a : Type u_1} {f : aαm a} {init : a} [inst : Monad m] [inst_1 : LawfulMonad m] {t : Std.RBSet α cmp}, Std.RBSet.foldlM f init t = List.foldlM f init t.toList
                          theorem Std.RBSet.forM_eq_forM_toList {m : Type u_1 → Type u_2} {α : Type u_3} {cmp : ααOrdering} {f : αm PUnit} [Monad m] [LawfulMonad m] {t : Std.RBSet α cmp} :
                          Std.RBSet.forM f t = t.toList.forM f
                          theorem Std.RBSet.forIn_eq_forIn_toList {m : Type u_1 → Type u_2} {α : Type u_3} {cmp : ααOrdering} :
                          ∀ {α_1 : Type u_1} {init : α_1} {f : αα_1m (ForInStep α_1)} [inst : Monad m] [inst_1 : LawfulMonad m] {t : Std.RBSet α cmp}, forIn t init f = forIn t.toList init f
                          theorem Std.RBSet.toStream_eq {α : Type u_1} {cmp : ααOrdering} {t : Std.RBSet α cmp} :
                          toStream t = t.val.toStream
                          @[simp]
                          theorem Std.RBSet.toStream_toList {α : Type u_1} {cmp : ααOrdering} {t : Std.RBSet α cmp} :
                          (toStream t).toList = t.toList
                          theorem Std.RBSet.isEmpty_iff_toList_eq_nil {α : Type u_1} {cmp : ααOrdering} {t : Std.RBSet α cmp} :
                          t.isEmpty = true t.toList = []
                          theorem Std.RBSet.toList_sorted {α : Type u_1} {cmp : ααOrdering} {t : Std.RBSet α cmp} :
                          theorem Std.RBSet.findP?_some_eq_eq {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {y : α} {t : Std.RBSet α cmp} :
                          t.findP? cut = some ycut y = Ordering.eq
                          theorem Std.RBSet.find?_some_eq_eq {α : Type u_1} {cmp : ααOrdering} {x : α} {y : α} {t : Std.RBSet α cmp} :
                          t.find? x = some ycmp x y = Ordering.eq
                          theorem Std.RBSet.findP?_some_mem_toList {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {y : α} {t : Std.RBSet α cmp} (h : t.findP? cut = some y) :
                          y t.toList
                          theorem Std.RBSet.find?_some_mem_toList {α : Type u_1} {cmp : ααOrdering} {x : α} {y : α} {t : Std.RBSet α cmp} (h : t.find? x = some y) :
                          y t.toList
                          theorem Std.RBSet.findP?_some_memP {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {y : α} {t : Std.RBSet α cmp} (h : t.findP? cut = some y) :
                          theorem Std.RBSet.find?_some_mem {α : Type u_1} {cmp : ααOrdering} {x : α} {y : α} {t : Std.RBSet α cmp} (h : t.find? x = some y) :
                          x t
                          theorem Std.RBSet.mem_toList_unique {α : Type u_1} {cmp : ααOrdering} {x : α} {y : α} [Std.TransCmp cmp] {t : Std.RBSet α cmp} (hx : x t.toList) (hy : y t.toList) (e : cmp x y = Ordering.eq) :
                          x = y
                          theorem Std.RBSet.findP?_some {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {y : α} [Std.TransCmp cmp] [Std.RBNode.IsStrictCut cmp cut] {t : Std.RBSet α cmp} :
                          t.findP? cut = some y y t.toList cut y = Ordering.eq
                          theorem Std.RBSet.find?_some {α : Type u_1} {cmp : ααOrdering} {x : α} {y : α} [Std.TransCmp cmp] {t : Std.RBSet α cmp} :
                          t.find? x = some y y t.toList cmp x y = Ordering.eq
                          theorem Std.RBSet.memP_iff_findP? {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} [Std.TransCmp cmp] [Std.RBNode.IsCut cmp cut] {t : Std.RBSet α cmp} :
                          Std.RBSet.MemP cut t ∃ (y : α), t.findP? cut = some y
                          theorem Std.RBSet.mem_iff_find? {α : Type u_1} {cmp : ααOrdering} {x : α} [Std.TransCmp cmp] {t : Std.RBSet α cmp} :
                          x t ∃ (y : α), t.find? x = some y
                          @[simp]
                          theorem Std.RBSet.contains_iff {α : Type u_1} {cmp : ααOrdering} {x : α} [Std.TransCmp cmp] {t : Std.RBSet α cmp} :
                          t.contains x = true x t
                          instance Std.RBSet.instDecidableMemOfTransCmp {α : Type u_1} {cmp : ααOrdering} {x : α} [Std.TransCmp cmp] {t : Std.RBSet α cmp} :
                          Equations
                          theorem Std.RBSet.size_eq {α : Type u_1} {cmp : ααOrdering} (t : Std.RBSet α cmp) :
                          t.size = t.toList.length
                          theorem Std.RBSet.mem_toList_insert_self {α : Type u_1} {cmp : ααOrdering} (v : α) (t : Std.RBSet α cmp) :
                          v (t.insert v).toList
                          theorem Std.RBSet.mem_insert_self {α : Type u_1} {cmp : ααOrdering} [Std.OrientedCmp cmp] (v : α) (t : Std.RBSet α cmp) :
                          v t.insert v
                          theorem Std.RBSet.mem_insert_of_eq {α : Type u_1} {cmp : ααOrdering} {v : α} {v' : α} [Std.TransCmp cmp] (t : Std.RBSet α cmp) (h : cmp v v' = Ordering.eq) :
                          v' t.insert v
                          theorem Std.RBSet.mem_toList_insert_of_mem {α : Type u_1} {cmp : ααOrdering} {v' : α} (v : α) {t : Std.RBSet α cmp} (h : v' t.toList) :
                          v' (t.insert v).toList cmp v v' = Ordering.eq
                          theorem Std.RBSet.mem_insert_of_mem_toList {α : Type u_1} {cmp : ααOrdering} {v' : α} [Std.OrientedCmp cmp] (v : α) {t : Std.RBSet α cmp} (h : v' t.toList) :
                          v' t.insert v
                          theorem Std.RBSet.mem_insert_of_mem {α : Type u_1} {cmp : ααOrdering} {v' : α} [Std.TransCmp cmp] (v : α) {t : Std.RBSet α cmp} (h : v' t) :
                          v' t.insert v
                          theorem Std.RBSet.mem_toList_insert {α : Type u_1} {cmp : ααOrdering} {v' : α} {v : α} [Std.TransCmp cmp] {t : Std.RBSet α cmp} :
                          v' (t.insert v).toList v' t.toList t.find? v some v' v' = v
                          theorem Std.RBSet.mem_insert {α : Type u_1} {cmp : ααOrdering} {v' : α} {v : α} [Std.TransCmp cmp] {t : Std.RBSet α cmp} :
                          v' t.insert v v' t cmp v v' = Ordering.eq
                          theorem Std.RBSet.find?_congr {α : Type u_1} {cmp : ααOrdering} {v₁ : α} {v₂ : α} [Std.TransCmp cmp] (t : Std.RBSet α cmp) (h : cmp v₁ v₂ = Ordering.eq) :
                          t.find? v₁ = t.find? v₂
                          theorem Std.RBSet.findP?_insert_of_eq {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {v : α} [Std.TransCmp cmp] [Std.RBNode.IsStrictCut cmp cut] (t : Std.RBSet α cmp) (h : cut v = Ordering.eq) :
                          (t.insert v).findP? cut = some v
                          theorem Std.RBSet.find?_insert_of_eq {α : Type u_1} {cmp : ααOrdering} {v' : α} {v : α} [Std.TransCmp cmp] (t : Std.RBSet α cmp) (h : cmp v' v = Ordering.eq) :
                          (t.insert v).find? v' = some v
                          theorem Std.RBSet.findP?_insert_of_ne {α : Type u_1} {cmp : ααOrdering} {cut : αOrdering} {v : α} [Std.TransCmp cmp] [Std.RBNode.IsStrictCut cmp cut] (t : Std.RBSet α cmp) (h : cut v Ordering.eq) :
                          (t.insert v).findP? cut = t.findP? cut
                          theorem Std.RBSet.find?_insert_of_ne {α : Type u_1} {cmp : ααOrdering} {v' : α} {v : α} [Std.TransCmp cmp] (t : Std.RBSet α cmp) (h : cmp v' v Ordering.eq) :
                          (t.insert v).find? v' = t.find? v'
                          theorem Std.RBSet.findP?_insert {α : Type u_1} {cmp : ααOrdering} [Std.TransCmp cmp] (t : Std.RBSet α cmp) (v : α) (cut : αOrdering) [Std.RBNode.IsStrictCut cmp cut] :
                          (t.insert v).findP? cut = if cut v = Ordering.eq then some v else t.findP? cut
                          theorem Std.RBSet.find?_insert {α : Type u_1} {cmp : ααOrdering} [Std.TransCmp cmp] (t : Std.RBSet α cmp) (v : α) (v' : α) :
                          (t.insert v).find? v' = if cmp v' v = Ordering.eq then some v else t.find? v'