@@ -12,8 +12,20 @@ open import Cubical.Data.Nat
12
12
13
13
open import Cubical.Data.Sum.Base
14
14
15
+ open Iso
16
+
17
+
18
+ private
19
+ variable
20
+ ℓa ℓb ℓc ℓd : Level
21
+ A : Type ℓa
22
+ B : Type ℓb
23
+ C : Type ℓc
24
+ D : Type ℓd
25
+
26
+
15
27
-- Path space of sum type
16
- module SumPath {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} where
28
+ module ⊎Path {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} where
17
29
18
30
Cover : A ⊎ B → A ⊎ B → Type (ℓ-max ℓ ℓ')
19
31
Cover (inl a) (inl a') = Lift {j = ℓ-max ℓ ℓ'} (a ≡ a')
@@ -67,40 +79,77 @@ module SumPath {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} where
67
79
isOfHLevelLift (suc n) (isProp→isOfHLevelSuc n isProp⊥)
68
80
isOfHLevelCover n p q (inr b) (inr b') = isOfHLevelLift (suc n) (q b b')
69
81
70
- isEmbedding-inl : ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} → isEmbedding (inl {A = A} {B = B})
71
- isEmbedding-inl w z = snd (compEquiv LiftEquiv (SumPath .Cover≃Path (inl w) (inl z)))
82
+ isEmbedding-inl : isEmbedding (inl {A = A} {B = B})
83
+ isEmbedding-inl w z = snd (compEquiv LiftEquiv (⊎Path .Cover≃Path (inl w) (inl z)))
72
84
73
- isEmbedding-inr : ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} → isEmbedding (inr {A = A} {B = B})
74
- isEmbedding-inr w z = snd (compEquiv LiftEquiv (SumPath .Cover≃Path (inr w) (inr z)))
85
+ isEmbedding-inr : isEmbedding (inr {A = A} {B = B})
86
+ isEmbedding-inr w z = snd (compEquiv LiftEquiv (⊎Path .Cover≃Path (inr w) (inr z)))
75
87
76
- isOfHLevelSum : ∀ {ℓ ℓ'} (n : HLevel) {A : Type ℓ} {B : Type ℓ'}
88
+ isOfHLevel⊎ : (n : HLevel)
77
89
→ isOfHLevel (suc (suc n)) A
78
90
→ isOfHLevel (suc (suc n)) B
79
91
→ isOfHLevel (suc (suc n)) (A ⊎ B)
80
- isOfHLevelSum n lA lB c c' =
92
+ isOfHLevel⊎ n lA lB c c' =
81
93
isOfHLevelRetract (suc n)
82
- (SumPath.encode c c')
83
- (SumPath.decode c c')
84
- (SumPath.decodeEncode c c')
85
- (SumPath.isOfHLevelCover n lA lB c c')
86
-
87
- isSetSum : ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} → isSet A → isSet B → isSet (A ⊎ B)
88
- isSetSum = isOfHLevelSum 0
89
-
90
- isGroupoidSum : ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} → isGroupoid A → isGroupoid B → isGroupoid (A ⊎ B)
91
- isGroupoidSum = isOfHLevelSum 1
92
-
93
- is2GroupoidSum : ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} → is2Groupoid A → is2Groupoid B → is2Groupoid (A ⊎ B)
94
- is2GroupoidSum = isOfHLevelSum 2
95
-
96
- sumIso : ∀ {ℓa ℓb ℓc ℓd} {A : Type ℓa} {B : Type ℓb} {C : Type ℓc} {D : Type ℓd}
97
- → Iso A C → Iso B D
98
- → Iso (A ⊎ B) (C ⊎ D)
99
- Iso.fun (sumIso iac ibd) (inl x) = inl (iac .Iso.fun x)
100
- Iso.fun (sumIso iac ibd) (inr x) = inr (ibd .Iso.fun x)
101
- Iso.inv (sumIso iac ibd) (inl x) = inl (iac .Iso.inv x)
102
- Iso.inv (sumIso iac ibd) (inr x) = inr (ibd .Iso.inv x)
103
- Iso.rightInv (sumIso iac ibd) (inl x) = cong inl (iac .Iso.rightInv x)
104
- Iso.rightInv (sumIso iac ibd) (inr x) = cong inr (ibd .Iso.rightInv x)
105
- Iso.leftInv (sumIso iac ibd) (inl x) = cong inl (iac .Iso.leftInv x)
106
- Iso.leftInv (sumIso iac ibd) (inr x) = cong inr (ibd .Iso.leftInv x)
94
+ (⊎Path.encode c c')
95
+ (⊎Path.decode c c')
96
+ (⊎Path.decodeEncode c c')
97
+ (⊎Path.isOfHLevelCover n lA lB c c')
98
+
99
+ isSet⊎ : isSet A → isSet B → isSet (A ⊎ B)
100
+ isSet⊎ = isOfHLevel⊎ 0
101
+
102
+ isGroupoid⊎ : isGroupoid A → isGroupoid B → isGroupoid (A ⊎ B)
103
+ isGroupoid⊎ = isOfHLevel⊎ 1
104
+
105
+ is2Groupoid⊎ : is2Groupoid A → is2Groupoid B → is2Groupoid (A ⊎ B)
106
+ is2Groupoid⊎ = isOfHLevel⊎ 2
107
+
108
+ ⊎Iso : Iso A C → Iso B D → Iso (A ⊎ B) (C ⊎ D)
109
+ fun (⊎Iso iac ibd) (inl x) = inl (iac .fun x)
110
+ fun (⊎Iso iac ibd) (inr x) = inr (ibd .fun x)
111
+ inv (⊎Iso iac ibd) (inl x) = inl (iac .inv x)
112
+ inv (⊎Iso iac ibd) (inr x) = inr (ibd .inv x)
113
+ rightInv (⊎Iso iac ibd) (inl x) = cong inl (iac .rightInv x)
114
+ rightInv (⊎Iso iac ibd) (inr x) = cong inr (ibd .rightInv x)
115
+ leftInv (⊎Iso iac ibd) (inl x) = cong inl (iac .leftInv x)
116
+ leftInv (⊎Iso iac ibd) (inr x) = cong inr (ibd .leftInv x)
117
+
118
+ ⊎-swap-Iso : Iso (A ⊎ B) (B ⊎ A)
119
+ fun ⊎-swap-Iso (inl x) = inr x
120
+ fun ⊎-swap-Iso (inr x) = inl x
121
+ inv ⊎-swap-Iso (inl x) = inr x
122
+ inv ⊎-swap-Iso (inr x) = inl x
123
+ rightInv ⊎-swap-Iso (inl _) = refl
124
+ rightInv ⊎-swap-Iso (inr _) = refl
125
+ leftInv ⊎-swap-Iso (inl _) = refl
126
+ leftInv ⊎-swap-Iso (inr _) = refl
127
+
128
+ ⊎-swap-≃ : A ⊎ B ≃ B ⊎ A
129
+ ⊎-swap-≃ = isoToEquiv ⊎-swap-Iso
130
+
131
+ ⊎-assoc-Iso : Iso ((A ⊎ B) ⊎ C) (A ⊎ (B ⊎ C))
132
+ fun ⊎-assoc-Iso (inl (inl x)) = inl x
133
+ fun ⊎-assoc-Iso (inl (inr x)) = inr (inl x)
134
+ fun ⊎-assoc-Iso (inr x) = inr (inr x)
135
+ inv ⊎-assoc-Iso (inl x) = inl (inl x)
136
+ inv ⊎-assoc-Iso (inr (inl x)) = inl (inr x)
137
+ inv ⊎-assoc-Iso (inr (inr x)) = inr x
138
+ rightInv ⊎-assoc-Iso (inl _) = refl
139
+ rightInv ⊎-assoc-Iso (inr (inl _)) = refl
140
+ rightInv ⊎-assoc-Iso (inr (inr _)) = refl
141
+ leftInv ⊎-assoc-Iso (inl (inl _)) = refl
142
+ leftInv ⊎-assoc-Iso (inl (inr _)) = refl
143
+ leftInv ⊎-assoc-Iso (inr _) = refl
144
+
145
+ ⊎-assoc-≃ : (A ⊎ B) ⊎ C ≃ A ⊎ (B ⊎ C)
146
+ ⊎-assoc-≃ = isoToEquiv ⊎-assoc-Iso
147
+
148
+ ⊎-⊥-Iso : Iso (A ⊎ ⊥) A
149
+ fun ⊎-⊥-Iso (inl x) = x
150
+ inv ⊎-⊥-Iso x = inl x
151
+ rightInv ⊎-⊥-Iso x = refl
152
+ leftInv ⊎-⊥-Iso (inl x) = refl
153
+
154
+ ⊎-⊥-≃ : A ⊎ ⊥ ≃ A
155
+ ⊎-⊥-≃ = isoToEquiv ⊎-⊥-Iso
0 commit comments