Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typevariate and list-based polynomials are isomorphic #922

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
46e2f61
scalar multiplication is homomorphic
felixwellen Aug 30, 2022
67c30c4
CommAlgebra instance for list-based polynomials
felixwellen Aug 30, 2022
ebb54b7
refer to the new algebra structure
felixwellen Aug 30, 2022
f58fb50
revert deleted line
felixwellen Aug 30, 2022
d0fedc8
elimProp2 for UnivariatePolyList
felixwellen Aug 30, 2022
5405ea2
properties of list-based polynomials, related to the UMP of polynomials
felixwellen Aug 30, 2022
f5f22e2
property of algebras needed for the ump of the list-based polynomials
felixwellen Aug 30, 2022
6461467
construct induced homomorphism
felixwellen Aug 30, 2022
7ca7ca8
uniqueness part of the universal property of list-based polynomials
felixwellen Aug 31, 2022
7371e5c
refactor: reduce noise
felixwellen Aug 31, 2022
3aaaadf
export all parts of the unviersal property
felixwellen Aug 31, 2022
2e299bb
Merge branch 'master' into ump_list_polynomials
felixwellen Aug 31, 2022
f69cf67
add stubs
felixwellen Sep 1, 2022
dee4321
add a reference to the universal property, so make it easier to find
felixwellen Sep 1, 2022
cf79eb9
Merge branch 'ump_list_polynomials' into typevariate_equiv_list-based…
felixwellen Sep 1, 2022
f31753e
export generator
felixwellen Sep 1, 2022
68b256b
uniqueness part of the universal property of FreeCommAlgebra
felixwellen Sep 1, 2022
c045e59
generator preserving isomorphism between typevariate and list-based p…
felixwellen Sep 1, 2022
b5bee81
corollary easing isomorphism construction from ump
felixwellen Sep 7, 2022
b5db192
corollary easing isomorphism construction from ump
felixwellen Sep 7, 2022
ac61c93
use new corollaries
felixwellen Sep 7, 2022
2d60d28
Merge branch 'master' into algebra_structure_list_polynomials
felixwellen Sep 13, 2022
e8a8f0d
rename
felixwellen Sep 13, 2022
659b391
add the implicit ring hom and use it to simplify the definition
felixwellen Sep 13, 2022
920a054
Merge branch 'algebra_structure_list_polynomials' into ump_list_polyn…
felixwellen Sep 13, 2022
bb6acc4
Merge branch 'ump_list_polynomials' into typevariate_equiv_list-based…
felixwellen Sep 13, 2022
bcede63
Merge branch 'master' into typevariate_equiv_list-based_poly
felixwellen Oct 20, 2022
022defc
fix merge
felixwellen Oct 20, 2022
258dff9
Merge branch 'master' into typevariate_equiv_list-based_poly
felixwellen Oct 25, 2022
6b8ff12
Merge branch 'master' into typevariate_equiv_list-based_poly
felixwellen Nov 3, 2022
64e1254
introduce equalByUMP for UnivariateListPoly
felixwellen Nov 3, 2022
5b5624c
fix indentation bug
felixwellen Nov 3, 2022
24103cd
export iso
felixwellen Nov 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cubical/Algebra/CommAlgebra/FreeCommAlgebra/Properties.agda
Original file line number Diff line number Diff line change
Expand Up @@ -352,17 +352,17 @@ Iso.leftInv (homMapIso {R = R} {I = I} A) =
λ f → Σ≡Prop (λ f → isPropIsCommAlgebraHom {M = R [ I ]} {N = A} f)
(Theory.homRetrievable A f)

homMapPath : {R : CommRing ℓ} {I : Type ℓ'} (A : CommAlgebra R (ℓ-max ℓ ℓ'))
→ CommAlgebraHom (R [ I ]) A ≡ (I → fst A)
homMapPath A = isoToPath (homMapIso A)

