l3lab/ntp-mathlib huggingface dataset:
/-- Structure of an `EMetricSpace` defined by an extended norm. -/
@[reducible]
def emetricSpace : EMetricSpace V where
  edist x y := e (x - y)
  edist_self x := by simp
  eq_of_edist_eq_zero {x y} := by simp [sub_eq_zero]
  edist_comm := e.map_sub_rev
  edist_triangle x y z :=
    calc
      e (x - z) = e (x - y + (y - z)) := by 

Proof state:
𝕜 : Type u_1
V : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : AddCommGroup V
inst✝ : Module 𝕜 V
e : ENorm 𝕜 V
x y z : V
⊢ ↑e (x - z) = ↑e (x - y + (y - z))

Next tactic:
rw [sub_add_sub_cancel]
/-- Structure of an `EMetricSpace` defined by an extended norm. -/
@[reducible]
def emetricSpace : EMetricSpace V where
  edist x y := e (x - y)
  edist_self x := by simp
  eq_of_edist_eq_zero {x y} := by 

Proof state:
𝕜 : Type u_1
V : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : AddCommGroup V
inst✝ : Module 𝕜 V
e : ENorm 𝕜 V
x y : V
⊢ edist x y = 0 → x = y

Next tactic:
simp [sub_eq_zero]
/-- The subspace of vectors with finite enorm. -/
def finiteSubspace : Subspace 𝕜 V where
  carrier := { x | e x < ⊤ }
  zero_mem' := by 

