-
Notifications
You must be signed in to change notification settings - Fork 1
/
Types.agda
209 lines (187 loc) · 7.82 KB
/
Types.agda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
{-# OPTIONS --rewriting #-}
module _ where
open import Data.Empty
open import Data.Unit
open import Data.Sum
open import Data.Product
open import Data.Nat
open import Universe
open import Rational
infix 60 _⊗_
infix 50 _⊕_
data τ : ℕ → Set where
𝟘 : τ 0
𝟙 : τ 1
_⊕_ : ∀ {m n : ℕ} → τ m → τ n → τ (m + n)
_⊗_ : ∀ {m n} → τ m → τ n → τ (m * n)
τ-univ : Indexed-universe _ _ _
τ-univ = record { I = ℕ ; U = τ ; El = ⟦_⟧ }
where ⟦_⟧ : ∀ {n} → τ n → Set
⟦ 𝟘 ⟧ = ⊥
⟦ 𝟙 ⟧ = ⊤
⟦ t₁ ⊕ t₂ ⟧ = ⟦ t₁ ⟧ ⊎ ⟦ t₂ ⟧
⟦ t₁ ⊗ t₂ ⟧ = ⟦ t₁ ⟧ × ⟦ t₂ ⟧
data T : ℚ → Set where
_/_ : ∀ {m n} → τ m → τ n → T (m / n)
_⊞_ _⊠_ : ∀ {p q} → T p → T q → T (p ++ q)
T-univ : Indexed-universe _ _ _
T-univ = record { I = ℚ ; U = T ; El = ⟦_⟧ }
where ⟦_⟧ : ∀ {q} → T q → Set
⟦ t₁ / t₂ ⟧ = {!!}
⟦ t₁ ⊞ t₂ ⟧ = {!!}
⟦ t₁ ⊠ t₂ ⟧ = {!!}
open import Function
open import Categories.Category
open import Relation.Binary.PropositionalEquality
τ-cat : ℕ → Category _ _ _
τ-cat n = record { Obj = τ n
; _⇒_ = λ a b → El a → El b
; _≡_ = _≡_
; id = id
; _∘_ = λ g f → g ∘ f
; assoc = refl
; identityˡ = refl
; identityʳ = refl
; equiv = isEquivalence
; ∘-resp-≡ = ∘-resp-≡
}
where open Indexed-universe τ-univ
∘-resp-≡ : {A B C : Set} {f h : B → C} {g i : A → B}
→ f ≡ h → g ≡ i → f ∘ g ≡ h ∘ i
∘-resp-≡ refl refl = refl
T-cat : ℚ → Category _ _ _
T-cat q = record { Obj = T q
; _⇒_ = λ a b → El a → El b
; _≡_ = _≡_
; id = id
; _∘_ = λ g f → g ∘ f
; assoc = refl
; identityˡ = refl
; identityʳ = refl
; equiv = isEquivalence
; ∘-resp-≡ = ∘-resp-≡
}
where open Indexed-universe T-univ
∘-resp-≡ : {A B C : Set} {f h : B → C} {g i : A → B}
→ f ≡ h → g ≡ i → f ∘ g ≡ h ∘ i
∘-resp-≡ refl refl = refl
module _ where
open import Data.Nat.Properties.Simple
*-right-identity : ∀ n → n * 1 ≡ n
*-right-identity zero = refl
*-right-identity (suc n) = cong suc (*-right-identity n)
distribˡ-*-+ : ∀ m n o → m * (n + o) ≡ m * n + m * o
distribˡ-*-+ m n o = let open ≡-Reasoning in
begin
m * (n + o)
≡⟨ *-comm m (n + o) ⟩
(n + o) * m
≡⟨ distribʳ-*-+ m n o ⟩
n * m + o * m
≡⟨ cong (λ x → x + o * m) (*-comm n m) ⟩
m * n + o * m
≡⟨ cong (λ x → m * n + x) (*-comm o m) ⟩
m * n + m * o
∎
{-# BUILTIN REWRITE _≡_ #-}
{-# REWRITE +-right-identity #-}
{-# REWRITE +-assoc #-}
{-# REWRITE *-right-identity #-}
{-# REWRITE *-assoc #-}
{-# REWRITE *-right-zero #-}
{-# REWRITE distribʳ-*-+ #-}
{-# REWRITE distribˡ-*-+ #-}
infix 30 _⟷_
infixr 50 _◎_
data _⟷_ : ∀ {n} → τ n → τ n → Set where
unite₊l : ∀ {n} {t : τ n} → 𝟘 ⊕ t ⟷ t
uniti₊l : ∀ {n} {t : τ n} → t ⟷ 𝟘 ⊕ t
unite₊r : ∀ {n} {t : τ n} → t ⊕ 𝟘 ⟷ t
uniti₊r : ∀ {n} {t : τ n} → t ⟷ t ⊕ 𝟘
swap₊ : ∀ {n} {t₁ t₂ : τ n} → (t₁ ⊕ t₂) ⟷ (t₂ ⊕ t₁)
assocl₊ : ∀ {n} {t₁ t₂ t₃ : τ n} → t₁ ⊕ (t₂ ⊕ t₃) ⟷ (t₁ ⊕ t₂) ⊕ t₃
assocr₊ : ∀ {n} {t₁ t₂ t₃ : τ n} → (t₁ ⊕ t₂) ⊕ t₃ ⟷ t₁ ⊕ (t₂ ⊕ t₃)
unite⋆l : ∀ {n} {t : τ n} → 𝟙 ⊗ t ⟷ t
uniti⋆l : ∀ {n} {t : τ n} → t ⟷ 𝟙 ⊗ t
unite⋆r : ∀ {n} {t : τ n} → t ⊗ 𝟙 ⟷ t
uniti⋆r : ∀ {n} {t : τ n} → t ⟷ t ⊗ 𝟙
swap⋆ : ∀ {n} {t₁ t₂ : τ n} → t₁ ⊗ t₂ ⟷ t₂ ⊗ t₁
assocl⋆ : ∀ {n} {t₁ t₂ t₃ : τ n} → t₁ ⊗ (t₂ ⊗ t₃) ⟷ (t₁ ⊗ t₂) ⊗ t₃
assocr⋆ : ∀ {n} {t₁ t₂ t₃ : τ n} → (t₁ ⊗ t₂) ⊗ t₃ ⟷ t₁ ⊗ (t₂ ⊗ t₃)
absorbr : ∀ {n} {t : τ n} → 𝟘 ⊗ t ⟷ 𝟘
absorbl : ∀ {n} {t : τ n} → t ⊗ 𝟘 ⟷ 𝟘
factorzr : ∀ {n} {t : τ n} → 𝟘 ⟷ t ⊗ 𝟘
factorzl : ∀ {n} {t : τ n} → 𝟘 ⟷ 𝟘 ⊗ t
dist : ∀ {n} {t₁ t₂ t₃ : τ n} → (t₁ ⊕ t₂) ⊗ t₃ ⟷ (t₁ ⊗ t₃) ⊕ (t₂ ⊗ t₃)
factor : ∀ {n} {t₁ t₂ t₃ : τ n} → (t₁ ⊗ t₃) ⊕ (t₂ ⊗ t₃) ⟷ (t₁ ⊕ t₂) ⊗ t₃
distl : ∀ {n} {t₁ t₂ t₃ : τ n } → t₁ ⊗ (t₂ ⊕ t₃) ⟷ (t₁ ⊗ t₂) ⊕ (t₁ ⊗ t₃)
factorl : ∀ {n} {t₁ t₂ t₃ : τ n } → (t₁ ⊗ t₂) ⊕ (t₁ ⊗ t₃) ⟷ t₁ ⊗ (t₂ ⊕ t₃)
id⟷ : ∀ {n} {t : τ n} → t ⟷ t
_◎_ : ∀ {n} {t₁ t₂ t₃ : τ n} → (t₁ ⟷ t₂) → (t₂ ⟷ t₃) → (t₁ ⟷ t₃)
_⊕_ : ∀ {n} {t₁ t₂ t₃ t₄ : τ n} → (t₁ ⟷ t₃) → (t₂ ⟷ t₄) → (t₁ ⊕ t₂ ⟷ t₃ ⊕ t₄)
_⊗_ : ∀ {n} {t₁ t₂ t₃ t₄ : τ n} → (t₁ ⟷ t₃) → (t₂ ⟷ t₄) → (t₁ ⊗ t₂ ⟷ t₃ ⊗ t₄)
infix 90 !_
!_ : ∀ {n} {t₁ t₂ : τ n} → (t₁ ⟷ t₂) → (t₂ ⟷ t₁)
! unite₊l = uniti₊l
! uniti₊l = unite₊l
! unite₊r = uniti₊r
! uniti₊r = unite₊r
! swap₊ = swap₊
! assocl₊ = assocr₊
! assocr₊ = assocl₊
! unite⋆l = uniti⋆l
! uniti⋆l = unite⋆l
! unite⋆r = uniti⋆r
! uniti⋆r = unite⋆r
! swap⋆ = swap⋆
! assocl⋆ = assocr⋆
! assocr⋆ = assocl⋆
! absorbl = factorzr
! absorbr = factorzl
! factorzl = absorbr
! factorzr = absorbl
! dist = factor
! factor = dist
! distl = factorl
! factorl = distl
! id⟷ = id⟷
! (c₁ ◎ c₂) = ! c₂ ◎ ! c₁
! (c₁ ⊕ c₂) = ! c₁ ⊕ ! c₂
! (c₁ ⊗ c₂) = ! c₁ ⊗ ! c₂
open import Action
ElT : ∀ q → T q → Σ[ G ∈ Group _ _ ] Σ[ S ∈ Set _ ] Action G S
ElT (p / q) (T₁ / T₂) = {!!} , τ q , {!!}
ElT (._ / ._) (T₁ ⊞ T₂) = {!!}
ElT (._ / ._) (T₁ ⊠ T₂) = {!!}
private
C₂ : Group _ _
C₂ = record { Carrier = 𝟙 ⊕ 𝟙 ⟷ 𝟙 ⊕ 𝟙
; _≈_ = _≡_
; _∙_ = _◎_
; ε = id⟷
; _⁻¹ = !_
; isGroup = record {
isMonoid = record {
isSemigroup = record {
isEquivalence = isEquivalence
-- need Pi1 for the holes
; assoc = {!!}
; ∙-cong = {!!}
}
; identity = {!!}
}
; inverse = {!!}
; ⁻¹-cong = {!!}
}
}
El1/2 : Σ[ G ∈ Group _ _ ] Σ[ S ∈ Set _ ] Action G S
El1/2 = C₂ , El (𝟙 ⊕ 𝟙) , record { ρ = λ { (swap₊ , inj₁ tt) → inj₂ tt ; (swap₊ , inj₂ tt) → inj₁ tt
; (id⟷ , inj₁ tt) → inj₁ tt ; (id⟷ , inj₂ tt) → inj₂ tt
; (proj₁ ◎ proj₂ , inj₁ tt) → {!!} ; (proj₁ ◎ proj₂ , inj₂ tt) → {!!}
; (proj₁ ⊕ proj₂ , inj₁ tt) → {!!} ; (proj₁ ⊕ proj₂ , inj₂ tt) → {!!}
}
; ρ-resp-≈ = {!!}
; identityA = {!!}
; compatibility = {!!}
}
where open Indexed-universe τ-univ