l3lab/ntp-mathlib huggingface dataset:
/-- Derivative under integral of `x ↦ ∫ F x a` at a given point `x₀ : ℝ`, assuming
`F x₀` is integrable, `x ↦ F x a` is differentiable on an interval around `x₀` for ae `a`
(with interval radius independent of `a`) with derivative uniformly bounded by an integrable
function, and `F x` is ae-measurable for `x` in a possibly smaller neighborhood of `x₀`. -/
theorem hasDerivAt_integral_of_dominated_loc_of_deriv_le {F : 𝕜 → α → E} {F' : 𝕜 → α → E} {x₀ : 𝕜}
    {ε : ℝ} (ε_pos : 0 < ε) (hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) μ)
    (hF_int : Integrable (F x₀) μ) (hF'_meas : AEStronglyMeasurable (F' x₀) μ) {bound : α → ℝ}
    (h_bound : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a) (bound_integrable : Integrable bound μ)
    (h_diff : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x) :
    Integrable (F' x₀) μ ∧ HasDerivAt (fun n => ∫ a, F n a ∂μ) (∫ a, F' x₀ a ∂μ) x₀ := by
  have x₀_in : x₀ ∈ ball x₀ ε := mem_ball_self ε_pos
  have diff_x₀ : ∀ᵐ a ∂μ, HasDerivAt (fun x => F x a) (F' x₀ a) x₀ :=
    h_diff.mono fun a ha => ha x₀ x₀_in
  have : ∀ᵐ a ∂μ, LipschitzOnWith (Real.nnabs (bound a)) (fun x : 𝕜 => F x a) (ball x₀ ε) := by
    apply (h_diff.and h_bound).mono
    

Proof state:
α : Type u_1
inst✝⁷ : MeasurableSpace α
μ : Measure α
𝕜 : Type u_2
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_4
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F F' : 𝕜 → α → E
x₀ : 𝕜
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : 𝕜) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
bound : α → ℝ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x
x₀_in : x₀ ∈ ball x₀ ε
diff_x₀ : ∀ᵐ (a : α) ∂μ, HasDerivAt (fun x => F x a) (F' x₀ a) x₀
⊢ ∀ (x : α),
    ((∀ x_1 ∈ ball x₀ ε, HasDerivAt (fun x_2 => F x_2 x) (F' x_1 x) x_1) ∧ ∀ x_1 ∈ ball x₀ ε, ‖F' x_1 x‖ ≤ bound x) →
      LipschitzOnWith (Real.nnabs (bound x)) (fun x_1 => F x_1 x) (ball x₀ ε)

Next tactic:
rintro a ⟨ha_deriv, ha_bound⟩
/-- Derivative under integral of `x ↦ ∫ F x a` at a given point `x₀ : ℝ`, assuming
`F x₀` is integrable, `x ↦ F x a` is differentiable on an interval around `x₀` for ae `a`
(with interval radius independent of `a`) with derivative uniformly bounded by an integrable
function, and `F x` is ae-measurable for `x` in a possibly smaller neighborhood of `x₀`. -/
theorem hasDerivAt_integral_of_dominated_loc_of_deriv_le {F : 𝕜 → α → E} {F' : 𝕜 → α → E} {x₀ : 𝕜}
    {ε : ℝ} (ε_pos : 0 < ε) (hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) μ)
    (hF_int : Integrable (F x₀) μ) (hF'_meas : AEStronglyMeasurable (F' x₀) μ) {bound : α → ℝ}
    (h_bound : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a) (bound_integrable : Integrable bound μ)
    (h_diff : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x) :
    Integrable (F' x₀) μ ∧ HasDerivAt (fun n => ∫ a, F n a ∂μ) (∫ a, F' x₀ a ∂μ) x₀ := by
  have x₀_in : x₀ ∈ ball x₀ ε := mem_ball_self ε_pos
  have diff_x₀ : ∀ᵐ a ∂μ, HasDerivAt (fun x => F x a) (F' x₀ a) x₀ :=
    h_diff.mono fun a ha => ha x₀ x₀_in
  have : ∀ᵐ a ∂μ, LipschitzOnWith (Real.nnabs (bound a)) (fun x : 𝕜 => F x a) (ball x₀ ε) := by
    apply (h_diff.and h_bound).mono
    rintro a ⟨ha_deriv, ha_bound⟩
    

Proof state:
case intro
α : Type u_1
inst✝⁷ : MeasurableSpace α
μ : Measure α
𝕜 : Type u_2
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_4
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F F' : 𝕜 → α → E
x₀ : 𝕜
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : 𝕜) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
bound : α → ℝ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x
x₀_in : x₀ ∈ ball x₀ ε
diff_x₀ : ∀ᵐ (a : α) ∂μ, HasDerivAt (fun x => F x a) (F' x₀ a) x₀
a : α
ha_deriv : ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x
ha_bound : ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a
⊢ LipschitzOnWith (Real.nnabs (bound a)) (fun x => F x a) (ball x₀ ε)

Next tactic:
refine' (convex_ball _ _).lipschitzOnWith_of_nnnorm_hasDerivWithin_le
      (fun x x_in => (ha_deriv x x_in).hasDerivWithinAt) fun x x_in => _
/-- Derivative under integral of `x ↦ ∫ F x a` at a given point `x₀ : ℝ`, assuming
`F x₀` is integrable, `x ↦ F x a` is differentiable on an interval around `x₀` for ae `a`
(with interval radius independent of `a`) with derivative uniformly bounded by an integrable
function, and `F x` is ae-measurable for `x` in a possibly smaller neighborhood of `x₀`. -/
theorem hasDerivAt_integral_of_dominated_loc_of_deriv_le {F : 𝕜 → α → E} {F' : 𝕜 → α → E} {x₀ : 𝕜}
    {ε : ℝ} (ε_pos : 0 < ε) (hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) μ)
    (hF_int : Integrable (F x₀) μ) (hF'_meas : AEStronglyMeasurable (F' x₀) μ) {bound : α → ℝ}
    (h_bound : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a) (bound_integrable : Integrable bound μ)
    (h_diff : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x) :
    Integrable (F' x₀) μ ∧ HasDerivAt (fun n => ∫ a, F n a ∂μ) (∫ a, F' x₀ a ∂μ) x₀ := by
  have x₀_in : x₀ ∈ ball x₀ ε := mem_ball_self ε_pos
  have diff_x₀ : ∀ᵐ a ∂μ, HasDerivAt (fun x => F x a) (F' x₀ a) x₀ :=
    h_diff.mono fun a ha => ha x₀ x₀_in
  have : ∀ᵐ a ∂μ, LipschitzOnWith (Real.nnabs (bound a)) (fun x : 𝕜 => F x a) (ball x₀ ε) := by
    apply (h_diff.and h_bound).mono
    rintro a ⟨ha_deriv, ha_bound⟩
    refine' (convex_ball _ _).lipschitzOnWith_of_nnnorm_hasDerivWithin_le
      (fun x x_in => (ha_deriv x x_in).hasDerivWithinAt) fun x x_in => _
    

Proof state:
case intro
α : Type u_1
inst✝⁷ : MeasurableSpace α
μ : Measure α
𝕜 : Type u_2
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_4
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F F' : 𝕜 → α → E
x₀ : 𝕜
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : 𝕜) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
bound : α → ℝ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x
x₀_in : x₀ ∈ ball x₀ ε
diff_x₀ : ∀ᵐ (a : α) ∂μ, HasDerivAt (fun x => F x a) (F' x₀ a) x₀
a : α
ha_deriv : ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x
ha_bound : ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a
x : 𝕜
x_in : x ∈ ball x₀ ε
⊢ ‖F' x a‖₊ ≤ Real.nnabs (bound a)

Next tactic:
rw [← NNReal.coe_le_coe, coe_nnnorm, Real.coe_nnabs]
/-- Derivative under integral of `x ↦ ∫ F x a` at a given point `x₀ : ℝ`, assuming
`F x₀` is integrable, `x ↦ F x a` is differentiable on an interval around `x₀` for ae `a`
(with interval radius independent of `a`) with derivative uniformly bounded by an integrable
function, and `F x` is ae-measurable for `x` in a possibly smaller neighborhood of `x₀`. -/
theorem hasDerivAt_integral_of_dominated_loc_of_deriv_le {F : 𝕜 → α → E} {F' : 𝕜 → α → E} {x₀ : 𝕜}
    {ε : ℝ} (ε_pos : 0 < ε) (hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) μ)
    (hF_int : Integrable (F x₀) μ) (hF'_meas : AEStronglyMeasurable (F' x₀) μ) {bound : α → ℝ}
    (h_bound : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a) (bound_integrable : Integrable bound μ)
    (h_diff : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x) :
    Integrable (F' x₀) μ ∧ HasDerivAt (fun n => ∫ a, F n a ∂μ) (∫ a, F' x₀ a ∂μ) x₀ := by
  have x₀_in : x₀ ∈ ball x₀ ε := mem_ball_self ε_pos
  have diff_x₀ : ∀ᵐ a ∂μ, HasDerivAt (fun x => F x a) (F' x₀ a) x₀ :=
    h_diff.mono fun a ha => ha x₀ x₀_in
  have : ∀ᵐ a ∂μ, LipschitzOnWith (Real.nnabs (bound a)) (fun x : 𝕜 => F x a) (ball x₀ ε) := by
    apply (h_diff.and h_bound).mono
    rintro a ⟨ha_deriv, ha_bound⟩
    refine' (convex_ball _ _).lipschitzOnWith_of_nnnorm_hasDerivWithin_le
      (fun x x_in => (ha_deriv x x_in).hasDerivWithinAt) fun x x_in => _
    rw [← NNReal.coe_le_coe, coe_nnnorm, Real.coe_nnabs]
    

Proof state:
case intro
α : Type u_1
inst✝⁷ : MeasurableSpace α
μ : Measure α
𝕜 : Type u_2
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_4
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F F' : 𝕜 → α → E
x₀ : 𝕜
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : 𝕜) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
bound : α → ℝ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x
x₀_in : x₀ ∈ ball x₀ ε
diff_x₀ : ∀ᵐ (a : α) ∂μ, HasDerivAt (fun x => F x a) (F' x₀ a) x₀
a : α
ha_deriv : ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x
ha_bound : ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a
x : 𝕜
x_in : x ∈ ball x₀ ε
⊢ ‖F' x a‖ ≤ |bound a|

Next tactic:
exact (ha_bound x x_in).trans (le_abs_self _)
/-- Derivative under integral of `x ↦ ∫ F x a` at a given point `x₀ : ℝ`, assuming
`F x₀` is integrable, `x ↦ F x a` is differentiable on an interval around `x₀` for ae `a`
(with interval radius independent of `a`) with derivative uniformly bounded by an integrable
function, and `F x` is ae-measurable for `x` in a possibly smaller neighborhood of `x₀`. -/
theorem hasDerivAt_integral_of_dominated_loc_of_deriv_le {F : 𝕜 → α → E} {F' : 𝕜 → α → E} {x₀ : 𝕜}
    {ε : ℝ} (ε_pos : 0 < ε) (hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) μ)
    (hF_int : Integrable (F x₀) μ) (hF'_meas : AEStronglyMeasurable (F' x₀) μ) {bound : α → ℝ}
    (h_bound : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a) (bound_integrable : Integrable bound μ)
    (h_diff : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x) :
    Integrable (F' x₀) μ ∧ HasDerivAt (fun n => ∫ a, F n a ∂μ) (∫ a, F' x₀ a ∂μ) x₀ := by
  have x₀_in : x₀ ∈ ball x₀ ε := mem_ball_self ε_pos
  have diff_x₀ : ∀ᵐ a ∂μ, HasDerivAt (fun x => F x a) (F' x₀ a) x₀ :=
    h_diff.mono fun a ha => ha x₀ x₀_in
  have : ∀ᵐ a ∂μ, LipschitzOnWith (Real.nnabs (bound a)) (fun x : 𝕜 => F x a) (ball x₀ ε) := by
    apply (h_diff.and h_bound).mono
    rintro a ⟨ha_deriv, ha_bound⟩
    refine' (convex_ball _ _).lipschitzOnWith_of_nnnorm_hasDerivWithin_le
      (fun x x_in => (ha_deriv x x_in).hasDerivWithinAt) fun x x_in => _
    rw [← NNReal.coe_le_coe, coe_nnnorm, Real.coe_nnabs]
    exact (ha_bound x x_in).trans (le_abs_self _)
  

Proof state:
α : Type u_1
inst✝⁷ : MeasurableSpace α
μ : Measure α
𝕜 : Type u_2
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_4
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F F' : 𝕜 → α → E
x₀ : 𝕜
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : 𝕜) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
bound : α → ℝ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x
x₀_in : x₀ ∈ ball x₀ ε
diff_x₀ : ∀ᵐ (a : α) ∂μ, HasDerivAt (fun x => F x a) (F' x₀ a) x₀
this : ∀ᵐ (a : α) ∂μ, LipschitzOnWith (Real.nnabs (bound a)) (fun x => F x a) (ball x₀ ε)
⊢ Integrable (F' x₀) ∧ HasDerivAt (fun n => ∫ (a : α), F n a ∂μ) (∫ (a : α), F' x₀ a ∂μ) x₀

Next tactic:
exact
    hasDerivAt_integral_of_dominated_loc_of_lip ε_pos hF_meas hF_int hF'_meas this bound_integrable
      diff_x₀
/-- The inverse of the golden ratio is the opposite of its conjugate. -/
theorem inv_gold : φ⁻¹ = -ψ := by
  

Proof state:
⊢ φ⁻¹ = -ψ

Next tactic:
have : 1 + Real.sqrt 5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num))
/-- The inverse of the golden ratio is the opposite of its conjugate. -/
theorem inv_gold : φ⁻¹ = -ψ := by
  have : 1 + Real.sqrt 5 ≠ 0 := ne_of_gt (add_pos (by 

Proof state:
⊢ 0 < 1

Next tactic:
norm_num
/-- The inverse of the golden ratio is the opposite of its conjugate. -/
theorem inv_gold : φ⁻¹ = -ψ := by
  have : 1 + Real.sqrt 5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by 

Proof state:
⊢ 0 < 5

Next tactic:
norm_num
/-- The inverse of the golden ratio is the opposite of its conjugate. -/
theorem inv_gold : φ⁻¹ = -ψ := by
  have : 1 + Real.sqrt 5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num))
  

Proof state:
this : 1 + sqrt 5 ≠ 0
⊢ φ⁻¹ = -ψ

Next tactic:
field_simp [sub_mul, mul_add]
/-- The inverse of the golden ratio is the opposite of its conjugate. -/
theorem inv_gold : φ⁻¹ = -ψ := by
  have : 1 + Real.sqrt 5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num))
  field_simp [sub_mul, mul_add]
  

