forked from crypto-agda/crypto-agda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflat-funs-prod.agda
49 lines (43 loc) · 2.22 KB
/
flat-funs-prod.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
module flat-funs-prod where
open import Data.Unit using (⊤)
import Data.Product as ×
open × using (_×_; _,_)
open import data-universe
open import flat-funs
×-FunU : ∀ {s t} {S : Set s} {T : Set t} → FunUniverse S → FunUniverse T → FunUniverse (S × T)
×-FunU funs-S funs-T = mk (×-U S.universe T.universe)
(λ { (A₀ , A₁) (B₀ , B₁) → (A₀ S.`→ B₀) × (A₁ T.`→ B₁) })
where module S = FunUniverse funs-S
module T = FunUniverse funs-T
×⊤-FunU : ∀ {s} {S : Set s} → FunUniverse S → FunUniverse ⊤ → FunUniverse S
×⊤-FunU funs-S funs-T = mk S.universe (λ A B → (A S.`→ B) × (_ T.`→ _))
where module S = FunUniverse funs-S
module T = FunUniverse funs-T
×-FunOps : ∀ {s t} {S : Set s} {T : Set t} {funs-S : FunUniverse S} {funs-T : FunUniverse T}
→ FunOps funs-S → FunOps funs-T
→ FunOps (×-FunU funs-S funs-T)
×-FunOps ops-S ops-T
= mk (S.id , T.id) (×.zip S._∘_ T._∘_)
(S.<0b> , T.<0b>) (S.<1b> , T.<1b>) (S.cond , T.cond) (×.zip S.fork T.fork) (S.tt , T.tt)
(×.zip S.<_,_> T.<_,_>) (S.fst , T.fst) (S.snd , T.snd)
(S.dup , T.dup) (×.map S.first T.first)
(S.swap , T.swap) (S.assoc , T.assoc)
(S.<tt,id> , T.<tt,id>) (S.snd<tt,> , T.snd<tt,>)
(×.zip S.<_×_> T.<_×_>) (×.map S.second T.second)
(S.nil , T.nil) (S.cons , T.cons) (S.uncons , T.uncons)
where module S = FunOps ops-S
module T = FunOps ops-T
×⊤-FunOps : ∀ {s} {S : Set s} {funs-S : FunUniverse S} {funs-⊤ : FunUniverse ⊤}
→ FunOps funs-S → FunOps funs-⊤
→ FunOps (×⊤-FunU funs-S funs-⊤)
×⊤-FunOps ops-S ops-⊤
= mk (S.id , T.id) (×.zip S._∘_ T._∘_)
(S.<0b> , T.<0b>) (S.<1b> , T.<1b>) (S.cond , T.cond) (×.zip S.fork T.fork) (S.tt , T.tt)
(×.zip S.<_,_> T.<_,_>) (S.fst , T.fst) (S.snd , T.snd)
(S.dup , T.dup) (×.map S.first T.first)
(S.swap , T.swap) (S.assoc , T.assoc)
(S.<tt,id> , T.<tt,id>) (S.snd<tt,> , T.snd<tt,>)
(×.zip S.<_×_> T.<_×_>) (×.map S.second T.second)
(S.nil , T.nil) (S.cons , T.id) (S.uncons , T.id)
where module S = FunOps ops-S
module T = FunOps ops-⊤