Proof state:
𝕜 : Type u_1
V : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : AddCommGroup V
inst✝ : Module 𝕜 V
e : ENorm 𝕜 V
⊢ 0 ∈
    { carrier := {x | ↑e x < ⊤},
        add_mem' := (_ : ∀ {x y : V}, x ∈ {x | ↑e x < ⊤} → y ∈ {x | ↑e x < ⊤} → ↑e (x + y) < ⊤) }.carrier

Next tactic:
simp
/-- Metric space structure on `e.finiteSubspace`. We use `EMetricSpace.toMetricSpace`
to ensure that this definition agrees with `e.emetricSpace`. -/
instance metricSpace : MetricSpace e.finiteSubspace := by
  

Proof state:
𝕜 : Type u_1
V : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : AddCommGroup V
inst✝ : Module 𝕜 V
e : ENorm 𝕜 V
⊢ MetricSpace ↥(finiteSubspace e)

Next tactic:
letI := e.emetricSpace
/-- Metric space structure on `e.finiteSubspace`. We use `EMetricSpace.toMetricSpace`
to ensure that this definition agrees with `e.emetricSpace`. -/
instance metricSpace : MetricSpace e.finiteSubspace := by
  letI := e.emetricSpace
  

Proof state:
𝕜 : Type u_1
V : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : AddCommGroup V
inst✝ : Module 𝕜 V
e : ENorm 𝕜 V
this : EMetricSpace V := emetricSpace e
⊢ MetricSpace ↥(finiteSubspace e)

Next tactic:
refine' EMetricSpace.toMetricSpace fun x y => _
/-- Metric space structure on `e.finiteSubspace`. We use `EMetricSpace.toMetricSpace`
to ensure that this definition agrees with `e.emetricSpace`. -/
instance metricSpace : MetricSpace e.finiteSubspace := by
  letI := e.emetricSpace
  refine' EMetricSpace.toMetricSpace fun x y => _
  

Proof state:
𝕜 : Type u_1
V : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : AddCommGroup V
inst✝ : Module 𝕜 V
e : ENorm 𝕜 V
this : EMetricSpace V := emetricSpace e
x y : ↥(finiteSubspace e)
⊢ edist x y ≠ ⊤

Next tactic:
change e (x - y) ≠ ⊤
/-- Metric space structure on `e.finiteSubspace`. We use `EMetricSpace.toMetricSpace`
to ensure that this definition agrees with `e.emetricSpace`. -/
instance metricSpace : MetricSpace e.finiteSubspace := by
  letI := e.emetricSpace
  refine' EMetricSpace.toMetricSpace fun x y => _
  change e (x - y) ≠ ⊤
  

Proof state:
𝕜 : Type u_1
V : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : AddCommGroup V
inst✝ : Module 𝕜 V
e : ENorm 𝕜 V
this : EMetricSpace V := emetricSpace e
x y : ↥(finiteSubspace e)
⊢ ↑e (↑x - ↑y) ≠ ⊤

Next tactic:
exact ne_top_of_le_ne_top (ENNReal.add_lt_top.2 ⟨x.2, y.2⟩).ne (e.map_sub_le x y)
/-- Normed space instance on `e.finiteSubspace`. -/
instance normedSpace : NormedSpace 𝕜 e.finiteSubspace where
  norm_smul_le c x := le_of_eq <| by 

Proof state:
𝕜 : Type u_1
V : Type u_2
inst✝² : NormedField 𝕜
inst✝¹ : AddCommGroup V
inst✝ : Module 𝕜 V
e : ENorm 𝕜 V
c : 𝕜
x : ↥(finiteSubspace e)
⊢ ‖c • x‖ = ‖c‖ * ‖x‖

Next tactic:
simp [finite_norm_eq, ENNReal.toReal_mul]
/-- `exp (-b * x)` is integrable on `(a, ∞)`. -/
theorem exp_neg_integrableOn_Ioi (a : ℝ) {b : ℝ} (h : 0 < b) :
    IntegrableOn (fun x : ℝ => exp (-b * x)) (Ioi a) := by
  

Proof state:
a b : ℝ
h : 0 < b
⊢ IntegrableOn (fun x => rexp (-b * x)) (Ioi a)

Next tactic:
have : Tendsto (fun x => -exp (-b * x) / b) atTop (𝓝 (-0 / b)) := by
    refine' Tendsto.div_const (Tendsto.neg _) _
    exact tendsto_exp_atBot.comp (tendsto_id.neg_const_mul_atTop (Right.neg_neg_iff.2 h))
/-- `exp (-b * x)` is integrable on `(a, ∞)`. -/
theorem exp_neg_integrableOn_Ioi (a : ℝ) {b : ℝ} (h : 0 < b) :
    IntegrableOn (fun x : ℝ => exp (-b * x)) (Ioi a) := by
  have : Tendsto (fun x => -exp (-b * x) / b) atTop (𝓝 (-0 / b)) := by
    

Proof state:
a b : ℝ
h : 0 < b
⊢ Tendsto (fun x => -rexp (-b * x) / b) atTop (𝓝 (-0 / b))

Next tactic:
refine' Tendsto.div_const (Tendsto.neg _) _
/-- `exp (-b * x)` is integrable on `(a, ∞)`. -/
theorem exp_neg_integrableOn_Ioi (a : ℝ) {b : ℝ} (h : 0 < b) :
    IntegrableOn (fun x : ℝ => exp (-b * x)) (Ioi a) := by
  have : Tendsto (fun x => -exp (-b * x) / b) atTop (𝓝 (-0 / b)) := by
    refine' Tendsto.div_const (Tendsto.neg _) _
    

Proof state:
a b : ℝ
h : 0 < b
⊢ Tendsto (fun x => rexp (-b * x)) atTop (𝓝 0)

Next tactic:
exact tendsto_exp_atBot.comp (tendsto_id.neg_const_mul_atTop (Right.neg_neg_iff.2 h))
/-- `exp (-b * x)` is integrable on `(a, ∞)`. -/
theorem exp_neg_integrableOn_Ioi (a : ℝ) {b : ℝ} (h : 0 < b) :
    IntegrableOn (fun x : ℝ => exp (-b * x)) (Ioi a) := by
  have : Tendsto (fun x => -exp (-b * x) / b) atTop (𝓝 (-0 / b)) := by
    refine' Tendsto.div_const (Tendsto.neg _) _
    exact tendsto_exp_atBot.comp (tendsto_id.neg_const_mul_atTop (Right.neg_neg_iff.2 h))
  

Proof state:
a b : ℝ
h : 0 < b
this : Tendsto (fun x => -rexp (-b * x) / b) atTop (𝓝 (-0 / b))
⊢ IntegrableOn (fun x => rexp (-b * x)) (Ioi a)

Next tactic:
refine' integrableOn_Ioi_deriv_of_nonneg' (fun x _ => _) (fun x _ => (exp_pos _).le) this
/-- `exp (-b * x)` is integrable on `(a, ∞)`. -/
theorem exp_neg_integrableOn_Ioi (a : ℝ) {b : ℝ} (h : 0 < b) :
    IntegrableOn (fun x : ℝ => exp (-b * x)) (Ioi a) := by
  have : Tendsto (fun x => -exp (-b * x) / b) atTop (𝓝 (-0 / b)) := by
    refine' Tendsto.div_const (Tendsto.neg _) _
    exact tendsto_exp_atBot.comp (tendsto_id.neg_const_mul_atTop (Right.neg_neg_iff.2 h))
  refine' integrableOn_Ioi_deriv_of_nonneg' (fun x _ => _) (fun x _ => (exp_pos _).le) this
  

Proof state:
a b : ℝ
h : 0 < b
this : Tendsto (fun x => -rexp (-b * x) / b) atTop (𝓝 (-0 / b))
x : ℝ
x✝ : x ∈ Ici a
⊢ HasDerivAt (fun x => -rexp (-b * x) / b) (rexp (-b * x)) x

Next tactic:
simpa [h.ne'] using ((hasDerivAt_id x).const_mul b).neg.exp.neg.div_const b
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  

Proof state:
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
⊢ IntegrableOn f (Ioi a)

Next tactic:
cases' h2.isBigOWith with c h3
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  

Proof state:
case intro
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c : ℝ
h3 : Asymptotics.IsBigOWith c atTop f fun x => rexp (-b * x)
⊢ IntegrableOn f (Ioi a)

Next tactic:
rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  

Proof state:
case intro
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c : ℝ
h3 : ∃ a, ∀ b_1 ≥ a, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
⊢ IntegrableOn f (Ioi a)

Next tactic:
cases' h3 with r bdr
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  cases' h3 with r bdr
  

Proof state:
case intro.intro
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c r : ℝ
bdr : ∀ b_1 ≥ r, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
⊢ IntegrableOn f (Ioi a)

Next tactic:
let v := max a r
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  cases' h3 with r bdr
  let v := max a r
  -- show integrable on `(a, v]` from continuity
  

Proof state:
case intro.intro
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c r : ℝ
bdr : ∀ b_1 ≥ r, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
v : ℝ := max a r
⊢ IntegrableOn f (Ioi a)

Next tactic:
have int_left : IntegrableOn f (Ioc a v) := by
    rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le (le_max_left a r)]
    have u : Icc a v ⊆ Ici a := Icc_subset_Ici_self
    exact (h1.mono u).intervalIntegrable_of_Icc (le_max_left a r)
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  cases' h3 with r bdr
  let v := max a r
  -- show integrable on `(a, v]` from continuity
  have int_left : IntegrableOn f (Ioc a v) := by
    

Proof state:
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c r : ℝ
bdr : ∀ b_1 ≥ r, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
v : ℝ := max a r
⊢ IntegrableOn f (Ioc a v)

Next tactic:
rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le (le_max_left a r)]
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  cases' h3 with r bdr
  let v := max a r
  -- show integrable on `(a, v]` from continuity
  have int_left : IntegrableOn f (Ioc a v) := by
    rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le (le_max_left a r)]
    

