module Algebra.Ring.Module.Vec {β} (R : Ring β) where
The module of finite vectorsπ
Fix a ring and choose to be your favourite natural number β or a natural number you totally despise, thatβs fine, too. A basic fact from high school linear algebra is that, for a natural number, βlists of realsβ are a vector space over the field of real numbers Here we prove a generalisation of that fact: lists of elements of are a module over
: β n β Module R β
Fin-vec-module = to-module mk where
Fin-vec-module n : make-module R (Fin n β β R β)
mk .make-module.has-is-set = hlevel 2
mk .make-module._+_ f g i = f i R.+ g i
mk .make-module.inv f i = R.- f i
mk .make-module.0g i = R.0r
mk .make-module._β_ f g i = f R.* g i
mk
.make-module.+-assoc f g h = funext Ξ» i β R.+-associative
mk .make-module.+-invl f = funext Ξ» i β R.+-invl
mk .make-module.+-idl f = funext Ξ» i β R.+-idl
mk .make-module.+-comm f g = funext Ξ» i β R.+-commutes
mk .make-module.β-distribl r x y = funext Ξ» i β R.*-distribl
mk .make-module.β-distribr r x y = funext Ξ» i β R.*-distribr
mk .make-module.β-assoc r s x = funext Ξ» i β R.*-associative
mk .make-module.β-id x = funext Ξ» i β R.*-idl mk
Furthermore, the module of vectors has the following nice property: If is an vector with entries for some other there is a unique linear map which agrees with our original This map is given by linear extension: The vector gives rise to the map which sends to
: β {n} β (Fin n β β S β)
linear-extension β Linear-map (Fin-vec-module n) S
.map x = β G' Ξ» i β x i S.β fun i
linear-extension fun .lin .linear r m n =
linear-extension fun (Ξ» i β (r R.* m i R.+ n i) S.β fun i) β‘β¨ ap (β G') (funext Ξ» i β S.β-distribr (r R.* m i) (n i) (fun i)) β©
β G' (Ξ» i β (r R.* m i) S.β fun i S.+ n i S.β fun i) β‘β¨ β-split (Module-onβAbelian-group-on (S .snd)) (Ξ» i β (r R.* m i) S.β fun i) _ β©
β G' (Ξ» i β (r R.* m i) S.β fun i) β S.+ β G' (Ξ» i β n i S.β fun i) β‘β¨ ap! (ap (β G') (funext Ξ» i β sym (S.β-assoc r (m i) _))) β©
β β G' (Ξ» i β r S.β m i S.β fun i) β S.+ β G' (Ξ» i β n i S.β fun i) β‘Λβ¨ apΒ‘ (β-distr r Ξ» i β m i S.β fun i) β©
β β G' (r S.β β G' (Ξ» i β m i S.β fun i) S.+ β G' Ξ» i β n i S.β fun i) β
As productsπ
To reduce how arbitrary the construction above seems, we show that the module of finite vectors is equivalently the finite product of with itself, times (indirectly justifying the notation while weβre at it). Note that this is a product in the category , not in the category of rings.
open is-indexed-product
open Indexed-product
Fin-vec-is-product: β {n} β Indexed-product (R-Mod R _) {Idx = Fin n} Ξ» _ β representable-module R
{n} .Ξ F = Fin-vec-module n
Fin-vec-is-product .Ο i .hom k = k i
Fin-vec-is-product .Ο i .preserves .linear r m n = refl
Fin-vec-is-product {n} .has-is-ip .tuple {Y} f = assemble where
Fin-vec-is-product : R-Mod.Hom Y (Fin-vec-module n)
assemble .hom yob ix = f ix # yob
assemble .preserves .linear r m n = funext Ξ» i β f i .preserves .linear _ _ _
assemble .has-is-ip .commute = trivial!
Fin-vec-is-product .has-is-ip .unique {h = h} f ps =
Fin-vec-is-product Ξ» i ix β ap hom (ps ix) $β i ext