Theorem: exists_ratio_hasDerivAt_eq_ratio_slope
File: Mathlib/Analysis/Calculus/MeanValue.lean

tactic: let h x := (g b - g a) * f x - (f b - f a) * g x
state_before: E : Type ?u.307798
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.307894
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f f' : ℝ → ℝ
a b : ℝ
hab : a < b
hfc : ContinuousOn f (Icc a b)
hff' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt f (f' x) x
hfd : DifferentiableOn ℝ f (Ioo a b)
g g' : ℝ → ℝ
hgc : ContinuousOn g (Icc a b)
hgg' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt g (g' x) x
hgd : DifferentiableOn ℝ g (Ioo a b)
⊢ ∃ c, c ∈ Ioo a b ∧ (g b - g a) * f' c = (f b - f a) * g' c

tactic: have hI : h a = h b := by simp only; ring
state_before: E : Type ?u.307798
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.307894
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f f' : ℝ → ℝ
a b : ℝ
hab : a < b
hfc : ContinuousOn f (Icc a b)
hff' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt f (f' x) x
hfd : DifferentiableOn ℝ f (Ioo a b)
g g' : ℝ → ℝ
hgc : ContinuousOn g (Icc a b)
hgg' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt g (g' x) x
hgd : DifferentiableOn ℝ g (Ioo a b)
h : ℝ → ℝ := fun x => (g b - g a) * f x - (f b - f a) * g x
⊢ ∃ c, c ∈ Ioo a b ∧ (g b - g a) * f' c = (f b - f a) * g' c

tactic: let h' x := (g b - g a) * f' x - (f b - f a) * g' x
state_before: E : Type ?u.307798
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.307894
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f f' : ℝ → ℝ
a b : ℝ
hab : a < b
hfc : ContinuousOn f (Icc a b)
hff' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt f (f' x) x
hfd : DifferentiableOn ℝ f (Ioo a b)
g g' : ℝ → ℝ
hgc : ContinuousOn g (Icc a b)
hgg' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt g (g' x) x
hgd : DifferentiableOn ℝ g (Ioo a b)
h : ℝ → ℝ := fun x => (g b - g a) * f x - (f b - f a) * g x
hI : h a = h b
⊢ ∃ c, c ∈ Ioo a b ∧ (g b - g a) * f' c = (f b - f a) * g' c

tactic: have hhh' : ∀ x ∈ Ioo a b, HasDerivAt h (h' x) x := fun x hx =>
  ((hff' x hx).const_mul (g b - g a)).sub ((hgg' x hx).const_mul (f b - f a))
state_before: E : Type ?u.307798
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.307894
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f f' : ℝ → ℝ
a b : ℝ
hab : a < b
hfc : ContinuousOn f (Icc a b)
hff' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt f (f' x) x
hfd : DifferentiableOn ℝ f (Ioo a b)
g g' : ℝ → ℝ
hgc : ContinuousOn g (Icc a b)
hgg' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt g (g' x) x
hgd : DifferentiableOn ℝ g (Ioo a b)
h : ℝ → ℝ := fun x => (g b - g a) * f x - (f b - f a) * g x
hI : h a = h b
h' : ℝ → ℝ := fun x => (g b - g a) * f' x - (f b - f a) * g' x
⊢ ∃ c, c ∈ Ioo a b ∧ (g b - g a) * f' c = (f b - f a) * g' c

tactic: have hhc : ContinuousOn h (Icc a b) :=
  (continuousOn_const.mul hfc).sub (continuousOn_const.mul hgc)
