Theorem: Std.RBNode.Path.ordered_iff
File: Std/Data/RBMap/Lemmas.lean

tactic: induction p with
| root => simp
| left _ _ x _ ih | right _ _ x _ ih => ?_
state_before: α : Type u_1
cmp : α → α → Ordering
p : Path α
⊢ Ordered cmp p ↔
    List.Pairwise (cmpLT cmp) (listL p) ∧
      List.Pairwise (cmpLT cmp) (listR p) ∧ ∀ (x : α), x ∈ listL p → ∀ (y : α), y ∈ listR p → cmpLT cmp x y

tactic: all_goals
  rw [Ordered, and_congr_right_eq fun h => by simp [All_def, rootOrdered_iff h]; rfl]
  simp [List.pairwise_append, or_imp, forall_and, ih, RBNode.ordered_iff]
state_before: case left
α : Type u_1
cmp : α → α → Ordering
c✝ : RBColor
parent✝ : Path α
x : α
r✝ : RBNode α
ih :
  Ordered cmp parent✝ ↔
    List.Pairwise (cmpLT cmp) (listL parent✝) ∧
      List.Pairwise (cmpLT cmp) (listR parent✝) ∧
        ∀ (x : α), x ∈ listL parent✝ → ∀ (y : α), y ∈ listR parent✝ → cmpLT cmp x y
⊢ Ordered cmp (left c✝ parent✝ x r✝) ↔
    List.Pairwise (cmpLT cmp) (listL (left c✝ parent✝ x r✝)) ∧
      List.Pairwise (cmpLT cmp) (listR (left c✝ parent✝ x r✝)) ∧
        ∀ (x_1 : α), x_1 ∈ listL (left c✝ parent✝ x r✝) → ∀ (y : α), y ∈ listR (left c✝ parent✝ x r✝) → cmpLT cmp x_1 y

case right
α : Type u_1
cmp : α → α → Ordering
c✝ : RBColor
l✝ : RBNode α
x : α
parent✝ : Path α
ih :
  Ordered cmp parent✝ ↔
    List.Pairwise (cmpLT cmp) (listL parent✝) ∧
      List.Pairwise (cmpLT cmp) (listR parent✝) ∧
        ∀ (x : α), x ∈ listL parent✝ → ∀ (y : α), y ∈ listR parent✝ → cmpLT cmp x y
⊢ Ordered cmp (right c✝ l✝ x parent✝) ↔
    List.Pairwise (cmpLT cmp) (listL (right c✝ l✝ x parent✝)) ∧
      List.Pairwise (cmpLT cmp) (listR (right c✝ l✝ x parent✝)) ∧
        ∀ (x_1 : α),
          x_1 ∈ listL (right c✝ l✝ x parent✝) → ∀ (y : α), y ∈ listR (right c✝ l✝ x parent✝) → cmpLT cmp x_1 y

tactic: simp
state_before: case root
α : Type u_1
cmp : α → α → Ordering
⊢ Ordered cmp root ↔
    List.Pairwise (cmpLT cmp) (listL root) ∧
      List.Pairwise (cmpLT cmp) (listR root) ∧ ∀ (x : α), x ∈ listL root → ∀ (y : α), y ∈ listR root → cmpLT cmp x y

tactic: rw [Ordered, and_congr_right_eq fun h => by simp [All_def, rootOrdered_iff h]; rfl]
state_before: case right
α : Type u_1
cmp : α → α → Ordering
c✝ : RBColor
l✝ : RBNode α
x : α
parent✝ : Path α
ih :
  Ordered cmp parent✝ ↔
    List.Pairwise (cmpLT cmp) (listL parent✝) ∧
      List.Pairwise (cmpLT cmp) (listR parent✝) ∧
        ∀ (x : α), x ∈ listL parent✝ → ∀ (y : α), y ∈ listR parent✝ → cmpLT cmp x y
⊢ Ordered cmp (right c✝ l✝ x parent✝) ↔
    List.Pairwise (cmpLT cmp) (listL (right c✝ l✝ x parent✝)) ∧
      List.Pairwise (cmpLT cmp) (listR (right c✝ l✝ x parent✝)) ∧
        ∀ (x_1 : α),
          x_1 ∈ listL (right c✝ l✝ x parent✝) → ∀ (y : α), y ∈ listR (right c✝ l✝ x parent✝) → cmpLT cmp x_1 y

tactic: simp [List.pairwise_append, or_imp, forall_and, ih, RBNode.ordered_iff]
state_before: case right
α : Type u_1
cmp : α → α → Ordering
c✝ : RBColor
l✝ : RBNode α
x : α
parent✝ : Path α
ih :
  Ordered cmp parent✝ ↔
    List.Pairwise (cmpLT cmp) (listL parent✝) ∧
      List.Pairwise (cmpLT cmp) (listR parent✝) ∧
        ∀ (x : α), x ∈ listL parent✝ → ∀ (y : α), y ∈ listR parent✝ → cmpLT cmp x y
