Skip to content

Commit d738032

Browse files
authored
Merge branch 'master' into oriented-graded-posets
2 parents e77e2c7 + 1f2af52 commit d738032

File tree

124 files changed

+4727
-2280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+4727
-2280
lines changed

Cubical/Algebra/Algebra/Base.agda

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ open import Cubical.Foundations.SIP
1010

1111
open import Cubical.Data.Sigma
1212

13-
open import Cubical.Displayed.Base
14-
open import Cubical.Displayed.Auto
15-
open import Cubical.Displayed.Record
16-
open import Cubical.Displayed.Universe
17-
1813
open import Cubical.Reflection.RecordEquiv
1914

2015
open import Cubical.Algebra.Monoid
@@ -36,7 +31,7 @@ record IsAlgebra (R : Ring ℓ) {A : Type ℓ'}
3631
(0a 1a : A) (_+_ _·_ : A A A) (-_ : A A)
3732
(_⋆_ : ⟨ R ⟩ A A) : Type (ℓ-max ℓ ℓ') where
3833

39-
constructor isalgebra
34+
no-eta-equality
4035

4136
open RingStr (snd R) using (1r) renaming (_+_ to _+r_; _·_ to _·r_)
4237

@@ -59,8 +54,6 @@ unquoteDecl IsAlgebraIsoΣ = declareRecordIsoΣ IsAlgebraIsoΣ (quote IsAlgebra)
5954

6055
record AlgebraStr (R : Ring ℓ) (A : Type ℓ') : Type (ℓ-max ℓ ℓ') where
6156

62-
constructor algebrastr
63-
6457
field
6558
0a : A
6659
1a : A
@@ -72,6 +65,8 @@ record AlgebraStr (R : Ring ℓ) (A : Type ℓ') : Type (ℓ-max ℓ ℓ') where
7265

7366
open IsAlgebra isAlgebra public
7467

68+
unquoteDecl AlgebraStrIsoΣ = declareRecordIsoΣ AlgebraStrIsoΣ (quote AlgebraStr)
69+
7570
Algebra : (R : Ring ℓ) ℓ' Type (ℓ-max ℓ (ℓ-suc ℓ'))
7671
Algebra R ℓ' = Σ[ A ∈ Type ℓ' ] AlgebraStr R A
7772