Proof state:
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c r : ℝ
bdr : ∀ b_1 ≥ r, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
v : ℝ := max a r
⊢ IntervalIntegrable f volume a (max a r)

Next tactic:
have u : Icc a v ⊆ Ici a := Icc_subset_Ici_self
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  cases' h3 with r bdr
  let v := max a r
  -- show integrable on `(a, v]` from continuity
  have int_left : IntegrableOn f (Ioc a v) := by
    rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le (le_max_left a r)]
    have u : Icc a v ⊆ Ici a := Icc_subset_Ici_self
    

Proof state:
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c r : ℝ
bdr : ∀ b_1 ≥ r, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
v : ℝ := max a r
u : Icc a v ⊆ Ici a
⊢ IntervalIntegrable f volume a (max a r)

Next tactic:
exact (h1.mono u).intervalIntegrable_of_Icc (le_max_left a r)
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  cases' h3 with r bdr
  let v := max a r
  -- show integrable on `(a, v]` from continuity
  have int_left : IntegrableOn f (Ioc a v) := by
    rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le (le_max_left a r)]
    have u : Icc a v ⊆ Ici a := Icc_subset_Ici_self
    exact (h1.mono u).intervalIntegrable_of_Icc (le_max_left a r)
  

Proof state:
case intro.intro
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c r : ℝ
bdr : ∀ b_1 ≥ r, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
v : ℝ := max a r
int_left : IntegrableOn f (Ioc a v)
⊢ IntegrableOn f (Ioi a)

