Skip to content

Commit ba8b3d2

Browse files
authored
Telescoping sums in abelian groups (#1944)
Straightforward and small, hopefully.
1 parent 1388f91 commit ba8b3d2

6 files changed

Lines changed: 221 additions & 4 deletions

‎src/group-theory/abelian-groups.lagda.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,9 @@ module _
364364
right-subtraction-Ab : type-Ab A type-Ab A type-Ab A
365365
right-subtraction-Ab = right-div-Group (group-Ab A)
366366

367+
right-subtraction-Ab' : type-Ab A type-Ab A type-Ab A
368+
right-subtraction-Ab' y x = right-subtraction-Ab x y
369+
367370
ap-right-subtraction-Ab :
368371
{x x' y y' : type-Ab A} x = x' y = y'
369372
right-subtraction-Ab x y = right-subtraction-Ab x' y'

‎src/group-theory/sums-of-finite-sequences-of-elements-abelian-groups.lagda.md‎

Lines changed: 121 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ open import foundation.universe-levels
2525
2626
open import group-theory.abelian-groups
2727
open import group-theory.commutative-monoids
28+
open import group-theory.function-abelian-groups
29+
open import group-theory.homomorphisms-abelian-groups
2830
open import group-theory.multiples-of-elements-abelian-groups
2931
open import group-theory.sums-of-finite-sequences-of-elements-commutative-monoids
3032
open import group-theory.sums-of-finite-sequences-of-elements-commutative-semigroups
@@ -33,6 +35,9 @@ open import group-theory.sums-of-finite-sequences-of-elements-groups
3335
open import linear-algebra.finite-sequences-in-abelian-groups
3436
open import linear-algebra.finite-sequences-in-commutative-monoids
3537
38+
open import lists.finite-sequences
39+
open import lists.pairs-of-successive-elements-finite-sequences
40+
3641
open import univalent-combinatorics.coproduct-types
3742
open import univalent-combinatorics.standard-finite-types
3843
```
@@ -146,7 +151,7 @@ module _
146151
extend-sum-fin-sequence-type-Commutative-Monoid (commutative-monoid-Ab G)
147152
```
148153

149-
### Shifting a sum of elements in a monoid
154+
### Shifting a sum of elements in an abelian group
150155

151156
```agda
152157
module _
@@ -205,8 +210,7 @@ module _
205210
206211
abstract
207212
preserves-sum-permutation-fin-sequence-type-Ab :
208-
(n : ℕ) → (σ : Permutation n) →
209-
(f : fin-sequence-type-Ab G n) →
213+
(n : ℕ) (σ : Permutation n) (f : fin-sequence-type-Ab G n) →
210214
sum-fin-sequence-type-Ab G n f =
211215
sum-fin-sequence-type-Ab G n (f ∘ map-equiv σ)
212216
preserves-sum-permutation-fin-sequence-type-Ab =
@@ -225,6 +229,120 @@ abstract
225229
sum-constant-fin-sequence-type-Group (group-Ab G)
226230
```
227231

232+
### Interchanging sums and addition
233+
234+
```agda
235+
module _
236+
{l : Level}
237+
(G : Ab l)
238+
where
239+
240+
abstract
241+
interchange-sum-add-fin-sequence-type-Ab :
242+
(n : ℕ) (f g : fin-sequence-type-Ab G n) →
243+
sum-fin-sequence-type-Ab G n (λ i → add-Ab G (f i) (g i)) =
244+
add-Ab G (sum-fin-sequence-type-Ab G n f) (sum-fin-sequence-type-Ab G n g)
245+
interchange-sum-add-fin-sequence-type-Ab =
246+
interchange-sum-mul-fin-sequence-type-Commutative-Monoid
247+
( commutative-monoid-Ab G)
248+
```
249+
250+
### The sum operation is an abelian group homomorphism
251+
252+
```agda
253+
hom-sum-fin-sequence-type-Ab :
254+
{l : Level} (G : Ab l) (n : ℕ) →
255+
hom-Ab (function-Ab G (Fin n)) G
256+
hom-sum-fin-sequence-type-Ab G n =
257+
( sum-fin-sequence-type-Ab G n ,
258+
interchange-sum-add-fin-sequence-type-Ab G n _ _)
259+
```
260+
261+
### Negation distributes over sums
262+
263+
```agda
264+
abstract
265+
distributive-neg-sum-fin-sequence-type-Ab :
266+
{l : Level} (G : Ab l) (n : ℕ) (u : fin-sequence-type-Ab G n) →
267+
neg-Ab G (sum-fin-sequence-type-Ab G n u) =
268+
sum-fin-sequence-type-Ab G n (neg-Ab G ∘ u)
269+
distributive-neg-sum-fin-sequence-type-Ab G n u =
270+
inv
271+
( preserves-negatives-hom-Ab
272+
( function-Ab G (Fin n))
273+
( G)
274+
( hom-sum-fin-sequence-type-Ab G n))
275+
```
276+
277+
### Interchanging sums and subtraction
278+
279+
```agda
280+
module _
281+
{l : Level}
282+
(G : Ab l)
283+
where
284+
285+
abstract
286+
interchange-sum-right-subtraction-fin-sequence-type-Ab :
287+
(n : ℕ) (f g : fin-sequence-type-Ab G n) →
288+
sum-fin-sequence-type-Ab G n (λ i → right-subtraction-Ab G (f i) (g i)) =
289+
right-subtraction-Ab G
290+
( sum-fin-sequence-type-Ab G n f)
291+
( sum-fin-sequence-type-Ab G n g)
292+
interchange-sum-right-subtraction-fin-sequence-type-Ab n f g =
293+
( interchange-sum-add-fin-sequence-type-Ab G n f (neg-Ab G ∘ g)) ∙
294+
( ap-add-Ab G
295+
( refl)
296+
( inv (distributive-neg-sum-fin-sequence-type-Ab G n g)))
297+
```
298+
299+
### Telescoping sums
300+
301+
A telescoping sum is a sum of the form `∑ aₙ₊₁ - aₙ` or `∑ aₙ - aₙ₊₁`.
302+
303+
```agda
304+
module _
305+
{l : Level}
306+
(G : Ab l)
307+
where
308+
309+
telescope-fin-sequence-type-Ab :
310+
(n : ℕ) → fin-sequence-type-Ab G (succ-ℕ n) → fin-sequence-type-Ab G n
311+
telescope-fin-sequence-type-Ab n u =
312+
ind-Σ (right-subtraction-Ab G) ∘ pair-succ-fin-sequence n u
313+
314+
telescope-fin-sequence-type-Ab' :
315+
(n : ℕ) → fin-sequence-type-Ab G (succ-ℕ n) → fin-sequence-type-Ab G n
316+
telescope-fin-sequence-type-Ab' n u =
317+
ind-Σ (right-subtraction-Ab' G) ∘ pair-succ-fin-sequence n u
318+
319+
abstract
320+
sum-telescope-fin-sequence-type-Ab :
321+
(n : ℕ) (u : fin-sequence-type-Ab G (succ-ℕ n)) →
322+
sum-fin-sequence-type-Ab G n (telescope-fin-sequence-type-Ab n u) =
323+
right-subtraction-Ab G (head-fin-sequence n u) (last-fin-sequence n u)
324+
sum-telescope-fin-sequence-type-Ab 0 u =
325+
inv (right-inverse-law-add-Ab G (head-fin-sequence 0 u))
326+
sum-telescope-fin-sequence-type-Ab (succ-ℕ n) u =
327+
( ap-add-Ab G
328+
( sum-telescope-fin-sequence-type-Ab n (tail-fin-sequence (succ-ℕ n) u))
329+
( refl)) ∙
330+
( commutative-add-Ab G _ _) ∙
331+
( add-right-subtraction-Ab G _ _ _)
332+
333+
sum-telescope-fin-sequence-type-Ab' :
334+
(n : ℕ) (u : fin-sequence-type-Ab G (succ-ℕ n)) →
335+
sum-fin-sequence-type-Ab G n (telescope-fin-sequence-type-Ab' n u) =
336+
right-subtraction-Ab G (last-fin-sequence n u) (head-fin-sequence n u)
337+
sum-telescope-fin-sequence-type-Ab' n u =
338+
( htpy-sum-fin-sequence-type-Ab G
339+
( n)
340+
( λ i → inv (neg-right-subtraction-Ab G _ _))) ∙
341+
( inv (distributive-neg-sum-fin-sequence-type-Ab G n _)) ∙
342+
( ap (neg-Ab G) (sum-telescope-fin-sequence-type-Ab n u)) ∙
343+
( neg-right-subtraction-Ab G _ _)
344+
```
345+
228346
## See also
229347

230348
- [Sums of finite families of elements in abelian groups](group-theory.sums-of-finite-families-of-elements-commutative-monoids.md)

‎src/group-theory/sums-of-finite-sequences-of-elements-commutative-monoids.lagda.md‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ open import foundation.identity-types
2424
open import foundation.universe-levels
2525
2626
open import group-theory.commutative-monoids
27+
open import group-theory.function-commutative-monoids
28+
open import group-theory.homomorphisms-commutative-monoids
2729
open import group-theory.powers-of-elements-commutative-monoids
2830
open import group-theory.sums-of-finite-sequences-of-elements-commutative-semigroups
2931
open import group-theory.sums-of-finite-sequences-of-elements-monoids
@@ -269,6 +271,48 @@ abstract
269271
sum-constant-fin-sequence-type-Monoid (monoid-Commutative-Monoid M)
270272
```
271273

274+
### Interchanging sums and monoid multiplication
275+
276+
```agda
277+
module _
278+
{l : Level}
279+
(M : Commutative-Monoid l)
280+
where
281+
282+
abstract
283+
interchange-sum-mul-fin-sequence-type-Commutative-Monoid :
284+
(n : ℕ) (f g : fin-sequence-type-Commutative-Monoid M n) →
285+
sum-fin-sequence-type-Commutative-Monoid M n
286+
( λ i → mul-Commutative-Monoid M (f i) (g i)) =
287+
mul-Commutative-Monoid M
288+
( sum-fin-sequence-type-Commutative-Monoid M n f)
289+
( sum-fin-sequence-type-Commutative-Monoid M n g)
290+
interchange-sum-mul-fin-sequence-type-Commutative-Monoid 0 _ _ =
291+
inv (right-unit-law-mul-Commutative-Monoid M _)
292+
interchange-sum-mul-fin-sequence-type-Commutative-Monoid (succ-ℕ n) f g =
293+
( ap-mul-Commutative-Monoid M
294+
( interchange-sum-mul-fin-sequence-type-Commutative-Monoid
295+
( n)
296+
( f ∘ inl-Fin n)
297+
( g ∘ inl-Fin n))
298+
( refl)) ∙
299+
( interchange-mul-mul-Commutative-Monoid M _ _ _ _)
300+
```
301+
302+
### The sum operation is a commutative monoid homomorphism
303+
304+
```agda
305+
hom-sum-fin-sequence-type-Commutative-Monoid :
306+
{l : Level} (M : Commutative-Monoid l) (n : ℕ) →
307+
hom-Commutative-Monoid
308+
( function-Commutative-Monoid M (Fin n))
309+
( M)
310+
hom-sum-fin-sequence-type-Commutative-Monoid M n =
311+
( ( ( sum-fin-sequence-type-Commutative-Monoid M n) ,
312+
interchange-sum-mul-fin-sequence-type-Commutative-Monoid M n _ _) ,
313+
sum-zero-fin-sequence-type-Commutative-Monoid M n)
314+
```
315+
272316
## See also
273317

274318
- [Sums of finite families of elements in commutative monoids](group-theory.sums-of-finite-families-of-elements-commutative-monoids.md)

‎src/lists.lagda.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ open import lists.functoriality-tuples public
1919
open import lists.functoriality-tuples-finite-sequences public
2020
open import lists.lists public
2121
open import lists.lists-discrete-types public
22+
open import lists.pairs-of-successive-elements-finite-sequences public
2223
open import lists.partial-sequences public
2324
open import lists.permutation-lists public
2425
open import lists.permutation-tuples public

‎src/lists/finite-sequences.lagda.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,19 @@ module _
5454
empty-fin-sequence ()
5555

5656
head-fin-sequence : (n : ℕ) fin-sequence A (succ-ℕ n) A
57-
head-fin-sequence n v = v (inr star)
57+
head-fin-sequence n v = v (neg-one-Fin n)
58+
59+
last-fin-sequence : (n : ℕ) fin-sequence A (succ-ℕ n) A
60+
last-fin-sequence n v = v (zero-Fin n)
5861

5962
tail-fin-sequence :
6063
(n : ℕ) fin-sequence A (succ-ℕ n) fin-sequence A n
6164
tail-fin-sequence n v = v ∘ (inl-Fin n)
6265

66+
init-fin-sequence :
67+
(n : ℕ) fin-sequence A (succ-ℕ n) fin-sequence A n
68+
init-fin-sequence n v = v ∘ skip-zero-Fin n
69+
6370
cons-fin-sequence :
6471
(n : ℕ) A fin-sequence A n fin-sequence A (succ-ℕ n)
6572
cons-fin-sequence n a v (inl x) = v x
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Pairs of successive elements in a finite sequence
2+
3+
```agda
4+
module lists.pairs-of-successive-elements-finite-sequences where
5+
```
6+
7+
<details><summary>Imports</summary>
8+
9+
```agda
10+
open import elementary-number-theory.natural-numbers
11+
12+
open import foundation.cartesian-product-types
13+
open import foundation.coproduct-types
14+
open import foundation.dependent-pair-types
15+
open import foundation.function-extensionality
16+
open import foundation.homotopies
17+
open import foundation.identity-types
18+
open import foundation.unit-type
19+
open import foundation.universe-levels
20+
21+
open import lists.finite-sequences
22+
23+
open import univalent-combinatorics.standard-finite-types
24+
```
25+
26+
</details>
27+
28+
## Idea
29+
30+
Given a nonempty [finite sequence](lists.finite-sequences.md) `a` with elements
31+
`a₀, a₁, ..., aₙ`, the
32+
{{#concept "sequence of pairs of successive elements" Agda=pair-succ-fin-sequence}}
33+
of `a` is the the sequence `(a₀, a₁), (a₁, a₂), ..., (aₙ₋₁, aₙ)`.
34+
35+
## Definition
36+
37+
```agda
38+
pair-succ-fin-sequence :
39+
{l : Level} {A : UU l} (n : ℕ)
40+
fin-sequence A (succ-ℕ n) fin-sequence (A × A) n
41+
pair-succ-fin-sequence n a i =
42+
( a (skip-zero-Fin n i) ,
43+
a (inl-Fin n i))
44+
```

0 commit comments

Comments
 (0)