Proof state:
this : 1 + sqrt 5 ≠ 0
⊢ 2 * 2 = 5 - 1

Next tactic:
norm_num
/-- The opposite of the golden ratio is the inverse of its conjugate. -/
theorem inv_goldConj : ψ⁻¹ = -φ := by
  

Proof state:
⊢ ψ⁻¹ = -φ

Next tactic:
rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg]
/-- The opposite of the golden ratio is the inverse of its conjugate. -/
theorem inv_goldConj : ψ⁻¹ = -φ := by
  rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg]
  

Proof state:
⊢ -ψ = φ⁻¹

Next tactic:
exact inv_gold.symm
@[simp]
theorem gold_mul_goldConj : φ * ψ = -1 := by
  

Proof state:
⊢ φ * ψ = -1

Next tactic:
field_simp
@[simp]
theorem gold_mul_goldConj : φ * ψ = -1 := by
  field_simp
  

Proof state:
⊢ (1 + sqrt 5) * (1 - sqrt 5) = -(2 * 2)

Next tactic:
rw [← sq_sub_sq]
@[simp]
theorem gold_mul_goldConj : φ * ψ = -1 := by
  field_simp
  rw [← sq_sub_sq]
  

Proof state:
⊢ 1 ^ 2 - sqrt 5 ^ 2 = -(2 * 2)

