-- Mathlib/.lake/packages/batteries/Batteries/Data/RBMap/Lemmas.lean
theorem All.upperBound?_ub {t : RBNode α} (hp : t.All p) (H : ∀ {x}, ub = some x → p x) :
    t.upperBound? cut ub = some x → p x

Proof state:
case node
α : Type u_1
p : α → Prop
cut : α → Ordering
x : α
c✝ : RBColor
l✝ : RBNode α
v✝ : α
r✝ : RBNode α
ihl : ∀ {ub : Option α}, All p l✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut l✝ ub = some x → p x
ihr : ∀ {ub : Option α}, All p r✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut r✝ ub = some x → p x
ub : Option α
hp : All p (node c✝ l✝ v✝ r✝)
H : ∀ {x : α}, ub = some x → p x
⊢ upperBound? cut (node c✝ l✝ v✝ r✝) ub = some x → p x

Tactic:
simp [upperBound?]

Result:
case node
α : Type u_1
p : α → Prop
cut : α → Ordering
x : α
c✝ : RBColor
l✝ : RBNode α
v✝ : α
r✝ : RBNode α
ihl : ∀ {ub : Option α}, All p l✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut l✝ ub = some x → p x
ihr : ∀ {ub : Option α}, All p r✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut r✝ ub = some x → p x
ub : Option α
hp : All p (node c✝ l✝ v✝ r✝)
H : ∀ {x : α}, ub = some x → p x
⊢ (match cut v✝ with
      | Ordering.lt => upperBound? cut l✝ (some v✝)
      | Ordering.gt => upperBound? cut r✝ ub
      | Ordering.eq => some v✝) =
      some x →
    p x

Proof state:
case node.h_2
α : Type u_1
p : α → Prop
cut : α → Ordering
x : α
c✝ : RBColor
l✝ : RBNode α
v✝ : α
r✝ : RBNode α
ihl : ∀ {ub : Option α}, All p l✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut l✝ ub = some x → p x
ihr : ∀ {ub : Option α}, All p r✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut r✝ ub = some x → p x
ub : Option α
hp : All p (node c✝ l✝ v✝ r✝)
H : ∀ {x : α}, ub = some x → p x
x✝ : Ordering
heq✝ : cut v✝ = Ordering.gt
⊢ upperBound? cut r✝ ub = some x → p x

Tactic:
exact ihr hp.2.2 H

Result:
no goals

Proof state:
case nil
α : Type u_1
p : α → Prop
cut : α → Ordering
x : α
ub : Option α
hp : All p nil
H : ∀ {x : α}, ub = some x → p x
⊢ upperBound? cut nil ub = some x → p x

Tactic:
exact H

Result:
no goals

Proof state:
case node.h_1
α : Type u_1
p : α → Prop
cut : α → Ordering
x : α
c✝ : RBColor
l✝ : RBNode α
v✝ : α
r✝ : RBNode α
ihl : ∀ {ub : Option α}, All p l✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut l✝ ub = some x → p x
ihr : ∀ {ub : Option α}, All p r✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut r✝ ub = some x → p x
ub : Option α
hp : All p (node c✝ l✝ v✝ r✝)
H : ∀ {x : α}, ub = some x → p x
x✝ : Ordering
heq✝ : cut v✝ = Ordering.lt
⊢ upperBound? cut l✝ (some v✝) = some x → p x

Tactic:
exact ihl hp.2.1 fun | rfl => hp.1

Result:
no goals

Proof state:
case node
α : Type u_1
p : α → Prop
cut : α → Ordering
x : α
c✝ : RBColor
l✝ : RBNode α
v✝ : α
r✝ : RBNode α
ihl : ∀ {ub : Option α}, All p l✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut l✝ ub = some x → p x
ihr : ∀ {ub : Option α}, All p r✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut r✝ ub = some x → p x
ub : Option α
hp : All p (node c✝ l✝ v✝ r✝)
H : ∀ {x : α}, ub = some x → p x
⊢ (match cut v✝ with
      | Ordering.lt => upperBound? cut l✝ (some v✝)
      | Ordering.gt => upperBound? cut r✝ ub
      | Ordering.eq => some v✝) =
      some x →
    p x

Tactic:
split

Result:
case node.h_1
α : Type u_1
p : α → Prop
cut : α → Ordering
x : α
c✝ : RBColor
l✝ : RBNode α
v✝ : α
r✝ : RBNode α
ihl : ∀ {ub : Option α}, All p l✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut l✝ ub = some x → p x
ihr : ∀ {ub : Option α}, All p r✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut r✝ ub = some x → p x
ub : Option α
hp : All p (node c✝ l✝ v✝ r✝)
H : ∀ {x : α}, ub = some x → p x
x✝ : Ordering
heq✝ : cut v✝ = Ordering.lt
⊢ upperBound? cut l✝ (some v✝) = some x → p x

case node.h_2
α : Type u_1
p : α → Prop
cut : α → Ordering
x : α
c✝ : RBColor
l✝ : RBNode α
v✝ : α
r✝ : RBNode α
ihl : ∀ {ub : Option α}, All p l✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut l✝ ub = some x → p x
ihr : ∀ {ub : Option α}, All p r✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut r✝ ub = some x → p x
ub : Option α
hp : All p (node c✝ l✝ v✝ r✝)
H : ∀ {x : α}, ub = some x → p x
x✝ : Ordering
heq✝ : cut v✝ = Ordering.gt
⊢ upperBound? cut r✝ ub = some x → p x

case node.h_3
α : Type u_1
p : α → Prop
cut : α → Ordering
x : α
c✝ : RBColor
l✝ : RBNode α
v✝ : α
r✝ : RBNode α
ihl : ∀ {ub : Option α}, All p l✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut l✝ ub = some x → p x
ihr : ∀ {ub : Option α}, All p r✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut r✝ ub = some x → p x
ub : Option α
hp : All p (node c✝ l✝ v✝ r✝)
H : ∀ {x : α}, ub = some x → p x
x✝ : Ordering
heq✝ : cut v✝ = Ordering.eq
⊢ some v✝ = some x → p x

Proof state:
case node.h_3
α : Type u_1
p : α → Prop
cut : α → Ordering
x : α
c✝ : RBColor
l✝ : RBNode α
v✝ : α
r✝ : RBNode α
ihl : ∀ {ub : Option α}, All p l✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut l✝ ub = some x → p x
ihr : ∀ {ub : Option α}, All p r✝ → (∀ {x : α}, ub = some x → p x) → upperBound? cut r✝ ub = some x → p x
ub : Option α
hp : All p (node c✝ l✝ v✝ r✝)
H : ∀ {x : α}, ub = some x → p x
x✝ : Ordering
heq✝ : cut v✝ = Ordering.eq
⊢ some v✝ = some x → p x

Tactic:
exact fun | rfl => hp.1

Result:
no goals