-- Mathlib/MeasureTheory/Integral/FundThmCalculus.lean
theorem integral_comp_smul_deriv''' {f f' : ℝ → ℝ} {g : ℝ → G} (hf : ContinuousOn f [[a, b]])
    (hff' : ∀ x ∈ Ioo (min a b) (max a b), HasDerivWithinAt f (f' x) (Ioi x) x)
    (hg_cont : ContinuousOn g (f '' Ioo (min a b) (max a b))) (hg1 : IntegrableOn g (f '' [[a, b]]))
    (hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) [[a, b]]) :
    (∫ x in a..b, f' x • (g ∘ f) x) = ∫ u in f a..f b, g u

Proof state:
case pos
a b : ℝ
G : Type u_5
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
f f' : ℝ → ℝ
g : ℝ → G
hf : ContinuousOn f [[a, b]]
hff' : ∀ x ∈ Ioo (a ⊓ b) (a ⊔ b), HasDerivWithinAt f (f' x) (Ioi x) x
hg_cont : ContinuousOn g (f '' Ioo (a ⊓ b) (a ⊔ b))
hg1 : IntegrableOn g (f '' [[a, b]]) volume
hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) [[a, b]] volume
hG : CompleteSpace G
⊢ ∫ (x : ℝ) in a..b, f' x • (g ∘ f) x = ∫ (u : ℝ) in f a..f b, g u

Tactic:
rw [hf.image_uIcc, ← intervalIntegrable_iff'] at hg1

Result:
case pos
a b : ℝ
G : Type u_5
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
f f' : ℝ → ℝ
g : ℝ → G
hf : ContinuousOn f [[a, b]]
hff' : ∀ x ∈ Ioo (a ⊓ b) (a ⊔ b), HasDerivWithinAt f (f' x) (Ioi x) x
hg_cont : ContinuousOn g (f '' Ioo (a ⊓ b) (a ⊔ b))
hg1 : IntervalIntegrable g volume (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]]))
hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) [[a, b]] volume
hG : CompleteSpace G
⊢ ∫ (x : ℝ) in a..b, f' x • (g ∘ f) x = ∫ (u : ℝ) in f a..f b, g u

Proof state:
a b : ℝ
G : Type u_5
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
f f' : ℝ → ℝ
g : ℝ → G
hf : ContinuousOn f [[a, b]]
hff' : ∀ x ∈ Ioo (a ⊓ b) (a ⊔ b), HasDerivWithinAt f (f' x) (Ioi x) x
hg1 : IntervalIntegrable g volume (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]]))
hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) [[a, b]] volume
hG : CompleteSpace G
h_cont : ContinuousOn (fun u => ∫ (t : ℝ) in f a..f u, g t) [[a, b]]
x : ℝ
hx : x ∈ Ioo (a ⊓ b) (a ⊔ b)
c : ℝ
hc : c ∈ Ioo (a ⊓ b) x
d : ℝ
hd : d ∈ Ioo x (a ⊔ b)
cdsub : [[c, d]] ⊆ Ioo (a ⊓ b) (a ⊔ b)
J : Set ℝ := [[sInf (f '' [[c, d]]), sSup (f '' [[c, d]])]]
hg_cont : ContinuousOn g J
hJ : f '' [[c, d]] = J
h2x : f x ∈ J
⊢ [[f a, f x]] ⊆ f '' [[a, b]]

Tactic:
exact hf.surjOn_uIcc left_mem_uIcc (Ioo_subset_Icc_self hx)

Result:
no goals

Proof state:
a b : ℝ
G : Type u_5
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
f f' : ℝ → ℝ
g : ℝ → G
hf : ContinuousOn f [[a, b]]
hff' : ∀ x ∈ Ioo (a ⊓ b) (a ⊔ b), HasDerivWithinAt f (f' x) (Ioi x) x
hg_cont : ContinuousOn g (f '' Ioo (a ⊓ b) (a ⊔ b))
hg1 : IntervalIntegrable g volume (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]]))
hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) [[a, b]] volume
hG : CompleteSpace G
h_cont : ContinuousOn (fun u => ∫ (t : ℝ) in f a..f u, g t) [[a, b]]
x : ℝ
hx : x ∈ Ioo (a ⊓ b) (a ⊔ b)
c : ℝ
hc : c ∈ Ioo (a ⊓ b) x
d : ℝ
hd : d ∈ Ioo x (a ⊔ b)
⊢ Icc c d ⊆ Ioo (a ⊓ b) (a ⊔ b)

Tactic:
exact Icc_subset_Ioo hc.1 hd.2

Result:
no goals

Proof state:
a b : ℝ
G : Type u_5
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
f f' : ℝ → ℝ
g : ℝ → G
hf : ContinuousOn f [[a, b]]
hff' : ∀ x ∈ Ioo (a ⊓ b) (a ⊔ b), HasDerivWithinAt f (f' x) (Ioi x) x
hg_cont : ContinuousOn g (f '' Ioo (a ⊓ b) (a ⊔ b))
hg1 : IntervalIntegrable g volume (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]]))
hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) [[a, b]] volume
hG : CompleteSpace G
⊢ ContinuousOn (fun u => ∫ (t : ℝ) in f a..f u, g t) [[a, b]]

Tactic:
refine (continuousOn_primitive_interval' hg1 ?_).comp hf ?_

Result:
case refine_1
a b : ℝ
G : Type u_5
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
f f' : ℝ → ℝ
g : ℝ → G
hf : ContinuousOn f [[a, b]]
hff' : ∀ x ∈ Ioo (a ⊓ b) (a ⊔ b), HasDerivWithinAt f (f' x) (Ioi x) x
hg_cont : ContinuousOn g (f '' Ioo (a ⊓ b) (a ⊔ b))
hg1 : IntervalIntegrable g volume (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]]))
hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) [[a, b]] volume
hG : CompleteSpace G
⊢ f a ∈ [[sInf (f '' [[a, b]]), sSup (f '' [[a, b]])]]

case refine_2
a b : ℝ
G : Type u_5
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
f f' : ℝ → ℝ
g : ℝ → G
hf : ContinuousOn f [[a, b]]
hff' : ∀ x ∈ Ioo (a ⊓ b) (a ⊔ b), HasDerivWithinAt f (f' x) (Ioi x) x
hg_cont : ContinuousOn g (f '' Ioo (a ⊓ b) (a ⊔ b))
hg1 : IntervalIntegrable g volume (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]]))
hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) [[a, b]] volume
hG : CompleteSpace G
⊢ MapsTo f [[a, b]] [[sInf (f '' [[a, b]]), sSup (f '' [[a, b]])]]

Proof state:
a b : ℝ
G : Type u_5
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
f f' : ℝ → ℝ
g : ℝ → G
hf : ContinuousOn f [[a, b]]
hff' : ∀ x ∈ Ioo (a ⊓ b) (a ⊔ b), HasDerivWithinAt f (f' x) (Ioi x) x
hg1 : IntervalIntegrable g volume (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]]))
hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) [[a, b]] volume
hG : CompleteSpace G
h_cont : ContinuousOn (fun u => ∫ (t : ℝ) in f a..f u, g t) [[a, b]]
x : ℝ
hx : x ∈ Ioo (a ⊓ b) (a ⊔ b)
c : ℝ
hc : c ∈ Ioo (a ⊓ b) x
d : ℝ
hd : d ∈ Ioo x (a ⊔ b)
cdsub : [[c, d]] ⊆ Ioo (a ⊓ b) (a ⊔ b)
J : Set ℝ := [[sInf (f '' [[c, d]]), sSup (f '' [[c, d]])]]
hg_cont : ContinuousOn g J
hJ : f '' [[c, d]] = J
h2x : f x ∈ J
⊢ IntervalIntegrable g volume (f a) (f x)

Tactic:
refine hg1.mono_set ?_

Result:
a b : ℝ
G : Type u_5
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
f f' : ℝ → ℝ
g : ℝ → G
hf : ContinuousOn f [[a, b]]
hff' : ∀ x ∈ Ioo (a ⊓ b) (a ⊔ b), HasDerivWithinAt f (f' x) (Ioi x) x
hg1 : IntervalIntegrable g volume (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]]))
hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) [[a, b]] volume
hG : CompleteSpace G
h_cont : ContinuousOn (fun u => ∫ (t : ℝ) in f a..f u, g t) [[a, b]]
x : ℝ
hx : x ∈ Ioo (a ⊓ b) (a ⊔ b)
c : ℝ
hc : c ∈ Ioo (a ⊓ b) x
d : ℝ
hd : d ∈ Ioo x (a ⊔ b)
cdsub : [[c, d]] ⊆ Ioo (a ⊓ b) (a ⊔ b)
J : Set ℝ := [[sInf (f '' [[c, d]]), sSup (f '' [[c, d]])]]
hg_cont : ContinuousOn g J
hJ : f '' [[c, d]] = J
h2x : f x ∈ J
⊢ [[f a, f x]] ⊆ [[sInf (f '' [[a, b]]), sSup (f '' [[a, b]])]]

Proof state:
case refine_2
a b : ℝ
G : Type u_5
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
f f' : ℝ → ℝ
g : ℝ → G
hf : ContinuousOn f [[a, b]]
hff' : ∀ x ∈ Ioo (a ⊓ b) (a ⊔ b), HasDerivWithinAt f (f' x) (Ioi x) x
hg_cont : ContinuousOn g (f '' Ioo (a ⊓ b) (a ⊔ b))
hg1 : IntervalIntegrable g volume (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]]))
hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) [[a, b]] volume
hG : CompleteSpace G
⊢ MapsTo f [[a, b]] (f '' [[a, b]])

Tactic:
exact mapsTo_image _ _

Result:
no goals

Proof state:
a b : ℝ
G : Type u_5
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
f f' : ℝ → ℝ
g : ℝ → G
hf : ContinuousOn f [[a, b]]
hff' : ∀ x ∈ Ioo (a ⊓ b) (a ⊔ b), HasDerivWithinAt f (f' x) (Ioi x) x
hg1 : IntervalIntegrable g volume (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]]))
hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) [[a, b]] volume
hG : CompleteSpace G
h_cont : ContinuousOn (fun u => ∫ (t : ℝ) in f a..f u, g t) [[a, b]]
x : ℝ
hx : x ∈ Ioo (a ⊓ b) (a ⊔ b)
c : ℝ
hc : c ∈ Ioo (a ⊓ b) x
d : ℝ
hd : d ∈ Ioo x (a ⊔ b)
cdsub : [[c, d]] ⊆ Ioo (a ⊓ b) (a ⊔ b)
J : Set ℝ := [[sInf (f '' [[c, d]]), sSup (f '' [[c, d]])]]
hg_cont : ContinuousOn g J
hJ : f '' [[c, d]] = J
⊢ f x ∈ f '' [[c, d]]

Tactic:
exact mem_image_of_mem _ (mem_uIcc_of_le hc.2.le hd.1.le)

Result:
no goals

Proof state:
case refine_1
a b : ℝ
G : Type u_5
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
f f' : ℝ → ℝ
g : ℝ → G
hf : ContinuousOn f [[a, b]]
hff' : ∀ x ∈ Ioo (a ⊓ b) (a ⊔ b), HasDerivWithinAt f (f' x) (Ioi x) x
hg_cont : ContinuousOn g (f '' Ioo (a ⊓ b) (a ⊔ b))
hg1 : IntervalIntegrable g volume (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]]))
hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) [[a, b]] volume
hG : CompleteSpace G
⊢ f a ∈ f '' [[a, b]]

Tactic:
exact mem_image_of_mem f left_mem_uIcc

Result:
no goals