-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcartierSolution14.lp
2233 lines (1866 loc) · 125 KB
/
cartierSolution14.lp
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* https://github.com/1337777/cartier/blob/master/cartierSolution14.lp
https://github.com/1337777/cartier/blob/master/Kosta_Dosen_outline_alt.pdf
Kosta Dosen's functorial programming: « m— » (read as « emdash » or « modos »), a new proof assistant for schemes.
A computational logic (co-inductive) interface for algebraic geometry schemes.
cartierSolution13.lp : DOSEN'S FUNCTORIAL PROGRAMMING
cartierSolution14.lp : 1+2=3 VIA 3 METHODS: HIGHER DATA TYPE, ADJUNCTION, COLIMIT
cartierSolution15.lp : POLYNOMIAL FUNCTORS AND CATEGORIES AS POLYNOMIAL COMONOIDS
cartierSolution16.lp : COMPUTATIONAL LOGIC (CO-INDUCTIVE) INTERFACE FOR SHEAVES AND SCHEMES
https://github.com/1337777/cartier/blob/master/cartierSolution13.lp
https://github.com/1337777/cartier/blob/master/cartierSolution14.lp
https://github.com/1337777/cartier/blob/master/cartierSolution15.lp
https://github.com/1337777/cartier/blob/master/cartierSolution16.lp
https://github.com/1337777/cartier/blob/master/Kosta_Dosen_outline_alt.pdf
https://github.com/1337777/cartier/blob/master/Kosta_Dosen_outline_alt.docx
OUTLINE OF cartierSolution14.lp :
# SECTION 1 : Natural numbers category via DATATYPES CATS/OPERATORS IN THE OUTER DOUBLECAT PROF
# SECTION 2 : Natural numbers object, via DATATYPES OBJECTS/FUNCTORS IN ANY INNER PARTICULAR CAT AND INTERNAL ADJUNCTIONS/PRODUCTS/EXPONENTIALS
# SECTION 2.1 : Alternative addition function via (encoded/non-intrinsic) multi-variable/parameter adjunction
# SECTION 2.2 : TODO: Addition function via intrinsic/structural multi-variable adjunction and multivariable functors/profunctors...
# SECTION 3 : Category of finite sets/numbers, and colimits/limits and addition/coproduct
*/
/* Short description (possibly outdated):
A new implementation of dependent types via Dosen's substructural categorial programming: example of the Yoneda lemma for fibrations
Applications: datatypes or 1+2=3 via 3 methods: natural numbers category via types, natural numbers object via adjunctions and category of finite sets/numbers via colimits
https://github.com/1337777/cartier/blob/master/cartierSolution14.lp
Cut-elimination in the double category of fibred profunctors with inner cut-eliminated adjunctions:
https://github.com/1337777/cartier/blob/master/cartierSolution13.lp
The goal of this section is to demo that it is possible to do a roundtrip between the concrete data structures and the abstract prover grammar; this is very subtle. The concrete application of these datatypes is the computation with the addition function of two variables that 1+2=3 via 3 different methods: the natural numbers category via intrinsic types, the natural numbers object via adjunctions/product/exponential, and the category of finite sets/numbers via limits/colimits/coproducts.
the AlgebraicJulia library package is an attempt to add “functional language” features to the Julia scientific computing language, via category theory. This applied category theory on concrete data structures allows to achieve some amount of compositionality (function-based) features onto ordinary scientific computing. The AlgebraicJulia implementation essentially hacks and reimplements some pseudo-dependent-types domain-specific-language embedded within Julia. The present text claims that there is a better approach via the LambdaPi logical framework and Kosta Dosen's substructural categorial programming. This new approach allows, not only to compute with concrete data, but also to do so via a grammatical interface which is more strongly-typed and which enables the theorem proving/programming of the correctness-by-construction of the algorithms.
An updated file, https://github.com/1337777/cartier/blob/master/cartierSolution14.lp, now contains the correct-by-construction concrete computation of the data of limits and colimits in the concrete category of sets and its functor categories. The goal is to demo that it is possible to do a roundtrip between the concrete data structures and the abstract prover grammar; this is very subtle. But this demo now successfully works generically, including on this silly example: the limit/equalizer of a (inductive) diagram when the (inductive-hypothesis) product cone [12;11]×[22;21]×[33;32;31] now is given an extra constant arrow [22;21] → [33;32;31] onto 31, besides its old discrete base diagram. The output is the limit cone apex object and side arrows (and its universality):
compute obj_category_Obj ((category_Obj_obj One) ∘>o (sigma_Fst (construct_inductively_limit_instance_liset _ example_graph_isf example_diagram)));
(0,13,21,31) :: (0,13,22,31) :: (0,12,21,31) :: (0,12,22,31) :: (0,11,21,31) :: (0,11,22,31) :: nil
Also the other methods output concrete data; first via intrinsic types, then via adjunctions:
compute ((Product_pair_func (Succ_inj_nat_func (Succ_inj_nat_func Zero_inj_nat_func)) (Succ_inj_nat_func Zero_inj_nat_func)) ∘> add_nat_func);
// Succ_inj_nat_func (Succ_inj_nat_func (Succ_inj_nat_func Zero_inj_nat_func))
compute λ C : cat, (iprod_pair_hom (Product_pair_func (itermin_func C) (itermin_func C))
(Func_cov_hom (itermin_func C) Id_func) (Func_cov_hom (itermin_func C) Id_func)) '∘ (_)_'∘>
((Id_hom _) ∘>'_(_) ∘'
((Product_pair_cov_hom (Product_pair_func _ _)
(Product_projL_func Id_func) [Id_func] (Product_projR_func Id_func) [Id_func] Id_func
(Succ_inj_inat_hom C (Zero_inj_inat_hom C)) (Succ_inj_inat_hom C (Succ_inj_inat_hom C (Zero_inj_inat_hom C))))
'∘ (_)_'∘> (add_inat_hom C)));
// λ C, Succ_inj_inat_hom C (Succ_inj_inat_hom C (Succ_inj_inat_hom C (Zero_inj_inat_hom C)))
*/
/*
> lambdapi --version
2.5.0 # https://github.com/Deducteam/lambdapi https://github.com/Deducteam/lambdapi-stdlib
> cat lambdapi.pkg
package_name = modos
root_path = modos
*/
// require open Blanqui.Lib.Set Blanqui.Lib.Prop Blanqui.Lib.FOL Blanqui.Lib.Eq Blanqui.Lib.Bool Blanqui.Lib.Nat Blanqui.Lib.List;
require open modos.cartierSolution13;
verbose 10;
flag "print_contexts" on; flag "print_domains" on; flag "print_meta_types" on;
// flag "print_implicits" on;
// debug +a; //debug +acdeghiklmoprsyuvxyz;
print coerce_rule; // /!\ only for console mode: print unif_rule;
// search "spine = (cartierSolution13.cat → cartierSolution13.cat) , hyp = cartierSolution13.cat";
/* ---------------------------
* # SECTION 1 : Natural numbers category via DATATYPES CATS/OPERATORS IN THE OUTER DOUBLECAT PROF
*/
//REVIEW nomenclature: projection/copairing, pairing/univ, injection/cocase, case/couniv,... instead of intro , elim
constant symbol FuncCat_cat : Π (A B : cat), cat ;
constant symbol FuncCat_proj_func : Π (A B : cat) , //no lack for accumulator because align assoc
func (Product_cat A (FuncCat_cat A B)) B;
injective symbol FuncCat_pair_func : Π [A B D : cat]
(F : func (Product_cat A D) B), func D (FuncCat_cat A B);
//TODO hom arrows for FuncCat
//naturality
rule $K ∘> (FuncCat_pair_func $F ) ↪ (FuncCat_pair_func ((Product_mapR_func _ $K) ∘> $F));
//beta
rule (Product_mapR_func $A (FuncCat_pair_func $F )) ∘> (FuncCat_proj_func $A $B ) ↪ $F ;
rule Product_pair_func $K (FuncCat_pair_func $F) ∘> (FuncCat_proj_func $A $B ) ↪ Product_pair_func $K Id_func ∘> $F;
//eta
rule (FuncCat_pair_func (FuncCat_proj_func $A $B )) ↪ Id_func;
constant symbol nat_cat : cat;
constant symbol Zero_inj_nat_func : func Terminal_cat nat_cat;
constant symbol Succ_inj_nat_func : Π [I], func I nat_cat → func I nat_cat;
symbol case_nat_func [L0 : cat]
(L0_zero : func Terminal_cat L0)
(L0_succ : func L0 L0 ) : func nat_cat L0;
// accumulation
rule $m ∘> (Succ_inj_nat_func $n) ↪ (Succ_inj_nat_func ($m ∘> $n));
// beta
rule (Zero_inj_nat_func) ∘> (case_nat_func $L0_zero $L0_succ) ↪ $L0_zero;
rule (Succ_inj_nat_func $n) ∘> (case_nat_func $L0_zero $L0_succ)
↪ ($n ∘> (case_nat_func $L0_zero $L0_succ)) ∘> $L0_succ;
symbol add_nat_func : func (Product_cat nat_cat nat_cat) nat_cat ≔
begin
have add' : func nat_cat (FuncCat_cat nat_cat nat_cat)
{ refine (case_nat_func _ _ )
{ refine FuncCat_pair_func _;
refine (Product_projL_func Id_func);
}
{ refine FuncCat_pair_func _;
refine Succ_inj_nat_func _;
refine (FuncCat_proj_func _ _);
};
};
refine ((Product_mapR_func nat_cat add' ) ∘> (FuncCat_proj_func nat_cat nat_cat))
end;
compute ((Product_pair_func (Succ_inj_nat_func (Succ_inj_nat_func Zero_inj_nat_func)) (Succ_inj_nat_func Zero_inj_nat_func)) ∘> add_nat_func);
// Succ_inj_nat_func (Succ_inj_nat_func (Succ_inj_nat_func Zero_inj_nat_func))
/* ---------------------------
* # SECTION 2 : Natural numbers object, via DATATYPES OBJECTS/FUNCTORS IN ANY INNER PARTICULAR CAT AND INTERNAL ADJUNCTIONS/PRODUCTS/EXPONENTIALS
*/
constant symbol itermin_func (C : cat) : func (Terminal_cat) C;
constant symbol itermin_adj (C : cat) : adj (Terminal_func C) (itermin_func C);
symbol itermin_pair_hom [C : cat] [I] (L0 : func I C)
: hom L0 (Unit_mod Id_func (itermin_func C)) (Terminal_func I)
≔ (Adj_con_hom (itermin_adj C) Id_func L0);
symbol idiag_func (C : cat) : func C (Product_cat C C)
≔ Product_pair_func [C] [C] [C] Id_func Id_func;
constant symbol iprod_func (C : cat) : func (Product_cat C C) C;
constant symbol idiag_iprod_adj (C : cat) : adj (idiag_func C) (iprod_func C);
symbol iprod_proj_left_hom [C : cat] [I] (N : func I (Product_cat C C)) [J] (Z : func J I) :
hom ((Z ∘> N) ∘> (iprod_func C)) (Unit_mod Id_func ((Product_projL_func N))) Z
≔ Func_cov_hom (Product_projL_func Id_func) _ ∘>'_(_) ∘' (Adj_cov_hom (idiag_iprod_adj C) N Z) ;
symbol iprod_proj_right_hom [C : cat] [I] (N : func I (Product_cat C C)) [J] (Z : func J I) :
hom ((Z ∘> N) ∘> (iprod_func C)) (Unit_mod Id_func ((Product_projR_func N))) Z
≔ Func_cov_hom (Product_projR_func Id_func) _ ∘>'_(_) ∘' (Adj_cov_hom (idiag_iprod_adj C) N Z) ;
constant symbol iprod_ladj_proj_left_hom [C : cat] [I] [I'] (N : func I I') (N' : func I' (Product_cat C C)) [J] (Z : func J I) :
hom (Z ∘> N) (Unit_mod (N' /* TODO N' is Product */ ∘> (iprod_func C)) ((Product_projL_func (N' <∘ N)))) Z;
rule (Id_hom _) ∘>'_(_) ∘' (iprod_ladj_proj_left_hom $N $N' $Z) ↪ (iprod_proj_left_hom ($N ∘> $N') $Z);
rule (Product_pair_cov_hom (Product_pair_func _ _ ) (Product_projL_func Id_func) [Id_func] (Product_projR_func Id_func) [Id_func] $Y $f $g) '∘ ((_)_'∘> (iprod_ladj_proj_left_hom (Product_pair_func $F' $G') Id_func Id_func))
↪ (iprod_ladj_proj_left_hom _ Id_func Id_func '∘ ((_)_'∘> $f));
symbol iprod_pair_hom [C : cat] [I] (N : func I (Product_cat C C)) [C'] [K0 : func C' C] [J] [L0 : func J C'] [M : func J I]
(L0_fst : hom L0 (Unit_mod (/*Z ∘>*/ K0) ((Product_projL_func N))) M)
(L0_snd : hom L0 (Unit_mod (/*Z ∘>*/ K0) ((Product_projR_func N))) M) :
hom (L0 /*∘> Z*/) (Unit_mod K0 ((iprod_func C) <∘ N)) M ≔
(Adj_con_hom (idiag_iprod_adj C) K0 Id_func) ∘>'_(_) ∘' (Product_pair_cov_hom L0 Id_func Id_func M L0_fst L0_snd);
symbol const_func [C : cat] I (X : func Terminal_cat C) : func I C ≔ Terminal_func I ∘> X;
constant symbol iexp_func (C : cat) : func (Product_cat (Op_cat C) C) C;
constant symbol iprod_iexp_adj (C : cat) (X : func Terminal_cat C) :
adj (Product_pair_func (const_func C X) Id_func ∘> (iprod_func C))
((Product_pair_func (const_func C (Op_func X)) Id_func) ∘> (iexp_func C));
constant symbol inat_func (C : cat) : func (Terminal_cat) C;
constant symbol Zero_inj_inat_hom (C : cat) : hom (itermin_func C) (Unit_mod Id_func (inat_func C)) Id_func;
constant symbol Succ_inj_inat_hom (C : cat) : Π [C0] [X0 : func C0 C] [I] [X: func I C0] [Y : func I _],
hom X (Unit_mod X0 (inat_func C)) Y → hom X (Unit_mod X0 (inat_func C)) Y;
symbol case_inat_hom [C : cat] [J] (Y : func Terminal_cat J) [L0 : func J C]
(L0_zero : hom (itermin_func C) (Unit_mod Id_func L0) Y)
(L0_succ : /* Π (Y : func Terminal_cat J) , */ hom L0 (Unit_mod Id_func L0) Id_func): //TODO... hmm nope, L0_succ already in context of Y
hom (inat_func C) (Unit_mod Id_func L0) Y;
//natural
rule ($m '∘ (_)_'∘> (Succ_inj_inat_hom $C $n)) ↪ (Succ_inj_inat_hom $C ($m '∘ (_)_'∘> $n));
rule (Id_hom _) ∘>'_ (_) ∘' (Succ_inj_inat_hom $C $n)
↪ (Succ_inj_inat_hom $C ((Id_hom _) ∘>'_ (_) ∘' $n));
// rule (Func_con_hom $F $G) ∘>'_ (_) ∘' (Succ_inj_inat_hom $C $n) //not used?
// ↪ (Succ_inj_inat_hom $C ((Func_con_hom $F $G) ∘>'_ (_) ∘' $n));
rule Id_hom _ ∘>'_ (_) ∘' ($n '∘ (_)_'∘> (Zero_inj_inat_hom $C)) //TODO redo as accumulator for succ
↪ (Id_hom _ ∘>'_ (_) ∘' $n) '∘ (_)_'∘> (Zero_inj_inat_hom $C);
//beta
rule (Zero_inj_inat_hom $C) '∘ (_)_'∘> (case_inat_hom $Y $L0_zero $L0_succ)
↪ $L0_zero;
rule (Succ_inj_inat_hom $C $n) '∘ (_)_'∘> (case_inat_hom $Y $L0_zero $L0_succ)
↪ ($n '∘ (_)_'∘> (case_inat_hom $Y $L0_zero $L0_succ)) '∘ (_)_'∘> $L0_succ;
symbol addParam_inat_hom C : hom (inat_func C) (Unit_mod (Product_pair_func (const_func C (inat_func C)) Id_func ∘> (iprod_func C)) (inat_func C)) Id_func ≔
begin
assume C;
have add' : hom (inat_func C) (Unit_mod Id_func ((Product_pair_func (const_func C (Op_func (inat_func C))) Id_func ∘> (iexp_func C)) <∘ (inat_func C))) Id_func
{ refine (case_inat_hom _ _ _ )
{ refine ((Adj_con_hom (iprod_iexp_adj C (inat_func C)) Id_func Id_func) ∘>'_((inat_func C)) ∘' _ );
refine iprod_ladj_proj_left_hom _ (Product_pair_func (const_func C (inat_func C)) Id_func) _;
}
{ refine ((Adj_con_hom (iprod_iexp_adj C (inat_func C)) Id_func Id_func) ∘>'_((inat_func C)) ∘' _ );
refine (Succ_inj_inat_hom C _);
refine ( (Adj_cov_hom (iprod_iexp_adj C (inat_func C)) (inat_func C) Id_func) );
};
};
refine (add' '∘ (_)_'∘> (Adj_cov_hom (iprod_iexp_adj C (inat_func C)) (inat_func C) Id_func));
end;
compute λ C : cat, ((Adj_con_hom (idiag_iprod_adj C) Id_func Id_func) ∘>'_(_) ∘'
(Product_pair_cov_hom _ (Id_func) [Id_func] (Id_func) [Id_func] Id_func
(Succ_inj_inat_hom C (Zero_inj_inat_hom C))
(Func_cov_hom (itermin_func C) Id_func)))
'∘ (_)_'∘> ((Id_hom _) ∘>'_(_) ∘'
((Succ_inj_inat_hom C (Succ_inj_inat_hom C (Zero_inj_inat_hom C)))
'∘ (_)_'∘> (addParam_inat_hom C)));
// λ C, Succ_inj_inat_hom C (Succ_inj_inat_hom C (Succ_inj_inat_hom C (Zero_inj_inat_hom C)))
// TODO REVIEW obviously stuck computation, ?should be able to connect the two because action of adjoint functor is definabe from unit operationss, together with functoriality...
// compute λ C : cat, ((Adj_con_hom (idiag_iprod_adj C) Id_func Id_func) ∘>'_(_) ∘'
// (Product_pair_cov_hom _ (Id_func) [Id_func] (Id_func) [Id_func] Id_func
// (Succ_inj_inat_hom C (Zero_inj_inat_hom C))
// (Succ_inj_inat_hom C (Succ_inj_inat_hom C (Zero_inj_inat_hom C)))))
// '∘ (_)_'∘> ((Id_hom _) ∘>'_(_) ∘' (addParam_inat_hom C));
// compute λ C : cat, Product_pair_cov_hom (Product_pair_func _ _) (Product_projL_func _ _) [Id_func] (Product_projR_func _ _) [Id_func] Id_func
// (Succ_inj_inat_hom C (Zero_inj_inat_hom C))
// (Succ_inj_inat_hom C (Succ_inj_inat_hom C (Zero_inj_inat_hom C)))
// '∘ (_)_'∘> ((Func_con_hom (iprod_func C) (Product_pair_func (const_func C (inat_func C)) Id_func)) ∘>'_(_) ∘' addParam_inat_hom C);
/* * # SECTION 2.1 : Alternative dddition function via (encoded/non-intrinsic) multi-variable/parameter adjunction
*/
constant symbol exp2_func (C : cat) : func (Product_cat (Op_cat C) C) C;
injective symbol adjProdExp2_lambda_hom [C : cat] : let I ≔ Terminal_cat in Π [X : func I C] [J] (P : func J C) [Z : func I J] [J'] (Q : func J' C) [Y : func I J'],
hom ((Product_pair_func X Y)) (Unit_mod (Product_mapR_func _ Q ∘> (iprod_func C)) P) Z
→ hom Y (Unit_mod Q (Product_mapR_func _ P ∘> (exp2_func C))) (Product_pair_func (Op_func X) Z);
symbol adjProdExp2_eval_hom [C : cat] : let I ≔ Terminal_cat in Π [X : func I C] [J] (P : func J C) [Z : func I J] [J'] (Q : func J' C) [Y : func I J'],
hom Y (Unit_mod Q (Product_mapR_func (Op_cat C) P ∘> (exp2_func C))) (Product_pair_func (Op_func X) Z)
→ hom ((Product_pair_func X Y)) (Unit_mod (Product_mapR_func C Q ∘> (iprod_func C)) P) Z;
//beta
rule (adjProdExp2_eval_hom $P $Q (adjProdExp2_lambda_hom $P $Q $h)) ↪ $h;
//eta,
//TODO: REVIEW slow, warning unjoinable with beta rule, note the loop with beta rule
// rule (adjProdExp2_lambda_hom $P $Q (adjProdExp2_eval_hom $P $Q $h)) ↪ $h;
//TODO: REVIEW WHY: NOTE THAT MUST ASSOCIATE ON LEFT IN THE RESULT .. NOTE THAT THIS ASSOCIATIVITY IS NON-COMPUTATIONAL BUT ONLY PROPOSITIONAL
rule (Product_pair_cov_hom (Product_pair_func _ _) (Product_projL_func Id_func) [Id_func] (Product_projR_func Id_func) [Id_func] Id_func $f $g) '∘ (_)_'∘> (adjProdExp2_eval_hom $P $Q $h)
↪ (adjProdExp2_eval_hom $P $Q (($g '∘ (_)_'∘> $h) ∘>'_(_) ∘' (Product_pair_con_hom (Product_pair_func _ _) (Product_projL_func Id_func) [Id_func] (Product_projR_func Id_func) [Id_func] Id_func (Op_hom $f) (Func_con_hom _ _) ) ));
rule adjProdExp2_lambda_hom $P $Q $h '∘ ((_)_'∘> ((Func_cov_hom (exp2_func $C) _ ∘>'_(_)) ∘' Product_mapR_con_hom [_] [_] [_] [$P] [$P'] $p))
↪ adjProdExp2_lambda_hom $P' $Q ($h '∘ ((_)_'∘> $p)) ;
rule (adjProdExp2_lambda_hom $P $Q $h ∘>'_(_)) ∘' (Product_pair_con_hom (Product_pair_func _ _) (Product_projL_func Id_func) [Id_func] (Product_projR_func Id_func) [Id_func] Id_func $x $z)
↪ adjProdExp2_lambda_hom $P $Q ((Product_pair_cov_hom (Product_pair_func _ _) (Product_projL_func Id_func) [Id_func] (Product_projR_func Id_func) [Id_func] Id_func (Op_hom $x) (Func_cov_hom _ Id_func)) '∘ (_)_'∘>
($h ∘>'_(_) ∘' $z));
symbol add_inat_hom C : hom (Product_pair_func (inat_func C) (inat_func C)) (Unit_mod (iprod_func C) (inat_func C)) Id_func ≔
begin
assume C; refine adjProdExp2_eval_hom _ Id_func _;
refine case_inat_hom _ _ _
{ refine adjProdExp2_lambda_hom [_] [inat_func C] (inat_func C) _ _ ;
refine iprod_ladj_proj_left_hom _ Id_func _;
}
{ refine (Func_cov_hom (exp2_func C) _ ∘>'_(_) ∘' (Product_mapR_con_hom (Succ_inj_inat_hom C (Func_cov_hom _ Id_func))));
}
end;
//NOTE: this uses the naturality conversion ($x''x'_ '∘ ((Id_func)_'∘> ( ($s ∘>'_(_)) ∘' $y'y_ )))
// ↪ ($s ∘>'_(_)) ∘' ($x''x'_ '∘ ((Id_func)_'∘> ( $y'y_ )))
// to move out (Func_cov_hom (Product_projL_func C C) (Product_pair_func Id_func Id_func) ∘>'_(_) ∘'
compute λ C : cat, (iprod_pair_hom (Product_pair_func (itermin_func C) (itermin_func C))
(Func_cov_hom (itermin_func C) Id_func) (Func_cov_hom (itermin_func C) Id_func)) '∘ (_)_'∘>
((Id_hom _) ∘>'_(_) ∘'
((Product_pair_cov_hom (Product_pair_func _ _)
(Product_projL_func Id_func) [Id_func] (Product_projR_func Id_func) [Id_func] Id_func
(Succ_inj_inat_hom C (Zero_inj_inat_hom C)) (Succ_inj_inat_hom C (Succ_inj_inat_hom C (Zero_inj_inat_hom C))))
'∘ (_)_'∘> (add_inat_hom C)));
// λ C, Succ_inj_inat_hom C (Succ_inj_inat_hom C (Succ_inj_inat_hom C (Zero_inj_inat_hom C)))
// MEMO: REVERSE DEBUGGED: λ C, ((( ((Adj_con_hom (idiag_iprod_adj C) Id_func Id_func ∘>'_ Product_pair_func (itermin_func C) (itermin_func C)) ∘' Product_pair_cov_hom (itermin_func C) Id_func Id_func Id_func (Func_cov_hom (itermin_func C) Id_func) (Func_cov_hom (itermin_func C) Id_func) ) '∘ (Id_func _'∘> ( (Func_cov_hom (Product_projL_func Id_func) (Product_pair_func Id_func Id_func) ∘>'_ Product_pair_func (itermin_func C) (itermin_func C)) ∘' Adj_cov_hom (idiag_iprod_adj C) (Product_pair_func (itermin_func C) (itermin_func C)) Id_func)) ) '∘ (Id_func _'∘> Zero_inj_inat_hom C)) '∘ (Id_func _'∘> Succ_inj_inat_hom C)) '∘ (Id_func _'∘> Succ_inj_inat_hom C)
/* ---------------------------
* # SECTION 2.2 : TODO: Addition function via intrinsic/structural multi-variable adjunction and multivariable functors/profunctors...
*/
///// TODO:
/* ---------------------------
* # SECTION 3 : Category of finite sets/numbers, and colimits/limits and addition/coproduct
*/
inductive one : TYPE ≔ One : one;
constant symbol one_type : Type;
rule τ one_type ↪ one;
constant symbol obj : Π C : cat, TYPE;
constant symbol obj_type : Π C : cat, Type;
rule τ (obj_type $C) ↪ obj $C;
symbol ∘>o: Π [Y Z : cat], obj Y → func Y Z → obj Z;
notation ∘>o infix left 90;
rule $X ∘>o ($G ∘> $H) ↪ ($X ∘>o $G) ∘>o $H
with $F ∘>o Id_func ↪ $F;
///TODO also dependent versions of One elim, and dependent One
//Terminal_cat ahas dual status as also datatype:
//intro rule
constant symbol Terminal_obj : obj Terminal_cat;
//elim rule, rename Terminal_elim_func ?
injective symbol Obj_func : Π [Y : cat], obj Y → func Terminal_cat Y ;
//computation rule, obj
// rule (Terminal_obj) ∘>o (Obj_func $F) ↪ $F;
rule $M ∘>o (Obj_func $F) ↪ $F;
//TODO reverse also Terminal_elim_funcd... same as ordinarry cut-elim with functors
rule (Obj_func $F) ∘> $H ↪ (Obj_func ($F ∘>o $H));
injective symbol Op_obj : Π [ Y : cat] , obj Y → obj (Op_cat Y);
rule Op_obj ($F ∘>o $G) ↪ (Op_obj $F) ∘>o (Op_func $G); //or reverse?
rule Obj_func (Terminal_obj) ↪ Id_func; //as usual this causes non-constant symbol
constant symbol arr: Π [A B : cat], obj A → mod A B → obj B → TYPE ;
constant symbol arr_type: Π [A B : cat], obj A → mod A B → obj B → Type ;
rule τ (@arr_type $A $B $F $R $G) ↪ (@arr $A $B $F $R $G);
//todo erase Id condition?
symbol '∘a : Π [A B' B : cat] [S : mod A B'] [T : mod A B]
[X : obj A] [Y : obj B'] [G : func B' B], //SHOULD X be Terminal_obj ?
arr X S Y → transf S Id_func T G → arr X T (Y ∘>o G);
notation '∘a infix right 80;
symbol ∘a' [A' B A : cat] [S : mod A' B] [T : mod A B]
[X : obj A'] [Y : obj B] [F : func A' A] : //SHOULD Y be Terminal_obj ?
transf S F T Id_func → arr X S Y → arr (X ∘>o F) T Y;
notation ∘a' infix left 80;
//todo both cov ad con of ''∘ (nahhh erase: only operator arrgument has Id frame)?
rule ($r '∘a $rs) '∘a $st
↪ $r '∘a ($rs ''∘ $st);
rule $r '∘a (Id_transf _) ↪ $r;
rule $st ∘a' ($rs ∘a' $r)
↪ ($st ∘'' $rs) ∘a' $r;
rule (Id_transf _) ∘a' $r ↪ $r;
/// aka terminalunitprofunctor_elim_hom, which, for one, contains also terminal_elim_cov_hom
//TODO redo
// injective symbol Arr_hom: Π [A B : cat] [F : obj A] [R : mod A B] [G : obj B], arr F R G → hom (Obj_func F) R (Obj_func G);
injective symbol Arr_hom /* terminalunitprofunctor_elim_hom */:
Π [A B: cat] [R : mod A B] (F : func Terminal_cat A) (G : func Terminal_cat B)
(t_arr : arr (Terminal_obj ∘>o F) R (Terminal_obj ∘>o G)),
hom F R G;
symbol DEFINABLE_Arr_hom_instance_terminal_elim_cov_hom [E : cat] (F : func Terminal_cat E) (G : func Terminal_cat E)
(t_arr : arr (Terminal_obj ∘>o F) (Unit_mod Id_func (G )) Terminal_obj) : //TODO o<∘
hom F (Unit_mod Id_func G) Id_func ≔ Arr_hom _ _ t_arr ;
//computation rule for Arr_hom
//reversed to tradeoff with more usual rule for datatype elimination... nope reversed back because elim now uses arr input
rule (Arr_hom _ _ $r) '∘ $t ↪ (Arr_hom _ _ ($r '∘a $t));
rule $t ∘' (Arr_hom _ _ $r) ↪ (Arr_hom _ _ ($t ∘a' $r));
//TODO? Id_arr ?
// constant symbol Id_arr [A : cat] (F : obj A) : arr F (Unit_mod Id_func Id_func) F;
// rule (Id_arr Terminal_obj) '∘a ( (_) _'∘> (Arr_hom $r)) ↪ $r;
// rule Arr_hom (Id_arr $F) ↪ Id_hom (Obj_func $F);
//TODO rename Func_cov_hom to Id_cov_hom because of this explanation: ?
//TODO redo Id_cov_arr for more general thant Id_func ?
constant symbol Id_cov_arr [A : cat] (F : obj A) : arr F (Unit_mod Id_func (Obj_func F)) Terminal_obj;
//computation rule for Arr_hom
rule (Id_cov_arr $F) '∘a ( (_) _'∘> (Arr_hom _ _ $r)) ↪ $r;
rule Arr_hom (Obj_func _) Id_func (Id_cov_arr $F) ↪ Func_cov_hom _ _ ;
constant symbol Id_con_arr [A : cat] (F : obj A) : arr Terminal_obj (Unit_mod (Obj_func F) Id_func ) F;
rule ( (Arr_hom _ _ $r) ∘>'_ (_)) ∘a' (Id_con_arr $F) ↪ $r;
rule Arr_hom Id_func (Obj_func _) (Id_con_arr $F) ↪ Func_con_hom _ _ ;
constant symbol Id_con_arr0 [A A0 : cat] (K : func A A0) (F : obj A) : arr Terminal_obj (Unit_mod (Obj_func (F ∘>o K)) K ) F;
rule ( (Arr_hom _ _ $r) ∘>'_ (_)) ∘a' (Id_con_arr0 Id_func $F) ↪ $r;
rule Arr_hom Id_func (Obj_func _) (Id_con_arr0 Id_func $F) ↪ Func_con_hom _ _ ;
//computation rule for Obj_func, arr
rule (Func_cov_hom ( Obj_func $E_obj) _) ∘>'_(_) ∘a' (Id_cov_arr $M)
↪ (Id_cov_arr $E_obj);
//TODO REVIEW ∘↓o and Func_con_arr not necessary ?
// TODO ∘↓o ? vs (Func_cov_arr $F) '∘a (_) _'∘>
symbol ∘↓o : Π [I A B : cat] [R : mod A B] [F : func I A]
[G : func I B], hom F R G → Π (X : obj I), arr (X ∘>o F) R (X ∘>o G);
notation ∘↓o infix left 120;
//TODO ?
rule (Arr_hom _ _ $r) ∘↓o Terminal_obj ↪ $r;
//reverse direction?
rule ($r ∘↓ $H) ∘↓o $K ↪ $r ∘↓o ($K ∘>o $H );
// TODO redo Func_cov_arr to more general than Id_func similar as Id_cov_arr or category_Arr_cov_arr ?
///TODO ?
constant symbol Func_con_arr : Π [I J] (Z: func I J ) (M: obj I),
arr M (Unit_mod Z Id_func) (M ∘>o Z);
type λ [A : cat] (F : obj A), Func_con_arr (Obj_func F) Terminal_obj;
constant symbol Func_cov_arr : Π [I J] (Z: func I J ) (M: obj I),
arr (M ∘>o Z) (Unit_mod Id_func Z) M;
rule (Func_con_hom $Z $F) ∘↓o $H ↪ Func_con_arr $Z ($H ∘>o $F)
with (Func_cov_hom $Z $F) ∘↓o $H ↪ Func_cov_arr $Z ($H ∘>o $F);
//TODO MEMO LATER... get complex
constant symbol presh : Π C : cat, TYPE;
constant symbol presh_type : Π C : cat, Type;
rule τ (presh_type $C) ↪ presh $C;
constant symbol copresh : Π C : cat, TYPE;
constant symbol copresh_type : Π C : cat, Type;
rule τ (copresh_type $C) ↪ copresh $C;
constant symbol ⊗o : Π [A B : cat], mod A B → presh B → presh A ; //Tensor_mod;
notation ⊗o infix left 70;
constant symbol o⊗ : Π [A B: cat], copresh A → mod A B → copresh B ; //Tensor_mod;
notation o⊗ infix left 70;
constant symbol Unit_presh : Π [X A : cat], func A X → obj X → presh A ;
symbol o<<∘ : Π [A X : cat], mod A X → obj X → presh A;
symbol ∘>>o : Π [B X: cat], obj X → mod X B → copresh B;
notation o<<∘ infix left 80; notation ∘>>o infix right 80;
rule (Unit_mod $F $G) o<<∘ $K ↪ Unit_presh $F ($K ∘>o $G)
with ($R ⊗ $S) o<<∘ $G ↪ $R ⊗o ($S o<<∘ $G);
injective symbol Presh_mod : Π [Y : cat], presh Y → mod Y Terminal_cat ;
rule (Presh_mod $F) o<<∘ $M ↪ $F;
////-----------
inductive category : TYPE ≔ | Struct_category : Π
(category_Obj : Type)
(category_Arr : τ category_Obj → τ category_Obj → Type)
(category_Comp : Π [M N L : τ category_Obj] (f : τ (category_Arr M N)) (g : τ (category_Arr N L)), τ (category_Arr M L))
(category_Iden : Π (M: τ category_Obj), τ (category_Arr M M)), category;
injective symbol category_Obj_type (C : category) : Type;
rule category_Obj_type (Struct_category $category_Obj $category_Arr $category_Comp $category_Iden) ↪ $category_Obj;
injective symbol category_Obj (C : category) : TYPE ≔ τ (category_Obj_type C);
injective symbol category_Arr_type [C : category] : (category_Obj C) → (category_Obj C) → Type;
rule @category_Arr_type (Struct_category $category_Obj $category_Arr $category_Comp $category_Iden) ↪ $category_Arr;
injective symbol category_Arr [C : category] : (category_Obj C) → (category_Obj C) → TYPE ≔ λ M N, τ (category_Arr_type M N);
symbol category_Comp [C : category] : Π [M N L : (category_Obj C)] (f : category_Arr M N) (g : (category_Arr N L)), (category_Arr M L);
rule @category_Comp (Struct_category $category_Obj $category_Arr $category_Comp $category_Iden) ↪ $category_Comp;
symbol category_Iden [C : category] : Π (M: (category_Obj C)), (category_Arr M M);
rule @category_Iden (Struct_category $category_Obj $category_Arr $category_Comp $category_Iden) ↪ $category_Iden;
(C D : category) inductive functor : TYPE ≔ | Struct_functor : Π
(functor_Obj : category_Obj C → category_Obj D)
(functor_Arr : Π [M N : category_Obj C], category_Arr M N → category_Arr (functor_Obj M) (functor_Obj N)), functor C D;
symbol functor_Obj [C D : category] (F : functor C D) : category_Obj C → category_Obj D;
rule functor_Obj (Struct_functor $functor_Obj $functor_Arr) ↪ $functor_Obj;
symbol functor_Arr [C D : category] (F : functor C D) : Π [M N : category_Obj C], category_Arr M N → category_Arr (functor_Obj F M) (functor_Obj F N);
rule @functor_Arr _ _ (Struct_functor $functor_Obj $functor_Arr) ↪ $functor_Arr;
symbol comp_functor [C D E : category] (F : functor C D) (G : functor D E) : functor C E
≔ Struct_functor (λ M : category_Obj C, functor_Obj G (functor_Obj F M)) (λ (M N : category_Obj C) a, (functor_Arr G (functor_Arr F a)));
symbol iden_functor (C : category) : functor C C
≔ Struct_functor (λ M : category_Obj C, M) (λ (M N : category_Obj C) a, a);
symbol constant_functor (C : category) [D : category] (M : category_Obj D) : functor C D
≔ Struct_functor (λ _, M) (λ _ _ _, category_Iden M);
[C D : category] inductive transformation (F G: functor C D) : TYPE ≔ | Struct_transformation [F G: functor C D] : Π
(transformation_Arr : Π (M : category_Obj C), category_Arr (functor_Obj F M) (functor_Obj G M)), transformation F G;
symbol transformation_Arr [C D : category] [F G: functor C D] (h : transformation F G) : Π (M : category_Obj C), category_Arr (functor_Obj F M) (functor_Obj G M);
rule transformation_Arr (Struct_transformation $transformation_Arr) ↪ $transformation_Arr;
symbol iden_transformation [C D : category] (F : functor C D) : transformation F F
≔ Struct_transformation (λ M : category_Obj C, category_Iden (functor_Obj F M));
symbol comp_transformation [C D : category] [F G H: functor C D] (h : transformation F G) (t : transformation G H) : transformation F H
≔ Struct_transformation (λ M : category_Obj C, category_Comp (transformation_Arr h M) (transformation_Arr t M));
symbol tensor_cov_transformation [C D E : category] [F G : functor C D] (h : transformation F G) (K : functor D E) : transformation (comp_functor F K) (comp_functor G K)
≔ Struct_transformation (λ M : category_Obj C, functor_Arr K (transformation_Arr h M));
symbol tensor_con_transformation [C D B : category] [F G : functor C D] (K : functor B C) (h : transformation F G) : transformation (comp_functor K F) (comp_functor K G)
≔ Struct_transformation (λ M : category_Obj B, (transformation_Arr h (functor_Obj K M)));
symbol constant_transformation [C D : category] [M N : category_Obj D] (a : category_Arr M N): transformation (constant_functor C M) (constant_functor C N)
≔ Struct_transformation (λ M : category_Obj C, a);
symbol terminal_category : category ≔ Struct_category one_type (λ F G, one_type) (λ F G H f g, One) (λ F, One);
symbol terminal_intro_functor (C : category) : functor C terminal_category ≔ constant_functor C One;
injective symbol category_Obj_functor [C : category] (M : category_Obj C) : functor terminal_category C
≔ Struct_functor (λ _, M) (λ _ _ _, category_Iden M);
injective symbol category_Arr_transformation [C : category] [M N : category_Obj C] (a : category_Arr M N) : transformation (category_Obj_functor M) (category_Obj_functor N)
≔ Struct_transformation (λ _, a);
inductive natUniv : TYPE ≔
| Base_natUniv : nat → natUniv
| Pair_natUniv : natUniv → natUniv → natUniv
// | InLeft_natUniv : natUniv → natUniv
// | InRight_natUniv : natUniv → natUniv
| Undefined_natUniv : natUniv;
symbol natUniv_type : Type; rule τ natUniv_type ↪ natUniv;
symbol natUniv_eq : natUniv → natUniv → bool;
rule natUniv_eq (Base_natUniv $x) (Base_natUniv $y) ↪ eqn $x $y
with natUniv_eq (Base_natUniv $x) (Pair_natUniv $y1 $y2) ↪ false
with natUniv_eq (Base_natUniv $x) (Undefined_natUniv) ↪ false
with natUniv_eq (Pair_natUniv $y1 $y2) (Base_natUniv $x) ↪ false
with natUniv_eq (Pair_natUniv $y1 $y2) (Undefined_natUniv) ↪ false
with natUniv_eq (Pair_natUniv $x1 $x2) (Pair_natUniv $y1 $y2) ↪ (natUniv_eq $x1 $y1) and (natUniv_eq $x2 $y2)
with natUniv_eq (Undefined_natUniv) (Undefined_natUniv) ↪ true
with natUniv_eq (Undefined_natUniv) (Pair_natUniv $y1 $y2) ↪ false
with natUniv_eq (Undefined_natUniv) (Base_natUniv $x) ↪ false;
// with natUniv_eq (InLeft_natUniv $x) (InLeft_natUniv $y) ↪ natUniv_eq $x $y
// with natUniv_eq (InLeft_natUniv $x) (InRight_natUniv $y) ↪ false
symbol natUniv_fst : natUniv → natUniv;
symbol natUniv_snd : natUniv → natUniv;
rule natUniv_fst (Pair_natUniv $1 $2) ↪ $1;
rule natUniv_snd (Pair_natUniv $1 $2) ↪ $2;
injective symbol listsub (l : list natUniv_type) ≔ (`Σ_ x : natUniv, istrue(∈ natUniv_eq x l));
injective symbol liset_Arr_type (M : list natUniv_type) (N : list natUniv_type) : Type
≔ natUniv_type →_ natUniv_type;
injective symbol liset_Arr (M : list natUniv_type) (N : list natUniv_type) ≔ τ (liset_Arr_type M N);
symbol liset_Comp [M N L : list natUniv_type] (f : (liset_Arr M N)) (g : (liset_Arr N L)) : (liset_Arr M L)
≔ λ x, (g (f x));
injective symbol liset_Iden M : (liset_Arr M M) ≔ λ x, x;
symbol liset ≔ Struct_category (list_type natUniv_type) (liset_Arr_type) (@liset_Comp) (liset_Iden);
/// _______________
inductive empty : TYPE ≔ ;
constant symbol empty_type : Type;
rule τ (empty_type) ↪ empty;
symbol rect_empty : Π [p0: (empty → Type)], Π x: empty, τ (p0 x);
(p : Type) inductive option : TYPE ≔
| Some : τ p → option p
| None : option p;
constant symbol option_type : Type → Type;
rule τ (option_type $p) ↪ option $p;
symbol rect_option : Π [a0 : Type], Π [p0: (option a0 → Type)], (Π x1: τ a0, τ (p0 (Some x1))) → (τ (p0 (None ))) → Π x: option a0, τ (p0 x);
rule rect_option $1 $2 (Some $x) ↪ $1 $x;
rule rect_option $1 $2 (None) ↪ $2;
inductive graph : TYPE ≔ | Struct_graph : Π
(graph_Obj : Type)
(graph_Arr : τ graph_Obj → τ graph_Obj → Type), graph;
injective symbol graph_Obj_type (C : graph) : Type;
rule graph_Obj_type (Struct_graph $graph_Obj $graph_Arr) ↪ $graph_Obj;
/* injective */ symbol graph_Obj (C : graph) : TYPE ≔ τ (graph_Obj_type C);
injective symbol graph_Arr_type [C : graph] : (graph_Obj C) → (graph_Obj C) → Type;
rule @graph_Arr_type (Struct_graph $graph_Obj $graph_Arr) ↪ $graph_Arr;
symbol graph_Arr [C : graph] : (graph_Obj C) → (graph_Obj C) → TYPE ≔ λ M N, τ (graph_Arr_type M N);
//TODO quotient by assoc iden... this quotient is harrder to explain than expected because no way to remember that it is now a free category
// hmm in fact whole "concrete freely_category" is a bad idea, should directly do abstract (freely-)cat datatype on graph...
// injective symbol freely_category (C : graph) : category ≔ Struct_category (graph_Obj_type C) (@freely_category_Arr_type C) (@freely_category_Comp C) (@freely_category_Iden C);
(C : graph) inductive diagram (D : category) : TYPE ≔ | Struct_diagram [D] : Π
(diagram_Obj : graph_Obj C → category_Obj D)
(diagram_Arr : Π [M N : graph_Obj C], graph_Arr M N → category_Arr (diagram_Obj M) (diagram_Obj N)), diagram C D;
symbol diagram_Obj [C : graph] [D : category] (F : diagram C D) : graph_Obj C → category_Obj D;
rule diagram_Obj (Struct_diagram $diagram_Obj $diagram_Arr) ↪ $diagram_Obj;
symbol diagram_Arr [C : graph] [D : category] (F : diagram C D) : Π [M N : graph_Obj C], graph_Arr M N → category_Arr (diagram_Obj F M) (diagram_Obj F N);
rule @diagram_Arr _ _ (Struct_diagram $diagram_Obj $diagram_Arr) ↪ $diagram_Arr;
(C D : graph) inductive graphMorph : TYPE ≔ | Struct_graphMorph : Π
(graphMorph_Obj : graph_Obj C → graph_Obj D)
(graphMorph_Arr : Π [M N : graph_Obj C], graph_Arr M N → graph_Arr (graphMorph_Obj M) (graphMorph_Obj N)), graphMorph C D;
symbol graphMorph_Obj [C : graph] [D : graph] (F : graphMorph C D) : graph_Obj C → graph_Obj D;
rule graphMorph_Obj (Struct_graphMorph $graphMorph_Obj $graphMorph_Arr) ↪ $graphMorph_Obj;
symbol graphMorph_Arr [C : graph] [D : graph] (F : graphMorph C D) : Π [M N : graph_Obj C], graph_Arr M N → graph_Arr (graphMorph_Obj F M) (graphMorph_Obj F N);
rule @graphMorph_Arr _ _ (Struct_graphMorph $graphMorph_Obj $graphMorph_Arr) ↪ $graphMorph_Arr;
symbol comp_graphMorph_diagram [C' : graph] [C : graph] (F : graphMorph C' C) [D : category] (G : diagram C D) : diagram C' D
≔ Struct_diagram (λ M : graph_Obj C', diagram_Obj G (graphMorph_Obj F M)) (λ (M N : graph_Obj C') a, (diagram_Arr G (graphMorph_Arr F a)));
/* injective */ symbol joinGraph_Obj [C : graph] (X Y : graph_Obj C) : Type ≔ (graph_Obj_type C) ;
injective symbol joinGraph_Arr [C : graph] (X Y : graph_Obj C) : Π (M N : τ (joinGraph_Obj X Y)), Type;
constant symbol joinGraph_Arr_introOld [C : graph] (X Y : graph_Obj C) : Π [M N : graph_Obj C], graph_Arr M N → τ (joinGraph_Arr X Y M N);
constant symbol joinGraph_Arr_introNew [C : graph] (X Y : graph_Obj C) : τ (joinGraph_Arr X Y X Y);
symbol joinGraph_Arr_elim [C : graph] [X Y : graph_Obj C] : Π [E : τ (joinGraph_Obj X Y) → τ (joinGraph_Obj X Y) → Type]
(first : Π [M N : graph_Obj C], graph_Arr M N → τ (E M N)) (second: τ (E X Y)),
Π (M N : graph_Obj C), τ (joinGraph_Arr X Y M N) → τ (E M N);
rule (@joinGraph_Arr_elim $C $X $Y $E $oldarr $newarr _ _ (@joinGraph_Arr_introOld $C $X $Y _ _ $a)) ↪ ($oldarr _ _ $a);
rule (@joinGraph_Arr_elim $C $X $Y $E $oldarr $newarr _ _ (@joinGraph_Arr_introNew $C $X $Y)) ↪ ($newarr);
///todo review this eta necessarry?
rule (@joinGraph_Arr_elim _ $X $Y _ (@joinGraph_Arr_introOld _ $X $Y) (@joinGraph_Arr_introNew _ $X $Y)) ↪ λ M N a, a;
injective symbol joinGraph [C : graph] (X Y : graph_Obj C): graph ≔ Struct_graph (joinGraph_Obj X Y) (joinGraph_Arr X Y);
symbol joinGraph_graphMorph_Obj [C : graph] (X Y : graph_Obj C) : graph_Obj C → graph_Obj (joinGraph X Y) ≔ λ x, x;
symbol joinGraph_graphMorph [C : graph] (X Y : graph_Obj C) : graphMorph C (joinGraph X Y)
≔ @Struct_graphMorph C (joinGraph X Y) (joinGraph_graphMorph_Obj X Y) (@joinGraph_Arr_introOld _ X Y);
/////////////----------
inductive cone [C : graph] [D : category] (M : category_Obj D) (F : diagram C D) : TYPE ≔ | Struct_cone [C D M F] : Π
(cone_Arr : Π (N : graph_Obj C), category_Arr M (diagram_Obj F N)), @cone C D M F ;
injective symbol cone_Arr [C D M F] (c : @cone C D M F) : Π (N : graph_Obj C), category_Arr M (diagram_Obj F N);
rule cone_Arr (Struct_cone $1) ↪ $1;
symbol tensor_cone [C B : graph] [D : category] (K: graphMorph B C) [M : category_Obj D] [F : diagram C D] (h : cone M F)
: cone M (comp_graphMorph_diagram K F)
≔ Struct_cone (λ N : graph_Obj B, (cone_Arr h (graphMorph_Obj K N)));
symbol comp_con_cone [D : category] [M' M : category_Obj D] (m : category_Arr M' M) [C : graph] [F : diagram C D] (t : cone M F) : cone M' F
≔ Struct_cone (λ N : graph_Obj C, category_Comp m (cone_Arr t N));
inductive limit' [C : graph] [D : category] (F : diagram C D) : TYPE ≔ | Struct_limit' [C D F]:
Π (limit'_Obj : category_Obj D)
(limit'_Cone : cone limit'_Obj F)
(limit'_Univ : Π [M : category_Obj D] (t : cone M F), category_Arr M limit'_Obj), @limit' C D F;
injective symbol limit'_Obj [C D F] (lim_F : @limit' C D F) : category_Obj D;
rule limit'_Obj (Struct_limit' $1 $2 $3) ↪ $1;
injective symbol limit'_Cone [C D F] (lim_F : @limit' C D F) : cone (limit'_Obj lim_F) F;
rule limit'_Cone (Struct_limit' $1 $2 $3) ↪ $2;
injective symbol limit'_Univ [C D F] (lim_F : @limit' C D F) : Π [M : category_Obj D] (t : cone M F), category_Arr M (limit'_Obj lim_F);
rule @limit'_Univ _ _ _ (Struct_limit' $1 $2 $3) ↪ $3;
inductive equalizing [C : graph] [X Y : graph_Obj C] [D : category] [M : category_Obj D] (F : diagram (joinGraph X Y) D)
(t : cone M (comp_graphMorph_diagram (joinGraph_graphMorph X Y) F)): TYPE ≔ | Struct_equalizing [C X Y D M F t] :
Π (equalizing_Obj : category_Obj D)
(equalizing_Arr : category_Arr (equalizing_Obj) M)
(equalizing_Cone : cone (equalizing_Obj) F), @equalizing C X Y D M F t;
constant symbol equalizing_type [C : graph] [X Y : graph_Obj C] [D : category] [M : category_Obj D] (F : diagram (joinGraph X Y) D)
(t : cone M (comp_graphMorph_diagram (joinGraph_graphMorph X Y) F)): Type;
rule τ (@equalizing_type $C $X $Y $D $M $F $t) ↪ @equalizing $C $X $Y $D $M $F $t;
injective symbol equalizing_Obj [C X Y D M F t] (L : @equalizing C X Y D M F t): category_Obj D;
rule equalizing_Obj (Struct_equalizing $1 $2 $3) ↪ $1;
injective symbol equalizing_Arr [C X Y D M F t] (L : @equalizing C X Y D M F t): category_Arr (@equalizing_Obj C X Y D M F t L) M;
rule equalizing_Arr (Struct_equalizing $1 $2 $3) ↪ $2;
injective symbol equalizing_Cone [C X Y D M F t] (L : @equalizing C X Y D M F t): cone (@equalizing_Obj C X Y D M F t L) F;
rule equalizing_Cone (Struct_equalizing $1 $2 $3) ↪ $3;
inductive equalizer [C : graph] [X Y : graph_Obj C] [D : category] [M : category_Obj D] (F : diagram (joinGraph X Y) D)
(t : cone M (comp_graphMorph_diagram (joinGraph_graphMorph X Y) F)): TYPE ≔ | Struct_equalizer [C X Y D M F t] :
Π (equalizer_Equalizing : @equalizing C X Y D M F t)
(equalizer_Univ : Π L : @equalizing C X Y D M F t, category_Arr (equalizing_Obj L) (equalizing_Obj equalizer_Equalizing)), @equalizer C X Y D M F t;
//TODO equalizer_type
injective symbol equalizer_Equalizing [C X Y D M F t] (L : @equalizer C X Y D M F t): @equalizing C X Y D M F t;
rule equalizer_Equalizing (Struct_equalizer $1 $2) ↪ $1;
injective symbol equalizer_Univ [C X Y D M F t] (L : @equalizer C X Y D M F t): Π L0 : @equalizing C X Y D M F t, category_Arr (@equalizing_Obj C X Y D M F t L0) (@equalizing_Obj C X Y D M F t (@equalizer_Equalizing C X Y D M F t L));
rule equalizer_Univ (Struct_equalizer $1 $2) ↪ $2;
///---
symbol emptyGraph : graph ≔ Struct_graph (empty_type ) (λ _ _, empty_type);
///---
/* injective */ symbol optionGraph_Obj (C : graph) : Type ≔ option_type (graph_Obj_type C);
injective symbol optionGraph_Arr (C : graph) : Π (M N : τ (optionGraph_Obj C)), Type;
constant symbol optionGraph_Arr_intro (C : graph) : Π [M N : graph_Obj C], graph_Arr M N → τ (optionGraph_Arr C (Some M) (Some N));
symbol optionGraph_Arr_elim (C : graph) : Π [E : τ (optionGraph_Obj C) → τ (optionGraph_Obj C) → Type]
(E_left : Π [M N : graph_Obj C], graph_Arr M N → τ (E (Some M) (Some N))) ,
Π (M N : τ (optionGraph_Obj C)), τ (optionGraph_Arr C M N) → τ (E M N);
rule (@optionGraph_Arr_elim $C $E $E_left _ _ (@optionGraph_Arr_intro $C _ _ $a)) ↪ ($E_left _ _ $a);
///todo review this eta necessarry?
rule (@optionGraph_Arr_elim $C (optionGraph_Arr $C) (@optionGraph_Arr_intro $C)) ↪ λ M N a, a;
injective symbol optionGraph (C : graph) : graph ≔ Struct_graph (optionGraph_Obj C) (optionGraph_Arr C);
symbol optionGraph_graphMorph (C : graph) : graphMorph C (optionGraph C)
≔ @Struct_graphMorph C (optionGraph C) (Some) (@optionGraph_Arr_intro C);
///---
inductive terminal (D : category) : TYPE ≔ | Struct_terminal [D] :
Π (terminal_Obj : category_Obj D)
(terminal_Univ : Π L0 : category_Obj D, category_Arr L0 (terminal_Obj)), @terminal D;
injective symbol terminal_Obj [D] (L : @terminal D): @category_Obj D;
rule terminal_Obj (Struct_terminal $1 $2) ↪ $1;
injective symbol terminal_Univ [D] (L : @terminal D): Π L0 : @category_Obj D, category_Arr L0 (@terminal_Obj D L);
rule terminal_Univ (Struct_terminal $1 $2) ↪ $2;
///---
inductive producing [C : graph] [D : category] [M : category_Obj D] (F : diagram (optionGraph C) D)
(t : cone M (comp_graphMorph_diagram (optionGraph_graphMorph C) F)): TYPE ≔ | Struct_producing [C D M F t] :
Π (producing_Obj : category_Obj D)
(producing_Arr : category_Arr (producing_Obj) M)
(producing_Cone : cone (producing_Obj) F), @producing C D M F t;
constant symbol producing_type [C : graph] [D : category] [M : category_Obj D] (F : diagram (optionGraph C) D)
(t : cone M (comp_graphMorph_diagram (optionGraph_graphMorph C) F)): Type;
rule τ (@producing_type $C $D $M $F $t) ↪ @producing $C $D $M $F $t;
injective symbol producing_Obj [C D M F t] (L : @producing C D M F t): category_Obj D;
rule producing_Obj (Struct_producing $1 $2 $3) ↪ $1;
injective symbol producing_Arr [C D M F t] (L : @producing C D M F t): category_Arr (@producing_Obj C D M F t L) M;
rule producing_Arr (Struct_producing $1 $2 $3) ↪ $2;
injective symbol producing_Cone [C D M F t] (L : @producing C D M F t): cone (@producing_Obj C D M F t L) F;
rule producing_Cone (Struct_producing $1 $2 $3) ↪ $3;
inductive product [C : graph] [D : category] [M : category_Obj D] (F : diagram (optionGraph C) D)
(t : cone M (comp_graphMorph_diagram (optionGraph_graphMorph C) F)): TYPE ≔ | Struct_product [C D M F t] :
Π (product_Producing : @producing C D M F t)
(product_Univ : Π L : @producing C D M F t, category_Arr (producing_Obj L) (producing_Obj product_Producing)), @product C D M F t;
//TODO product_type
injective symbol product_Producing [C D M F t] (L : @product C D M F t): @producing C D M F t;
rule product_Producing (Struct_product $1 $2) ↪ $1;
injective symbol product_Univ [C D M F t] (L : @product C D M F t): Π L0 : @producing C D M F t, category_Arr (@producing_Obj C D M F t L0) (@producing_Obj C D M F t (@product_Producing C D M F t L));
rule product_Univ (Struct_product $1 $2) ↪ $2;
///-----
inductive isFiniteGraph : graph → TYPE ≔
| EmptyGraph_isFiniteGraph : isFiniteGraph emptyGraph
| OptionGraph_isFiniteGraph [C : graph] : isFiniteGraph C → isFiniteGraph (optionGraph C)
| JoinGraph_isFiniteGraph [C : graph]: isFiniteGraph C → Π (X Y : graph_Obj C), isFiniteGraph (joinGraph X Y) ;
symbol rect_isFiniteGraph : Π p0: (Π x0: graph, isFiniteGraph x0 → Type),
τ (p0 emptyGraph EmptyGraph_isFiniteGraph) →
(Π C: graph, Π x1: isFiniteGraph C, τ (p0 C x1) → τ (p0 (optionGraph C) (OptionGraph_isFiniteGraph x1))) →
(Π C: graph, Π x3: isFiniteGraph C, Π X: graph_Obj C, Π Y: graph_Obj C, τ (p0 C x3) → τ (p0 (joinGraph X Y) (JoinGraph_isFiniteGraph x3 X Y ))) →
Π x0: graph, Π x: isFiniteGraph x0, τ (p0 x0 x);
rule @rect_isFiniteGraph $1 $2 $3 $4 $5 (@EmptyGraph_isFiniteGraph) ↪
$2 ;
rule @rect_isFiniteGraph $1 $2 $3 $4 $5 (@OptionGraph_isFiniteGraph $6 $7) ↪
$3 $6 $7 (@rect_isFiniteGraph $1 $2 $3 $4 $6 $7);
rule @rect_isFiniteGraph $1 $2 $3 $4 $5 (@JoinGraph_isFiniteGraph $6 $7 $8 $9) ↪
$4 $6 $7 $8 $9 (@rect_isFiniteGraph $1 $2 $3 $4 $6 $7);
symbol lemma_ind_hypothesis_equalizer_limit : Π D, (Π [C X Y M F t], @equalizer C X Y D M F t) →
Π [C : graph] [X Y : graph_Obj C] (C_isf : isFiniteGraph C),
(Π (F' : diagram C D), @limit' C D F') →
Π (F : diagram (joinGraph X Y) D), @limit' (joinGraph X Y) D F ≔
begin
assume D eqs C X Y C_ist IH F;
have IH_F : limit' (comp_graphMorph_diagram (joinGraph_graphMorph X Y) F)
{ refine (IH (comp_graphMorph_diagram (joinGraph_graphMorph X Y) F)) };
have Eq_IH_F : equalizer F (limit'_Cone IH_F)
{ refine (eqs _ _ _ _ F (limit'_Cone IH_F)) };
apply @Struct_limit'
{ refine (equalizing_Obj (equalizer_Equalizing Eq_IH_F)) }
{ refine (equalizing_Cone (equalizer_Equalizing Eq_IH_F)) }
{ assume M c_;
have Eq_side : category_Arr M (limit'_Obj IH_F)
{ refine (limit'_Univ IH_F) (tensor_cone (joinGraph_graphMorph X Y) c_) };
refine (equalizer_Univ Eq_IH_F (Struct_equalizing M Eq_side c_ )) ; };
end;
// ---------
symbol liset_terminal_natUniv : natUniv ≔ Base_natUniv 0;
symbol liset_terminal :
terminal liset ≔
begin
refine Struct_terminal _ _
{ refine (liset_terminal_natUniv ⸬ □)
}
{ refine λ M x, liset_terminal_natUniv
};
end;
symbol foldl [b] [a] (f : τ b → τ a → τ b) (i : τ b) : list a → τ b;
rule foldl $f $i □ ↪ $i
with foldl $f $i ($x ⸬ $l) ↪ $f (foldl $f $i $l) $x ;
compute foldl (⋅) □ ((1 ⸬ 2 ⸬ □) ⸬ (5 ⸬ 6 ⸬ □) ⸬ □);
symbol flatten [a] : list (list_type a) → list a ≔ foldl (⋅) □; //rev
symbol liset_product :
Π [A: graph], Π [K: category_Obj liset],
Π F: diagram (optionGraph A) liset,
Π t: cone K (comp_graphMorph_diagram (optionGraph_graphMorph A) F),
product F t ≔
begin
assume A K F t;
refine Struct_product _ _
{ refine Struct_producing _ _ _
{ refine (flatten (map (λ xs, map (Pair_natUniv xs) (diagram_Obj F None)) K));
}
{ refine natUniv_fst;
}
{ refine (Struct_cone _);
simplify;
refine rect_option _ _
{ assume M; refine (λ x, (cone_Arr t M) (natUniv_fst x));
}
{ refine natUniv_snd
};
}
}
{ assume L0; simplify producing_Obj;
refine (λ i, Pair_natUniv ((producing_Arr L0) i) (cone_Arr (producing_Cone L0) None i));
};
end;
symbol liset_equalizer :
Π [A: graph], Π [X: graph_Obj A], Π [Y: graph_Obj A], Π [K: category_Obj liset],
Π F: diagram (joinGraph X Y) liset,
Π t: cone K (comp_graphMorph_diagram (joinGraph_graphMorph X Y) F),
equalizer F t ≔
begin
assume A X Y K F t;
refine Struct_equalizer _ _
{ refine Struct_equalizing _ _ _
{ refine (let f ≔ (category_Comp (cone_Arr t X) (diagram_Arr F (joinGraph_Arr_introNew X Y))) in
let g ≔ (cone_Arr t Y) in
filter (λ x, natUniv_eq (f x) (g x)) K) ;
}
{ refine (λ x : natUniv, x);
}
{ refine (Struct_cone _);
refine (λ M, category_Comp (λ x : natUniv, x) ((cone_Arr t M)));
}
}
{ assume L0;
refine (λ i, (equalizing_Arr L0) i);
};
end;
//data for the main example
symbol example_graph : graph ≔ begin
refine (@joinGraph _ _ _ )
{ refine (optionGraph (optionGraph (optionGraph emptyGraph) ) )
}
{ refine (Some None)
}
{ refine (None)
}
end;
symbol example_graph_isf : isFiniteGraph example_graph ≔
begin
refine (@JoinGraph_isFiniteGraph _ _ _ _ ) ;
refine (@OptionGraph_isFiniteGraph _ _) ;
refine (@OptionGraph_isFiniteGraph _ _) ;
refine (@OptionGraph_isFiniteGraph _ _) ;
refine (@EmptyGraph_isFiniteGraph ) ;
end;
symbol example_diagram : diagram example_graph liset
≔ begin
refine Struct_diagram _ _
{
refine rect_option _ _
{
refine rect_option _ _
{
refine rect_option _ _
{
refine rect_empty
}
{
refine ((Base_natUniv 13) ⸬ (Base_natUniv 12) ⸬ (Base_natUniv 11) ⸬ □)
}
}
{
refine ((Base_natUniv 22) ⸬ (Base_natUniv 21) ⸬ □)
}
}
{
refine ((Base_natUniv 32) ⸬ (Base_natUniv 31) ⸬ □)
}
}
{
refine (joinGraph_Arr_elim _ _ )
{
refine (optionGraph_Arr_elim _ _ );
refine (optionGraph_Arr_elim _ _ );
refine (optionGraph_Arr_elim _ _ );
assume M N;
refine rect_empty
}
{
refine (λ x, Base_natUniv 31)
}
}
end;
// ---------
//universality is in extensional formulation, as compared to intensional intrinsic formulation for limit_cov projection limit_cov_transf
// injective symbol limit_cov_univ' : Π [B J J' : cat] [W : mod J' J] [F : func J B] [F_⇐_W : func J' B] (isl : limit_cov F W F_⇐_W),
// Π [I : cat] [M : func I B],
// transf (((Unit_mod M F)) ⇐ W) Id_func (Unit_mod M F_⇐_W) Id_func;
injective symbol ilimit_cov_univ : Π [B J J' : cat] [W : mod J' J] [F : func J B] [F_⇐_W : func J' B] (isl : limit_cov F W F_⇐_W),
Π [I : cat] [M : func I B] [X : func J' I] ,
hom X (((Unit_mod M F)) ⇐ W) Id_func → hom X (Unit_mod M F_⇐_W) Id_func;
//narrurality of limit intro
//WARRNING: this rule is necessarry because no such more general rule as: rule ($M)_'∘> ($g '∘ $t) ↪ (($M)_'∘> $g) ''∘ $t;
// which fails because $M is not id
// rule ($Z)_'∘> ($f '∘ (limit_cov_univ' $isl))
// ↪ ( (_)_'∘> $f ) ''∘ (limit_cov_univ' $isl );
rule @'∘ _ _ _ _ _ _ _ Id_func _ $f (($Z)_'∘> (ilimit_cov_univ $isl $c))
↪ ilimit_cov_univ $isl ($f '∘ ($Z)_'∘> $c);
type @transf;
/// ======================================================
// /!\ WARNING REVIEW THIS SLOW /!\ UNCOMMENT FOR DEV OR TEST COMPILE
//TODO: review slow? 5 minutes
//UNCOMMENT
// rule (@∘>'_ _ _ _ _ _ (Unit_mod _ Id_func) _ $f _) ∘' (ilimit_cov_univ $isl $c)
// ↪ ilimit_cov_univ $isl ((comp_Imply_cov_mod $f) ∘' $c);
/// ======================================================
injective symbol ilimit_cov_cone : Π [B J J' : cat] [W : mod J' J] [F : func J B] [F_⇐_W : func J' B] (isl : limit_cov F W F_⇐_W),
hom F_⇐_W (((Unit_mod Id_func F)) ⇐ W) Id_func;
//beta
// rule (limit_cov_univ' $isl) ''∘ ((_)_'∘> (ilimit_cov_cone $isl)) ↪ Id_transf _;
rule (ilimit_cov_univ $isl $c) '∘ (_)_'∘> (ilimit_cov_cone $isl) ↪ $c;
//eta
// rule ((_)_'∘> (ilimit_cov_cone $isl)) ''∘ (limit_cov_univ' $isl) ↪ Id_transf _;
rule (ilimit_cov_univ $isl (ilimit_cov_cone $isl)) ↪ Func_cov_hom _ _;
/*-----
* That cat is Type is only required for ilimit_type */
constant symbol cat_Type : Type ;
rule τ (cat_Type) ↪ cat;
//universality is in extensional formulation, as compared to intensional intrinsic formulation for limit_cov projection limit_cov_transf
injective symbol ilimit_type [J' B : cat] [J : cat] (F : func J B) (W : mod J' J) : Type ≔
`Σ_ (F_⇐_W : func J' B),
(hom_type F_⇐_W (((Unit_mod Id_func F)) ⇐ W) Id_func)
× (`Π_ [I : cat], `Π_ [M : func I B], `Π_ [S : func J' I], /* TODO: T should Id_func ? */
hom_type S (((Unit_mod M F)) ⇐ W) Id_func →_ hom_type S (Unit_mod M F_⇐_W) Id_func);
injective symbol ilimit [J' B : cat] [J : cat] (F : func J B) (W : mod J' J) : TYPE ≔ τ (ilimit_type F W);
injective symbol ilimit_limit_cov [J' B J F W] (F_⇐_W : @ilimit J' B J F W) :
limit_cov F W (sigma_Fst F_⇐_W);
rule @ilimit_cov_univ _ _ _ _ _ _ (@ilimit_limit_cov $J' $B $J $F $W $F_⇐_W)
↪ (sigma_Snd $F_⇐_W)₂;
rule @ilimit_cov_cone _ _ _ _ _ _ (@ilimit_limit_cov $J' $B $J $F $W $F_⇐_W)
↪ (sigma_Snd $F_⇐_W)₁;
rule @∘' _ _ _ _ _ _ _ Id_func _ (@limit_cov_univ_transf _ _ _ _ _ _ (@ilimit_limit_cov $J' $B $J $F $W $F_⇐_W) _ _) $c
↪ (sigma_Snd $F_⇐_W)₂ _ _ _ $c ;
////-----------
constant symbol graph_cat : Π C : graph, cat;
constant symbol graph_Obj_obj [C : graph] (M : graph_Obj C) : obj (graph_cat C);
//TODO normalization operations define recursively by cases
symbol obj_graph_Obj [C : graph] (M : obj (graph_cat C)) : graph_Obj C;
rule (obj_graph_Obj (graph_Obj_obj $o)) ↪ $o;
//TODO: also generalize this from Id_func ? similar as for category
constant symbol graph_Arr_cov_arr [C : graph] (M N : obj (graph_cat C)) (a : graph_Arr (obj_graph_Obj M) (obj_graph_Obj N)) :
arr M (Unit_mod Id_func (Obj_func N)) Terminal_obj;
constant symbol graph_Arr_con_arr [C : graph] (M N : obj (graph_cat C)) (a : graph_Arr (obj_graph_Obj M) (obj_graph_Obj N)) :
arr Terminal_obj (Unit_mod (Obj_func M) Id_func) N;
//TODO: finish: graph viewed as unit profunctor
constant symbol graphunitprofunctor_Arr_arr [C : graph] (M N : obj (graph_cat C)) (a : graph_Arr (obj_graph_Obj M) (obj_graph_Obj N)) :
arr M (Unit_mod Id_func Id_func) N;
//have both cov elim and con elim?, and separrated from (neutral) categoryunitprofunctor elim?
injective symbol graph_elim_cov_func [C : graph] : Π [E : cat]
(E_obj : Π (M : graph_Obj C), obj E)
(E_cov_arr : Π [M N : graph_Obj C] (a : graph_Arr M N),
arr (E_obj M) (Unit_mod Id_func (Obj_func (E_obj N))) Terminal_obj),
func (graph_cat C) E;
//TODO later as accumulator? for redirecting associativity
rule $M ∘>o (graph_elim_cov_func $E_obj $E_cov_arr)
↪ $E_obj (obj_graph_Obj $M);
rule (Func_cov_hom (graph_elim_cov_func $E_obj $E_cov_arr) _) ∘>'_(_) ∘a' (graph_Arr_cov_arr $M $N $a)