Documentation

UnitConjecture.FreeModule

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 #

@[inline]
abbrev FormalSum (R : Type u_1) (X : Type u_2) [inst : Ring R] :
Type (maxu_2u_1)

A formal sum represents an R-linear combination of finitely many elements of X. This is implemented as a list R × X, which associates to each element X of the list a coefficient from R.

Equations

Coordinate functions and Supports #

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.

def monomCoeff (R : Type u_1) (X : Type u_2) [inst : Ring R] [inst : DecidableEq X] (x₀ : X) (nx : R × X) :
R

Coordinates for a formal sum with one term.

Equations
theorem monom_coords_hom {R : Type u_1} [inst : Ring R] {X : Type u_2} [inst : DecidableEq X] (x₀ : X) (x : X) (a : R) (b : R) :
monomCoeff R X x₀ (a + b, x) = monomCoeff R X x₀ (a, x) + monomCoeff R X x₀ (b, x)

Homomorphism property for coordinates for a formal sum with one term.

theorem monom_coords_mul {R : Type u_1} [inst : Ring R] {X : Type u_2} [inst : DecidableEq X] {x : X} (x₀ : X) (a : R) (b : R) :
monomCoeff R X x₀ (a * b, x) = a * monomCoeff R X x₀ (b, x)

Associativity of scalar multiplication coordinates for a formal sum with one term.

theorem monom_coords_at_zero {R : Type u_1} [inst : Ring R] {X : Type u_2} [inst : DecidableEq X] (x₀ : X) (x : X) :
monomCoeff R X x₀ (0, x) = 0

Coordinates for a formal sum with one term with scalar 0.

def FormalSum.coords {R : Type u_1} [inst : Ring R] {X : Type u_2} [inst : DecidableEq X] :
FormalSum R XXR

The coordinates for a formal sum.

Equations

Support of a formal sum #

We next define the support of a formal sum and prove the property that coordinates vanish outside the support.

def FormalSum.support {R : Type u_1} [inst : Ring R] {X : Type u_2} (s : FormalSum R X) :

Support for a formal sum in a weak sense (coordinates may vanish on this).

Equations
theorem nonzero_coord_in_support {R : Type u_1} [inst : Ring R] {X : Type u_2} [inst : DecidableEq X] (s : FormalSum R X) (x : X) :

Support contains elements x : X where the coordinate is not 0.

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.

def equalOnList {R : Type u_1} {X : Type u_2} (l : List X) (f : XR) (g : XR) :

The condition of being equal on all elements is a given list

Equations
theorem equalOnList_of_equal {R : Type u_2} {X : Type u_1} (l : List X) (f : XR) (g : XR) :
f = gequalOnList l f g

Equal functions are equal on arbitrary supports.

theorem eq_mem_of_equalOnList {R : Type u_2} {X : Type u_1} (l : List X) (f : XR) (g : XR) (x : X) (mhyp : x l) :
equalOnList l f gf x = g x

Functions equal on support l are equal on each x ∈ l.

instance decidableEqualOnList {R : Type u_1} [inst : DecidableEq R] {X : Type u_2} (l : List X) (f : XR) (g : XR) :

Decidability of equality on list.

Equations

Quotient Free Module #

def eqlCoords (R : Type) (X : Type) [inst : Ring R] [inst : DecidableEq X] (s₁ : FormalSum R X) (s₂ : FormalSum R X) :

Relation by equal coordinates.