Next tactic:
norm_num
@[simp]
theorem goldConj_mul_gold : ψ * φ = -1 := by
  

Proof state:
⊢ ψ * φ = -1

Next tactic:
rw [mul_comm]
@[simp]
theorem goldConj_mul_gold : ψ * φ = -1 := by
  rw [mul_comm]
  

Proof state:
⊢ φ * ψ = -1

Next tactic:
exact gold_mul_goldConj
@[simp]
theorem gold_add_goldConj : φ + ψ = 1 := by
  

Proof state:
⊢ φ + ψ = 1

Next tactic:
rw [goldenRatio, goldenConj]
@[simp]
theorem gold_add_goldConj : φ + ψ = 1 := by
  rw [goldenRatio, goldenConj]
  

Proof state:
⊢ (1 + sqrt 5) / 2 + (1 - sqrt 5) / 2 = 1

Next tactic:
ring
theorem one_sub_goldConj : 1 - φ = ψ := by
  

Proof state:
⊢ 1 - φ = ψ

Next tactic:
linarith [gold_add_goldConj]
theorem one_sub_gold : 1 - ψ = φ := by
  

Proof state:
⊢ 1 - ψ = φ

Next tactic:
linarith [gold_add_goldConj]
@[simp]
theorem gold_sub_goldConj : φ - ψ = Real.sqrt 5 := by
  

