1-- Multiplication can be checked on generators of a relative linear span.2-- Part of Cumulus, the Grace17 mathematics library.3-- Copyright (c) 2026 Grant Passmore.4-- Released under the Apache License 2.0. See LICENSE in the repository root.5-- Authors: Grant Passmore67module Grace.Cumulus.Algebra.LinearSpanMultiplication8import LinearSpan910def rightMultipliers (B times T y : Set) : Set:= {u ∈ B | times(u, y) ∈ T}1112section Algebras13variable (A add zero neg mul one B plus z minus times unit f T y : Set)14notationring R := (A, add, zero, neg, mul, one)15notationring S := (B, plus, z, minus, times, unit)16hypothesis source : IsCommRing(R)17hypothesis target : IsCommRing(S)18hypothesis hom : IsRingHom(f, R, S)19hypothesis submodule : Submodule(f, R, S, T)20hypothesis element : y ∈ S2122theorem rightMultipliers.submodule23shows Submodule(f, R, S, rightMultipliers(B, times, T, y))24proof25have ordinary := IsCommRing.ring with target26have zeroIn := IsRing.zero_in_carrier with ordinary27have zeroMem := Submodule.zero_mem with source, target, hom, submodule28have negClosed := Submodule.neg_closed with source, target, hom, submodule29have addClosed := Submodule.add_closed with source, target, hom, submodule30have bounded : rightMultipliers(B, times, T, y) ⊆ B bysimp [Subset, rightMultipliers]31have zeroMember : S[0] ∈ rightMultipliers(B, times, T, y)32have value : S[0* y] = S[0] byring33apply rightMultipliers.membership.backward34rw value35refine⟨zeroIn, zeroMem⟩36have negative : ClosedUnary(rightMultipliers(B, times, T, y), minus)37intros u hu38obtain⟨member, product⟩:= rightMultipliers.membership.forward with hu39have closed := IsRing.neg_closed with ordinary, member40have included := ClosedUnary.mem with negClosed, product41have equation : S[(-u) * y] = S[-(u * y)] byring42apply rightMultipliers.membership.backward43rw equation44refine⟨closed, included⟩45have addition : ClosedBinary(rightMultipliers(B, times, T, y), plus)46intros u hu v hv47obtain⟨memberU, productU⟩:= rightMultipliers.membership.forward with hu48obtain⟨memberV, productV⟩:= rightMultipliers.membership.forward with hv49have closed := IsRing.add_closed with ordinary, memberU, memberV50have included := ClosedBinary.mem with addClosed, productU, productV51have equation : S[(u + v) * y] = S[u * y + v * y] byring52apply rightMultipliers.membership.backward53rw equation54refine⟨closed, included⟩55have scalars : ∀ a ∈ R, ∀ u ∈ rightMultipliers(B, times, T, y), S[f(a) * u] ∈ rightMultipliers(B, times, T, y)56intros a ha u hu57obtain⟨member, product⟩:= rightMultipliers.membership.forward with hu58have image := IsRingHom.closed with hom, ha59have closed := IsRing.mul_closed with ordinary, image, member60have included := Submodule.scalar_mul_mem with source, target, hom, submodule, ha, product61have equation : S[(f(a) * u) * y] = S[f(a) * (u * y)] byring62apply rightMultipliers.membership.backward63rw equation64refine⟨closed, included⟩65unfold Submodule66refine⟨bounded, zeroMember, negative, addition, scalars⟩6768theorem linearSpan.mul_mem (G x : Set)69requires bounded : G ⊆ S70requires generators : ∀ g ∈ G, S[g * y] ∈ T71requires member : x ∈ linearSpan(f, R, S, G)72shows S[x * y] ∈ T73proof74have multipliers := rightMultipliers.submodule with*75have included : G ⊆ rightMultipliers(B, times, T, y)76intros g hg77have inB := bounded with g, hg78have product := generators with g, hg79exact rightMultipliers.membership.backward with⟨inB, product⟩80have span := linearSpan.least with source, target, hom, multipliers, included81have multiplier := span with x, member82have data := rightMultipliers.membership.forward with multiplier83exact data.right8485end Algebras86