@@ -27,112 +27,156 @@ noncomputable section
27
27
28
28
open Polynomial
29
29
30
+ namespace Real
31
+
30
32
/-- The golden ratio `φ := (1 + √5)/2`. -/
31
33
abbrev goldenRatio : ℝ := (1 + √5 ) / 2
32
34
33
35
/-- The conjugate of the golden ratio `ψ := (1 - √5)/2`. -/
34
36
abbrev goldenConj : ℝ := (1 - √5 ) / 2
35
37
36
- @[inherit_doc goldenRatio] scoped [goldenRatio] notation "φ" => goldenRatio
37
- @[inherit_doc goldenConj] scoped [goldenRatio] notation "ψ" => goldenConj
38
- open Real goldenRatio
38
+ @[inherit_doc] scoped [goldenRatio] notation "φ" => Real.goldenRatio
39
+ @[inherit_doc] scoped [goldenRatio] notation "ψ" => Real.goldenConj
40
+
41
+ open goldenRatio
39
42
40
43
/-- The inverse of the golden ratio is the opposite of its conjugate. -/
41
- theorem inv_gold : φ⁻¹ = -ψ := by
44
+ theorem inv_goldenRatio : φ⁻¹ = -ψ := by
42
45
have : 1 + √5 ≠ 0 := by positivity
43
46
field_simp [sub_mul, mul_add]
44
47
norm_num
45
48
49
+ @[deprecated (since := "2025-08-23")] alias _root_.inv_gold := inv_goldenRatio
50
+
46
51
/-- The opposite of the golden ratio is the inverse of its conjugate. -/
47
- theorem inv_goldConj : ψ⁻¹ = -φ := by
52
+ theorem inv_goldenConj : ψ⁻¹ = -φ := by
48
53
rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg]
49
- exact inv_gold.symm
54
+ exact inv_goldenRatio.symm
55
+
56
+ @[deprecated (since := "2025-08-23")] alias _root_.inv_goldConj := inv_goldenConj
50
57
51
58
@[simp]
52
- theorem gold_mul_goldConj : φ * ψ = -1 := by
59
+ theorem goldenRatio_mul_goldenConj : φ * ψ = -1 := by
53
60
field_simp
54
61
rw [← sq_sub_sq]
55
62
norm_num
56
63
64
+ @[deprecated (since := "2025-08-23")] alias _root_.gold_mul_goldConj := goldenRatio_mul_goldenConj
65
+
57
66
@[simp]
58
- theorem goldConj_mul_gold : ψ * φ = -1 := by
67
+ theorem goldenConj_mul_goldenRatio : ψ * φ = -1 := by
59
68
rw [mul_comm]
60
- exact gold_mul_goldConj
69
+ exact goldenRatio_mul_goldenConj
70
+
71
+ @[deprecated (since := "2025-08-23")] alias _root_.goldConj_mul_gold := goldenConj_mul_goldenRatio
61
72
62
73
@[simp]
63
- theorem gold_add_goldConj : φ + ψ = 1 := by
74
+ theorem goldenRatio_add_goldenConj : φ + ψ = 1 := by
64
75
rw [goldenRatio, goldenConj]
65
76
ring
66
77
67
- theorem one_sub_goldConj : 1 - φ = ψ := by
68
- linarith [gold_add_goldConj]
78
+ @[deprecated (since := "2025-08-23")] alias _root_.gold_add_goldConj := goldenRatio_add_goldenConj
79
+
80
+ theorem one_sub_goldenConj : 1 - φ = ψ := by
81
+ linarith [goldenRatio_add_goldenConj]
69
82
70
- theorem one_sub_gold : 1 - ψ = φ := by
71
- linarith [gold_add_goldConj]
83
+ @[deprecated (since := "2025-08-23")] alias _root_.one_sub_goldConj := one_sub_goldenConj
84
+
85
+ theorem one_sub_goldenRatio : 1 - ψ = φ := by
86
+ linarith [goldenRatio_add_goldenConj]
87
+
88
+ @[deprecated (since := "2025-08-23")] alias _root_.one_sub_gold := one_sub_goldenRatio
72
89
73
90
@[simp]
74
- theorem gold_sub_goldConj : φ - ψ = √5 := by ring
91
+ theorem goldenRatio_sub_goldenConj : φ - ψ = √5 := by ring
75
92
76
- theorem gold_pow_sub_gold_pow (n : ℕ) : φ ^ (n + 2 ) - φ ^ (n + 1 ) = φ ^ n := by
93
+ @[deprecated (since := "2025-08-23")] alias _root_.gold_sub_goldConj := goldenRatio_sub_goldenConj
94
+
95
+ theorem goldenRatio_pow_sub_goldenRatio_pow (n : ℕ) : φ ^ (n + 2 ) - φ ^ (n + 1 ) = φ ^ n := by
77
96
rw [goldenRatio]; ring_nf; norm_num; ring
78
97
98
+ @[deprecated (since := "2025-08-23")]
99
+ alias gold_pow_sub_gold_pow := goldenRatio_pow_sub_goldenRatio_pow
100
+
79
101
@[simp 1200]
80
- theorem gold_sq : φ ^ 2 = φ + 1 := by
102
+ theorem goldenRatio_sq : φ ^ 2 = φ + 1 := by
81
103
rw [goldenRatio, ← sub_eq_zero]
82
104
ring_nf
83
105
rw [Real.sq_sqrt] <;> norm_num
84
106
107
+ @[deprecated (since := "2025-08-23")] alias _root_.gold_sq := goldenRatio_sq
108
+
85
109
@[simp 1200]
86
- theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by
110
+ theorem goldenConj_sq : ψ ^ 2 = ψ + 1 := by
87
111
rw [goldenConj, ← sub_eq_zero]
88
112
ring_nf
89
113
rw [Real.sq_sqrt] <;> norm_num
90
114
91
- theorem gold_pos : 0 < φ :=
115
+ @[deprecated (since := "2025-08-23")] alias _root_.goldConj_sq := goldenConj_sq
116
+
117
+ theorem goldenRatio_pos : 0 < φ :=
92
118
mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two
93
119
94
- theorem gold_ne_zero : φ ≠ 0 :=
95
- ne_of_gt gold_pos
120
+ @[deprecated (since := "2025-08-23")] alias _root_.gold_pos := goldenRatio_pos
121
+
122
+ theorem goldenRatio_ne_zero : φ ≠ 0 :=
123
+ ne_of_gt goldenRatio_pos
96
124
97
- theorem one_lt_gold : 1 < φ := by
98
- refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos)
125
+ @[deprecated (since := "2025-08-23")] alias _root_.gold_ne_zero := goldenRatio_ne_zero
126
+
127
+ theorem one_lt_goldenRatio : 1 < φ := by
128
+ refine lt_of_mul_lt_mul_left ?_ (le_of_lt goldenRatio_pos)
99
129
simp [← sq, zero_lt_one]
100
130
101
- theorem gold_lt_two : φ < 2 := by calc
131
+ @[deprecated (since := "2025-08-23")] alias _root_.one_lt_gold := one_lt_goldenRatio
132
+
133
+ theorem goldenRatio_lt_two : φ < 2 := by calc
102
134
(1 + √5 ) / 2 < (1 + 3 ) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num
103
135
_ = 2 := by norm_num
104
136
105
- theorem goldConj_neg : ψ < 0 := by
106
- linarith [one_sub_goldConj, one_lt_gold]
137
+ @[deprecated (since := "2025-08-23")] alias _root_.gold_lt_two := goldenRatio_lt_two
138
+
139
+ theorem goldenConj_neg : ψ < 0 := by
140
+ linarith [one_sub_goldenConj, one_lt_goldenRatio]
141
+
142
+ @[deprecated (since := "2025-08-23")] alias _root_.goldConj_neg := goldenConj_neg
107
143
108
- theorem goldConj_ne_zero : ψ ≠ 0 :=
109
- ne_of_lt goldConj_neg
144
+ theorem goldenConj_ne_zero : ψ ≠ 0 :=
145
+ ne_of_lt goldenConj_neg
110
146
111
- theorem neg_one_lt_goldConj : -1 < ψ := by
112
- rw [neg_lt, ← inv_gold]
113
- exact inv_lt_one_of_one_lt₀ one_lt_gold
147
+ @[deprecated (since := "2025-08-23")] alias _root_.goldConj_ne_zero := goldenConj_ne_zero
148
+
149
+ theorem neg_one_lt_goldenConj : -1 < ψ := by
150
+ rw [neg_lt, ← inv_goldenRatio]
151
+ exact inv_lt_one_of_one_lt₀ one_lt_goldenRatio
152
+
153
+ @[deprecated (since := "2025-08-23")] alias _root_.neg_one_lt_goldConj := neg_one_lt_goldenConj
114
154
115
155
/-!
116
156
## Irrationality
117
157
-/
118
158
119
159
120
160
/-- The golden ratio is irrational. -/
121
- theorem gold_irrational : Irrational φ := by
161
+ theorem goldenRatio_irrational : Irrational φ := by
122
162
have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
123
163
have := this.ratCast_add 1
124
164
convert this.ratCast_mul (show (0 .5 : ℚ) ≠ 0 by norm_num)
125
165
norm_num
126
166
field_simp
127
167
168
+ @[deprecated (since := "2025-08-23")] alias _root_.gold_irrational := goldenRatio_irrational
169
+
128
170
/-- The conjugate of the golden ratio is irrational. -/
129
- theorem goldConj_irrational : Irrational ψ := by
171
+ theorem goldenConj_irrational : Irrational ψ := by
130
172
have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num)
131
173
have := this.ratCast_sub 1
132
174
convert this.ratCast_mul (show (0 .5 : ℚ) ≠ 0 by norm_num)
133
175
norm_num
134
176
field_simp
135
177
178
+ @[deprecated (since := "2025-08-23")] alias _root_.goldConj_irrational := goldenConj_irrational
179
+
136
180
/-!
137
181
## Links with Fibonacci sequence
138
182
-/
@@ -167,19 +211,25 @@ theorem fib_isSol_fibRec : fibRec.IsSolution (fun x => x.fib : ℕ → α) := by
167
211
simp [Finset.sum_fin_eq_sum_range, Finset.sum_range_succ']
168
212
169
213
/-- The geometric sequence `fun n ↦ φ^n` is a solution of `fibRec`. -/
170
- theorem geom_gold_isSol_fibRec : fibRec.IsSolution (φ ^ ·) := by
214
+ theorem geom_goldenRatio_isSol_fibRec : fibRec.IsSolution (φ ^ ·) := by
171
215
rw [fibRec.geom_sol_iff_root_charPoly, fibRec_charPoly_eq]
172
216
simp
173
217
218
+ @[deprecated (since := "2025-08-23")]
219
+ alias _root_.geom_gold_isSol_fibRec := geom_goldenRatio_isSol_fibRec
220
+
174
221
/-- The geometric sequence `fun n ↦ ψ^n` is a solution of `fibRec`. -/
175
- theorem geom_goldConj_isSol_fibRec : fibRec.IsSolution (ψ ^ ·) := by
222
+ theorem geom_goldenConj_isSol_fibRec : fibRec.IsSolution (ψ ^ ·) := by
176
223
rw [fibRec.geom_sol_iff_root_charPoly, fibRec_charPoly_eq]
177
224
simp
178
225
226
+ @[deprecated (since := "2025-08-23")]
227
+ alias geom_goldConj_isSol_fibRec := geom_goldenConj_isSol_fibRec
228
+
179
229
end Fibrec
180
230
181
231
/-- Binet's formula as a function equality. -/
182
- theorem Real. coe_fib_eq' :
232
+ theorem coe_fib_eq' :
183
233
(fun n => Nat.fib n : ℕ → ℝ) = fun n => (φ ^ n - ψ ^ n) / √5 := by
184
234
rw [fibRec.sol_eq_of_eq_init]
185
235
· intro i hi
@@ -196,29 +246,37 @@ theorem Real.coe_fib_eq' :
196
246
rw [Pi.sub_apply]
197
247
ring
198
248
apply (@fibRec ℝ _).solSpace.sub_mem
199
- · exact Submodule.smul_mem fibRec.solSpace (√5 )⁻¹ geom_gold_isSol_fibRec
200
- · exact Submodule.smul_mem fibRec.solSpace (√5 )⁻¹ geom_goldConj_isSol_fibRec
249
+ · exact Submodule.smul_mem fibRec.solSpace (√5 )⁻¹ geom_goldenRatio_isSol_fibRec
250
+ · exact Submodule.smul_mem fibRec.solSpace (√5 )⁻¹ geom_goldenConj_isSol_fibRec
201
251
202
- /-- Binet's formula as a dependent equality. -/
203
- theorem Real. coe_fib_eq : ∀ n, (Nat.fib n : ℝ) = (φ ^ n - ψ ^ n) / √5 := by
252
+ /-- ** Binet's formula** as a dependent equality. -/
253
+ theorem coe_fib_eq : ∀ n, (Nat.fib n : ℝ) = (φ ^ n - ψ ^ n) / √5 := by
204
254
rw [← funext_iff, Real.coe_fib_eq']
205
255
206
256
/-- Relationship between the Fibonacci Sequence, Golden Ratio and its conjugate's exponents -/
207
- theorem fib_golden_conj_exp (n : ℕ) : Nat.fib (n + 1 ) - φ * Nat.fib n = ψ ^ n := by
257
+ theorem fib_succ_sub_goldenRatio_mul_fib (n : ℕ) : Nat.fib (n + 1 ) - φ * Nat.fib n = ψ ^ n := by
208
258
repeat rw [coe_fib_eq]
209
259
rw [mul_div, div_sub_div_same, mul_sub, ← pow_succ']
210
260
ring_nf
211
261
have nz : √5 ≠ 0 := by norm_num
212
262
rw [← (mul_inv_cancel₀ nz).symm, one_mul]
213
263
264
+ @[deprecated (since := "2025-08-23")]
265
+ alias _root_.fib_golden_conj_exp := fib_succ_sub_goldenRatio_mul_fib
266
+
214
267
/-- Relationship between the Fibonacci Sequence, Golden Ratio and its exponents -/
215
- theorem fib_golden_exp' (n : ℕ) : φ * Nat.fib (n + 1 ) + Nat.fib n = φ ^ (n + 1 ) := by
268
+ lemma goldenRatio_mul_fib_succ_add_fib (n : ℕ) : φ * Nat.fib (n + 1 ) + Nat.fib n = φ ^ (n + 1 ) := by
216
269
induction n with
217
270
| zero => norm_num
218
271
| succ n ih =>
219
272
calc
220
273
_ = φ * (Nat.fib n) + φ ^ 2 * (Nat.fib (n + 1 )) := by
221
274
simp only [Nat.fib_add_one (Nat.succ_ne_zero n), Nat.succ_sub_succ_eq_sub, tsub_zero,
222
- Nat.cast_add, gold_sq ]; ring
275
+ Nat.cast_add, goldenRatio_sq ]; ring
223
276
_ = φ * ((Nat.fib n) + φ * (Nat.fib (n + 1 ))) := by ring
224
277
_ = φ ^ (n + 2 ) := by rw [add_comm, ih]; ring
278
+
279
+ @[deprecated (since := "2025-08-23")]
280
+ alias _root_.fib_golden_exp' := goldenRatio_mul_fib_succ_add_fib
281
+
282
+ end Real
0 commit comments