Theorem: Estimator.improveUntilAux_spec
File: Mathlib/Order/Estimator.lean

tactic: rw [Estimator.improveUntilAux]
state_before: α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
⊢ match improveUntilAux a p e r with
  | Except.error a_1 => ¬p a.get = true
  | Except.ok e' => p (bound a e') = true
state_after: α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
⊢ match
    if p (bound a e) = true then pure e
    else
      match improve a e, ⋯ with
      | none, x => Except.error (if r = true then none else some e)
      | some e', x => improveUntilAux a p e' true with
  | Except.error a_1 => ¬p a.get = true
  | Except.ok e' => p (bound a e') = true

tactic: by_cases h : p (bound a e)
state_before: α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
⊢ match
    if p (bound a e) = true then pure e
    else
      match improve a e, ⋯ with
      | none, x => Except.error (if r = true then none else some e)
      | some e', x => improveUntilAux a p e' true with
  | Except.error a_1 => ¬p a.get = true
  | Except.ok e' => p (bound a e') = true
state_after: case pos
α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : p (bound a e) = true
⊢ match
    if p (bound a e) = true then pure e
    else
      match improve a e, ⋯ with
      | none, x => Except.error (if r = true then none else some e)
      | some e', x => improveUntilAux a p e' true with
  | Except.error a_1 => ¬p a.get = true
  | Except.ok e' => p (bound a e') = true

case neg
α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : ¬p (bound a e) = true
⊢ match
    if p (bound a e) = true then pure e
    else
      match improve a e, ⋯ with
      | none, x => Except.error (if r = true then none else some e)
      | some e', x => improveUntilAux a p e' true with
  | Except.error a_1 => ¬p a.get = true
  | Except.ok e' => p (bound a e') = true

tactic: simp only [h]
state_before: case pos
α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : p (bound a e) = true
⊢ match
    if p (bound a e) = true then pure e
    else
      match improve a e, ⋯ with
      | none, x => Except.error (if r = true then none else some e)
      | some e', x => improveUntilAux a p e' true with
  | Except.error a_1 => ¬p a.get = true
  | Except.ok e' => p (bound a e') = true
state_after: case pos
α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : p (bound a e) = true
⊢ match
    if True then pure e
    else
      match improve a e, ⋯ with
      | none, x => Except.error (if r = true then none else some e)
      | some e', x => improveUntilAux a p e' true with
  | Except.error a_1 => ¬p a.get = true
  | Except.ok e' => p (bound a e') = true

tactic: exact h
state_before: case pos
α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : p (bound a e) = true
⊢ match
    if True then pure e
    else
      match improve a e, ⋯ with
      | none, x => Except.error (if r = true then none else some e)
      | some e', x => improveUntilAux a p e' true with
  | Except.error a_1 => ¬p a.get = true
  | Except.ok e' => p (bound a e') = true
state_after: no goals

tactic: simp only [h]
state_before: case neg
α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : ¬p (bound a e) = true
⊢ match
    if p (bound a e) = true then pure e
    else
      match improve a e, ⋯ with
      | none, x => Except.error (if r = true then none else some e)
      | some e', x => improveUntilAux a p e' true with
  | Except.error a_1 => ¬p a.get = true
  | Except.ok e' => p (bound a e') = true
state_after: case neg
α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : ¬p (bound a e) = true
⊢ match
    if False then pure e
    else
      match improve a e, ⋯ with
      | none, x => Except.error (if r = true then none else some e)
      | some e', x => improveUntilAux a p e' true with
  | Except.error a_1 => ¬p a.get = true
  | Except.ok e' => p (bound a e') = true

tactic: match improve a e, improve_spec e with
| none, eq =>
  simp only [Bool.not_eq_true]
  rw [eq] at h
  exact Bool.bool_eq_false h
| some e', _ =>
  exact Estimator.improveUntilAux_spec a p e' true
state_before: case neg
α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : ¬p (bound a e) = true
⊢ match
    if False then pure e
    else
      match improve a e, ⋯ with
      | none, x => Except.error (if r = true then none else some e)
      | some e', x => improveUntilAux a p e' true with
  | Except.error a_1 => ¬p a.get = true
  | Except.ok e' => p (bound a e') = true
state_after: no goals

tactic: simp only [Bool.not_eq_true]
state_before: α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : ¬p (bound a e) = true
eq :
  match none with
  | none => bound a e = a.get
  | some e' => bound a e < bound a e'
⊢ match
    if False then pure e
    else
      match none, eq with
      | none, x => Except.error (if r = true then none else some e)
      | some e', x => improveUntilAux a p e' true with
  | Except.error a_1 => ¬p a.get = true
  | Except.ok e' => p (bound a e') = true
state_after: α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : ¬p (bound a e) = true
eq :
  match none with
  | none => bound a e = a.get
  | some e' => bound a e < bound a e'
⊢ p a.get = false

tactic: rw [eq] at h
state_before: α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : ¬p (bound a e) = true
eq :
  match none with
  | none => bound a e = a.get
  | some e' => bound a e < bound a e'
⊢ p a.get = false
state_after: α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : ¬p a.get = true
eq :
  match none with
  | none => bound a e = a.get
  | some e' => bound a e < bound a e'
⊢ p a.get = false

tactic: exact Bool.bool_eq_false h
state_before: α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : ¬p a.get = true
eq :
  match none with
  | none => bound a e = a.get
  | some e' => bound a e < bound a e'
⊢ p a.get = false
state_after: no goals

tactic: exact Estimator.improveUntilAux_spec a p e' true
state_before: α : Type u_2
inst✝² : Preorder α
ε : Type u_1
a : Thunk α
p : α → Bool
inst✝¹ : Estimator a ε
inst✝ : WellFoundedGT ↑(range (bound a))
e : ε
r : Bool
h : ¬p (bound a e) = true
e' : ε
x✝ :
  match some e' with
  | none => bound a e = a.get
  | some e' => bound a e < bound a e'
⊢ match
    if False then pure e
    else
      match some e', x✝ with
      | none, x => Except.error (if r = true then none else some e)
      | some e', x => improveUntilAux a p e' true with
  | Except.error a_1 => ¬p a.get = true
  | Except.ok e' => p (bound a e') = true
state_after: no goals