@@ -208,13 +203,15 @@ isPropIsAlgebra R _ _ _ _ _ _ = let open IsLeftModule in
208203
isPropIsAlgebraHom : (R : Ring ℓ) {A : Type ℓ'} {B : Type ℓ''}
209204
(AS : AlgebraStr R A) (f : A B) (BS : AlgebraStr R B)
210205
isProp (IsAlgebraHom AS f BS)
211-
isPropIsAlgebraHom R AS f BS = isOfHLevelRetractFromIso 1 IsAlgebraHomIsoΣ
212-
(isProp×5 (is-set _ _)
213-
(is-set _ _)
214-
(isPropΠ2 λ _ _ is-set _ _)
215-
(isPropΠ2 λ _ _ is-set _ _)
216-
(isPropΠ λ _ is-set _ _)
217-
(isPropΠ2 λ _ _ is-set _ _))
206+
isPropIsAlgebraHom R AS f BS =
207+
isOfHLevelRetractFromIso 1
208+
IsAlgebraHomIsoΣ
209+
(isProp×5 (is-set _ _)
210+
(is-set _ _)
211+
(isPropΠ2 λ _ _ is-set _ _)
212+
(isPropΠ2 λ _ _ is-set _ _)
213+
(isPropΠ λ _ is-set _ _)
214+
(isPropΠ2 λ _ _ is-set _ _))
218215
where
219216
open AlgebraStr BS
220217

@@ -237,33 +234,6 @@ isSetAlgebraEquiv M N = isSetΣ (isOfHLevel≃ 2 M.is-set N.is-set)
237234
AlgebraHom≡ : {φ ψ : AlgebraHom A B} fst φ ≡ fst ψ φ ≡ ψ
238235
AlgebraHom≡ = Σ≡Prop λ f isPropIsAlgebraHom _ _ f _
239236

240-
𝒮ᴰ-Algebra : (R : Ring ℓ) DUARel (𝒮-Univ ℓ') (AlgebraStr R) (ℓ-max ℓ ℓ')
241-
𝒮ᴰ-Algebra R =
242-
𝒮ᴰ-Record (𝒮-Univ _) (IsAlgebraEquiv {R = R})
243-
(fields:
244-
data[ 0a ∣ nul ∣ pres0 ]
245-
data[ 1a ∣ nul ∣ pres1 ]
246-
data[ _+_ ∣ bin ∣ pres+ ]
247-
data[ _·_ ∣ bin ∣ pres· ]
248-
data[ -_ ∣ autoDUARel _ _ ∣ pres- ]
249-
data[ _⋆_ ∣ autoDUARel _ _ ∣ pres⋆ ]
250-
prop[ isAlgebra ∣ (λ _ _ isPropIsAlgebra _ _ _ _ _ _ _) ])
251-
where
252-
open AlgebraStr
253-
254-
-- faster with some sharing
255-
nul = autoDUARel (𝒮-Univ _) (λ A A)
256-
bin = autoDUARel (𝒮-Univ _) (λ A A A A)
257-
258-
AlgebraPath : (A B : Algebra R ℓ') (AlgebraEquiv A B) ≃ (A ≡ B)
259-
AlgebraPath {R = R} = ∫ (𝒮ᴰ-Algebra R) .UARel.ua
260-
261-
uaAlgebra : AlgebraEquiv A B A ≡ B
262-
uaAlgebra {A = A} {B = B} = equivFun (AlgebraPath A B)
263-
264-
isGroupoidAlgebra : isGroupoid (Algebra R ℓ')
265-
isGroupoidAlgebra _ _ = isOfHLevelRespectEquiv 2 (AlgebraPath _ _) (isSetAlgebraEquiv _ _)
266-
267237
-- Smart constructor for algebra homomorphisms
268238
-- that infers the other equations from pres1, pres+, pres·, and pres⋆
269239

Cubical/Algebra/Algebra/Properties.agda

Lines changed: 13 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ open import Cubical.Foundations.HLevels
1010
open import Cubical.Foundations.GroupoidLaws
1111
open import Cubical.Foundations.Path
1212
open import Cubical.Foundations.Transport
13-
open import Cubical.Foundations.Univalence
14-
open import Cubical.Foundations.SIP
13+
open import Cubical.Foundations.SIP using (⟨_⟩)
1514

1615
open import Cubical.Data.Sigma
1716

@@ -185,57 +184,15 @@ module AlgebraEquivs where
185184
(λ g isPropIsAlgebraHom _ (B .snd) g (C .snd))
186185
(isoOnTypes .leftInv (g .fst))
187186

188-
-- the Algebra version of uaCompEquiv
189-
module AlgebraUAFunctoriality where
190-
open AlgebraStr
191-
open AlgebraEquivs
192-
193-
Algebra≡ : (A B : Algebra R ℓ') (
194-
Σ[ p ∈ ⟨ A ⟩ ≡ ⟨ B ⟩ ]
195-
Σ[ q0 ∈ PathP (λ i p i) (0a (snd A)) (0a (snd B)) ]
196-
Σ[ q1 ∈ PathP (λ i p i) (1a (snd A)) (1a (snd B)) ]
197-
Σ[ r+ ∈ PathP (λ i p i p i p i) (_+_ (snd A)) (_+_ (snd B)) ]
198-
Σ[ r· ∈ PathP (λ i p i p i p i) (_·_ (snd A)) (_·_ (snd B)) ]
199-
Σ[ s- ∈ PathP (λ i p i p i) (-_ (snd A)) (-_ (snd B)) ]
200-
Σ[ s⋆ ∈ PathP (λ i ⟨ R ⟩ p i p i) (_⋆_ (snd A)) (_⋆_ (snd B)) ]
201-
PathP (λ i IsAlgebra R (q0 i) (q1 i) (r+ i) (r· i) (s- i) (s⋆ i)) (isAlgebra (snd A))
202-
(isAlgebra (snd B)))
203-
≃ (A ≡ B)
204-
Algebra≡ A B = isoToEquiv theIso
205-
where
206-
open Iso
207-
theIso : Iso _ _
208-
fun theIso (p , q0 , q1 , r+ , r· , s- , s⋆ , t) i = p i
209-
, algebrastr (q0 i) (q1 i) (r+ i) (r· i) (s- i) (s⋆ i) (t i)
210-
inv theIso x = cong ⟨_⟩ x , cong (0a ∘ snd) x , cong (1a ∘ snd) x
211-
, cong (_+_ ∘ snd) x , cong (_·_ ∘ snd) x , cong (-_ ∘ snd) x , cong (_⋆_ ∘ snd) x
212-
, cong (isAlgebra ∘ snd) x
213-
rightInv theIso _ = refl
214-
leftInv theIso _ = refl
215-
216-
caracAlgebra≡ : (p q : A ≡ B) cong ⟨_⟩ p ≡ cong ⟨_⟩ q p ≡ q
217-
caracAlgebra≡ {A = A} {B = B} p q P =
218-
sym (transportTransport⁻ (ua (Algebra≡ A B)) p)
219-
∙∙ cong (transport (ua (Algebra≡ A B))) helper
220-
∙∙ transportTransport⁻ (ua (Algebra≡ A B)) q
221-
where
222-
helper : transport (sym (ua (Algebra≡ A B))) p ≡ transport (sym (ua (Algebra≡ A B))) q
223-
helper = Σ≡Prop
224-
(λ _ isPropΣ
225-
(isOfHLevelPathP' 1 (is-set (snd B)) _ _)
226-
λ _ isPropΣ (isOfHLevelPathP' 1 (is-set (snd B)) _ _)
227-
λ _ isPropΣ (isOfHLevelPathP' 1 (isSetΠ2 λ _ _ is-set (snd B)) _ _)
228-
λ _ isPropΣ (isOfHLevelPathP' 1 (isSetΠ2 λ _ _ is-set (snd B)) _ _)
229-
λ _ isPropΣ (isOfHLevelPathP' 1 (isSetΠ λ _ is-set (snd B)) _ _)
230-
λ _ isPropΣ (isOfHLevelPathP' 1 (isSetΠ2 λ _ _ is-set (snd B)) _ _)
231-
λ _ isOfHLevelPathP 1 (isPropIsAlgebra _ _ _ _ _ _ _) _ _)
232-
(transportRefl (cong ⟨_⟩ p) ∙ P ∙ sym (transportRefl (cong ⟨_⟩ q)))
233-
234-
uaCompAlgebraEquiv : (f : AlgebraEquiv A B) (g : AlgebraEquiv B C)
235-
uaAlgebra (compAlgebraEquiv f g) ≡ uaAlgebra f ∙ uaAlgebra g
236-
uaCompAlgebraEquiv f g = caracAlgebra≡ _ _ (
237-
cong ⟨_⟩ (uaAlgebra (compAlgebraEquiv f g))
238-
≡⟨ uaCompEquiv _ _ ⟩
239-
cong ⟨_⟩ (uaAlgebra f) ∙ cong ⟨_⟩ (uaAlgebra g)
240-
≡⟨ sym (cong-∙ ⟨_⟩ (uaAlgebra f) (uaAlgebra g)) ⟩
241-
cong ⟨_⟩ (uaAlgebra f ∙ uaAlgebra g) ∎)
187+
isSetAlgebraStr : (A : Type ℓ') isSet (AlgebraStr R A)
188+
isSetAlgebraStr A =
189+
let open AlgebraStr
190+
in isOfHLevelSucIfInhabited→isOfHLevelSuc 1 λ str
191+
isOfHLevelRetractFromIso 2 AlgebraStrIsoΣ $
192+
isSetΣ (str .is-set) λ _
193+
isSetΣ (str .is-set) λ _
194+
isSetΣ (isSet→ (isSet→ (str .is-set))) λ _
195+
isSetΣ (isSet→ (isSet→ (str .is-set))) λ _
196+
isSetΣ (isSet→ (str .is-set)) (λ _
197+
isSetΣSndProp (isSet→ (isSet→ (str .is-set))) λ _
198+
isPropIsAlgebra _ _ _ _ _ _ _)
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{-# OPTIONS --safe #-}
2+
module Cubical.Algebra.Algebra.Univalence where
3+
4+
open import Cubical.Foundations.Prelude
5+
open import Cubical.Foundations.Function
6+
open import Cubical.Foundations.Isomorphism
7+
open import Cubical.Foundations.Equiv
8+
open import Cubical.Foundations.Univalence
9+
open import Cubical.Foundations.HLevels
10+
open import Cubical.Foundations.GroupoidLaws
11+
open import Cubical.Foundations.SIP
12+
13+
open import Cubical.Functions.Embedding
14+
15+
open import Cubical.Data.Sigma
16+
17+
open import Cubical.Displayed.Base
18+
open import Cubical.Displayed.Auto
19+
open import Cubical.Displayed.Record
20+
open import Cubical.Displayed.Universe
21+
22+
open import Cubical.Algebra.Ring.Base
23+
open import Cubical.Algebra.Algebra.Base
24+
open import Cubical.Algebra.Algebra.Properties
25+
26+
private
27+
variable
28+
ℓ ℓ' ℓ'' ℓ''' : Level
29+
R : Ring ℓ
30+
A B C D : Algebra R ℓ
31+
32+
open IsAlgebraHom
33+
34+
𝒮ᴰ-Algebra : (R : Ring ℓ) DUARel (𝒮-Univ ℓ') (AlgebraStr R) (ℓ-max ℓ ℓ')
35+
𝒮ᴰ-Algebra R =
36+
𝒮ᴰ-Record (𝒮-Univ _) (IsAlgebraEquiv {R = R})
37+
(fields:
38+
data[ 0a ∣ nul ∣ pres0 ]
39+
data[ 1a ∣ nul ∣ pres1 ]
40+
data[ _+_ ∣ bin ∣ pres+ ]
41+
data[ _·_ ∣ bin ∣ pres· ]
42+
data[ -_ ∣ autoDUARel _ _ ∣ pres- ]
43+
data[ _⋆_ ∣ autoDUARel _ _ ∣ pres⋆ ]
44+
prop[ isAlgebra ∣ (λ A ΣA
45+
isPropIsAlgebra
46+
R
47+
(snd (fst (fst (fst (fst (fst ΣA))))))
48+
(snd (fst (fst (fst (fst ΣA)))))
49+
(snd (fst (fst (fst ΣA))))
50+
(snd (fst (fst ΣA)))
51+
(snd (fst ΣA))
52+
(snd ΣA)) ])
53+
where
54+
open AlgebraStr
55+
56+
-- faster with some sharing
57+
nul = autoDUARel (𝒮-Univ _) (λ A A)
58+
bin = autoDUARel (𝒮-Univ _) (λ A A A A)
59+
60+
AlgebraPath : (A B : Algebra R ℓ') (AlgebraEquiv A B) ≃ (A ≡ B)
61+
AlgebraPath {R = R} = ∫ (𝒮ᴰ-Algebra R) .UARel.ua
62+
63+
uaAlgebra : AlgebraEquiv A B A ≡ B
64+
uaAlgebra {A = A} {B = B} = equivFun (AlgebraPath A B)
65+
66+
isGroupoidAlgebra : isGroupoid (Algebra R ℓ')
67+
isGroupoidAlgebra _ _ = isOfHLevelRespectEquiv 2 (AlgebraPath _ _) (isSetAlgebraEquiv _ _)
68+
69+
-- the Algebra version of uaCompEquiv
70+
module AlgebraUAFunctoriality where
71+
open AlgebraStr
72+
open AlgebraEquivs
73+
74+
caracAlgebra≡ : (p q : A ≡ B) cong ⟨_⟩ p ≡ cong ⟨_⟩ q p ≡ q
75+
caracAlgebra≡ _ _ α =
76+
isEmbedding→Inj (iso→isEmbedding (invIso ΣPathIsoPathΣ)) _ _ $
77+
Σ≡Prop (λ _ isOfHLevelPathP' 1 (isSetAlgebraStr _) _ _) α
78+
79+
uaCompAlgebraEquiv : (f : AlgebraEquiv A B) (g : AlgebraEquiv B C)
80+
uaAlgebra (compAlgebraEquiv f g) ≡ uaAlgebra f ∙ uaAlgebra g
81+
uaCompAlgebraEquiv f g = caracAlgebra≡ _ _ (
82+
cong ⟨_⟩ (uaAlgebra (compAlgebraEquiv f g))
83+
≡⟨ uaCompEquiv _ _ ⟩
84+
cong ⟨_⟩ (uaAlgebra f) ∙ cong ⟨_⟩ (uaAlgebra g)
85+
≡⟨ sym (cong-∙ ⟨_⟩ (uaAlgebra f) (uaAlgebra g)) ⟩
86+
cong ⟨_⟩ (uaAlgebra f ∙ uaAlgebra g) ∎)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{-# OPTIONS --safe #-}
2+
module Cubical.Algebra.CommAlgebra.AsModule where
3+
4+
open import Cubical.Algebra.CommAlgebra.AsModule.Base public
5+
open import Cubical.Algebra.CommAlgebra.AsModule.Properties public

0 commit comments

Comments
 (0)