|
| 1 | +{-# OPTIONS --safe #-} |
| 2 | + |
| 3 | +module Cubical.Algebra.CommRing.Quotient.ImageQuotient where |
| 4 | + |
| 5 | +open import Cubical.Foundations.Prelude |
| 6 | +open import Cubical.Foundations.Structure |
| 7 | +open import Cubical.Foundations.Function |
| 8 | +open import Cubical.Data.Sigma |
| 9 | + |
| 10 | +open import Cubical.Algebra.CommRing |
| 11 | +open import Cubical.Algebra.CommRing.Ideal |
| 12 | +open import Cubical.Algebra.Ring.Properties |
| 13 | +open RingTheory |
| 14 | + |
| 15 | +import Cubical.HITs.SetQuotients as SQ |
| 16 | +import Cubical.Algebra.CommRing.Quotient as CQ |
| 17 | + |
| 18 | +module _ {ℓ : Level} (R : CommRing ℓ) {X : Type ℓ} (f : X → ⟨ R ⟩) where |
| 19 | + module _ where |
| 20 | + open CommRingStr ⦃...⦄ |
| 21 | + open CQ |
| 22 | + instance |
| 23 | + _ = str R |
| 24 | + |
| 25 | + data generatedIdeal : ⟨ R ⟩ → Type ℓ where |
| 26 | + single : ∀ x → generatedIdeal (f x) |
| 27 | + zero : generatedIdeal 0r |
| 28 | + add : ∀ {x y} → generatedIdeal x → generatedIdeal y → |
| 29 | + generatedIdeal (x + y) |
| 30 | + mul : ∀ {r x} → generatedIdeal x → generatedIdeal (r · x) |
| 31 | + squash : ∀ {x} → isProp (generatedIdeal x) |
| 32 | + |
| 33 | + genIdeal : IdealsIn R |
| 34 | + genIdeal = makeIdeal (λ r → generatedIdeal r , squash) |
| 35 | + add zero λ r → mul |
| 36 | + |
| 37 | + _/Im_ : CommRing ℓ |
| 38 | + _/Im_ = R / genIdeal |
| 39 | + |
| 40 | + quotientImageHom : CommRingHom R _/Im_ |
| 41 | + quotientImageHom = quotientHom R genIdeal |
| 42 | + |
| 43 | + instance |
| 44 | + _ = str _/Im_ |
| 45 | + |
| 46 | + zeroOnImage : (x : X) → quotientImageHom $cr (f x) ≡ 0r |
| 47 | + zeroOnImage x = zeroOnIdeal genIdeal _ (single x) |
| 48 | + |
| 49 | + module _ {ℓ' : Level} {S : CommRing ℓ'} (g : CommRingHom R S) |
| 50 | + (gfx=0 : ∀ (x : X) → g $cr (f x) ≡ CommRingStr.0r (snd S)) where |
| 51 | + open CommIdeal R |
| 52 | + open IsCommRingHom (snd g) |
| 53 | + open CommRingStr ⦃...⦄ |
| 54 | + instance |
| 55 | + _ = snd R |
| 56 | + _ = snd S |
| 57 | + _ = snd _/Im_ |
| 58 | + |
| 59 | + extendToIdeal : (r : ⟨ R ⟩) → r ∈ genIdeal → g $cr r ≡ 0r |
| 60 | + extendToIdeal .(f x) (single x) = gfx=0 x |
| 61 | + extendToIdeal .(0r) zero = pres0 |
| 62 | + extendToIdeal .(r + s) (add {r} {s} r∈I s∈I) = |
| 63 | + g $cr (r + s ) |
| 64 | + ≡⟨ pres+ r s ⟩ |
| 65 | + (g $cr r) + (g $cr s) |
| 66 | + ≡⟨ cong (λ a → a + (g $cr s)) (extendToIdeal r r∈I) ⟩ |
| 67 | + 0r + (g $cr s) |
| 68 | + ≡⟨ cong (λ a → 0r + a) (extendToIdeal s s∈I) ⟩ |
| 69 | + 0r + 0r |
| 70 | + ≡⟨ +IdL 0r ⟩ |
| 71 | + 0r ∎ |
| 72 | + extendToIdeal .(r · s) (mul {r} {s} s∈I) = |
| 73 | + (g $cr (r · s)) |
| 74 | + ≡⟨ pres· r s ⟩ |
| 75 | + (g $cr r) · (g $cr s) |
| 76 | + ≡⟨ cong (λ a → (g $cr r) · a) (extendToIdeal s s∈I) ⟩ |
| 77 | + (g $cr r) · 0r |
| 78 | + ≡⟨ 0RightAnnihilates (CommRing→Ring S) (g $cr r) ⟩ |
| 79 | + 0r ∎ |
| 80 | + extendToIdeal r (squash r∈I0 r∈I1 i) = |
| 81 | + is-set (g $cr r) 0r (extendToIdeal r r∈I0) (extendToIdeal r r∈I1) i |
| 82 | + |
| 83 | + inducedMap : ⟨ _/Im_ ⟩ → ⟨ S ⟩ |
| 84 | + inducedMap = SQ.elim (λ x → is-set) (fst g) |
| 85 | + λ { a b r → equalByDifference (CommRing→Ring S) _ _ |
| 86 | + ( |
| 87 | + (g $cr a - g $cr b) |
| 88 | + ≡⟨ cong (λ b → g $cr a + b) (sym (pres- b)) ⟩ |
| 89 | + (g $cr a + g $cr (- b)) |
| 90 | + ≡⟨ sym (pres+ a (- b)) ⟩ |
| 91 | + g $cr (a - b) |
| 92 | + ≡⟨ extendToIdeal _ r ⟩ |
| 93 | + (0r ∎) |
| 94 | + ) |
| 95 | + } |
| 96 | + |
| 97 | + open IsCommRingHom |
| 98 | + |
| 99 | + inducedMapPreservesRing : IsCommRingHom (str _/Im_) inducedMap (str S) |
| 100 | + pres0 inducedMapPreservesRing = |
| 101 | + inducedMap 0r |
| 102 | + ≡⟨ cong inducedMap (pres0 (snd quotientImageHom)) ⟩ |
| 103 | + inducedMap (quotientImageHom $cr 0r) |
| 104 | + ≡⟨⟩ |
| 105 | + g $cr 0r |
| 106 | + ≡⟨ pres0 (snd g) ⟩ |
| 107 | + 0r ∎ |
| 108 | + pres1 inducedMapPreservesRing = |
| 109 | + inducedMap 1r |
| 110 | + ≡⟨ cong inducedMap (pres1 (snd quotientImageHom)) ⟩ |
| 111 | + inducedMap (quotientImageHom $cr 1r) |
| 112 | + ≡⟨⟩ |
| 113 | + g $cr 1r |
| 114 | + ≡⟨ pres1 (snd g) ⟩ |
| 115 | + 1r ∎ |
| 116 | + pres+ inducedMapPreservesRing = |
| 117 | + SQ.elimProp2 (λ x y → is-set _ _ ) (pres+ (snd g)) |
| 118 | + pres· inducedMapPreservesRing = |
| 119 | + SQ.elimProp2 (λ x y → is-set _ _ ) (pres· (snd g)) |
| 120 | + pres- inducedMapPreservesRing = |
| 121 | + SQ.elimProp (λ x → is-set _ _ ) (pres- (snd g)) |
| 122 | + |
| 123 | + inducedHom : CommRingHom _/Im_ S |
| 124 | + inducedHom = inducedMap , inducedMapPreservesRing |
| 125 | + |
| 126 | + inducedMapUnique : (h : ⟨ _/Im_ ⟩ → ⟨ S ⟩) → |
| 127 | + fst g ≡ h ∘ (fst quotientImageHom) → |
| 128 | + inducedMap ≡ h |
| 129 | + inducedMapUnique _ = funExt ∘ SQ.elimProp (λ { x → is-set _ _ }) ∘ funExt⁻ |
| 130 | + |
| 131 | + inducedHomUnique : (h : CommRingHom (_/Im_) S) → |
| 132 | + (p : g ≡ (h ∘cr quotientImageHom)) → |
| 133 | + inducedHom ≡ h |
| 134 | + inducedHomUnique h p = Σ≡Prop |
| 135 | + (λ { x → isPropIsCommRingHom (str _/Im_) x (str S) }) |
| 136 | + (inducedMapUnique (fst h) (cong fst p)) |
| 137 | + |
0 commit comments