Grace/Cumulus/Algebra/Algebras/Quotient.g17

Open in Workbench Download source

Imports

Grace.Cumulus.Algebra.Algebras.Basic · Grace.Cumulus.Algebra.Ring

Declarations

Source

1-- Quotients of algebras by ideals: the quotient algebra, its projection,2-- and the lift of a homomorphism that kills the ideal, in particular an3-- ideal generated by finitely many elements the homomorphism sends to zero.4-- Part of Cumulus, the Grace17 mathematics library.5-- Copyright (c) 2026 Grant Passmore.6-- Released under the Apache License 2.0. See LICENSE in the repository root.7-- Authors: Grant Passmore89module Grace.Cumulus.Algebra.Algebras.Quotient10import Grace.Cumulus.Algebra.Algebras.Basic11import Grace.Cumulus.Algebra.Ring1213-- The definitions.1415-- The projection of the ring of A onto its quotient by J.16def algebraProjection (A J : Set) : Set :=17  quotientProjection(algebraCarrier(A), quotientRelation(Algebra.ring(A), J))1819-- The quotient algebra: the quotient ring with the projected structure map.20def quotientAlgebra (A J : Set) : Set :=21  Algebra.mk(Algebra.base(A), quotientRing(Algebra.ring(A), J),22    compose(algebraProjection(A, J), Algebra.map(A),23      Ring.carrier(Algebra.base(A)), algebraCarrier(A),24      Ring.carrier(quotientRing(Algebra.ring(A), J))))2526-- The homomorphism a quotient inherits from one that kills the ideal.27def algebraLift (f A B J : Set) : Set :=28  quotientMap(f, algebraCarrier(A), algebraCarrier(B),29    quotientRelation(Algebra.ring(A), J))3031-- The projections of the quotient algebra.32theorem quotientAlgebra.baseOf (A J : Set)33  shows Algebra.base(quotientAlgebra(A, J)) = Algebra.base(A)34proof35  simp [quotientAlgebra, Algebra.mk.base]3637theorem quotientAlgebra.ringOf (A J : Set)38  shows Algebra.ring(quotientAlgebra(A, J)) = quotientRing(Algebra.ring(A), J)39proof40  simp [quotientAlgebra, Algebra.mk.ring]4142theorem quotientAlgebra.mapOf (A J : Set)43  shows Algebra.map(quotientAlgebra(A, J)) =44    compose(algebraProjection(A, J), Algebra.map(A),45      Ring.carrier(Algebra.base(A)), algebraCarrier(A),46      Ring.carrier(quotientRing(Algebra.ring(A), J)))47proof48  simp [quotientAlgebra, Algebra.mk.map]4950theorem quotientAlgebra.carrierOf (A J : Set)51  shows algebraCarrier(quotientAlgebra(A, J)) =52    Ring.carrier(quotientRing(Algebra.ring(A), J))53proof54  unfold algebraCarrier55  rw quotientAlgebra.ringOf5657section Quotients58variable (A J : Set)59hypothesis algebra : Algebra(A)60hypothesis ideal : Ideal(Algebra.ring(A), J)6162-- The projection: a ring homomorphism onto the quotient, sending x to its63-- class, and killing exactly the ideal.64theorem algebraProjection.ring_hom65  shows algebraProjection(A, J) :66    Algebra.ring(A) →+* quotientRing(Algebra.ring(A), J)67proof68  have ringRing := Algebra.comm_ring with algebra69  have projection := quotientRing.projection_hom with ringRing, ideal70  unfold algebraProjection71  unfold algebraCarrier72  exact projection7374theorem algebraProjection.function75  shows algebraProjection(A, J) : algebraCarrier(A) →76    Ring.carrier(quotientRing(Algebra.ring(A), J))77proof78  obtain ⟨source, target, function, rest⟩ :=79    algebraProjection.ring_hom with algebra, ideal80  unfold algebraCarrier81  exact function8283theorem algebraProjection.value (x : Set)84  requires member : x ∈ algebraCarrier(A)85  shows algebraProjection(A, J)(x) =86    ⟦x⟧[algebraCarrier(A), quotientRelation(Algebra.ring(A), J)]87proof88  have ringRing := Algebra.comm_ring with algebra89  have equivalence := quotientRelation.equivalence with ringRing, ideal90  unfold algebraCarrier at member91  unfold algebraProjection92  unfold algebraCarrier93  exact quotientProjection.value with equivalence, member9495theorem algebraProjection.kills (x : Set)96  requires member : x ∈ J97  shows algebraProjection(A, J)(x) =98    Ring.zero(quotientRing(Algebra.ring(A), J))99proof100  have ringRing := Algebra.comm_ring with algebra101  have inCarrier := Ideal.mem_carrier at Algebra.ring(A), J, x with *102  have inAlgebra : x ∈ algebraCarrier(A)103    unfold algebraCarrier104    exact inCarrier105  have value := algebraProjection.value with algebra, ideal, inAlgebra106  have criterion := quotientRing.class_eq_zero_iff with ringRing, ideal,107    inCarrier108  rw [value, quotientRing.zeroOf]109  unfold algebraCarrier110  exact criterion.backward with member111112theorem algebraProjection.zero_iff (x : Set)113  requires member : x ∈ algebraCarrier(A)114  shows algebraProjection(A, J)(x) =115      Ring.zero(quotientRing(Algebra.ring(A), J)) ↔116    x ∈ J117proof118  have ringRing := Algebra.comm_ring with algebra119  have value := algebraProjection.value with algebra, ideal, member120  rw [value, quotientRing.zeroOf]121  unfold algebraCarrier at member122  unfold algebraCarrier123  exact quotientRing.class_eq_zero_iff with ringRing, ideal, member124125-- The quotient algebra, with the projection as a surjective homomorphism126-- onto it.127theorem quotientAlgebra.algebra128  shows Algebra(quotientAlgebra(A, J))129proof130  have baseRing := Algebra.base_comm_ring with algebra131  have ringRing := Algebra.comm_ring with algebra132  have structureMap := Algebra.structure_hom with algebra133  have quotientRing := quotientRing.comm_ring with ringRing, ideal134  have projection := quotientRing.projection_hom with ringRing, ideal135  have composite := RingHom.comp with baseRing, structureMap, projection136  unfold quotientAlgebra137  unfold algebraProjection138  unfold algebraCarrier139  exact Algebra.intro with baseRing, quotientRing, composite140141theorem algebraProjection.hom142  shows algebraProjection(A, J) : A →ₐ quotientAlgebra(A, J)143proof144  have quotient := quotientAlgebra.algebra with algebra, ideal145  have mapFunction := Algebra.map_function with algebra146  have projFunction := algebraProjection.function with algebra, ideal147  have projection := algebraProjection.ring_hom with algebra, ideal148  unfold AlgebraHom149  refine ⟨algebra, quotient, ?_, ?_, ?_⟩150  . symm151    exact quotientAlgebra.baseOf at A, J152  . rw quotientAlgebra.ringOf153    exact projection154  . intros a ha155    rw quotientAlgebra.mapOf156    symm157    exact compose.apply with mapFunction, projFunction, ha158159theorem algebraProjection.surjective160  shows SurjectiveBetween(algebraProjection(A, J), algebraCarrier(A),161    algebraCarrier(quotientAlgebra(A, J)))162proof163  have ringRing := Algebra.comm_ring with algebra164  have onto := quotientRing.projection_surjective with ringRing, ideal165  rw quotientAlgebra.carrierOf166  unfold algebraProjection167  unfold algebraCarrier168  exact onto169170-- Every element of the quotient is the class of an element of A.171theorem quotientAlgebra.representative (x : Set)172  requires member : x ∈ algebraCarrier(quotientAlgebra(A, J))173  shows ∃ y ∈ algebraCarrier(A), x = algebraProjection(A, J)(y)174proof175  have onto := algebraProjection.surjective with algebra, ideal176  obtain ⟨y, yIn, related⟩ := onto.right with x, member177  have value := FunctionBetween.apply_value with onto.left, yIn, related178  witness y179  refine ⟨yIn, ?_⟩180  rw value181182-- The lift. A homomorphism killing J has J inside its kernel, hence183-- respects the congruence modulo J; its lift sends the class of x to184-- f(x), is a homomorphism out of the quotient, and factors f through185-- the projection.186theorem AlgebraHom.kernel_of_killed (f B : Set)187  requires hom : f : A →ₐ B188  requires killed : ∀ x ∈ J, f(x) = Ring.zero(Algebra.ring(B))189  shows J ⊆ ringKernel(f, Ring.carrier(Algebra.ring(A)),190    Ring.zero(Algebra.ring(B)))191proof192  intros x hx193  have inCarrier := Ideal.mem_carrier at Algebra.ring(A), J, x with *194  have vanishes := killed with x, hx195  exact ringKernel.membership.backward with ⟨inCarrier, vanishes⟩196197theorem AlgebraHom.respects_of_killed (f B : Set)198  requires hom : f : A →ₐ B199  requires killed : ∀ x ∈ J, f(x) = Ring.zero(Algebra.ring(B))200  shows Respects(f, algebraCarrier(A), quotientRelation(Algebra.ring(A), J))201proof202  have targetAlgebra := AlgebraHom.target with hom203  have sourceParts := CommRing.parts with (Algebra.comm_ring with algebra)204  have targetParts := CommRing.parts with (Algebra.comm_ring with targetAlgebra)205  have homParts := RingHom.parts with (AlgebraHom.ring_hom with hom)206  have kernel := AlgebraHom.kernel_of_killed with algebra, ideal, hom, killed207  rw quotientRelation.value208  unfold algebraCarrier209  exact IsRingHom.respects_ideal with sourceParts, targetParts, homParts, kernel210211theorem algebraLift.class (f B x : Set)212  requires hom : f : A →ₐ B213  requires killed : ∀ x ∈ J, f(x) = Ring.zero(Algebra.ring(B))214  requires member : x ∈ algebraCarrier(A)215  shows algebraLift(f, A, B, J)(216    ⟦x⟧[algebraCarrier(A), quotientRelation(Algebra.ring(A), J)]) = f(x)217proof218  have ringRing := Algebra.comm_ring with algebra219  have function := AlgebraHom.function with hom220  have equivalence := quotientRelation.equivalence with ringRing, ideal221  have respects := AlgebraHom.respects_of_killed with algebra, ideal, hom,222    killed223  unfold algebraLift224  unfold algebraCarrier at function225  unfold algebraCarrier at respects226  unfold algebraCarrier at member227  unfold algebraCarrier228  exact quotientMap.class with function, equivalence, respects, member229230theorem AlgebraHom.lift (f B : Set)231  requires hom : f : A →ₐ B232  requires killed : ∀ x ∈ J, f(x) = Ring.zero(Algebra.ring(B))233  shows algebraLift(f, A, B, J) : quotientAlgebra(A, J) →ₐ B234proof235  have quotient := quotientAlgebra.algebra with algebra, ideal236  have targetAlgebra := AlgebraHom.target with hom237  have sameBase := AlgebraHom.base_eq with hom238  have ringRing := Algebra.comm_ring with algebra239  have targetRing := Algebra.comm_ring with targetAlgebra240  have ringHom := AlgebraHom.ring_hom with hom241  have kernel := AlgebraHom.kernel_of_killed with algebra, ideal, hom, killed242  have descended := RingHom.quotient_hom with ringRing, targetRing, ringHom,243    ideal, kernel244  have mapFunction := Algebra.map_function with algebra245  have projFunction := algebraProjection.function with algebra, ideal246  unfold AlgebraHom247  refine ⟨quotient, targetAlgebra, ?_, ?_, ?_⟩248  . rw quotientAlgebra.baseOf249    exact sameBase250  . rw quotientAlgebra.ringOf251    unfold algebraLift252    unfold algebraCarrier253    exact descended254  . intros a ha255    rw quotientAlgebra.baseOf at ha256    have composed := compose.apply with mapFunction, projFunction, ha257    have mapped := FunctionBetween.apply_closed with mapFunction, ha258    have projected := algebraProjection.value with algebra, ideal, mapped259    have lifted := algebraLift.class with algebra, ideal, hom, killed, mapped260    rw [quotientAlgebra.mapOf, composed, projected, lifted]261    exact AlgebraHom.map_base with hom, ha262263theorem AlgebraHom.lift_factors (f B x : Set)264  requires hom : f : A →ₐ B265  requires killed : ∀ x ∈ J, f(x) = Ring.zero(Algebra.ring(B))266  requires member : x ∈ algebraCarrier(A)267  shows algebraLift(f, A, B, J)(algebraProjection(A, J)(x)) = f(x)268proof269  rw algebraProjection.value with algebra, ideal, member270  exact algebraLift.class with algebra, ideal, hom, killed, member271272-- Homomorphisms out of a quotient are determined by their composites with273-- the projection.274theorem AlgebraHom.quotient_ext (g h B : Set)275  requires first : g : quotientAlgebra(A, J) →ₐ B276  requires second : h : quotientAlgebra(A, J) →ₐ B277  requires agree : ∀ x ∈ algebraCarrier(A),278    g(algebraProjection(A, J)(x)) = h(algebraProjection(A, J)(x))279  shows g = h280proof281  have ringRing := Algebra.comm_ring with algebra282  have gFunction := AlgebraHom.function with first283  have hFunction := AlgebraHom.function with second284  apply FunctionBetween.ext with gFunction, hFunction285  intros X hX286  rw quotientAlgebra.carrierOf at hX287  obtain ⟨x, hx, shape⟩ := quotientRing.representative with ringRing, ideal,288    hX289  have inAlgebra : x ∈ algebraCarrier(A)290    unfold algebraCarrier291    exact hx292  have projected := algebraProjection.value with algebra, ideal, inAlgebra293  have same := agree with x, inAlgebra294  rw projected at same295  unfold algebraCarrier at same296  rw shape297  exact same298299end Quotients300301-- Ideals generated by a set of elements: a homomorphism killing the302-- generators kills the ideal, so it lifts to the quotient, and the303-- projection kills each generator.304section Generated305variable (A G : Set)306hypothesis algebra : Algebra(A)307hypothesis generators : G ⊆ algebraCarrier(A)308309theorem generatedIdeal.subset_kernel (f B : Set)310  requires hom : f : A →ₐ B311  requires killed : ∀ g ∈ G, f(g) = Ring.zero(Algebra.ring(B))312  shows ∀ x ∈ generatedIdeal(Algebra.ring(A), G),313    f(x) = Ring.zero(Algebra.ring(B))314proof315  have targetAlgebra := AlgebraHom.target with hom316  have ringRing := Algebra.comm_ring with algebra317  have targetRing := Algebra.comm_ring with targetAlgebra318  have ringHom := AlgebraHom.ring_hom with hom319  have kernelIdeal := ringKernel.ideal with ringRing, targetRing, ringHom320  have includes : G ⊆ ringKernel(f, Ring.carrier(Algebra.ring(A)),321      Ring.zero(Algebra.ring(B)))322    intros g hg323    have inCarrier := generators with g, hg324    unfold algebraCarrier at inCarrier325    have vanishes := killed with g, hg326    exact ringKernel.membership.backward with ⟨inCarrier, vanishes⟩327  have least := generatedIdeal.least with ringRing, kernelIdeal, includes328  intros x hx329  have inKernel := least with x, hx330  have data := ringKernel.membership.forward with inKernel331  exact data.right332333theorem AlgebraHom.lift_generated (f B : Set)334  requires hom : f : A →ₐ B335  requires killed : ∀ g ∈ G, f(g) = Ring.zero(Algebra.ring(B))336  shows algebraLift(f, A, B, generatedIdeal(Algebra.ring(A), G)) :337    quotientAlgebra(A, generatedIdeal(Algebra.ring(A), G)) →ₐ B338proof339  have ringRing := Algebra.comm_ring with algebra340  have ideal := generatedIdeal.ideal at _, G with ringRing341  have killedAll := generatedIdeal.subset_kernel with algebra, generators, hom,342    killed343  exact AlgebraHom.lift with algebra, ideal, hom, killedAll344345theorem AlgebraHom.lift_generated_factors (f B x : Set)346  requires hom : f : A →ₐ B347  requires killed : ∀ g ∈ G, f(g) = Ring.zero(Algebra.ring(B))348  requires member : x ∈ algebraCarrier(A)349  shows algebraLift(f, A, B, generatedIdeal(Algebra.ring(A), G))(350    algebraProjection(A, generatedIdeal(Algebra.ring(A), G))(x)) = f(x)351proof352  have ringRing := Algebra.comm_ring with algebra353  have ideal := generatedIdeal.ideal at _, G with ringRing354  have killedAll := generatedIdeal.subset_kernel with algebra, generators, hom,355    killed356  exact AlgebraHom.lift_factors with algebra, ideal, hom, killedAll, member357358theorem algebraProjection.kills_generator (g : Set)359  requires member : g ∈ G360  shows algebraProjection(A, generatedIdeal(Algebra.ring(A), G))(g) =361    Ring.zero(quotientRing(Algebra.ring(A), generatedIdeal(Algebra.ring(A), G)))362proof363  have ringRing := Algebra.comm_ring with algebra364  have ideal := generatedIdeal.ideal at _, G with ringRing365  have bounded : G ⊆ Ring.carrier(Algebra.ring(A))366    unfold algebraCarrier at generators367    exact generators368  have contains := generatedIdeal.contains with ringRing, bounded369  have inIdeal := contains with g, member370  exact algebraProjection.kills with algebra, ideal, inIdeal371372end Generated373