⊢ Ordered cmp parent✝ ∧
      (∀ (x_1 : α), x_1 ∈ l✝ → cmpLT cmp x_1 x) ∧
        ((∀ (a : α), a ∈ listL parent✝ → cmpLT cmp a x) ∧ ∀ (a : α), a ∈ listR parent✝ → cmpLT cmp x a) ∧
          (∀ (x : α),
              x ∈ l✝ → (∀ (a : α), a ∈ listL parent✝ → cmpLT cmp a x) ∧ ∀ (a : α), a ∈ listR parent✝ → cmpLT cmp x a) ∧
            RBNode.Ordered cmp l✝ ↔
    List.Pairwise (cmpLT cmp) (listL (right c✝ l✝ x parent✝)) ∧
      List.Pairwise (cmpLT cmp) (listR (right c✝ l✝ x parent✝)) ∧
        ∀ (x_1 : α),
          x_1 ∈ listL (right c✝ l✝ x parent✝) → ∀ (y : α), y ∈ listR (right c✝ l✝ x parent✝) → cmpLT cmp x_1 y

tactic: simp [All_def, rootOrdered_iff h]
state_before: α : Type u_1
cmp : α → α → Ordering
c✝ : RBColor
l✝ : RBNode α
x : α
parent✝ : Path α
ih :
  Ordered cmp parent✝ ↔
    List.Pairwise (cmpLT cmp) (listL parent✝) ∧
      List.Pairwise (cmpLT cmp) (listR parent✝) ∧
        ∀ (x : α), x ∈ listL parent✝ → ∀ (y : α), y ∈ listR parent✝ → cmpLT cmp x y
h : Ordered cmp parent✝
⊢ (All (fun x_1 => cmpLT cmp x_1 x) l✝ ∧
      RootOrdered cmp parent✝ x ∧ All (RootOrdered cmp parent✝) l✝ ∧ RBNode.Ordered cmp l✝) =
    ?m.92891

tactic: rfl
state_before: α : Type u_1
cmp : α → α → Ordering
c✝ : RBColor
l✝ : RBNode α
x : α
parent✝ : Path α
ih :
  Ordered cmp parent✝ ↔
    List.Pairwise (cmpLT cmp) (listL parent✝) ∧
      List.Pairwise (cmpLT cmp) (listR parent✝) ∧
        ∀ (x : α), x ∈ listL parent✝ → ∀ (y : α), y ∈ listR parent✝ → cmpLT cmp x y
h : Ordered cmp parent✝
⊢ (∀ (x_1 : α), x_1 ∈ l✝ → cmpLT cmp x_1 x) ∧
      ((∀ (a : α), a ∈ listL parent✝ → cmpLT cmp a x) ∧ ∀ (a : α), a ∈ listR parent✝ → cmpLT cmp x a) ∧
        (∀ (x : α),
            x ∈ l✝ → (∀ (a : α), a ∈ listL parent✝ → cmpLT cmp a x) ∧ ∀ (a : α), a ∈ listR parent✝ → cmpLT cmp x a) ∧
          RBNode.Ordered cmp l✝ ↔
    ?m.92891

tactic: exact ⟨
  fun ⟨⟨hL, hR, LR⟩, xr, ⟨Lx, xR⟩, ⟨rL, rR⟩, hr⟩ =>
    ⟨hL, ⟨⟨xr, xR⟩, hr, hR, rR⟩, Lx, fun _ ha _ hb => rL _ hb _ ha, LR⟩,
  fun ⟨hL, ⟨⟨xr, xR⟩, hr, hR, rR⟩, Lx, Lr, LR⟩ =>
    ⟨⟨hL, hR, LR⟩, xr, ⟨Lx, xR⟩, ⟨fun _ ha _ hb => Lr _ hb _ ha, rR⟩, hr⟩⟩
state_before: case left
α : Type u_1
cmp : α → α → Ordering
c✝ : RBColor
parent✝ : Path α
x : α
r✝ : RBNode α
ih :
  Ordered cmp parent✝ ↔
    List.Pairwise (cmpLT cmp) (listL parent✝) ∧
      List.Pairwise (cmpLT cmp) (listR parent✝) ∧
        ∀ (x : α), x ∈ listL parent✝ → ∀ (y : α), y ∈ listR parent✝ → cmpLT cmp x y
