Skip to content

Commit 492f19e

Browse files
authored
The sum of geometric series in the real numbers (#1676)
Builds on #1675, #1673, and #1672. Completes #1605.
1 parent b415c8b commit 492f19e

28 files changed

+1241
-152
lines changed

src/commutative-algebra/commutative-rings.lagda.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,13 @@ module _
200200
right-subtraction-Commutative-Ring =
201201
right-subtraction-Ring ring-Commutative-Ring
202202
203+
ap-right-subtraction-Commutative-Ring :
204+
{x x' y y' : type-Commutative-Ring} → x = x' → y = y' →
205+
right-subtraction-Commutative-Ring x y =
206+
right-subtraction-Commutative-Ring x' y'
207+
ap-right-subtraction-Commutative-Ring =
208+
ap-right-subtraction-Ring ring-Commutative-Ring
209+
203210
is-section-right-subtraction-Commutative-Ring :
204211
(x : type-Commutative-Ring) →
205212
( add-Commutative-Ring' x ∘
@@ -659,3 +666,20 @@ module _
659666
preserves-concat-add-list-Commutative-Ring =
660667
preserves-concat-add-list-Ring ring-Commutative-Ring
661668
```
669+
670+
### The sum of `x - y` and `y - z` is `x - z`
671+
672+
```agda
673+
module _
674+
{l : Level} (R : Commutative-Ring l)
675+
where
676+
677+
add-right-subtraction-Commutative-Ring :
678+
(x y z : type-Commutative-Ring R) →
679+
add-Commutative-Ring R
680+
( right-subtraction-Commutative-Ring R x y)
681+
( right-subtraction-Commutative-Ring R y z) =
682+
right-subtraction-Commutative-Ring R x z
683+
add-right-subtraction-Commutative-Ring =
684+
add-right-subtraction-Ab (ab-Commutative-Ring R)
685+
```

src/commutative-algebra/geometric-sequences-commutative-rings.lagda.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ module commutative-algebra.geometric-sequences-commutative-rings where
1010
open import commutative-algebra.commutative-rings
1111
open import commutative-algebra.commutative-semirings
1212
open import commutative-algebra.geometric-sequences-commutative-semirings
13+
open import commutative-algebra.groups-of-units-commutative-rings
14+
open import commutative-algebra.invertible-elements-commutative-rings
1315
open import commutative-algebra.powers-of-elements-commutative-rings
16+
open import commutative-algebra.sums-of-finite-sequences-of-elements-commutative-rings
1417
1518
open import elementary-number-theory.natural-numbers
1619
@@ -288,6 +291,11 @@ module _
288291
```agda
289292
module _
290293
{l : Level} (R : Commutative-Ring l) (a r : type-Commutative-Ring R)
294+
(let _*R_ = mul-Commutative-Ring R)
295+
(let _+R_ = add-Commutative-Ring R)
296+
(let _-R_ = right-subtraction-Commutative-Ring R)
297+
(let zero-R = zero-Commutative-Ring R)
298+
(let one-R = one-Commutative-Ring R)
291299
where
292300
293301
abstract
@@ -307,4 +315,141 @@ module _
307315
( commutative-semiring-Commutative-Ring R)
308316
( a)
309317
( r)
318+
319+
abstract
320+
compute-sum-standard-geometric-fin-sequence-Commutative-Ring :
321+
(H :
322+
is-invertible-element-Commutative-Ring R
323+
( right-subtraction-Commutative-Ring R (one-Commutative-Ring R) r)) →
324+
(n : ℕ) →
325+
sum-standard-geometric-fin-sequence-Commutative-Ring R a r n =
326+
mul-Commutative-Ring R
327+
( mul-Commutative-Ring R
328+
( a)
329+
( inv-is-invertible-element-Commutative-Ring R H))
330+
( right-subtraction-Commutative-Ring R
331+
( one-Commutative-Ring R)
332+
( power-Commutative-Ring R n r))
333+
compute-sum-standard-geometric-fin-sequence-Commutative-Ring
334+
(1/⟨1-r⟩ , H) 0 =
335+
inv
336+
( equational-reasoning
337+
(a *R 1/⟨1-r⟩) *R (one-R -R one-R)
338+
= (a *R 1/⟨1-r⟩) *R zero-R
339+
by
340+
ap-mul-Commutative-Ring R
341+
( refl)
342+
( right-inverse-law-add-Commutative-Ring R one-R)
343+
= zero-R
344+
by right-zero-law-mul-Commutative-Ring R _)
345+
compute-sum-standard-geometric-fin-sequence-Commutative-Ring
346+
(1/⟨1-r⟩ , H) (succ-ℕ n) =
347+
equational-reasoning
348+
sum-standard-geometric-fin-sequence-Commutative-Ring R a r (succ-ℕ n)
349+
350+
sum-standard-geometric-fin-sequence-Commutative-Ring R a r n +R
351+
seq-standard-geometric-sequence-Commutative-Ring R a r n
352+
by
353+
cons-sum-fin-sequence-type-Commutative-Ring R
354+
( n)
355+
( standard-geometric-fin-sequence-Commutative-Ring R
356+
( a)
357+
( r)
358+
( succ-ℕ n))
359+
( refl)
360+
361+
( (a *R 1/⟨1-r⟩) *R (one-R -R power-Commutative-Ring R n r)) +R
362+
( a *R power-Commutative-Ring R n r)
363+
by
364+
ap-add-Commutative-Ring R
365+
( compute-sum-standard-geometric-fin-sequence-Commutative-Ring
366+
( 1/⟨1-r⟩ , H)
367+
( n))
368+
( inv
369+
( htpy-mul-pow-standard-geometric-sequence-Commutative-Ring R
370+
( a)
371+
( r)
372+
( n)))
373+
374+
( a *R (1/⟨1-r⟩ *R (one-R -R power-Commutative-Ring R n r))) +R
375+
( a *R (one-R *R power-Commutative-Ring R n r))
376+
by
377+
ap-add-Commutative-Ring R
378+
( associative-mul-Commutative-Ring R _ _ _)
379+
( ap-mul-Commutative-Ring R
380+
( refl)
381+
( inv (left-unit-law-mul-Commutative-Ring R _)))
382+
383+
a *R
384+
( (1/⟨1-r⟩ *R (one-R -R power-Commutative-Ring R n r)) +R
385+
(one-R *R power-Commutative-Ring R n r))
386+
by inv (left-distributive-mul-add-Commutative-Ring R a _ _)
387+
388+
a *R
389+
( ( 1/⟨1-r⟩ *R (one-R -R power-Commutative-Ring R n r)) +R
390+
( (1/⟨1-r⟩ *R (one-R -R r)) *R power-Commutative-Ring R n r))
391+
by
392+
ap-mul-Commutative-Ring R
393+
( refl)
394+
( ap-add-Commutative-Ring R
395+
( refl)
396+
( ap-mul-Commutative-Ring R (inv (pr2 H)) refl))
397+
398+
a *R
399+
( ( 1/⟨1-r⟩ *R (one-R -R power-Commutative-Ring R n r)) +R
400+
( 1/⟨1-r⟩ *R ((one-R -R r) *R power-Commutative-Ring R n r)))
401+
by
402+
ap-mul-Commutative-Ring R
403+
( refl)
404+
( ap-add-Commutative-Ring R
405+
( refl)
406+
( associative-mul-Commutative-Ring R _ _ _))
407+
408+
a *R
409+
( 1/⟨1-r⟩ *R
410+
( ( one-R -R power-Commutative-Ring R n r) +R
411+
( (one-R -R r) *R power-Commutative-Ring R n r)))
412+
by
413+
ap-mul-Commutative-Ring R
414+
( refl)
415+
( inv (left-distributive-mul-add-Commutative-Ring R _ _ _))
416+
417+
( a *R 1/⟨1-r⟩) *R
418+
( ( one-R -R power-Commutative-Ring R n r) +R
419+
( (one-R -R r) *R power-Commutative-Ring R n r))
420+
by inv (associative-mul-Commutative-Ring R _ _ _)
421+
422+
( a *R 1/⟨1-r⟩) *R
423+
( ( one-R -R power-Commutative-Ring R n r) +R
424+
( (one-R *R power-Commutative-Ring R n r) -R
425+
(r *R power-Commutative-Ring R n r)))
426+
by
427+
ap-mul-Commutative-Ring R
428+
( refl)
429+
( ap-add-Commutative-Ring R
430+
( refl)
431+
( right-distributive-mul-right-subtraction-Commutative-Ring R
432+
( _)
433+
( _)
434+
( _)))
435+
436+
( a *R 1/⟨1-r⟩) *R
437+
( ( one-R -R power-Commutative-Ring R n r) +R
438+
( power-Commutative-Ring R n r -R
439+
power-Commutative-Ring R (succ-ℕ n) r))
440+
by
441+
ap-mul-Commutative-Ring R
442+
( refl)
443+
( ap-add-Commutative-Ring R
444+
( refl)
445+
( ap-right-subtraction-Commutative-Ring R
446+
( left-unit-law-mul-Commutative-Ring R _)
447+
( inv (power-succ-Commutative-Ring' R n r))))
448+
449+
( a *R 1/⟨1-r⟩) *R
450+
( one-R -R power-Commutative-Ring R (succ-ℕ n) r)
451+
by
452+
ap-mul-Commutative-Ring R
453+
( refl)
454+
( add-right-subtraction-Commutative-Ring R _ _ _)
310455
```

src/elementary-number-theory/geometric-sequences-rational-numbers.lagda.md

Lines changed: 20 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ open import elementary-number-theory.ring-of-rational-numbers
3030
open import elementary-number-theory.strict-inequality-rational-numbers
3131
3232
open import foundation.binary-transport
33+
open import foundation.dependent-pair-types
3334
open import foundation.function-extensionality
3435
open import foundation.identity-types
3536
open import foundation.negated-equality
@@ -111,102 +112,14 @@ module _
111112
compute-sum-standard-geometric-fin-sequence-ℚ :
112113
(n : ℕ) →
113114
sum-standard-geometric-fin-sequence-ℚ a r n =
114-
( a *ℚ
115-
( (one-ℚ -ℚ power-ℚ n r) *ℚ
116-
rational-inv-ℚˣ (invertible-diff-neq-ℚ r one-ℚ r≠1)))
117-
compute-sum-standard-geometric-fin-sequence-ℚ 0 =
118-
inv
119-
( equational-reasoning
120-
a *ℚ ((one-ℚ -ℚ one-ℚ) *ℚ _)
121-
= a *ℚ (zero-ℚ *ℚ _)
122-
by
123-
ap-mul-ℚ
124-
( refl)
125-
( ap-mul-ℚ (right-inverse-law-add-ℚ one-ℚ) refl)
126-
= a *ℚ zero-ℚ
127-
by ap-mul-ℚ refl (left-zero-law-mul-ℚ _)
128-
= zero-ℚ
129-
by right-zero-law-mul-ℚ a)
130-
compute-sum-standard-geometric-fin-sequence-ℚ (succ-ℕ n) =
131-
let
132-
1/⟨1-r⟩ = rational-inv-ℚˣ (invertible-diff-neq-ℚ r one-ℚ r≠1)
133-
in
134-
equational-reasoning
135-
sum-standard-geometric-fin-sequence-ℚ a r (succ-ℕ n)
136-
137-
sum-standard-geometric-fin-sequence-ℚ a r n +ℚ
138-
seq-standard-geometric-sequence-ℚ a r n
139-
by
140-
cons-sum-fin-sequence-type-Commutative-Ring
141-
( commutative-ring-ℚ)
142-
( n)
143-
( _)
144-
( refl)
145-
146-
( a *ℚ
147-
( (one-ℚ -ℚ power-ℚ n r) *ℚ 1/⟨1-r⟩)) +ℚ
148-
( a *ℚ power-ℚ n r)
149-
by
150-
ap-add-ℚ
151-
( compute-sum-standard-geometric-fin-sequence-ℚ n)
152-
( compute-standard-geometric-sequence-ℚ a r n)
153-
154-
a *ℚ
155-
(((one-ℚ -ℚ power-ℚ n r) *ℚ 1/⟨1-r⟩) +ℚ power-ℚ n r)
156-
by inv (left-distributive-mul-add-ℚ a _ _)
157-
158-
a *ℚ
159-
( (((one-ℚ -ℚ power-ℚ n r) *ℚ 1/⟨1-r⟩) +ℚ
160-
(power-ℚ n r *ℚ (one-ℚ -ℚ r)) *ℚ 1/⟨1-r⟩))
161-
by
162-
ap-mul-ℚ
163-
( refl)
164-
( ap-add-ℚ
165-
( refl)
166-
( inv
167-
( cancel-right-mul-div-ℚˣ _
168-
( invertible-diff-neq-ℚ r one-ℚ r≠1))))
169-
170-
a *ℚ
171-
( ( (one-ℚ -ℚ power-ℚ n r) +ℚ (power-ℚ n r *ℚ (one-ℚ -ℚ r))) *ℚ
172-
1/⟨1-r⟩)
173-
by
174-
ap-mul-ℚ
175-
( refl)
176-
( inv (right-distributive-mul-add-ℚ _ _ 1/⟨1-r⟩))
177-
178-
a *ℚ
179-
( ( one-ℚ -ℚ power-ℚ n r +ℚ
180-
((power-ℚ n r *ℚ one-ℚ) -ℚ (power-ℚ n r *ℚ r))) *ℚ
181-
1/⟨1-r⟩)
182-
by
183-
ap-mul-ℚ
184-
( refl)
185-
( ap-mul-ℚ
186-
( ap-add-ℚ refl (left-distributive-mul-diff-ℚ _ _ _))
187-
( refl))
188-
189-
a *ℚ
190-
( ( one-ℚ -ℚ power-ℚ n r +ℚ
191-
((power-ℚ n r -ℚ power-ℚ (succ-ℕ n) r))) *ℚ
192-
1/⟨1-r⟩)
193-
by
194-
ap-mul-ℚ
195-
( refl)
196-
( ap-mul-ℚ
197-
( ap-add-ℚ
198-
( refl)
199-
( ap-diff-ℚ
200-
( right-unit-law-mul-ℚ _)
201-
( inv (power-succ-ℚ n r))))
202-
( refl))
203-
= a *ℚ ((one-ℚ -ℚ power-ℚ (succ-ℕ n) r) *ℚ 1/⟨1-r⟩)
204-
by
205-
ap-mul-ℚ
206-
( refl)
207-
( ap-mul-ℚ
208-
( mul-right-div-Group group-add-ℚ _ _ _)
209-
( refl))
115+
( (a *ℚ rational-inv-ℚˣ (invertible-diff-neq-ℚ r one-ℚ r≠1)) *ℚ
116+
(one-ℚ -ℚ power-ℚ n r))
117+
compute-sum-standard-geometric-fin-sequence-ℚ =
118+
compute-sum-standard-geometric-fin-sequence-Commutative-Ring
119+
( commutative-ring-ℚ)
120+
( a)
121+
( r)
122+
( pr2 (invertible-diff-neq-ℚ r one-ℚ r≠1))
210123
```
211124

212125
### If `|r| < 1`, the sum of the standard geometric sequence `n ↦ arⁿ` is `a/(1-r)`
@@ -241,30 +154,24 @@ module _
241154
( inv
242155
( eq-htpy (compute-sum-standard-geometric-fin-sequence-ℚ a r r≠1)))
243156
( equational-reasoning
244-
a *ℚ
245-
( (one-ℚ -ℚ zero-ℚ) *ℚ
246-
rational-inv-ℚˣ (invertible-diff-neq-ℚ r one-ℚ r≠1))
157+
a *ℚ rational-inv-ℚˣ (invertible-diff-neq-ℚ r one-ℚ r≠1) *ℚ
158+
(one-ℚ -ℚ zero-ℚ)
159+
160+
a *ℚ rational-inv-ℚˣ (invertible-diff-neq-ℚ r one-ℚ r≠1) *ℚ one-ℚ
161+
by ap-mul-ℚ refl (right-zero-law-diff-ℚ _)
247162
248-
a *ℚ
249-
( one-ℚ *ℚ rational-inv-ℚˣ (invertible-diff-neq-ℚ r one-ℚ r≠1))
250-
by ap-mul-ℚ refl (ap-mul-ℚ (right-zero-law-diff-ℚ one-ℚ) refl)
251-
= a *ℚ rational-inv-ℚˣ (invertible-diff-neq-ℚ r one-ℚ r≠1)
252-
by ap-mul-ℚ refl (left-unit-law-mul-ℚ _))
253-
( uniformly-continuous-map-limit-sequence-Metric-Space
163+
a *ℚ rational-inv-ℚˣ (invertible-diff-neq-ℚ r one-ℚ r≠1)
164+
by right-unit-law-mul-ℚ _)
165+
( preserves-limits-sequence-uniformly-continuous-function-Metric-Space
254166
( metric-space-ℚ)
255167
( metric-space-ℚ)
256168
( comp-uniformly-continuous-function-Metric-Space
257169
( metric-space-ℚ)
258170
( metric-space-ℚ)
259171
( metric-space-ℚ)
260-
( uniformly-continuous-left-mul-ℚ a)
261-
( comp-uniformly-continuous-function-Metric-Space
262-
( metric-space-ℚ)
263-
( metric-space-ℚ)
264-
( metric-space-ℚ)
265-
( uniformly-continuous-right-mul-ℚ
266-
( rational-inv-ℚˣ (invertible-diff-neq-ℚ r one-ℚ r≠1)))
267-
( uniformly-continuous-diff-ℚ one-ℚ)))
172+
( uniformly-continuous-left-mul-ℚ
173+
( a *ℚ rational-inv-ℚˣ (invertible-diff-neq-ℚ r one-ℚ r≠1)))
174+
( uniformly-continuous-diff-ℚ one-ℚ))
268175
( λ n → power-ℚ n r)
269176
( zero-ℚ)
270177
( is-zero-limit-power-le-one-abs-ℚ r |r|<1))

src/elementary-number-theory/triangular-numbers.lagda.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ abstract
284284
by ap-mul-ℚ refl (right-zero-law-diff-ℚ one-ℚ)
285285
= rational-ℕ 2
286286
by right-unit-law-mul-ℚ _)
287-
( uniformly-continuous-map-limit-sequence-Metric-Space
287+
( preserves-limits-sequence-uniformly-continuous-function-Metric-Space
288288
( metric-space-ℚ)
289289
( metric-space-ℚ)
290290
( comp-uniformly-continuous-function-Metric-Space

src/literature/100-theorems.lagda.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ open import foundation.cantors-theorem using
116116
( theorem-Cantor)
117117
```
118118

119+
### 66. Sum of a Geometric Series {#66}
120+
121+
**Author:** [Louis Wasserman](https://github.com/lowasser)
122+
123+
```agda
124+
open import real-numbers.geometric-sequences-real-numbers using
125+
( compute-sum-standard-geometric-fin-sequence-ℝ ;
126+
compute-sum-standard-geometric-series-ℝ)
127+
```
128+
119129
### 68. Sum of an arithmetic series {#68}
120130

121131
**Author:** [malarbol](http://www.github.com/malarbol)

0 commit comments

Comments
 (0)