{-# OPTIONS --safe --without-K #-} open import Algebra.Bundles open import Level open import Relation.Unary open import Data.Sum open import Data.Product open import Data.List module _ {c ℓ} (A : CommutativeRing c ℓ) where open CommutativeRing A record Ideal r : Set (suc (c ⊔ ℓ ⊔ r)) where field ∋ : Pred Carrier r ∋-respects-≈ : {x y : Carrier} → x ≈ y → ∋ x → ∋ y ∋-respects-0 : ∋ 0# ∋-respects-+ : (x y : Carrier) → ∋ x → ∋ y → ∋ (x + y) ∋-magnetic : (x y : Carrier) → ∋ x → ∋ (x * y) IsRadicalIdeal : {r : Level} → Ideal r → Set (c ⊔ r) IsRadicalIdeal I = (x : _) → ∋ (x * x) → ∋ x where open Ideal I ⟨_⟩ : {r : Level} {I : Set r} → (M : I → Carrier) → Ideal (c ⊔ ℓ ⊔ r) ⟨_⟩ {r} {I} M = record { ∋ = ∋ ; ∋-respects-≈ = ∋-respect-≈ ; ∋-respects-0 = ∋-respect-0 ; ∋-respects-+ = ∋-respects-+ ; ∋-magnetic = ∋-magnetic } module Gen where data ∋ : Carrier → Set (c ⊔ ℓ ⊔ r) where ∋-base : (i : I) → ∋ (M i) ∋-respect-≈ : {x y : Carrier} → x ≈ y → ∋ x → ∋ y ∋-respect-0 : ∋ 0# ∋-respects-+ : (x y : Carrier) → ∋ x → ∋ y → ∋ (x + y) ∋-magnetic : (x y : Carrier) → ∋ x → ∋ (x * y) Sum : {r e : Level} {I : Set e} → (I → Ideal r) → Ideal (c ⊔ ℓ ⊔ r ⊔ e) Sum {I = I} M = ⟨ (λ ((i , a , _) : J) → a) ⟩ where J = Σ[ i ∈ I ] Σ[ a ∈ Carrier ] Ideal.∋ (M i) a module _ {r : Level} {I : Set r} (M : I → Carrier) where combine : List (Carrier × I) → Carrier combine vs = foldr _+_ 0# (Data.List.map (λ (a , i) → a * M i) vs) lemma-combine-++ : (vs ws : List (Carrier × I)) → combine (vs ++ ws) ≈ combine vs + combine ws lemma-combine-++ [] ws = sym (+-identityˡ (combine ws)) lemma-combine-++ ((a , i) ∷ vs) ws = {!!} lemma : (x : Carrier) → Ideal.∋ ⟨ M ⟩ x → ∃[ vs ] (x ≈ combine vs) lemma .(M i) (Gen.∋-base i) = ((1# , i) ∷ []) , trans (sym (*-identityˡ (M i))) (sym (+-identityʳ (1# * M i))) lemma x (Gen.∋-respect-≈ p q) with lemma _ q ... | vs , r = vs , (trans (sym p) r) lemma .(0#) Gen.∋-respect-0 = [] , refl lemma .(x + y) (Gen.∋-respects-+ x y p q) with lemma _ p with lemma _ q ... | vs , r | ws , s = (vs ++ ws) , {!+-cong ? ?!} lemma .(x * y) (Gen.∋-magnetic x y p) with lemma _ p ... | vs , r = (Data.List.map (λ (a , i) → (a * y , i)) vs) , {!!} lemma₂ : ((i j : I) → M i ≈ M j) → (vs : List (Carrier × I)) → combine vs ≈ 0# ⊎ Σ (Carrier × I) (λ { (a , i) → (combine vs ≈ a * M i) }) lemma₂ subsingleton [] = inj₁ refl lemma₂ subsingleton ((a , i) ∷ vs) with lemma₂ subsingleton vs ... | inj₁ p = inj₂ ((a , i) , {!!}) -- trans (+-cong p refl) ?) --(sym (+-identityˡ (a * M i)))) ... | inj₂ (q , p) = {!!} lemma₁ : ((i j : I) → M i ≈ M j) → (x : Carrier) → Ideal.∋ ⟨ M ⟩ x → x ≈ 0# ⊎ ∃[ (a , i) ] (x ≈ a * M i) lemma₁ subsingleton x p with lemma x p ... | [] , q = inj₁ q ... | vs@((_ , i) ∷ _) , q = inj₂ ((foldr _+_ 0# (Data.List.map fst vs) , i) , {!!}) where fst : {A : Set _} {B : Set _} → A × B → A fst (a , b) = a