Theorem: hasDerivAt_of_hasDerivAt_of_ne
File: Mathlib/Analysis/Calculus/ExtendDeriv.lean

tactic: have A : HasDerivWithinAt f (g x) (Ici x) x := by
  have diff : DifferentiableOn ℝ f (Ioi x) := fun y hy =>
    (f_diff y (ne_of_gt hy)).differentiableAt.differentiableWithinAt
  apply
    has_deriv_at_interval_left_endpoint_of_tendsto_deriv diff hf.continuousWithinAt
      self_mem_nhdsWithin
  have : Tendsto g (𝓝[>] x) (𝓝 (g x)) := tendsto_inf_left hg
  apply this.congr' _
  apply mem_of_superset self_mem_nhdsWithin fun y hy => _
  intros y hy
  exact (f_diff y (ne_of_gt hy)).deriv.symm
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
⊢ HasDerivAt f (g x) x

tactic: have B : HasDerivWithinAt f (g x) (Iic x) x := by
  have diff : DifferentiableOn ℝ f (Iio x) := fun y hy =>
    (f_diff y (ne_of_lt hy)).differentiableAt.differentiableWithinAt
  apply
    has_deriv_at_interval_right_endpoint_of_tendsto_deriv diff hf.continuousWithinAt
      self_mem_nhdsWithin
  have : Tendsto g (𝓝[<] x) (𝓝 (g x)) := tendsto_inf_left hg
  apply this.congr' _
  apply mem_of_superset self_mem_nhdsWithin fun y hy => _
  intros y hy
  exact (f_diff y (ne_of_lt hy)).deriv.symm
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
A : HasDerivWithinAt f (g x) (Ici x) x
⊢ HasDerivAt f (g x) x

tactic: simpa using B.union A
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
A : HasDerivWithinAt f (g x) (Ici x) x
B : HasDerivWithinAt f (g x) (Iic x) x
⊢ HasDerivAt f (g x) x

tactic: have diff : DifferentiableOn ℝ f (Ioi x) := fun y hy =>
  (f_diff y (ne_of_gt hy)).differentiableAt.differentiableWithinAt
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
⊢ HasDerivWithinAt f (g x) (Ici x) x

tactic: apply
  has_deriv_at_interval_left_endpoint_of_tendsto_deriv diff hf.continuousWithinAt
    self_mem_nhdsWithin
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
diff : DifferentiableOn ℝ f (Ioi x)
⊢ HasDerivWithinAt f (g x) (Ici x) x

tactic: have : Tendsto g (𝓝[>] x) (𝓝 (g x)) := tendsto_inf_left hg
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
diff : DifferentiableOn ℝ f (Ioi x)
⊢ Tendsto (fun x => deriv f x) (𝓝[Ioi x] x) (𝓝 (g x))

tactic: apply this.congr' _
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
diff : DifferentiableOn ℝ f (Ioi x)
this : Tendsto g (𝓝[Ioi x] x) (𝓝 (g x))
⊢ Tendsto (fun x => deriv f x) (𝓝[Ioi x] x) (𝓝 (g x))

tactic: apply mem_of_superset self_mem_nhdsWithin fun y hy => _
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
diff : DifferentiableOn ℝ f (Ioi x)
this : Tendsto g (𝓝[Ioi x] x) (𝓝 (g x))
⊢ g =ᶠ[𝓝[Ioi x] x] fun x => deriv f x

tactic: intros y hy
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
diff : DifferentiableOn ℝ f (Ioi x)
this : Tendsto g (𝓝[Ioi x] x) (𝓝 (g x))
⊢ ∀ (y : ℝ), y ∈ Ioi x → y ∈ {x | (fun x => g x = (fun x => deriv f x) x) x}

tactic: exact (f_diff y (ne_of_gt hy)).deriv.symm
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
diff : DifferentiableOn ℝ f (Ioi x)
this : Tendsto g (𝓝[Ioi x] x) (𝓝 (g x))
y : ℝ
hy : y ∈ Ioi x
⊢ y ∈ {x | (fun x => g x = (fun x => deriv f x) x) x}

tactic: have diff : DifferentiableOn ℝ f (Iio x) := fun y hy =>
  (f_diff y (ne_of_lt hy)).differentiableAt.differentiableWithinAt
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
A : HasDerivWithinAt f (g x) (Ici x) x
⊢ HasDerivWithinAt f (g x) (Iic x) x

tactic: apply
  has_deriv_at_interval_right_endpoint_of_tendsto_deriv diff hf.continuousWithinAt
    self_mem_nhdsWithin
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
A : HasDerivWithinAt f (g x) (Ici x) x
diff : DifferentiableOn ℝ f (Iio x)
⊢ HasDerivWithinAt f (g x) (Iic x) x

tactic: have : Tendsto g (𝓝[<] x) (𝓝 (g x)) := tendsto_inf_left hg
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
A : HasDerivWithinAt f (g x) (Ici x) x
diff : DifferentiableOn ℝ f (Iio x)
⊢ Tendsto (fun x => deriv f x) (𝓝[Iio x] x) (𝓝 (g x))

tactic: apply this.congr' _
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
A : HasDerivWithinAt f (g x) (Ici x) x
diff : DifferentiableOn ℝ f (Iio x)
this : Tendsto g (𝓝[Iio x] x) (𝓝 (g x))
⊢ Tendsto (fun x => deriv f x) (𝓝[Iio x] x) (𝓝 (g x))

tactic: apply mem_of_superset self_mem_nhdsWithin fun y hy => _
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
A : HasDerivWithinAt f (g x) (Ici x) x
diff : DifferentiableOn ℝ f (Iio x)
this : Tendsto g (𝓝[Iio x] x) (𝓝 (g x))
⊢ g =ᶠ[𝓝[Iio x] x] fun x => deriv f x

tactic: intros y hy
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
A : HasDerivWithinAt f (g x) (Ici x) x
diff : DifferentiableOn ℝ f (Iio x)
this : Tendsto g (𝓝[Iio x] x) (𝓝 (g x))
⊢ ∀ (y : ℝ), y ∈ Iio x → y ∈ {x | (fun x => g x = (fun x => deriv f x) x) x}

tactic: exact (f_diff y (ne_of_lt hy)).deriv.symm
state_before: E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
F : Type ?u.148628
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace ℝ F
f g : ℝ → E
x : ℝ
f_diff : ∀ (y : ℝ), y ≠ x → HasDerivAt f (g y) y
hf : ContinuousAt f x
hg : ContinuousAt g x
A : HasDerivWithinAt f (g x) (Ici x) x
diff : DifferentiableOn ℝ f (Iio x)
this : Tendsto g (𝓝[Iio x] x) (𝓝 (g x))
y : ℝ
hy : y ∈ Iio x
⊢ y ∈ {x | (fun x => g x = (fun x => deriv f x) x) x}