Skip to content

Commit e77e2c7

Browse files
authored
Merge branch 'agda:master' into oriented-graded-posets
2 parents 0d2e46e + 29cf31d commit e77e2c7

File tree

25 files changed

+1430
-224
lines changed

25 files changed

+1430
-224
lines changed

Cubical/Algebra/BooleanRing/Base.agda

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ open import Cubical.Algebra.Ring
88
open import Cubical.Algebra.AbGroup.Base
99
open import Cubical.Algebra.CommRing
1010
open import Cubical.Tactics.CommRingSolver
11-
11+
open RingTheory
1212

1313
private
1414
variable
@@ -48,6 +48,12 @@ BooleanStr→CommRingStr x = record { isCommRing = IsBooleanRing.isCommRing (Boo
4848
BooleanRing→CommRing : BooleanRing ℓ CommRing ℓ
4949
BooleanRing→CommRing (carrier , structure ) = carrier , BooleanStr→CommRingStr structure
5050

51+
BooleanStr→RingStr : { A : Type ℓ } BooleanStr A RingStr A
52+
BooleanStr→RingStr S = CommRingStr→RingStr (BooleanStr→CommRingStr S)
53+
54+
BooleanRing→Ring : BooleanRing ℓ Ring ℓ
55+
BooleanRing→Ring (carrier , structure ) = carrier , BooleanStr→RingStr structure
56+
5157
module BooleanAlgebraStr (A : BooleanRing ℓ) where
5258
open BooleanStr (A . snd)
5359
_∨_ : ⟨ A ⟩ ⟨ A ⟩ ⟨ A ⟩
@@ -96,8 +102,8 @@ module BooleanAlgebraStr (A : BooleanRing ℓ) where
96102
∧AnnihilL : 𝟘 ∧ x ≡ 𝟘
97103
∧AnnihilL = RingTheory.0LeftAnnihilates (CommRing→Ring (BooleanRing→CommRing A)) _
98104

99-
-IsId : x + x ≡ 𝟘
100-
-IsId {x = x} = RingTheory.+Idempotency→0 (CommRing→Ring (BooleanRing→CommRing A)) (x + x) 2x≡4x
105+
characteristic2 : x + x ≡ 𝟘
106+
characteristic2 {x = x} = RingTheory.+Idempotency→0 (CommRing→Ring (BooleanRing→CommRing A)) (x + x) 2x≡4x
101107
where
102108
2x≡4x : x + x ≡ (x + x) + (x + x)
103109
2x≡4x =
@@ -109,10 +115,13 @@ module BooleanAlgebraStr (A : BooleanRing ℓ) where
109115
≡⟨ cong₂ _+_ (cong₂ _+_ (·Idem x) (·Idem x)) (cong₂ _+_ (·Idem x) (·Idem x)) ⟩
110116
(x + x) + (x + x) ∎
111117

118+
-IsId : x ≡ - x
119+
-IsId {x = x} = implicitInverse (BooleanRing→Ring A) x x characteristic2
120+
112121
∨Idem : x ∨ x ≡ x
113122
∨Idem { x = x } =
114123
x + x + x · x
115-
≡⟨ cong (λ y y + x · x) -IsId
124+
≡⟨ cong (λ y y + x · x) characteristic2
116125
𝟘 + x · x
117126
≡⟨ +IdL (x · x) ⟩
118127
x · x
@@ -124,7 +133,7 @@ module BooleanAlgebraStr (A : BooleanRing ℓ) where
124133
(x + 𝟙) + (x · 𝟙)
125134
≡⟨ solve! (BooleanRing→CommRing A) ⟩
126135
𝟙 + (x + x)
127-
≡⟨ cong (λ y 𝟙 + y) -IsId
136+
≡⟨ cong (λ y 𝟙 + y) characteristic2
128137
𝟙 + 𝟘
129138
≡⟨ +IdR 𝟙 ⟩
130139
𝟙 ∎
@@ -152,7 +161,7 @@ module BooleanAlgebraStr (A : BooleanRing ℓ) where
152161
x + 𝟘 + 𝟘 + y · z + 𝟘 + x · y · z
153162
≡⟨ cong (λ a a + 𝟘 + 𝟘 + y · z + 𝟘 + a · y · z) (sym (·Idem x)) ⟩
154163
x · x + 𝟘 + 𝟘 + y · z + 𝟘 + x · x · y · z
155-
≡⟨ cong (λ a x · x + 𝟘 + 𝟘 + y · z + a + x · x · y · z) (sym (-IsId {x = (x · y) · z})) ⟩
164+
≡⟨ cong (λ a x · x + 𝟘 + 𝟘 + y · z + a + x · x · y · z) (sym (characteristic2 {x = (x · y) · z})) ⟩
156165
x · x + 𝟘 + 𝟘 + y · z + (x · y · z + x · y · z) + x · x · y · z
157166
≡⟨ (cong₂ (λ a b x · x + a + b + y · z + (x · y · z + x · y · z) + x · x · y · z)) (xa-xxa≡0 z) (xa-xxa≡0 y) ⟩
158167
x · x + (x · z + x · x · z) + (x · y + x · x · y) + y · z + (x · y · z + x · y · z) + x · x · y · z
@@ -163,7 +172,7 @@ module BooleanAlgebraStr (A : BooleanRing ℓ) where
163172
xa-xxa≡0 : (a : ⟨ A ⟩) 𝟘 ≡ x · a + x · x · a
164173
xa-xxa≡0 a =
165174
𝟘
166-
≡⟨ sym -IsId
175+
≡⟨ sym characteristic2
167176
x · a + x · a
168177
≡⟨ cong (λ y x · a + y · a) (sym (·Idem x)) ⟩
169178
x · a + x · x · a ∎
@@ -178,7 +187,7 @@ module BooleanAlgebraStr (A : BooleanRing ℓ) where
178187
x · x + (x · y + x · x · y)
179188
≡⟨ cong (λ z z + ((x · y) + (z · y))) (·Idem x) ⟩
180189
x + (x · y + x · y)
181-
≡⟨ cong (_+_ x) -IsId
190+
≡⟨ cong (_+_ x) characteristic2
182191
x + 𝟘
183192
≡⟨ +IdR x ⟩
184193
x ∎
@@ -190,7 +199,7 @@ module BooleanAlgebraStr (A : BooleanRing ℓ) where
190199
x + (x · y + x · x · y)
191200
≡⟨ cong (λ z x + (x · y + z · y)) (·Idem x) ⟩
192201
x + (x · y + x · y)
193-
≡⟨ cong (_+_ x) -IsId
202+
≡⟨ cong (_+_ x) characteristic2
194203
x + 𝟘
195204
≡⟨ +IdR x ⟩
196205
x ∎
@@ -202,7 +211,7 @@ module BooleanAlgebraStr (A : BooleanRing ℓ) where
202211
x + x · x
203212
≡⟨ cong (λ y x + y) (·Idem x) ⟩
204213
x + x
205-
≡⟨ -IsId
214+
≡⟨ characteristic2
206215
𝟘 ∎
207216

208217
¬Cancels∧L : ¬ x ∧ x ≡ 𝟘
@@ -226,7 +235,7 @@ module BooleanAlgebraStr (A : BooleanRing ℓ) where
226235
𝟙 + (𝟙 + x)
227236
≡⟨ +Assoc 𝟙 𝟙 x ⟩
228237
(𝟙 + 𝟙) + x
229-
≡⟨ cong (λ y y + x) ( -IsId {x = 𝟙}) ⟩
238+
≡⟨ cong (λ y y + x) ( characteristic2 {x = 𝟙}) ⟩
230239
𝟘 + x
231240
≡⟨ +IdL x ⟩
232241
x ∎
@@ -235,7 +244,7 @@ module BooleanAlgebraStr (A : BooleanRing ℓ) where
235244
¬0≡1 = +IdR 𝟙
236245

237246
¬1≡0 : ¬ 𝟙 ≡ 𝟘
238-
¬1≡0 = -IsId {x = 𝟙}
247+
¬1≡0 = characteristic2 {x = 𝟙}
239248

240249
DeMorgan¬∨ : ¬ (x ∨ y) ≡ ¬ x ∧ ¬ y
241250
DeMorgan¬∨ = solve! (BooleanRing→CommRing A)
@@ -245,7 +254,7 @@ module BooleanAlgebraStr (A : BooleanRing ℓ) where
245254
𝟙 + x · y
246255
≡⟨ solve! (BooleanRing→CommRing A) ⟩
247256
𝟘 + 𝟘 + 𝟙 + x · y
248-
≡⟨ cong₂ (λ a b ((a + b) + 𝟙) + (x · y)) (sym (-IsId {x = 𝟙 + x})) (sym (-IsId {x = y})) ⟩
257+
≡⟨ cong₂ (λ a b ((a + b) + 𝟙) + (x · y)) (sym (characteristic2 {x = 𝟙 + x})) (sym (characteristic2 {x = y})) ⟩
249258
((𝟙 + x) + (𝟙 + x)) + (y + y) + 𝟙 + x · y
250259
≡⟨ solve! (BooleanRing→CommRing A) ⟩
251260
¬ x ∨ ¬ y ∎

Cubical/Algebra/CommAlgebra/UnivariatePolyList.agda

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,11 @@ module _ (R : CommRing ℓ) where
221221

222222

223223
{- Reforumlation in terms of the R-AlgebraHom from R[X] to A -}
224-
indcuedHomEquivalence : AlgebraHom (CommAlgebra→Algebra ListPolyCommAlgebra) A ≃ ⟨ A ⟩
225-
fst indcuedHomEquivalence f = fst f X
226-
fst (fst (equiv-proof (snd indcuedHomEquivalence) x)) = inducedHom x
227-
snd (fst (equiv-proof (snd indcuedHomEquivalence) x)) = inducedMapGenerator x
228-
snd (equiv-proof (snd indcuedHomEquivalence) x) (g , gX≡x) =
224+
inducedHomEquivalence : AlgebraHom (CommAlgebra→Algebra ListPolyCommAlgebra) A ≃ ⟨ A ⟩
225+
fst inducedHomEquivalence f = fst f X
226+
fst (fst (equiv-proof (snd inducedHomEquivalence) x)) = inducedHom x
227+
snd (fst (equiv-proof (snd inducedHomEquivalence) x)) = inducedMapGenerator x
228+
snd (equiv-proof (snd inducedHomEquivalence) x) (g , gX≡x) =
229229
Σ≡Prop (λ _ is-set _ _) (sym (inducedHomUnique x g gX≡x))
230230

231231
equalByUMP : (f g : AlgebraHom (CommAlgebra→Algebra ListPolyCommAlgebra) A)

Cubical/Algebra/CommRing/Ideal/Base.agda

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ module CommIdeal (R' : CommRing ℓ) where
8989
∑Closed I {n = zero} _ _ = I .snd .contains0
9090
∑Closed I {n = suc n} V h = I .snd .+Closed (h zero) (∑Closed I (V ∘ suc) (h ∘ suc))
9191

92+
open Exponentiation R'
93+
94+
^sucClosed : (I : CommIdeal) (x : R) {n : ℕ}
95+
x ∈ I x ^ suc n ∈ I
96+
^sucClosed I x x∈I = subst-∈ I (·Comm _ x) (·Closed (snd I) _ x∈I)
97+
9298
0Ideal : CommIdeal
9399
fst 0Ideal x = (x ≡ 0r) , is-set _ _
94100
+Closed (snd 0Ideal) x≡0 y≡0 = cong₂ (_+_) x≡0 y≡0 ∙ +IdR _

Cubical/Algebra/CommRing/Ideal/Sum.agda

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ module IdealSum (R' : CommRing ℓ) where
156156
·iComm⊆ I J x = map λ (n , (α , β) , ∀αi∈I , ∀βi∈J , x≡∑αβ)
157157
(n , (β , α) , ∀βi∈J , ∀αi∈I , x≡∑αβ ∙ ∑Ext (λ i ·Comm (α i) (β i)))
158158

159+
·iRincl : (I J : CommIdeal) (I ·i J) ⊆ J
160+
·iRincl I J x x∈IJ = ·iLincl J I x (·iComm⊆ I J x x∈IJ)
161+
159162
·iComm : (I J : CommIdeal) I ·i J ≡ J ·i I
160163
·iComm I J = CommIdeal≡Char (·iComm⊆ I J) (·iComm⊆ J I)
161164

Cubical/Algebra/CommRing/RadicalIdeal.agda

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,12 @@ module RadicalIdeal (R' : CommRing ℓ) where
9999
1∈√→1∈ : (I : CommIdeal) 1r ∈ √ I 1r ∈ I
100100
1∈√→1∈ I = PT.rec (∈-isProp (fst I) _) λ (n , 1ⁿ∈I) subst-∈ I (1ⁿ≡1 n) 1ⁿ∈I
101101

102+
√Resp⊆ : (I J : CommIdeal) I ⊆ J √ I ⊆ √ J
103+
√Resp⊆ I J I⊆J x = map (map-snd λ {a} I⊆J (x ^ a))
104+
102105
-- important lemma for characterization of the Zariski lattice
103106
open KroneckerDelta (CommRing→Ring R')
107+
104108
√FGIdealCharLImpl : {n : ℕ} (V : FinVec R n) (I : CommIdeal)
105109
√ ⟨ V ⟩[ R' ] ⊆ √ I ( i V i ∈ √ I)
106110
√FGIdealCharLImpl V I √⟨V⟩⊆√I i = √⟨V⟩⊆√I _ (∈→∈√ ⟨ V ⟩[ R' ] (V i)
@@ -234,3 +238,10 @@ module RadicalIdeal (R' : CommRing ℓ) where
234238

235239
√·Absorb+ : (I J : CommIdeal) √ (I ·i (I +i J)) ≡ √ I
236240
√·Absorb+ I J = CommIdeal≡Char (√·Absorb+LIncl I J) (√·Absorb+RIncl I J)
241+
242+
√·ContrLIncl : (I J : CommIdeal) √ (√ I ·i √ J) ⊆ √ (I ·i J)
243+
√·ContrLIncl I J x = √·RContrLIncl I J x ∘ subst (x ∈_) (√·LContr I (√ J))
244+
245+
√Pres·LIncl : (I J : CommIdeal) (√ I ·i √ J) ⊆ √ (I ·i J)
246+
√Pres·LIncl I J x = √·ContrLIncl I J x ∘ ∈→∈√ (√ I ·i √ J) x
247+

Cubical/Algebra/SymmetricGroup.agda

Lines changed: 77 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,87 @@ module Cubical.Algebra.SymmetricGroup where
44
open import Cubical.Foundations.Prelude
55
open import Cubical.Foundations.Equiv
66
open import Cubical.Foundations.HLevels
7+
open import Cubical.Foundations.Function
8+
open import Cubical.Foundations.Isomorphism
9+
open import Cubical.Foundations.Univalence
10+
open import Cubical.Foundations.Structure
711
open import Cubical.Data.Sigma
8-
open import Cubical.Data.Nat using (ℕ ; suc ; zero)
9-
open import Cubical.Data.Fin using (Fin ; isSetFin)
10-
open import Cubical.Data.Empty
11-
open import Cubical.Relation.Nullary using (¬_)
12+
open import Cubical.Data.Nat
13+
open import Cubical.Data.SumFin
14+
open import Cubical.Data.Empty as Empty
15+
open import Cubical.Data.Bool
16+
open import Cubical.Data.Unit
1217

1318
open import Cubical.Algebra.Group
19+
open import Cubical.Algebra.Group.Morphisms
20+
open import Cubical.Algebra.Group.MorphismProperties
21+
open import Cubical.Algebra.Group.GroupPath
22+
open import Cubical.Algebra.Group.Instances.Bool
23+
open import Cubical.Algebra.Group.Instances.Unit
1424

15-
private
16-
variable
17-
: Level
25+
private variable
26+
ℓ ℓ' : Level
27+
X Y : Type ℓ
1828

19-
Symmetric-Group : (X : Type ℓ) isSet X Group ℓ
20-
Symmetric-Group X isSetX = makeGroup (idEquiv X) compEquiv invEquiv (isOfHLevel≃ 2 isSetX isSetX)
21-
compEquiv-assoc compEquivEquivId compEquivIdEquiv invEquiv-is-rinv invEquiv-is-linv
29+
SymGroup : (X : Type ℓ) isSet X Group ℓ
30+
SymGroup X isSetX = makeGroup {G = X ≃ X} (idEquiv X) compEquiv invEquiv
31+
(isOfHLevel≃ 2 isSetX isSetX)
32+
compEquiv-assoc
33+
compEquivEquivId
34+
compEquivIdEquiv
35+
invEquiv-is-rinv
36+
invEquiv-is-linv
2237

23-
-- Finite symmetrics groups
38+
FinSymGroup : Group₀
39+
FinSymGroup n = SymGroup (Fin n) isSetFin
2440

25-
Sym : Group _
26-
Sym n = Symmetric-Group (Fin n) isSetFin
41+
Sym0≃1 : GroupEquiv (FinSymGroup 0) UnitGroup₀
42+
Sym0≃1 = contrGroupEquivUnit $ inhProp→isContr (idEquiv _) $ isOfHLevel≃ 1 isProp⊥ isProp⊥
43+
44+
Sym0≡1 : FinSymGroup 0 ≡ UnitGroup₀
45+
Sym0≡1 = uaGroup Sym0≃1
46+
47+
Sym1≃1 : GroupEquiv (FinSymGroup 1) UnitGroup₀
48+
Sym1≃1 = contrGroupEquivUnit $ isOfHLevel≃ 0 isContrSumFin1 isContrSumFin1
49+
50+
Sym1≡1 : FinSymGroup 1 ≡ UnitGroup₀
51+
Sym1≡1 = uaGroup Sym1≃1
52+
53+
Sym2≃Bool : GroupEquiv (FinSymGroup 2) BoolGroup
54+
Sym2≃Bool = GroupIso→GroupEquiv $ invGroupIso $ ≅Bool $
55+
Fin 2 ≃ Fin 2 Iso⟨ equivCompIso SumFin2≃Bool SumFin2≃Bool ⟩
56+
Bool ≃ Bool Iso⟨ invIso univalenceIso ⟩
57+
Bool ≡ Bool Iso⟨ invIso reflectIso ⟩
58+
Bool ∎Iso
59+
where open BoolReflection
60+
61+
Sym2≡Bool : FinSymGroup 2 ≡ BoolGroup
62+
Sym2≡Bool = uaGroup Sym2≃Bool
63+
64+
SymUnit≃Unit : GroupEquiv (SymGroup Unit isSetUnit) UnitGroup₀
65+
SymUnit≃Unit = contrGroupEquivUnit $ isOfHLevel≃ 0 isContrUnit isContrUnit
66+
67+
SymUnit≡Unit : SymGroup Unit isSetUnit ≡ UnitGroup₀
68+
SymUnit≡Unit = uaGroup SymUnit≃Unit
69+
70+
SymBool≃Bool : GroupEquiv (SymGroup Bool isSetBool) BoolGroup
71+
SymBool≃Bool = GroupIso→GroupEquiv $ invGroupIso $ ≅Bool $
72+
Bool ≃ Bool Iso⟨ invIso univalenceIso ⟩
73+
Bool ≡ Bool Iso⟨ invIso reflectIso ⟩
74+
Bool ∎Iso
75+
where open BoolReflection
76+
77+
SymBool≡Bool : SymGroup Bool isSetBool ≡ BoolGroup
78+
SymBool≡Bool = uaGroup SymBool≃Bool
79+
80+
module _ (n : ℕ) where
81+
82+
⟨Sym⟩≃factorial : ⟨ FinSymGroup n ⟩ ≃ Fin (n !)
83+
⟨Sym⟩≃factorial = SumFin≃≃ n
84+
85+
⟨Sym⟩≡factorial : ⟨ FinSymGroup n ⟩ ≡ Fin (n !)
86+
⟨Sym⟩≡factorial = ua ⟨Sym⟩≃factorial
87+
88+
Sym-cong-≃ : isSetX isSetY X ≃ Y GroupEquiv (SymGroup X isSetX) (SymGroup Y isSetY)
89+
Sym-cong-≃ isSetX isSetY e .fst = equivComp e e
90+
Sym-cong-≃ isSetX isSetY e .snd = makeIsGroupHom λ g h sym $ equivEq $ funExt λ x cong (e .fst ∘ h .fst) (retEq e _)

0 commit comments

Comments
 (0)