Next tactic:
suffices IntegrableOn f (Ioi v) by
    have t := integrableOn_union.mpr ⟨int_left, this⟩
    simpa only [Ioc_union_Ioi_eq_Ioi, le_max_iff, le_refl, true_or_iff] using t
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  cases' h3 with r bdr
  let v := max a r
  -- show integrable on `(a, v]` from continuity
  have int_left : IntegrableOn f (Ioc a v) := by
    rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le (le_max_left a r)]
    have u : Icc a v ⊆ Ici a := Icc_subset_Ici_self
    exact (h1.mono u).intervalIntegrable_of_Icc (le_max_left a r)
  suffices IntegrableOn f (Ioi v) by
    

Proof state:
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c r : ℝ
bdr : ∀ b_1 ≥ r, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
v : ℝ := max a r
int_left : IntegrableOn f (Ioc a v)
this : IntegrableOn f (Ioi v)
⊢ IntegrableOn f (Ioi a)

Next tactic:
have t := integrableOn_union.mpr ⟨int_left, this⟩
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  cases' h3 with r bdr
  let v := max a r
  -- show integrable on `(a, v]` from continuity
  have int_left : IntegrableOn f (Ioc a v) := by
    rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le (le_max_left a r)]
    have u : Icc a v ⊆ Ici a := Icc_subset_Ici_self
    exact (h1.mono u).intervalIntegrable_of_Icc (le_max_left a r)
  suffices IntegrableOn f (Ioi v) by
    have t := integrableOn_union.mpr ⟨int_left, this⟩
    

Proof state:
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c r : ℝ
bdr : ∀ b_1 ≥ r, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
v : ℝ := max a r
int_left : IntegrableOn f (Ioc a v)
this : IntegrableOn f (Ioi v)
t : IntegrableOn f (Ioc a v ∪ Ioi v)
⊢ IntegrableOn f (Ioi a)

Next tactic:
simpa only [Ioc_union_Ioi_eq_Ioi, le_max_iff, le_refl, true_or_iff] using t
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  cases' h3 with r bdr
  let v := max a r
  -- show integrable on `(a, v]` from continuity
  have int_left : IntegrableOn f (Ioc a v) := by
    rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le (le_max_left a r)]
    have u : Icc a v ⊆ Ici a := Icc_subset_Ici_self
    exact (h1.mono u).intervalIntegrable_of_Icc (le_max_left a r)
  suffices IntegrableOn f (Ioi v) by
    have t := integrableOn_union.mpr ⟨int_left, this⟩
    simpa only [Ioc_union_Ioi_eq_Ioi, le_max_iff, le_refl, true_or_iff] using t
  -- now show integrable on `(v, ∞)` from asymptotic
  

Proof state:
case intro.intro
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c r : ℝ
bdr : ∀ b_1 ≥ r, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
v : ℝ := max a r
int_left : IntegrableOn f (Ioc a v)
⊢ IntegrableOn f (Ioi v)

Next tactic:
constructor
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  cases' h3 with r bdr
  let v := max a r
  -- show integrable on `(a, v]` from continuity
  have int_left : IntegrableOn f (Ioc a v) := by
    rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le (le_max_left a r)]
    have u : Icc a v ⊆ Ici a := Icc_subset_Ici_self
    exact (h1.mono u).intervalIntegrable_of_Icc (le_max_left a r)
  suffices IntegrableOn f (Ioi v) by
    have t := integrableOn_union.mpr ⟨int_left, this⟩
    simpa only [Ioc_union_Ioi_eq_Ioi, le_max_iff, le_refl, true_or_iff] using t
  -- now show integrable on `(v, ∞)` from asymptotic
  constructor
  · 

Proof state:
case intro.intro.left
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c r : ℝ
bdr : ∀ b_1 ≥ r, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
v : ℝ := max a r
int_left : IntegrableOn f (Ioc a v)
⊢ AEStronglyMeasurable f (Measure.restrict volume (Ioi v))

Next tactic:
exact (h1.mono <| Ioi_subset_Ici <| le_max_left a r).aestronglyMeasurable measurableSet_Ioi
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  cases' h3 with r bdr
  let v := max a r
  -- show integrable on `(a, v]` from continuity
  have int_left : IntegrableOn f (Ioc a v) := by
    rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le (le_max_left a r)]
    have u : Icc a v ⊆ Ici a := Icc_subset_Ici_self
    exact (h1.mono u).intervalIntegrable_of_Icc (le_max_left a r)
  suffices IntegrableOn f (Ioi v) by
    have t := integrableOn_union.mpr ⟨int_left, this⟩
    simpa only [Ioc_union_Ioi_eq_Ioi, le_max_iff, le_refl, true_or_iff] using t
  -- now show integrable on `(v, ∞)` from asymptotic
  constructor
  · exact (h1.mono <| Ioi_subset_Ici <| le_max_left a r).aestronglyMeasurable measurableSet_Ioi
  