Proof state:
⊢ φ - ψ = sqrt 5

Next tactic:
rw [goldenRatio, goldenConj]
@[simp]
theorem gold_sub_goldConj : φ - ψ = Real.sqrt 5 := by
  rw [goldenRatio, goldenConj]
  

Proof state:
⊢ (1 + sqrt 5) / 2 - (1 - sqrt 5) / 2 = sqrt 5

Next tactic:
ring
@[simp 1200]
theorem gold_sq : φ ^ 2 = φ + 1 := by
  

Proof state:
⊢ φ ^ 2 = φ + 1

Next tactic:
rw [goldenRatio, ← sub_eq_zero]
@[simp 1200]
theorem gold_sq : φ ^ 2 = φ + 1 := by
  rw [goldenRatio, ← sub_eq_zero]
  

Proof state:
⊢ ((1 + sqrt 5) / 2) ^ 2 - ((1 + sqrt 5) / 2 + 1) = 0

Next tactic:
ring_nf
@[simp 1200]
theorem gold_sq : φ ^ 2 = φ + 1 := by
  rw [goldenRatio, ← sub_eq_zero]
  ring_nf
  

Proof state:
⊢ -5 / 4 + sqrt 5 ^ 2 * (1 / 4) = 0

Next tactic:
rw [Real.sq_sqrt]
@[simp 1200]
theorem gold_sq : φ ^ 2 = φ + 1 := by
  rw [goldenRatio, ← sub_eq_zero]
  ring_nf
  rw [Real.sq_sqrt] <;> 

