Skip to content

Commit eedaf14

Browse files
committed
live sharing session
1 parent c46fc47 commit eedaf14

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

src/Limits/Product.lidr

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
2222
> module Limits.Product
2323
>
2424
> import Basic.Category
25+
> import Basic.Functor
26+
> import Product.ProductCategory
2527
>
2628
> %access public export
2729
> %default total
@@ -45,3 +47,64 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
4547
> unique : (x : obj cat) -> (f : mor cat x a) -> (g : mor cat x b)
4648
> -> (h : CommutingMorphism cat x a b carrier pi1 pi2 f g)
4749
> -> h = exists x f g
50+
>
51+
> productMorphism : (cat : Category) -> (a1, a2, b1, b2 : obj cat)
52+
> -> (f : mor cat a1 a2) -> (g : mor cat b1 b2)
53+
> -> (pr1 : Product cat a1 b1) -> (pr2 : Product cat a2 b2)
54+
> -> mor cat (carrier pr1) (carrier pr2)
55+
> productMorphism cat a1 a2 b1 b2 f g pr1 pr2 =
56+
> challenger $ exists pr2 prod1 (compose cat _ _ _ pi1' f) (compose cat _ _ _ pi2' g)
57+
> where
58+
> prod1 : obj cat
59+
> prod1 = carrier pr1
60+
> prod2 : obj cat
61+
> prod2 = carrier pr2
62+
> pi1' : mor cat prod1 a1
63+
> pi1' = pi1 pr1
64+
> pi2' : mor cat prod1 b1
65+
> pi2' = pi2 pr1
66+
>
67+
> productFunctor : (cat : Category) -> (pex : (a, b : obj cat) -> Product cat a b) -> CFunctor (productCategory cat cat) cat
68+
> productFunctor cat pex = MkCFunctor mapObj mapMor idLaw ?compLaw
69+
> where
70+
> mapObj : obj (productCategory cat cat) -> obj cat
71+
> mapObj (a,b) = carrier $ pex a b
72+
> mapMor : (a, b : obj (productCategory cat cat))
73+
> -> mor (productCategory cat cat) a b
74+
> -> mor cat (mapObj a) (mapObj b)
75+
> mapMor (a1,b1) (a2,b2) (MkProductMorphism f g) =
76+
> productMorphism cat a1 a2 b1 b2 f g (pex a1 b1) (pex a2 b2)
77+
> bla : (a,b : obj cat) -> CommutingMorphism cat (carrier (pex a b)) a b (carrier (pex a b))
78+
> (pi1 (pex a b))
79+
> (pi2 (pex a b))
80+
> (compose cat (carrier (pex a b)) a a (pi1 (pex a b)) (identity cat a))
81+
> (compose cat (carrier (pex a b)) b b (pi2 (pex a b)) (identity cat b))
82+
> bla a b = MkCommutingMorphism (identity cat (carrier (pex a b)))
83+
> (rewrite leftIdentity cat (carrier (pex a b)) a (pi1 (pex a b)) in
84+
> sym $ rightIdentity cat (carrier (pex a b)) a (pi1 (pex a b)))
85+
> (rewrite leftIdentity cat (carrier (pex a b)) b (pi2 (pex a b)) in
86+
> sym $ rightIdentity cat (carrier (pex a b)) b (pi2 (pex a b)))
87+
> idLaw : (a : obj (productCategory cat cat)) -> mapMor a a (identity (productCategory cat cat) a) = identity cat (mapObj a)
88+
> idLaw (a,b) = sym $ cong {f=challenger} $
89+
> unique (pex a b) (carrier (pex a b))
90+
> (compose cat (carrier (pex a b)) a a (pi1 (pex a b)) (identity cat a))
91+
> (compose cat (carrier (pex a b)) b b (pi2 (pex a b)) (identity cat b))
92+
> (bla a b)
93+
>
94+
> catHasProducts : Category -> Type
95+
> catHasProducts cat = (a, b : obj cat) -> Product cat a b
96+
97+
98+
(AxB) x C --> A x (B x C)
99+
< pi1_{(AxB)xC};pi1_{AxB}, < pi1_{(AxB)xC};pi2_{AxB}, pi2_{(AxB)xC}> >
100+
101+
102+
MkCFunctor
103+
(\(a, b) => carrier $ pex a b)
104+
(\(a1, b1), (a2, b2), (f, g) => productMorphism cat a1 a2 b1 b2 f g (pex a1 b1) (pex a2 b2))
105+
?id
106+
?comp
107+
108+
catHasProducts :
109+
110+
exists_a2.b2 (pi1_a1.b1;f, pi2_a1.b1;g )

0 commit comments

Comments
 (0)