Proof state:
case intro.intro.right
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c r : ℝ
bdr : ∀ b_1 ≥ r, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
v : ℝ := max a r
int_left : IntegrableOn f (Ioc a v)
⊢ HasFiniteIntegral f

Next tactic:
have : HasFiniteIntegral (fun x : ℝ => c * exp (-b * x)) (volume.restrict (Ioi v)) :=
    (exp_neg_integrableOn_Ioi v h0).hasFiniteIntegral.const_mul c
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  cases' h3 with r bdr
  let v := max a r
  -- show integrable on `(a, v]` from continuity
  have int_left : IntegrableOn f (Ioc a v) := by
    rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le (le_max_left a r)]
    have u : Icc a v ⊆ Ici a := Icc_subset_Ici_self
    exact (h1.mono u).intervalIntegrable_of_Icc (le_max_left a r)
  suffices IntegrableOn f (Ioi v) by
    have t := integrableOn_union.mpr ⟨int_left, this⟩
    simpa only [Ioc_union_Ioi_eq_Ioi, le_max_iff, le_refl, true_or_iff] using t
  -- now show integrable on `(v, ∞)` from asymptotic
  constructor
  · exact (h1.mono <| Ioi_subset_Ici <| le_max_left a r).aestronglyMeasurable measurableSet_Ioi
  have : HasFiniteIntegral (fun x : ℝ => c * exp (-b * x)) (volume.restrict (Ioi v)) :=
    (exp_neg_integrableOn_Ioi v h0).hasFiniteIntegral.const_mul c
  

Proof state:
case intro.intro.right
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c r : ℝ
bdr : ∀ b_1 ≥ r, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
v : ℝ := max a r
int_left : IntegrableOn f (Ioc a v)
this : HasFiniteIntegral fun x => c * rexp (-b * x)
⊢ HasFiniteIntegral f

Next tactic:
apply this.mono
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
    (h1 : ContinuousOn f (Ici a)) (h2 : f =O[atTop] fun x => exp (-b * x)) :
    IntegrableOn f (Ioi a) := by
  cases' h2.isBigOWith with c h3
  rw [Asymptotics.isBigOWith_iff, eventually_atTop] at h3
  cases' h3 with r bdr
  let v := max a r
  -- show integrable on `(a, v]` from continuity
  have int_left : IntegrableOn f (Ioc a v) := by
    rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le (le_max_left a r)]
    have u : Icc a v ⊆ Ici a := Icc_subset_Ici_self
    exact (h1.mono u).intervalIntegrable_of_Icc (le_max_left a r)
  suffices IntegrableOn f (Ioi v) by
    have t := integrableOn_union.mpr ⟨int_left, this⟩
    simpa only [Ioc_union_Ioi_eq_Ioi, le_max_iff, le_refl, true_or_iff] using t
  -- now show integrable on `(v, ∞)` from asymptotic
  constructor
  · exact (h1.mono <| Ioi_subset_Ici <| le_max_left a r).aestronglyMeasurable measurableSet_Ioi
  have : HasFiniteIntegral (fun x : ℝ => c * exp (-b * x)) (volume.restrict (Ioi v)) :=
    (exp_neg_integrableOn_Ioi v h0).hasFiniteIntegral.const_mul c
  apply this.mono
  

Proof state:
case intro.intro.right
f : ℝ → ℝ
a b : ℝ
h0 : 0 < b
h1 : ContinuousOn f (Ici a)
h2 : f =O[atTop] fun x => rexp (-b * x)
c r : ℝ
bdr : ∀ b_1 ≥ r, ‖f b_1‖ ≤ c * ‖rexp (-b * b_1)‖
v : ℝ := max a r
int_left : IntegrableOn f (Ioc a v)
this : HasFiniteIntegral fun x => c * rexp (-b * x)
⊢ ∀ᵐ (a : ℝ) ∂Measure.restrict volume (Ioi v), ‖f a‖ ≤ ‖c * rexp (-b * a)‖

Next tactic:
refine' (ae_restrict_iff' measurableSet_Ioi).mpr _