Proof state:
⊢ -5 / 4 + 5 * (1 / 4) = 0

Next tactic:
norm_num
@[simp 1200]
theorem gold_sq : φ ^ 2 = φ + 1 := by
  rw [goldenRatio, ← sub_eq_zero]
  ring_nf
  rw [Real.sq_sqrt] <;> 

Proof state:
⊢ 0 ≤ 5

Next tactic:
norm_num
@[simp 1200]
theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by
  

Proof state:
⊢ ψ ^ 2 = ψ + 1

Next tactic:
rw [goldenConj, ← sub_eq_zero]
@[simp 1200]
theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by
  rw [goldenConj, ← sub_eq_zero]
  

Proof state:
⊢ ((1 - sqrt 5) / 2) ^ 2 - ((1 - sqrt 5) / 2 + 1) = 0

Next tactic:
ring_nf
@[simp 1200]
theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by
  rw [goldenConj, ← sub_eq_zero]
  ring_nf
  

Proof state:
⊢ -5 / 4 + sqrt 5 ^ 2 * (1 / 4) = 0

Next tactic:
rw [Real.sq_sqrt]
@[simp 1200]
theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by
  rw [goldenConj, ← sub_eq_zero]
  ring_nf
  rw [Real.sq_sqrt] <;> 

Proof state:
⊢ -5 / 4 + 5 * (1 / 4) = 0

Next tactic:
norm_num
@[simp 1200]
theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by
  rw [goldenConj, ← sub_eq_zero]
  ring_nf
  rw [Real.sq_sqrt] <;> 

Proof state:
⊢ 0 ≤ 5

