blob: 27c01af7b1946de0463f88de3c5533213cbfaedb (
plain)
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
|
{-# OPTIONS --without-K --safe #-}
open import Categories.Category using (Category)
open import Category.Dagger.Semiadditive using (IdempotentSemiadditiveDagger)
open import Level using (Level; suc; _⊔_)
module Category.Dagger.2-Poset {o ℓ e : Level} where
import Relation.Binary.Reasoning.PartialOrder as ≤-Reasoning
open import Category.Monoidal.Instance.Posets {ℓ} {e} {e} using (Posets-Monoidal)
open import Categories.Category.Dagger using (HasDagger)
open import Categories.Category.Helper using (categoryHelper)
open import Categories.Category.Instance.Posets using (Posets)
open import Categories.Enriched.Category Posets-Monoidal using () renaming (Category to 2-Poset)
open import Data.Product using (_,_)
open import Data.Unit.Polymorphic using (tt)
open import Relation.Binary using (Poset)
open import Relation.Binary.Morphism.Bundles using (PosetHomomorphism; mkPosetHomo)
open PosetHomomorphism using (⟦_⟧; cong; mono)
record Dagger-2-Poset : Set (suc (o ⊔ ℓ ⊔ e)) where
open Poset using (Carrier; _≈_; isEquivalence)
field
2-poset : 2-Poset o
open 2-Poset 2-poset hiding (id) public
open 2-Poset 2-poset using (id)
category : Category o ℓ e
category = categoryHelper record
{ Obj = Obj
; _⇒_ = λ A B → Carrier (hom A B)
; _≈_ = λ {A B} → _≈_ (hom A B)
; id = ⟦ id ⟧ tt
; _∘_ = λ f g → ⟦ ⊚ ⟧ (f , g)
; assoc = ⊚-assoc
; identityˡ = unitˡ
; identityʳ = unitʳ
; equiv = λ {A B} → isEquivalence (hom A B)
; ∘-resp-≈ = λ f≈h g≈i → cong ⊚ (f≈h , g≈i)
}
field
hasDagger : HasDagger category
private
module P {A B : Obj} = Poset (hom A B)
open P using (_≤_) public
open Category category hiding (Obj) public
open HasDagger hasDagger public
field
†-resp-≤ : {A B : Obj} {f g : A ⇒ B} → f ≤ g → f † ≤ g †
dagger-2-poset : {𝒞 : Category o ℓ e} (ISA† : IdempotentSemiadditiveDagger 𝒞) → Dagger-2-Poset
dagger-2-poset {𝒞} ISA† = record
{ 2-poset = record
{ Obj = Obj
; hom = λ A B → record
{ Carrier = A ⇒ B
; _≈_ = _≈_
; _≤_ = ISA†._≤_
; isPartialOrder = record
{ isPreorder = record
{ isEquivalence = equiv
; reflexive = λ x≈y → Equiv.trans (ISA†.+-congʳ x≈y) ISA†.≤-refl
; trans = ISA†.≤-trans
}
; antisym = ISA†.≤-antisym
}
}
; id = mkPosetHomo _ _ (λ _ → id) (λ _ → ISA†.≤-refl)
; ⊚ = mkPosetHomo _ _ (λ (f , g) → f ∘ g) (λ (≤₁ , ≤₂) → ISA†.≤-resp-∘ ≤₁ ≤₂)
; ⊚-assoc = assoc
; unitˡ = identityˡ
; unitʳ = identityʳ
}
; hasDagger = record
{ _† = ISA†._†
; †-identity = ISA†.†-identity
; †-homomorphism = ISA†.†-homomorphism
; †-resp-≈ = ISA†.⟨_⟩†
; †-involutive = ISA†.†-involutive
}
; †-resp-≤ = ISA†.†-resp-≤
}
where
module ISA† = IdempotentSemiadditiveDagger ISA†
open Category 𝒞
module _ (S : Dagger-2-Poset) where
open Dagger-2-Poset S
record IsMap {A B : Obj} (f : A ⇒ B) : Set e where
field
functional : f ∘ f † ≤ id
entire : id ≤ f † ∘ f
record Map (A B : Obj) : Set (ℓ ⊔ e) where
field
map : A ⇒ B
isMap : IsMap map
open IsMap isMap public
idMap : {A : Obj} → Map A A
idMap {A} = record
{ map = id
; isMap = record
{ functional = begin
id ∘ id † ≈⟨ identityˡ ⟩
id † ≈⟨ †-identity ⟩
id ∎
; entire = begin
id ≈⟨ †-identity ⟨
id † ≈⟨ identityʳ ⟨
id † ∘ id ∎
}
}
where
open ≤-Reasoning (hom A A)
_∘-map_ : {A B C : Obj} → Map B C → Map A B → Map A C
_∘-map_ {A} {B} {C} g f = record
{ map = g.map ∘ f.map
; isMap = record
{ functional = func
; entire = ent
}
}
where
module g = Map g
module f = Map f
func : (g.map ∘ f.map) ∘ (g.map ∘ f.map) † ≤ id
func = begin
(g.map ∘ f.map) ∘ (g.map ∘ f.map) † ≈⟨ refl⟩∘⟨ †-homomorphism ⟩
(g.map ∘ f.map) ∘ f.map † ∘ g.map † ≈⟨ assoc ⟩
g.map ∘ f.map ∘ f.map † ∘ g.map † ≈⟨ refl⟩∘⟨ assoc ⟨
g.map ∘ (f.map ∘ f.map †) ∘ g.map † ≤⟨ mono ⊚ (Poset.refl (hom B C) , mono ⊚ (f.functional , Poset.refl (hom C B))) ⟩
g.map ∘ id ∘ g.map † ≈⟨ refl⟩∘⟨ identityˡ ⟩
g.map ∘ g.map † ≤⟨ g.functional ⟩
id ∎
where
open ≤-Reasoning (hom C C)
open HomReasoning using (refl⟩∘⟨_)
open Poset (hom C C)
ent : id ≤ (g.map ∘ f.map) † ∘ g.map ∘ f.map
ent = begin
id ≤⟨ f.entire ⟩
f.map † ∘ f.map ≈⟨ refl⟩∘⟨ identityˡ ⟨
f.map † ∘ id ∘ f.map ≤⟨ mono ⊚ (Poset.refl (hom B A) , mono ⊚ (g.entire , Poset.refl (hom A B))) ⟩
f.map † ∘ (g.map † ∘ g.map) ∘ f.map ≈⟨ refl⟩∘⟨ assoc ⟩
f.map † ∘ g.map † ∘ g.map ∘ f.map ≈⟨ assoc ⟨
(f.map † ∘ g.map †) ∘ g.map ∘ f.map ≈⟨ †-homomorphism ⟩∘⟨refl ⟨
(g.map ∘ f.map) † ∘ g.map ∘ f.map ∎
where
open ≤-Reasoning (hom A A)
open HomReasoning using (refl⟩∘⟨_; _⟩∘⟨refl)
open Poset (hom A A)
infixr 9 _∘-map_
open Map
Maps : Category o (ℓ ⊔ e) e
Maps = categoryHelper record
{ Obj = Obj
; _⇒_ = Map
; _≈_ = λ a b → map a ≈ map b
; id = idMap
; _∘_ = _∘-map_
; assoc = assoc
; identityˡ = identityˡ
; identityʳ = identityʳ
; equiv = record
{ refl = Equiv.refl
; sym = Equiv.sym
; trans = Equiv.trans
}
; ∘-resp-≈ = ∘-resp-≈
}
|