inducedHomUnique :
{R : CommRing ℓ} {I : Type ℓ'} (A : CommAlgebra R ℓ'') (φ : I → fst A )
→ (f : CommAlgebraHom (R [ I ]) A) → ((i : I) → fst f (Construction.var i) ≡ φ i)
→ f ≡ inducedHom A φ
inducedHomUnique {I = I} A φ f p =
isoFunInjective (homMapIso A) f (inducedHom A φ) λ j i → p i j

homMapPath : {R : CommRing ℓ} {I : Type ℓ'} (A : CommAlgebra R (ℓ-max ℓ ℓ'))
→ CommAlgebraHom (R [ I ]) A ≡ (I → fst A)
homMapPath A = isoToPath (homMapIso A)

{- Corollary: Two homomorphisms with the same values on generators are equal -}
equalByUMP : {R : CommRing ℓ} {I : Type ℓ'}
→ (A : CommAlgebra R ℓ'')
Expand Down
32 changes: 28 additions & 4 deletions Cubical/Algebra/CommAlgebra/UnivariatePolyList.agda
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,27 @@ module _ (R : CommRing ℓ) where
(ListPoly ,
constantPolynomialHom R)

private
X : ⟨ ListPolyCommAlgebra ⟩
X = 0r ∷ 1r ∷ []

{- export the generator 'X' -}
generator = X

{- Universal Property -}
module _ (A : Algebra (CommRing→Ring R) ℓ') where
open AlgebraStr ⦃...⦄ using (_⋆_; 0a; 1a; ⋆IdL; ⋆DistL+; ⋆DistR+; ⋆AssocL; ⋆AssocR; ⋆Assoc)
private instance
_ = snd A
_ = snd (Algebra→Ring A)
_ = snd (CommAlgebra→Algebra ListPolyCommAlgebra)
private
X : ⟨ ListPolyCommAlgebra ⟩
X = 0r ∷ 1r ∷ []

module _ (x : ⟨ A ⟩) where
open AlgebraTheory using (⋆AnnihilL; ⋆AnnihilR)
open RingTheory using (0RightAnnihilates; 0LeftAnnihilates)
open AbGroupTheory using (comm-4)
open PolyMod using (ElimProp; elimProp2; isSetPoly)


inducedMap : ⟨ ListPolyCommAlgebra ⟩ → ⟨ A ⟩
inducedMap [] = 0a
inducedMap (a ∷ p) = a ⋆ 1a + (x · inducedMap p)
Expand Down Expand Up @@ -216,10 +219,31 @@ module _ (R : CommRing ℓ) where
useSolver : (r : ⟨ R ⟩) → r ≡ (r · 1r) + 0r
useSolver = solve R


{- Reforumlation in terms of the R-AlgebraHom from R[X] to A -}
indcuedHomEquivalence : AlgebraHom (CommAlgebra→Algebra ListPolyCommAlgebra) A ≃ ⟨ A ⟩
fst indcuedHomEquivalence f = fst f X
fst (fst (equiv-proof (snd indcuedHomEquivalence) x)) = inducedHom x
snd (fst (equiv-proof (snd indcuedHomEquivalence) x)) = inducedMapGenerator x
snd (equiv-proof (snd indcuedHomEquivalence) x) (g , gX≡x) =
Σ≡Prop (λ _ → isSetAlgebra A _ _) (sym (inducedHomUnique x g gX≡x))

equalByUMP : (f g : AlgebraHom (CommAlgebra→Algebra ListPolyCommAlgebra) A)
→ fst f X ≡ fst g X
→ (x : ⟨ ListPolyCommAlgebra ⟩) → fst f x ≡ fst g x
equalByUMP f g fX≡gX x =
fst f x ≡[ i ]⟨ fst (inducedHomUnique (fst f X) f refl i) x ⟩
fst (inducedHom (fst f X)) x ≡[ i ]⟨ fst (inducedHom (fX≡gX i)) x ⟩
fst (inducedHom (fst g X)) x ≡[ i ]⟨ fst (inducedHomUnique (fst g X) g refl (~ i)) x ⟩
fst g x ∎

{- A corollary, which is useful for constructing isomorphisms to
algebras with the same universal property -}
isIdByUMP : (f : CommAlgebraHom ListPolyCommAlgebra ListPolyCommAlgebra)
felixwellen marked this conversation as resolved.
Show resolved Hide resolved
→ fst f X ≡ X
→ (x : ⟨ ListPolyCommAlgebra ⟩) → fst f x ≡ x
isIdByUMP f =
equalByUMP (CommAlgebra→Algebra ListPolyCommAlgebra)
f
(idAlgebraHom (CommAlgebra→Algebra ListPolyCommAlgebra))
where open AlgebraHoms using (idAlgebraHom)
4 changes: 4 additions & 0 deletions Cubical/Algebra/Polynomials/TypevariateHIT.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{-# OPTIONS --safe #-}
module Cubical.Algebra.Polynomials.TypevariateHIT where

open import Cubical.Algebra.Polynomials.TypevariateHIT.Base public
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{-# OPTIONS --safe #-}
module Cubical.Algebra.Polynomials.TypevariateHIT.EquivUnivariateListPoly where

open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Structure

open import Cubical.Data.Unit

open import Cubical.Algebra.CommRing
open import Cubical.Algebra.Algebra
open import Cubical.Algebra.CommAlgebra
open import Cubical.Algebra.Polynomials.TypevariateHIT
renaming (inducedHomUnique to inducedHomUniqueHIT;
isIdByUMP to isIdByUMP-HIT)
open import Cubical.Algebra.Polynomials.UnivariateList.UniversalProperty
renaming (generator to generatorList;
inducedHom to inducedHomList;
inducedHomUnique to inducedHomUniqueList;
isIdByUMP to isIdByUMP-List)

private variable
ℓ : Level

module _ {R : CommRing ℓ} where
open Theory renaming (inducedHom to inducedHomHIT)
open CommRingStr ⦃...⦄
private
instance
_ = snd R
X-HIT = Construction.var {R = R} {I = Unit} tt
X-List = generatorList R
felixwellen marked this conversation as resolved.
Show resolved Hide resolved

{-
Construct an iso between the two versions of polynomials.
Just using the universal properties to manually show that the two algebras are isomorphic
-}
private
open AlgebraHoms
open Iso
to : CommAlgebraHom (R [ Unit ]) (ListPolyCommAlgebra R)
to = inducedHomHIT (ListPolyCommAlgebra R) (λ _ → X-List)

from : CommAlgebraHom (ListPolyCommAlgebra R) (R [ Unit ])
from = inducedHomList R (CommAlgebra→Algebra (R [ Unit ])) X-HIT

toPresX : fst to X-HIT ≡ X-List
toPresX = refl

fromPresX : fst from X-List ≡ X-HIT
fromPresX = inducedMapGenerator R (CommAlgebra→Algebra (R [ Unit ])) X-HIT

idList = AlgebraHoms.idAlgebraHom (CommAlgebra→Algebra (ListPolyCommAlgebra R))
idHIT = AlgebraHoms.idAlgebraHom (CommAlgebra→Algebra (R [ Unit ]))

toFrom : (x : ⟨ ListPolyCommAlgebra R ⟩) → fst to (fst from x) ≡ x
toFrom = isIdByUMP-List R (to ∘a from) (cong (fst to) fromPresX)

fromTo : (x : ⟨ R [ Unit ] ⟩) → fst from (fst to x) ≡ x
fromTo = isIdByUMP-HIT (from ∘a to) λ {tt → fromPresX}

typevariateListPolyIso : Iso ⟨ R [ Unit ] ⟩ ⟨ ListPolyCommAlgebra R ⟩
fun typevariateListPolyIso = fst to
inv typevariateListPolyIso = fst from
rightInv typevariateListPolyIso = toFrom
leftInv typevariateListPolyIso = fromTo

typevariateListPolyEquiv : CommAlgebraEquiv (R [ Unit ]) (ListPolyCommAlgebra R)
fst typevariateListPolyEquiv = isoToEquiv typevariateListPolyIso
snd typevariateListPolyEquiv = snd to

typevariateListPolyGenerator :
fst (fst typevariateListPolyEquiv) X-HIT ≡ X-List
typevariateListPolyGenerator = refl