Next tactic:
norm_num
theorem gold_pos : 0 < φ :=
  mul_pos (by 

Proof state:
⊢ 0 < 1 + sqrt 5

Next tactic:
apply add_pos
theorem gold_pos : 0 < φ :=
  mul_pos (by apply add_pos <;> 

Proof state:
case ha
⊢ 0 < 1

Next tactic:
norm_num
theorem gold_pos : 0 < φ :=
  mul_pos (by apply add_pos <;> 

Proof state:
case hb
⊢ 0 < sqrt 5

Next tactic:
norm_num
theorem one_lt_gold : 1 < φ := by
  

Proof state:
⊢ 1 < φ

Next tactic:
refine' lt_of_mul_lt_mul_left _ (le_of_lt gold_pos)
theorem one_lt_gold : 1 < φ := by
  refine' lt_of_mul_lt_mul_left _ (le_of_lt gold_pos)
  

Proof state:
⊢ φ * 1 < φ * φ

Next tactic:
simp [← sq, gold_pos, zero_lt_one, - div_pow]
theorem goldConj_neg : ψ < 0 := by
  

Proof state:
⊢ ψ < 0

Next tactic:
linarith [one_sub_goldConj, one_lt_gold]
theorem neg_one_lt_goldConj : -1 < ψ := by
  

Proof state:
⊢ -1 < ψ

Next tactic:
rw [neg_lt, ← inv_gold]
theorem neg_one_lt_goldConj : -1 < ψ := by
  rw [neg_lt, ← inv_gold]
  

Proof state:
⊢ φ⁻¹ < 1

Next tactic:
exact inv_lt_one one_lt_gold
/-- The golden ratio is irrational. -/
theorem gold_irrational : Irrational φ := by
  

Proof state:
⊢ Irrational φ

Next tactic:
have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
/-- The golden ratio is irrational. -/
theorem gold_irrational : Irrational φ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by 

Proof state:
⊢ Nat.Prime 5

Next tactic:
norm_num
/-- The golden ratio is irrational. -/
theorem gold_irrational : Irrational φ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
  

Proof state:
this : Irrational (sqrt ↑5)
⊢ Irrational φ

Next tactic:
have := this.rat_add 1
/-- The golden ratio is irrational. -/
theorem gold_irrational : Irrational φ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
  have := this.rat_add 1
  

Proof state:
this✝ : Irrational (sqrt ↑5)
this : Irrational (↑1 + sqrt ↑5)
⊢ Irrational φ

Next tactic:
have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by norm_num)
/-- The golden ratio is irrational. -/
theorem gold_irrational : Irrational φ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
  have := this.rat_add 1
  have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by 

Proof state:
this✝ : Irrational (sqrt ↑5)
this : Irrational (↑1 + sqrt ↑5)
⊢ 0.5 ≠ 0

Next tactic:
norm_num
/-- The golden ratio is irrational. -/
theorem gold_irrational : Irrational φ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
  have := this.rat_add 1
  have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by norm_num)
  

Proof state:
this✝¹ : Irrational (sqrt ↑5)
this✝ : Irrational (↑1 + sqrt ↑5)
this : Irrational (↑0.5 * (↑1 + sqrt ↑5))
⊢ Irrational φ

Next tactic:
convert this
/-- The golden ratio is irrational. -/
theorem gold_irrational : Irrational φ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
  have := this.rat_add 1
  have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by norm_num)
  convert this
  

Proof state:
case h.e'_1
this✝¹ : Irrational (sqrt ↑5)
this✝ : Irrational (↑1 + sqrt ↑5)
this : Irrational (↑0.5 * (↑1 + sqrt ↑5))
⊢ φ = ↑0.5 * (↑1 + sqrt ↑5)

Next tactic:
norm_num
/-- The golden ratio is irrational. -/
theorem gold_irrational : Irrational φ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
  have := this.rat_add 1
  have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by norm_num)
  convert this
  norm_num
  

Proof state:
case h.e'_1
this✝¹ : Irrational (sqrt ↑5)
this✝ : Irrational (↑1 + sqrt ↑5)
this : Irrational (↑0.5 * (↑1 + sqrt ↑5))
⊢ φ = 1 / 2 * (1 + sqrt 5)

Next tactic:
field_simp
/-- The conjugate of the golden ratio is irrational. -/
theorem goldConj_irrational : Irrational ψ := by
  

Proof state:
⊢ Irrational ψ

Next tactic:
have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
/-- The conjugate of the golden ratio is irrational. -/
theorem goldConj_irrational : Irrational ψ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by 

Proof state:
⊢ Nat.Prime 5

