Theorem: AkraBazziRecurrence.GrowsPolynomially.abs
File: Mathlib/Computability/AkraBazzi/GrowsPolynomially.lean

tactic: cases eventually_atTop_nonneg_or_nonpos hf with
| inl hf' =>
  have hmain : f =ᶠ[atTop] fun x => |f x| := by
    filter_upwards [hf'] with x hx
    rw [abs_of_nonneg hx]
  rw [← iff_eventuallyEq hmain]
  exact hf
| inr hf' =>
  have hmain : -f =ᶠ[atTop] fun x => |f x| := by
    filter_upwards [hf'] with x hx
    simp only [Pi.neg_apply, abs_of_nonpos hx]
  rw [← iff_eventuallyEq hmain]
  exact hf.neg
state_before: f : ℝ → ℝ
hf : GrowsPolynomially f
⊢ GrowsPolynomially fun x => |f x|
state_after: no goals

tactic: have hmain : f =ᶠ[atTop] fun x => |f x| := by
  filter_upwards [hf'] with x hx
  rw [abs_of_nonneg hx]
state_before: case inl
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, 0 ≤ f x
⊢ GrowsPolynomially fun x => |f x|
state_after: case inl
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, 0 ≤ f x
hmain : f =ᶠ[atTop] fun x => |f x|
⊢ GrowsPolynomially fun x => |f x|

tactic: rw [← iff_eventuallyEq hmain]
state_before: case inl
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, 0 ≤ f x
hmain : f =ᶠ[atTop] fun x => |f x|
⊢ GrowsPolynomially fun x => |f x|
state_after: case inl
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, 0 ≤ f x
hmain : f =ᶠ[atTop] fun x => |f x|
⊢ GrowsPolynomially f

tactic: exact hf
state_before: case inl
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, 0 ≤ f x
hmain : f =ᶠ[atTop] fun x => |f x|
⊢ GrowsPolynomially f
state_after: no goals

tactic: filter_upwards [hf'] with x hx
state_before: f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, 0 ≤ f x
⊢ f =ᶠ[atTop] fun x => |f x|
state_after: case h
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, 0 ≤ f x
x : ℝ
hx : 0 ≤ f x
⊢ f x = |f x|

tactic: rw [abs_of_nonneg hx]
state_before: case h
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, 0 ≤ f x
x : ℝ
hx : 0 ≤ f x
⊢ f x = |f x|
state_after: no goals

tactic: have hmain : -f =ᶠ[atTop] fun x => |f x| := by
  filter_upwards [hf'] with x hx
  simp only [Pi.neg_apply, abs_of_nonpos hx]
state_before: case inr
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, f x ≤ 0
⊢ GrowsPolynomially fun x => |f x|
state_after: case inr
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, f x ≤ 0
hmain : -f =ᶠ[atTop] fun x => |f x|
⊢ GrowsPolynomially fun x => |f x|

tactic: rw [← iff_eventuallyEq hmain]
state_before: case inr
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, f x ≤ 0
hmain : -f =ᶠ[atTop] fun x => |f x|
⊢ GrowsPolynomially fun x => |f x|
state_after: case inr
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, f x ≤ 0
hmain : -f =ᶠ[atTop] fun x => |f x|
⊢ GrowsPolynomially (-f)

tactic: exact hf.neg
state_before: case inr
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, f x ≤ 0
hmain : -f =ᶠ[atTop] fun x => |f x|
⊢ GrowsPolynomially (-f)
state_after: no goals

tactic: filter_upwards [hf'] with x hx
state_before: f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, f x ≤ 0
⊢ -f =ᶠ[atTop] fun x => |f x|
state_after: case h
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, f x ≤ 0
x : ℝ
hx : f x ≤ 0
⊢ (-f) x = |f x|

tactic: simp only [Pi.neg_apply, abs_of_nonpos hx]
state_before: case h
f : ℝ → ℝ
hf : GrowsPolynomially f
hf' : ∀ᶠ (x : ℝ) in atTop, f x ≤ 0
x : ℝ
hx : f x ≤ 0
⊢ (-f) x = |f x|
state_after: no goals