Theorem: Batteries.RBNode.Ordered.memP_iff_upperBound?
File: .lake/packages/batteries/Batteries/Data/RBMap/Lemmas.lean

tactic: refine memP_def.trans ⟨fun ⟨y, hy, ey⟩ => ?_, fun ⟨x, hx, e⟩ => ⟨_, upperBound?_mem hx, e⟩⟩
state_before: α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
⊢ MemP cut t ↔ ∃ x, upperBound? cut t = some x ∧ cut x = Ordering.eq
state_after: α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
⊢ ∃ x, upperBound? cut t = some x ∧ cut x = Ordering.eq

tactic: have ⟨x, hx⟩ := ht.upperBound?_exists.2 ⟨_, hy, fun h => nomatch ey.symm.trans h⟩
state_before: α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
⊢ ∃ x, upperBound? cut t = some x ∧ cut x = Ordering.eq
state_after: α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
⊢ ∃ x, upperBound? cut t = some x ∧ cut x = Ordering.eq

tactic: refine ⟨x, hx, ?_⟩
state_before: α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
⊢ ∃ x, upperBound? cut t = some x ∧ cut x = Ordering.eq
state_after: α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
⊢ cut x = Ordering.eq

tactic: cases ex : cut x
state_before: α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
⊢ cut x = Ordering.eq
state_after: case lt
α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
ex : cut x = Ordering.lt
⊢ Ordering.lt = Ordering.eq

case eq
α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
ex : cut x = Ordering.eq
⊢ Ordering.eq = Ordering.eq

case gt
α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
ex : cut x = Ordering.gt
⊢ Ordering.gt = Ordering.eq

tactic: cases e : cmp x y
state_before: case lt
α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
ex : cut x = Ordering.lt
⊢ Ordering.lt = Ordering.eq
state_after: case lt.lt
α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
ex : cut x = Ordering.lt
e : cmp x y = Ordering.lt
⊢ Ordering.lt = Ordering.eq

case lt.eq
α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
ex : cut x = Ordering.lt
e : cmp x y = Ordering.eq
⊢ Ordering.lt = Ordering.eq

case lt.gt
α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
ex : cut x = Ordering.lt
e : cmp x y = Ordering.gt
⊢ Ordering.lt = Ordering.eq

tactic: cases ey.symm.trans <| IsCut.lt_trans e ex
state_before: case lt.lt
α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
ex : cut x = Ordering.lt
e : cmp x y = Ordering.lt
⊢ Ordering.lt = Ordering.eq
state_after: no goals

tactic: cases ey.symm.trans <| IsCut.congr e |>.symm.trans ex
state_before: case lt.eq
α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
ex : cut x = Ordering.lt
e : cmp x y = Ordering.eq
⊢ Ordering.lt = Ordering.eq
state_after: no goals

tactic: cases ey.symm.trans <| ht.upperBound?_least hx hy (OrientedCmp.cmp_eq_gt.1 e) ex
state_before: case lt.gt
α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
ex : cut x = Ordering.lt
e : cmp x y = Ordering.gt
⊢ Ordering.lt = Ordering.eq
state_after: no goals

tactic: rfl
state_before: case eq
α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
ex : cut x = Ordering.eq
⊢ Ordering.eq = Ordering.eq
state_after: no goals

tactic: cases upperBound?_ge hx ex
state_before: case gt
α : Type u_1
cmp : α → α → Ordering
cut : α → Ordering
t : RBNode α
inst✝¹ : TransCmp cmp
inst✝ : IsCut cmp cut
ht : Ordered cmp t
x✝ : ∃ x, x ∈ t ∧ cut x = Ordering.eq
y : α
hy : y ∈ t
ey : cut y = Ordering.eq
x : α
hx : upperBound? cut t = some x
ex : cut x = Ordering.gt
⊢ Ordering.gt = Ordering.eq
state_after: no goals