Next tactic:
norm_num
/-- The conjugate of the golden ratio is irrational. -/
theorem goldConj_irrational : Irrational ψ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
  

Proof state:
this : Irrational (sqrt ↑5)
⊢ Irrational ψ

Next tactic:
have := this.rat_sub 1
/-- The conjugate of the golden ratio is irrational. -/
theorem goldConj_irrational : Irrational ψ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
  have := this.rat_sub 1
  

Proof state:
this✝ : Irrational (sqrt ↑5)
this : Irrational (↑1 - sqrt ↑5)
⊢ Irrational ψ

Next tactic:
have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by norm_num)
/-- The conjugate of the golden ratio is irrational. -/
theorem goldConj_irrational : Irrational ψ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
  have := this.rat_sub 1
  have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by 

Proof state:
this✝ : Irrational (sqrt ↑5)
this : Irrational (↑1 - sqrt ↑5)
⊢ 0.5 ≠ 0

Next tactic:
norm_num
/-- The conjugate of the golden ratio is irrational. -/
theorem goldConj_irrational : Irrational ψ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
  have := this.rat_sub 1
  have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by norm_num)
  

Proof state:
this✝¹ : Irrational (sqrt ↑5)
this✝ : Irrational (↑1 - sqrt ↑5)
this : Irrational (↑0.5 * (↑1 - sqrt ↑5))
⊢ Irrational ψ

Next tactic:
convert this
/-- The conjugate of the golden ratio is irrational. -/
theorem goldConj_irrational : Irrational ψ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
  have := this.rat_sub 1
  have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by norm_num)
  convert this
  

Proof state:
case h.e'_1
this✝¹ : Irrational (sqrt ↑5)
this✝ : Irrational (↑1 - sqrt ↑5)
this : Irrational (↑0.5 * (↑1 - sqrt ↑5))
⊢ ψ = ↑0.5 * (↑1 - sqrt ↑5)

Next tactic:
norm_num
/-- The conjugate of the golden ratio is irrational. -/
theorem goldConj_irrational : Irrational ψ := by
  have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
  have := this.rat_sub 1
  have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by norm_num)
  convert this
  norm_num
  

Proof state:
case h.e'_1
this✝¹ : Irrational (sqrt ↑5)
this✝ : Irrational (↑1 - sqrt ↑5)
this : Irrational (↑0.5 * (↑1 - sqrt ↑5))
⊢ ψ = 1 / 2 * (1 - sqrt 5)

Next tactic:
field_simp
/-- The characteristic polynomial of `fibRec` is `X² - (X + 1)`. -/
theorem fibRec_charPoly_eq {β : Type*} [CommRing β] :
    fibRec.charPoly = X ^ 2 - (X + (1 : β[X])) := by
  

Proof state:
α : Type u_1
inst✝¹ : CommSemiring α
β : Type u_2
inst✝ : CommRing β
⊢ LinearRecurrence.charPoly fibRec = X ^ 2 - (X + 1)

Next tactic:
rw [fibRec, LinearRecurrence.charPoly]
/-- The characteristic polynomial of `fibRec` is `X² - (X + 1)`. -/
theorem fibRec_charPoly_eq {β : Type*} [CommRing β] :
    fibRec.charPoly = X ^ 2 - (X + (1 : β[X])) := by
  rw [fibRec, LinearRecurrence.charPoly]
  

Proof state:
α : Type u_1
inst✝¹ : CommSemiring α
β : Type u_2
inst✝ : CommRing β
⊢ ((monomial { order := 2, coeffs := ![1, 1] }.order) 1 -
      Finset.sum Finset.univ fun i => (monomial ↑i) (LinearRecurrence.coeffs { order := 2, coeffs := ![1, 1] } i)) =
    X ^ 2 - (X + 1)

Next tactic:
simp [Finset.sum_fin_eq_sum_range, Finset.sum_range_succ', ← smul_X_eq_monomial]
/-- As expected, the Fibonacci sequence is a solution of `fibRec`. -/
theorem fib_isSol_fibRec : fibRec.IsSolution (fun x => x.fib : ℕ → α) := by
  

Proof state:
α : Type u_1
inst✝ : CommSemiring α
⊢ LinearRecurrence.IsSolution fibRec fun x => ↑(Nat.fib x)

Next tactic:
rw [fibRec]