Free modules #
We construct the free module over a ring R generated by a set X. It is assumed that both
R and X have decidable equality. This is to obtain decidable equality for the elements of
the module, which we do (FreeModule.decEq).
We choose our definition to allow both such computations and to prove results.
The definition is as a quotient of Formal Sums (FormalSum),
which are simply lists of pairs (a, x) where a is a coefficient in R and x is a term in X.
We associate to such a formal sum a coordinate function X → R (FormalSum.coords).
We see that having the same coordinate functions gives an equivalence relation on the formal sums.
The free module (FreeModule) is then defined as the corresponding quotient of such formal sums.
We also give an alternative description via moves, which is more convenient for universal properties.
Formal sums #
Coordinate functions and Supports #
- We define coordinate functions X → R for formal sums.
- We define (weak) support, relate non-zero coordinates.
- We prove decidable equality on a list (easy fact).
Coordinate functions #
The definition of coordinate functions is in two steps. We first define the coordinate for a pair
(a, x), and then define the coordinate function for a formal sum by summing over such terms.
Coordinates for a formal sum with one term.
Equations
Instances For
Homomorphism property for coordinates for a formal sum with one term.
Associativity of scalar multiplication coordinates for a formal sum with one term.
Coordinates for a formal sum with one term with scalar 0.
The coordinates for a formal sum.
Equations
- LeanPool.Polylean.FormalSum.coords [] x✝ = 0
- LeanPool.Polylean.FormalSum.coords (h :: t) x✝ = LeanPool.Polylean.monomCoeff R X x✝ h + LeanPool.Polylean.FormalSum.coords t x✝
Instances For
Support of a formal sum #
We next define the support of a formal sum and prove the property that coordinates vanish outside the support.
Equality of coordinates on a list #
We define equality of coordinates on a list and prove that it is decidable and implied by equality of formal sums.
The condition of being equal on all elements is a given list
Equations
- LeanPool.Polylean.equalOnList [] f g = (true = true)
- LeanPool.Polylean.equalOnList (h :: t) f g = (f h = g h ∧ LeanPool.Polylean.equalOnList t f g)
Instances For
Equal functions are equal on arbitrary supports.
Functions equal on support l are equal on each x ∈ l.
Decidability of equality on list.
Equations
- One or more equations did not get rendered due to their size.
- LeanPool.Polylean.decidableEqualOnList [] f g = isTrue LeanPool.Polylean.decidableEqualOnList._proof_1
Quotient Free Module #
- We define relation by having equal coordinates
- We show this is an equivalence relation and define the quotient
Relation by equal coordinates.
Equations
- LeanPool.Polylean.eqlCoords R X s₁ s₂ = (s₁.coords = s₂.coords)
Instances For
Relation by equal coordinates is reflexive.
Relation by equal coordinates is symmetric.
Relation by equal coordinates is transitive.
Relation by equal coordinates is an equivalence relation.
Setoid based on equal coordinates.
Equations
- LeanPool.Polylean.formalSumSetoid R X = { r := LeanPool.Polylean.eqlCoords R X, iseqv := ⋯ }
Quotient free module.
Equations
- R[X] = Quotient (LeanPool.Polylean.formalSumSetoid R X)
Instances For
Notation for the quotient free module over R generated by G.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Decidable equality on quotient free modules #
We show that the free module F[X] has decidable equality. This has two steps:
- show decidable equality for images of formal sums.
- lift to quotient (by relating to formal sums).
We also show that the coordinate functions are defined on the quotient.
Equality on both supports gives equal quotients.
Decidable equality for quotient elements in the free module
Equations
- One or more equations did not get rendered due to their size.
Lift to quotient #
Boolean equality on support.
Equations
- LeanPool.Polylean.FreeModule.beqOnSupport l f g = l.all fun (x : X) => decide (f x = g x)
Instances For
Equality on support from boolean equality.
Boolean equality on support gives equal quotients.
Boolean equality for the quotient via lifting
Equations
- LeanPool.Polylean.FreeModule.beqQuot = Quotient.lift₂ (fun (s₁ s₂ : LeanPool.Polylean.FormalSum R X) => decide (⟦s₁⟧ = ⟦s₂⟧)) ⋯
Instances For
Boolean equality for the quotient is equality.
Boolean inequality for the quotient is inequality.
Induced coordinates on the quotient. #
Coordinates are well defined on the quotient.
coordinates for the quotient
Equations
- LeanPool.Polylean.FreeModule.coordinates x₀ = Quotient.lift (fun (s : LeanPool.Polylean.FormalSum R X) => s.coords x₀) ⋯
Instances For
Module structure #
We define the module structure on the quotient of the free module by the equivalence relation.
- We define scalar multiplication and addition on formal sums.
- We show that we have induced operations on the quotient.
- We show that the induced operations give a module structure on the quotient.
Scalar multiplication: on formal sums and on the quotient. #
Scalar multiplication on formal sums.
Equations
Instances For
Scalar multiplication on the Free Module.
Equations
- LeanPool.Polylean.FreeModule.scmul r = Quotient.lift (fun (s : LeanPool.Polylean.FormalSum R X) => ⟦LeanPool.Polylean.FormalSum.scmul r s⟧) ⋯
Instances For
Addition: on formal sums and on the quotient. #
Coordinates well-defined up to equivalence.
Addition of elements in the free module.
Equations
- LeanPool.Polylean.FreeModule.add = Quotient.lift₂ (fun (s₁ s₂ : LeanPool.Polylean.FormalSum R X) => ⟦s₁ ++ s₂⟧) ⋯
Instances For
Equations
Equations
Properties of operations on formal sums. #
Distributivity for the module operations.
Module properties for the free module. #
Associativity for scalar and ring products.
Commutativity of addition.
Associativity of addition.
The zero element of the free module.
Instances For
adding zero
adding zero
Distributivity for addition of module elements.
Distributivity with respect to scalars.
Multiplication by 1 : R.
Multiplication by 0 : R.
Equations
The module is an additive commutative group, mainly proved as a check
Equations
- One or more equations did not get rendered due to their size.
Equivalent definition of the relation via moves #
For conceptual results such as the universal property (needed for the group ring structure) it is useful to define the relation on the free module in terms of moves. We do this, and show that this is the same as the relation defined by equality of coordinates.
- We define elementary moves on formal sums
- We show coordinates equal if and only if related by elementary moves
- Hence can define map on Free Module when invariant under elementary moves
Elementary moves for formal sums.
- zeroCoeff {R X : Type} [Ring R] [DecidableEq R] [DecidableEq X] (tail : FormalSum R X) (x : X) (a : R) (h : a = 0) : ElementaryMove R X ((a, x) :: tail) tail
- addCoeffs {R X : Type} [Ring R] [DecidableEq R] [DecidableEq X] (a b : R) (x : X) (tail : FormalSum R X) : ElementaryMove R X ((a, x) :: (b, x) :: tail) ((a + b, x) :: tail)
- cons {R X : Type} [Ring R] [DecidableEq R] [DecidableEq X] (a : R) (x : X) (s₁ s₂ : FormalSum R X) : ElementaryMove R X s₁ s₂ → ElementaryMove R X ((a, x) :: s₁) ((a, x) :: s₂)
- swap {R X : Type} [Ring R] [DecidableEq R] [DecidableEq X] (a₁ a₂ : R) (x₁ x₂ : X) (tail : FormalSum R X) : ElementaryMove R X ((a₁, x₁) :: (a₂, x₂) :: tail) ((a₂, x₂) :: (a₁, x₁) :: tail)
Instances For
Free module quotient using elementary moves on formal sums.
Equations
Instances For
Image in the quotient (i.e., actual, not formal, sum).
Equations
- s.sum = Quot.mk (LeanPool.Polylean.ElementaryMove R X) s
Instances For
Equivalence by having the same image.
Instances For
Infix notation for equivalence by elementary moves.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Invariance of coordinates under elementary moves #
Coordinates are invariant under moves.
Coordinates on the quotients.
Equations
- LeanPool.Polylean.FreeModuleAux.coeff x₀ = Quot.lift (fun (s : LeanPool.Polylean.FormalSum R X) => s.coords x₀) ⋯
Instances For
Commutative diagram for coordinates.
Coordinates well-defined under the equivalence generated by moves.
Equal coordinates implies related by elementary moves. #
If a coordinate x for a formal sum s is non-zero, s is related by moves to a formal sum
with first term x with coefficient its coordinates, and the rest shorter than s.
If all coordinates are zero, then moves relate to the empty sum.
If coordinates are equal, the sums are related by moves.
Functions invariant under moves pass to the quotient. #
Lifting functions to the move induced quotient.
Injectivity of inclusions #
We show that, under appropriate hypotheses, two inclusions into Free Modules are injective.
- If
a : Ris nonzero, thenx : X ↦ ⟦[(a, x)]⟧is injective. - If
x: X, thena : R ↦ ⟦[(a, x)]⟧is injective.
These are used in proving injectivity results for related functions on group rings, which act as a check on the correctness of the definitions.
For a : R and a ≠ 0, injectivity of the function x : X ↦ [(a, x)] up to
equivalence.
For x: X, the functions a : R ↦ ⟦[(a, x)]⟧
Instances For
Injectivity of coeffInclusion
For a: A, the function x: X ↦ ⟦[(a, x)]⟧
Instances For
Injectivity of baseInclusion a give a ≠0
Basic Repr #
An instance of Repr on Free Modules, mainly for debugging (fairly crude). This is implemented
by constructing a norm ball containing all the non-zero coordinates, and then making a list of
non-zero coordinates.
The successor of the largest norm with nonzero coordinate on a support list.
Equations
- LeanPool.Polylean.maxNormSuccOnSupp norm crds [] = 0
- LeanPool.Polylean.maxNormSuccOnSupp norm crds (h :: t) = if crds h ≠ 0 then max (norm h + 1) (LeanPool.Polylean.maxNormSuccOnSupp norm crds t) else LeanPool.Polylean.maxNormSuccOnSupp norm crds t
Instances For
The successor of the largest norm with nonzero coefficient in a formal sum.
Equations
Instances For
The finite cube at radius k.
Equations
Instances For
Equations
- LeanPool.Polylean.natCube = { norm := id, cube := fun (n : ℕ) => (List.range n).reverse }
Equations
- LeanPool.Polylean.intCube = { norm := Int.natAbs, cube := fun (n : ℕ) => List.map Int.ofNat (List.range n).reverse ++ List.map Int.negSucc (List.range (n - 1)) }
A norm bound for the support of a quotient free-module element.
Equations
- x.normBound = Quotient.lift (fun (s : LeanPool.Polylean.FormalSum R X) => LeanPool.Polylean.FormalSum.normSucc LeanPool.Polylean.NormCube.norm s) ⋯ x
Instances For
The nonzero coefficients of a quotient free-module element in a bounded cube.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- LeanPool.Polylean.basicRepr = { reprPrec := fun (x : R[X]) (x_1 : ℕ) => Std.Format.text (reprStr x.coeffList) }