state_before: E : Type ?u.307798
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.307894
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f f' : ℝ → ℝ
a b : ℝ
hab : a < b
hfc : ContinuousOn f (Icc a b)
hff' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt f (f' x) x
hfd : DifferentiableOn ℝ f (Ioo a b)
g g' : ℝ → ℝ
hgc : ContinuousOn g (Icc a b)
hgg' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt g (g' x) x
hgd : DifferentiableOn ℝ g (Ioo a b)
h : ℝ → ℝ := fun x => (g b - g a) * f x - (f b - f a) * g x
hI : h a = h b
h' : ℝ → ℝ := fun x => (g b - g a) * f' x - (f b - f a) * g' x
hhh' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt h (h' x) x
⊢ ∃ c, c ∈ Ioo a b ∧ (g b - g a) * f' c = (f b - f a) * g' c

tactic: rcases exists_hasDerivAt_eq_zero h h' hab hhc hI hhh' with ⟨c, cmem, hc⟩
state_before: E : Type ?u.307798
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.307894
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f f' : ℝ → ℝ
a b : ℝ
hab : a < b
hfc : ContinuousOn f (Icc a b)
hff' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt f (f' x) x
hfd : DifferentiableOn ℝ f (Ioo a b)
g g' : ℝ → ℝ
hgc : ContinuousOn g (Icc a b)
hgg' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt g (g' x) x
hgd : DifferentiableOn ℝ g (Ioo a b)
h : ℝ → ℝ := fun x => (g b - g a) * f x - (f b - f a) * g x
hI : h a = h b
h' : ℝ → ℝ := fun x => (g b - g a) * f' x - (f b - f a) * g' x
hhh' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt h (h' x) x
hhc : ContinuousOn h (Icc a b)
⊢ ∃ c, c ∈ Ioo a b ∧ (g b - g a) * f' c = (f b - f a) * g' c

tactic: exact ⟨c, cmem, sub_eq_zero.1 hc⟩
state_before: case intro.intro
E : Type ?u.307798
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.307894
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f f' : ℝ → ℝ
a b : ℝ
hab : a < b
hfc : ContinuousOn f (Icc a b)
hff' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt f (f' x) x
hfd : DifferentiableOn ℝ f (Ioo a b)
g g' : ℝ → ℝ
hgc : ContinuousOn g (Icc a b)
hgg' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt g (g' x) x
hgd : DifferentiableOn ℝ g (Ioo a b)
h : ℝ → ℝ := fun x => (g b - g a) * f x - (f b - f a) * g x
hI : h a = h b
h' : ℝ → ℝ := fun x => (g b - g a) * f' x - (f b - f a) * g' x
hhh' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt h (h' x) x
hhc : ContinuousOn h (Icc a b)
c : ℝ
cmem : c ∈ Ioo a b
hc : h' c = 0
⊢ ∃ c, c ∈ Ioo a b ∧ (g b - g a) * f' c = (f b - f a) * g' c

tactic: simp only
state_before: E : Type ?u.307798
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.307894
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f f' : ℝ → ℝ
a b : ℝ
hab : a < b
hfc : ContinuousOn f (Icc a b)
hff' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt f (f' x) x
hfd : DifferentiableOn ℝ f (Ioo a b)
g g' : ℝ → ℝ
hgc : ContinuousOn g (Icc a b)
hgg' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt g (g' x) x
hgd : DifferentiableOn ℝ g (Ioo a b)
h : ℝ → ℝ := fun x => (g b - g a) * f x - (f b - f a) * g x
⊢ h a = h b

tactic: ring
state_before: E : Type ?u.307798
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.307894
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f f' : ℝ → ℝ
a b : ℝ
hab : a < b
hfc : ContinuousOn f (Icc a b)
hff' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt f (f' x) x
hfd : DifferentiableOn ℝ f (Ioo a b)
g g' : ℝ → ℝ
hgc : ContinuousOn g (Icc a b)
hgg' : ∀ (x : ℝ), x ∈ Ioo a b → HasDerivAt g (g' x) x
hgd : DifferentiableOn ℝ g (Ioo a b)
h : ℝ → ℝ := fun x => (g b - g a) * f x - (f b - f a) * g x
⊢ (g b - g a) * f a - (f b - f a) * g a = (g b - g a) * f b - (f b - f a) * g b