Equations
theorem eqlCoords.refl {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (s : FormalSum R X) :
eqlCoords R X s s

Relation by equal coordinates is reflexive.

theorem eqlCoords.symm {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] {s₁ : FormalSum R X} {s₂ : FormalSum R X} :
eqlCoords R X s₁ s₂eqlCoords R X s₂ s₁

Relation by equal coordinates is symmetric.

theorem eqlCoords.trans {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] {s₁ : FormalSum R X} {s₂ : FormalSum R X} {s₃ : FormalSum R X} :
eqlCoords R X s₁ s₂eqlCoords R X s₂ s₃eqlCoords R X s₁ s₃

Relation by equal coordinates is transitive.

theorem eqlCoords.is_equivalence {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] :

Relation by equal coordinates is an equivalence relation.

instance formalSumSetoid (R : Type) (X : Type) [inst : Ring R] [inst : DecidableEq X] :

Setoid based on equal coordinates.

Equations
@[inline]
abbrev FreeModule (R : Type) (X : Type) [inst : Ring R] [inst : DecidableEq X] :

Quotient free module.

Equations
Equations
  • One or more equations did not get rendered due to their size.

Decidable equality on quotient free modules #

We show that the free module F[X] has decidable equality. This has two steps:

We also show that the coordinate functions are defined on the quotient.

instance FreeModule.decideEqualQuotient {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (s₁ : FormalSum R X) (s₂ : FormalSum R X) :

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 #

def FreeModule.beqOnSupport {R : Type u_1} [inst : DecidableEq R] {X : Type u_2} (l : List X) (f : XR) (g : XR) :

Boolean equality on support.

Equations
theorem FreeModule.eql_on_support_of_true {R : Type u_2} [inst : DecidableEq R] {X : Type u_1} {l : List X} {f : XR} {g : XR} :

Equality on support from boolean equality.

Boolean equality on support gives equal quotients.

def FreeModule.beq_quot {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (x₁ : R[X]) (x₂ : R[X]) :

Boolean equality for the quotient via lifting

Equations
  • One or more equations did not get rendered due to their size.
theorem FreeModule.eq_of_beq_true {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (x₁ : R[X]) (x₂ : R[X]) :
FreeModule.beq_quot x₁ x₂ = truex₁ = x₂

Boolean equality for the quotient is equality.

theorem FreeModule.neq_of_beq_false {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (x₁ : R[X]) (x₂ : R[X]) :
FreeModule.beq_quot x₁ x₂ = false¬x₁ = x₂

Boolean inequality for the quotient is inequality.

instance FreeModule.decEq {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (x₁ : R[X]) (x₂ : R[X]) :
Decidable (x₁ = x₂)

Decidable equality for the free module.

Equations

Induced coordinates on the quotient. #

theorem FreeModule.equal_coords_of_approx {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (s₁ : FormalSum R X) (s₂ : FormalSum R X) :
s₁ s₂FormalSum.coords s₁ = FormalSum.coords s₂

Coordinates are well defined on the quotient.

def FreeModule.coordinates {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (x₀ : X) :
R[X]R

coordinates for the quotient

Equations

Module structure #

We define the module structure on the quotient of the free module by the equivalence relation.

Scalar multiplication: on formal sums and on the quotient. #

def FormalSum.scmul {R : Type u_1} [inst : Ring R] {X : Type u_2} :
RFormalSum R XFormalSum R X

Scalar multiplication on formal sums.

Equations
theorem FormalSum.scmul_coords {R : Type u_1} [inst : Ring R] {X : Type u_2} [inst : DecidableEq X] (r : R) (s : FormalSum R X) (x₀ : X) :

Coordinates after scalar multiplication.

def FormalSum.FreeModule.scmul {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] :
RR[X]R[X]

Scalar multiplication on the Free Module.

Equations
  • One or more equations did not get rendered due to their size.

Addition: on formal sums and on the quotient. #

theorem FormalSum.append_coords {R : Type u_1} [inst : Ring R] {X : Type u_2} [inst : DecidableEq X] (s₁ : FormalSum R X) (s₂ : FormalSum R X) (x₀ : X) :
FormalSum.coords s₁ x₀ + FormalSum.coords s₂ x₀ = FormalSum.coords (s₁ ++ s₂) x₀

Coordinates add when appending.

theorem FormalSum.append_equiv {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (s₁ : FormalSum R X) (s₂ : FormalSum R X) (t₁ : FormalSum R X) (t₂ : FormalSum R X) :
s₁ s₂t₁ t₂s₁ ++ t₁ s₂ ++ t₂

Coordinates well-defined up to equivalence.

def FreeModule.add {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] :
R[X]R[X]R[X]

Addition of elements in the free module.

Equations
  • One or more equations did not get rendered due to their size.
instance instAddFreeModule {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] :
Add (R[X])
Equations
  • instAddFreeModule = { add := FreeModule.add }
instance instHSMulFreeModule {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] :
HSMul R (R[X]) (R[X])
Equations
  • instHSMulFreeModule = { hSMul := FormalSum.FreeModule.scmul }

Properties of operations on formal sums. #

theorem FormalSum.action {R : Type u_1} [inst : Ring R] {X : Type u_2} (a : R) (b : R) (s : FormalSum R X) :

Associativity for scalar multiplication for formal sums.

theorem FormalSum.act_sum {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (a : R) (b : R) (s : FormalSum R X) :

Distributivity for the module operations.

Module properties for the free module. #

theorem FreeModule.module_action {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (a : R) (b : R) (x : R[X]) :
a b x = (a * b) x

Associativity for scalar and ring products.

theorem FreeModule.addn_comm {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (x₁ : R[X]) (x₂ : R[X]) :
x₁ + x₂ = x₂ + x₁

Commutativity of addition.

theorem FreeModule.add_assoc_aux {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (s₁ : FormalSum R X) (x₂ : R[X]) (x₃ : R[X]) :
Quotient.mk (formalSumSetoid R X) s₁ + x₂ + x₃ = Quotient.mk (formalSumSetoid R X) s₁ + (x₂ + x₃)
theorem FreeModule.addn_assoc {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (x₁ : R[X]) (x₂ : R[X]) (x₃ : R[X]) :
x₁ + x₂ + x₃ = x₁ + (x₂ + x₃)

Associativity of addition.

def FreeModule.zero {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] :
R[X]

The zero element of the free module.

Equations
theorem FreeModule.addn_zero {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (x : R[X]) :
x + FreeModule.zero = x

adding zero

theorem FreeModule.zero_addn {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (x : R[X]) :
FreeModule.zero + x = x

adding zero

theorem FreeModule.elem_distrib {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (a : R) (x₁ : R[X]) (x₂ : R[X]) :
a (x₁ + x₂) = a x₁ + a x₂

Distributivity for addition of module elements.

theorem FreeModule.coeffs_distrib {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (a : R) (b : R) (x : R[X]) :
a x + b x = (a + b) x

Distributivity with respect to scalars.

theorem FreeModule.unit_coeffs {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (x : R[X]) :
1 x = x

Multiplication by 1 : R.

theorem FreeModule.zero_coeffs {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] (x : R[X]) :

Multiplication by 0 : R.

instance FreeModule.instAddCommGroupFreeModule {R : Type} [inst : Ring R] {X : Type} [inst : DecidableEq X] :

The module is an additive commutative group, mainly proved as a check

Equations
  • FreeModule.instAddCommGroupFreeModule = AddCommGroup.mk (_ : ∀ (x₁ x₂ : R[X]), x₁ + x₂ = x₂ + x₁)

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.

inductive ElementaryMove (R : Type) (X : Type) [inst : Ring R] [inst : DecidableEq R] [inst : DecidableEq X] :
FormalSum R XFormalSum R XProp

Elementary moves for formal sums.

Instances For
    def FreeModuleAux (R : Type) (X : Type) [inst : Ring R] [inst : DecidableEq R] [inst : DecidableEq X] :
    Equations
    def FormalSum.sum {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (s : FormalSum R X) :

    Image in the quotient (i.e., actual, not formal, sum).

    Equations
    def FormalSum.equiv {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (s₁ : FormalSum R X) (s₂ : FormalSum R X) :

    Equivalence by having the same image.

    Equations

    Invariance of coordinates under elementary moves #

    theorem FormalSum.coords_move_invariant {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (x₀ : X) (s₁ : FormalSum R X) (s₂ : FormalSum R X) (h : ElementaryMove R X s₁ s₂) :
    FormalSum.coords s₁ x₀ = FormalSum.coords s₂ x₀

    Coordinates are invariant under moves.

    def FreeModuleAux.coeff {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (x₀ : X) :
    FreeModuleAux R XR

    Coordinates on the quotients.

    Equations
    theorem FormalSum.coeff_factors {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (x : X) (s : FormalSum R X) :

    Commutative diagram for coordinates.

    theorem FormalSum.coords_well_defined {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (x : X) (s₁ : FormalSum R X) (s₂ : FormalSum R X) :
    s₁ s₂FormalSum.coords s₁ x = FormalSum.coords s₂ x

    Coordinates well-defined under the equivalence generated by moves.

    theorem FormalSum.cons_equiv_of_equiv {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (s₁ : FormalSum R X) (s₂ : FormalSum R X) (a : R) (x : X) :
    s₁ s₂(a, x) :: s₁ (a, x) :: s₂

    Cons respects equivalence.

    theorem FormalSum.nonzero_coeff_has_complement {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (x₀ : X) (s : FormalSum R X) :
    0 FormalSum.coords s x₀ys, (FormalSum.coords s x₀, x₀) :: ys s List.length ys < List.length s

    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.

    theorem FormalSum.equiv_e_of_zero_coeffs {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (s : FormalSum R X) (hyp : ∀ (x : X), FormalSum.coords s x = 0) :
    s []

    If all coordinates are zero, then moves relate to the empty sum.

    theorem FormalSum.equiv_of_equal_coeffs {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (s₁ : FormalSum R X) (s₂ : FormalSum R X) (hyp : ∀ (x : X), FormalSum.coords s₁ x = FormalSum.coords s₂ x) :
    s₁ s₂

    If coordinates are equal, the sums are related by moves.

    Functions invariant under moves pass to the quotient. #

    theorem FormalSum.func_eql_of_move_equiv {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] {β : Sort u} (f : FormalSum R Xβ) :
    (∀ (s₁ s₂ : FormalSum R X), ElementaryMove R X s₁ s₂f s₁ = f s₂) → ∀ (s₁ s₂ : FormalSum R X), s₁ s₂f s₁ = f s₂

    Lifting functions to the move induced quotient.

    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

    theorem fst_le_max (a : ) (b : ) :
    a max a b
    theorem snd_le_max (a : ) (b : ) :
    b max a b
    theorem eq_fst_or_snd_of_max (a : ) (b : ) :
    max a b = a max a b = b
    def maxNormSuccOnSupp {R : Type u_1} [inst : Ring R] [inst : DecidableEq R] {X : Type u_2} (norm : X) (crds : XR) (s : List X) :
    Equations
    theorem max_in_support {R : Type u_2} [inst : Ring R] [inst : DecidableEq R] {X : Type u_1} (norm : X) (crds : XR) (s : List X) :
    maxNormSuccOnSupp norm crds s > 0x, crds x 0 maxNormSuccOnSupp norm crds s = norm x + 1
    theorem supp_below_max {R : Type u_2} [inst : Ring R] [inst : DecidableEq R] {X : Type u_1} (norm : X) (crds : XR) (s : List X) (x : X) :
    x scrds x 0norm x + 1 maxNormSuccOnSupp norm crds s
    theorem supp_zero_of_max_zero {R : Type u_2} [inst : Ring R] [inst : DecidableEq R] {X : Type u_1} (norm : X) (crds : XR) (s : List X) :
    maxNormSuccOnSupp norm crds s = 0∀ (x : X), x scrds x = 0
    def FormalSum.normSucc {R : Type u_1} [inst : Ring R] [inst : DecidableEq R] {X : Type u_2} [inst : DecidableEq X] (norm : X) (s : FormalSum R X) :
    Equations
    theorem normsucc_le {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (norm : X) (s₁ : FormalSum R X) (s₂ : FormalSum R X) (eql : s₁ s₂) :
    theorem norm_succ_eq {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (norm : X) (s₁ : FormalSum R X) (s₂ : FormalSum R X) (eql : s₁ s₂) :
    class NormCube (α : Type) :
    Instances
      def normCube (α : Type) [nc : NormCube α] (k : ) :
      List α
      Equations
      instance natCube :
      Equations
      instance finCube {k : } :
      Equations
      • One or more equations did not get rendered due to their size.
      instance prodCube {α : Type} {β : Type} [na : NormCube α] [nb : NormCube β] :
      NormCube (α × β)
      Equations
      • One or more equations did not get rendered due to their size.
      def FreeModule.normBound {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (x : R[X]) [nx : NormCube X] :
      Equations
      • One or more equations did not get rendered due to their size.
      def FreeModule.coeffList {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] (x : R[X]) [nx : NormCube X] :
      List (R × X)
      Equations
      instance basicRepr {R : Type} [inst : Ring R] [inst : DecidableEq R] {X : Type} [inst : DecidableEq X] [inst : NormCube X] [inst : Repr X] [inst : Repr R] :
      Repr (R[X])
      Equations