-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCwF.agda
More file actions
169 lines (131 loc) · 4.94 KB
/
CwF.agda
File metadata and controls
169 lines (131 loc) · 4.94 KB
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
module CwF where
open import prelude
open import Level
open import Categories.Category
open import Categories.Functor renaming (_≡_ to _==_; _∘_ to comp)
open import Categories.Fam
open import Categories.Presheaf
open import Categories.Support.PropositionalEquality
import Categories.Object.Terminal as Terminal
record CwF {o ℓ e a b : Level}
(C : Category o ℓ e)
(F : Presheaf C (Fam a b))
: Set (suc (o ⊔ ℓ ⊔ e ⊔ a ⊔ b)) where
open Category C renaming (_≡_ to _≅_)
open Terminal C
open Functor F
open Fam renaming (_≡_ to _==_; _∘_ to comp)
module C = Category C
module F = Functor F
Ctx = C.Obj
Subst = C._⇒_
Id : {Γ : Ctx} → Subst Γ Γ
Id = C.id
Ty : Ctx → Set _
Ty Γ = U (F.F₀ Γ)
Ter : (Γ : Ctx) → Ty Γ → Set _
Ter Γ A = (T (F.F₀ Γ)) A
TApp : {Δ Γ : Ctx}
(σ : Subst Δ Γ)
(A : Ty Γ)
→ ---------------
Ty Δ
TApp σ A = (Hom.f (F.F₁ σ)) A
tApp : {Δ Γ : Ctx}
(σ : Subst Δ Γ)
{A : Ty Γ}
(a : Ter Γ A)
→ ---------------
Ter Δ (TApp σ A)
tApp σ {A} a = (Hom.φ (F.F₁ σ)) A a
field -- Equalities that should be derivable
TIdEq : {Γ : Ctx}
{A : Ty Γ}
→ -------------------------------------------------
TApp Id A ≡ A
TAppEq : {Δ Γ Θ : Ctx}
{σ : Subst Δ Γ}
{τ : Subst Θ Δ}
{A : Ty Γ}
→ -------------------------------------------------
TApp τ (TApp σ A) ≡ TApp (σ ∘ τ) A
TAppAp : {Δ Γ : Ctx}
{σ : Subst Δ Γ}
{τ : Subst Δ Γ}
{A : Ty Γ}
(p : σ ≅ τ)
→ -------------------------------------------------
TApp σ A ≡ TApp τ A
tIdEq : {Γ : Ctx}
{A : Ty Γ}
{a : Ter Γ A}
→ -------------------------------------------------
tApp Id a
≡[ ap (Ter Γ) TIdEq ]≡
a
tAppEq : {Θ Δ Γ : Ctx}
{σ : Subst Δ Γ}
{τ : Subst Θ Δ}
{A : Ty Γ}
{a : Ter Γ A}
→ -------------------------------------------------
tApp τ (tApp σ a)
≡[ ap (Ter Θ) TAppEq ]≡
tApp (σ ∘ τ) a
tAppAp : {Δ Γ : Ctx}
{σ : Subst Δ Γ}
{τ : Subst Δ Γ}
{A : Ty Γ}
{a : Ter Γ A}
(p : σ ≅ τ)
→ -------------------------------------------------
tApp σ a
≡[ ap (Ter Δ) (TAppAp p) ]≡
tApp τ a
field
[] : Terminal
ctxExt : (Γ : Ctx)
(A : Ty Γ)
→ -------------------------------------------------
Ctx
p : {Γ : Ctx}
{A : Ty Γ}
→ -------------------------------------------------
Subst (ctxExt Γ A) Γ
q : {Γ : Ctx}
{A : Ty Γ}
→ -------------------------------------------------
Ter (ctxExt Γ A) (TApp (p {Γ} {A}) A)
uSubst : {Δ Γ : Ctx}
(σ : Subst Δ Γ)
{A : Ty Γ}
(a : Ter Δ (TApp σ A))
→ -------------------------------------------------
Subst Δ (ctxExt Γ A)
uEq₁ : {Δ Γ : Ctx}
(σ : Subst Δ Γ)
{A : Ty Γ}
(a : Ter Δ (TApp σ A))
→ -------------------------------------------------
p ∘ (uSubst σ a) ≅ σ
uEq₂ : {Γ : Ctx}
{A : Ty Γ}
→ -------------------------------------------------
uSubst (p {Γ} {A}) (q {Γ} {A}) ≅ Id
uEq₃ : {Δ Γ Θ : Ctx}
(σ : Subst Δ Γ)
{A : Ty Γ}
(a : Ter Δ (TApp σ A))
(τ : Subst Θ Δ)
→ -------------------------------------------------
(uSubst σ a) ∘ τ
≅
uSubst (σ ∘ τ) (coe (ap (Ter Θ) TAppEq) (tApp τ a))
uEq₄ : {Δ Γ : Ctx}
(σ : Subst Δ Γ)
{A : Ty Γ}
(a : Ter Δ (TApp σ A))
→ -------------------------------------------------
tApp (uSubst σ a) q
≡[ ap (Ter Δ) (trans TAppEq (TAppAp (uEq₁ σ a))) ]≡
a