⊢ (List.Pairwise (cmpLT cmp) (listL parent✝) ∧
        List.Pairwise (cmpLT cmp) (listR parent✝) ∧
          ∀ (x : α), x ∈ listL parent✝ → ∀ (y : α), y ∈ listR parent✝ → cmpLT cmp x y) ∧
      (∀ (x_1 : α), x_1 ∈ r✝ → cmpLT cmp x x_1) ∧
        ((∀ (a : α), a ∈ listL parent✝ → cmpLT cmp a x) ∧ ∀ (a : α), a ∈ listR parent✝ → cmpLT cmp x a) ∧
          ((∀ (x : α), x ∈ r✝ → ∀ (a : α), a ∈ listL parent✝ → cmpLT cmp a x) ∧
              ∀ (x : α), x ∈ r✝ → ∀ (a : α), a ∈ listR parent✝ → cmpLT cmp x a) ∧
            List.Pairwise (cmpLT cmp) (toList r✝) ↔
    List.Pairwise (cmpLT cmp) (listL parent✝) ∧
      (((∀ (x_1 : α), x_1 ∈ r✝ → cmpLT cmp x x_1) ∧ ∀ (a : α), a ∈ listR parent✝ → cmpLT cmp x a) ∧
          List.Pairwise (cmpLT cmp) (toList r✝) ∧
            List.Pairwise (cmpLT cmp) (listR parent✝) ∧
              ∀ (x : α), x ∈ r✝ → ∀ (a : α), a ∈ listR parent✝ → cmpLT cmp x a) ∧
        (∀ (a : α), a ∈ listL parent✝ → cmpLT cmp a x) ∧
          (∀ (x : α), x ∈ listL parent✝ → ∀ (x_2 : α), x_2 ∈ r✝ → cmpLT cmp x x_2) ∧
            ∀ (x : α), x ∈ listL parent✝ → ∀ (y : α), y ∈ listR parent✝ → cmpLT cmp x y

tactic: exact ⟨
  fun ⟨⟨hL, hR, LR⟩, lx, ⟨Lx, xR⟩, ⟨lL, lR⟩, hl⟩ =>
    ⟨⟨hL, ⟨hl, lx⟩, fun _ ha _ hb => lL _ hb _ ha, Lx⟩, hR, LR, lR, xR⟩,
  fun ⟨⟨hL, ⟨hl, lx⟩, Ll, Lx⟩, hR, LR, lR, xR⟩ =>
   ⟨⟨hL, hR, LR⟩, lx, ⟨Lx, xR⟩, ⟨fun _ ha _ hb => Ll _ hb _ ha, lR⟩, hl⟩⟩
state_before: case right
α : Type u_1
cmp : α → α → Ordering
c✝ : RBColor
l✝ : RBNode α
x : α
parent✝ : Path α
ih :
  Ordered cmp parent✝ ↔
    List.Pairwise (cmpLT cmp) (listL parent✝) ∧
      List.Pairwise (cmpLT cmp) (listR parent✝) ∧
        ∀ (x : α), x ∈ listL parent✝ → ∀ (y : α), y ∈ listR parent✝ → cmpLT cmp x y
⊢ (List.Pairwise (cmpLT cmp) (listL parent✝) ∧
        List.Pairwise (cmpLT cmp) (listR parent✝) ∧
          ∀ (x : α), x ∈ listL parent✝ → ∀ (y : α), y ∈ listR parent✝ → cmpLT cmp x y) ∧
      (∀ (x_1 : α), x_1 ∈ l✝ → cmpLT cmp x_1 x) ∧
        ((∀ (a : α), a ∈ listL parent✝ → cmpLT cmp a x) ∧ ∀ (a : α), a ∈ listR parent✝ → cmpLT cmp x a) ∧
          ((∀ (x : α), x ∈ l✝ → ∀ (a : α), a ∈ listL parent✝ → cmpLT cmp a x) ∧
              ∀ (x : α), x ∈ l✝ → ∀ (a : α), a ∈ listR parent✝ → cmpLT cmp x a) ∧
            List.Pairwise (cmpLT cmp) (toList l✝) ↔
    (List.Pairwise (cmpLT cmp) (listL parent✝) ∧
        (List.Pairwise (cmpLT cmp) (toList l✝) ∧ ∀ (x_1 : α), x_1 ∈ l✝ → cmpLT cmp x_1 x) ∧
          (∀ (x : α), x ∈ listL parent✝ → ∀ (x_2 : α), x_2 ∈ l✝ → cmpLT cmp x x_2) ∧
            ∀ (a : α), a ∈ listL parent✝ → cmpLT cmp a x) ∧
      List.Pairwise (cmpLT cmp) (listR parent✝) ∧
        (∀ (x : α), x ∈ listL parent✝ → ∀ (y : α), y ∈ listR parent✝ → cmpLT cmp x y) ∧
          (∀ (x : α), x ∈ l✝ → ∀ (a : α), a ∈ listR parent✝ → cmpLT cmp x a) ∧
            ∀ (a : α), a ∈ listR parent✝ → cmpLT cmp x a