-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcartierSolution13.lp
2534 lines (1880 loc) · 131 KB
/
cartierSolution13.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/cartierSolution13.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.
(A short description at the end of this file.)
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 cartierSolution13.lp :
# INTRODUCTION TO LAMBDAPI, PRELIMINARIES
# PRELIMINARIES REMINDERS ABOUT DEPENDENT TYPES
AND IMPLEMENTING CONTEXT-EXTENSION
(CATEGORIES WITH FAMILIES) WHICH COMPUTES# SIGMA-SUM: PART 1
# CATEGORIES, FUNCTORS, ISOFIBRATIONS OF CATEGORIES
# CONTEXT EXTENSION FOR CATEGORIES
# SIGMA-SUM FOR (ISO)FIBRATIONS OF CATEGORIES
# PI-PRODUCT FOR (ISO)FIBRATIONS OF CATEGORIES
# MODULES (PROFUNCTORS), UNIT HOM MODULES, AND TRANSFORMATIONS,
* YONEDA ACTION
# CUT-ELIMINATION AND ASSOCIATIVITY METATHEOREM
# PRODUCT CATEGORY
# PRODUCT CATEGORY AS A TRIVIAL ISOFIBRATION
# INDUCTIVE DATA TYPE, EXAMPLE OF THE JOIN CATEGORY
# DEPENDENT (ISO)FIBRATIONS OF MODULES
# CONTEXT EXTENSION FOR MODULES (PROFUNCTORS)
# SIGMA-SUM AND PI-PRODUCT OF FIBRED PROFUNCTORS
# FIBRATIONS: CARTESIAN TRANSPORT
# FIBRATIONS: COMMA CATEGORY
# FIBRATIONS: EXAMPLE OF FIBRED PRODUNCTOR, SQUARES FIBRED BY THEIR DIAGONAL
# CATEGORY OF ELEMENTS AS AN INSTANCE OF THE COMMA FIBRATION CATEGORY
# TENSOR (AND KAN EXTENSIONS AND CO-YONEDA REDUCTIONS) HOM FOR MODULES (PROFUNCTORS)
# INTERNAL HOM (IMPLICATION), LAMBDA CALCULUS FOR MODULES (PROFUNCTORS)
# SETS, UNDERLYING GROUPOIDS, DISCRETE/GROUPOIDS AS CATEGORIES, UNIVALENT CATEGORIES
# CONTAINER SETS, POLYNOMIAL MODULES, POLYNOMAIL FUNCTORS - PART 1. (cartierSolution15.lp FOR PART 2)
# ADJUNCTION OF FUNCTORS BETWEEN CATEGORIES
# WEIGHTED LIMITS, RIGHT ADJOINTS PRESERVE WEIGHTED LIMITS
# DUALITY, COVARIANT VS CONTRAVARIANCE, LEFT ADJOINT PRESERVE WEIGHTED COLIMITS BY DUALITY
*/
/*
> 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.Type Blanqui.Lib.Type Blanqui.Lib.Eq;
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";
/*****************************************
* # INTRODUCTION TO LAMBDAPI, PRELIMINARIES
******************************************/
// infinity groupoid, as in homotopy type theory
constant symbol Type : TYPE;
injective symbol τ : Type → TYPE;
builtin "T" ≔ τ;
builtin "Prop" ≔ Type;
builtin "P" ≔ τ;
constant symbol = [a] : τ a → τ a → Type /* not Prop */;
notation = infix 10;
constant symbol eq_refl [a] (x:τ a) : τ (x = x);
constant symbol ind_eq [a] [x y:τ a] : τ (x = y) → Π p, τ (p y) → τ (p x);
builtin "eq" ≔ =;
builtin "refl" ≔ eq_refl;
builtin "eqind" ≔ ind_eq;
opaque symbol eq_transf [a] [x y z:τ a] : τ (x = y) → τ (y = z) → τ (x = z)
≔ begin
assume a x y z Hxy Hyz;
rewrite Hxy; apply Hyz;
end;
constant symbol × : Type → Type → Type; notation × infix right 10;
symbol & [a b] : τ a → τ b → τ (a × b); notation & infix right 30;
symbol ₁ [a b] : τ(a × b) → τ a; notation ₁ postfix 10;
rule ($x & _)₁ ↪ $x;
symbol ₂ [a b] : τ(a × b) → τ b; notation ₂ postfix 10;
rule (_ & $x)₂ ↪ $x;
constant symbol ⊤ : Type;
constant symbol top : τ ⊤;
constant symbol ⊥ : Type;
constant symbol ⊥ₑ [p] : τ ⊥ → τ p;
constant symbol Π_ : Π [a], (τ a → Type) → Type; notation Π_ quantifier;
rule τ (@Π_ $a $b) ↪ Π x : τ $a, τ ($b x);
constant symbol →_ : Type → Type → Type; notation →_ infix right 10;
rule τ ($x →_ $y) ↪ τ $x → τ $y;
inductive τΣ_ [a : Type] (P : τ a → Type) : TYPE ≔
| Struct_sigma [a P] : Π (sigma_Fst : τ a) (sigma_Snd : τ (P sigma_Fst) ), @τΣ_ a P;
notation τΣ_ quantifier;
constant symbol Σ_ [a : Type] (P : τ a → Type) : Type; notation Σ_ quantifier;
rule τ (Σ_ $P) ↪ τΣ_ $P;
injective symbol sigma_Fst [a P] (s : @τΣ_ a P) : τ a;
rule sigma_Fst (Struct_sigma $1 $2) ↪ $1;
injective symbol sigma_Snd [a P] (s : @τΣ_ a P) : τ (P (sigma_Fst s));
rule sigma_Snd (Struct_sigma $1 $2) ↪ $2;
inductive unit : TYPE ≔ | tt : unit;
constant symbol unit_type : Type;
rule τ unit_type ↪ unit;
inductive bool : TYPE ≔
| true : bool
| false : bool;
constant symbol bool_type : Type;
rule τ bool_type ↪ bool;
symbol istrue : bool → Type;
rule istrue true ↪ ⊤
with istrue false ↪ ⊥;
symbol or : bool → bool → bool; notation or infix left 20;
rule true or _ ↪ true
with _ or true ↪ true
with false or $b ↪ $b
with $b or false ↪ $b;
symbol and : bool → bool → bool; notation and infix left 7;
rule true and $b ↪ $b
with $b and true ↪ $b
with false and _ ↪ false
with _ and false ↪ false;
symbol if : bool → Π [a], τ a → τ a → τ a;
rule if true $x _ ↪ $x
with if false _ $y ↪ $y;
inductive nat : TYPE ≔
| 0 : nat
| +1 : nat → nat; notation +1 postfix 100;
builtin "0" ≔ 0;
builtin "+1" ≔ +1;
constant symbol nat_type : Type;
rule τ nat_type ↪ nat;
symbol eqn : nat → nat → bool;
rule eqn 0 0 ↪ true
with eqn ($x +1) ($y +1) ↪ eqn $x $y
with eqn 0 (_ +1) ↪ false
with eqn (_ +1) 0 ↪ false;
(a:Type) inductive list:TYPE ≔
| □ : list a // \Box
| ⸬ : τ a → list a → list a; // ::
notation ⸬ infix right 20;
constant symbol list_type : Type → Type;
rule τ (list_type $a) ↪ list $a;
symbol ⋅ [a] : list a → list a → list a; notation ⋅ infix right 30; // \cdot
rule □ ⋅ $m ↪ $m
with ($x ⸬ $l) ⋅ $m ↪ $x ⸬ ($l ⋅ $m);
symbol filter [a] : (τ a → bool) → list a → list a;
rule filter _ □ ↪ □
with filter $p ($x ⸬ $l) ↪ if ($p $x) ($x ⸬ (filter $p $l)) (filter $p $l);
symbol ∈ [a] : (τ a → τ a → bool) → τ a → list a → bool;
rule ∈ _ _ □ ↪ false
with ∈ $beq $x ($y ⸬ $l) ↪ $beq $x $y or ∈ $beq $x $l;
symbol map [a b] : (τ a → τ b) → list a → list b;
rule map _ □ ↪ □
with map $f ($x ⸬ $l) ↪ $f $x ⸬ map $f $l;
constant symbol DEBUG_ADMIT [a : Type] : τ a;
injective symbol DEBUG_TAG1 [a : Type] : τ a → τ a; rule DEBUG_TAG1 $x ↪ $x;
injective symbol DEBUG_TAG2 [a : Type] : τ a → τ a; rule DEBUG_TAG2 $x ↪ $x;
/*****************************************
* # PRELIMINARIES REMINDERS ABOUT DEPENDENT TYPES
* AND IMPLEMENTING CONTEXT-EXTENSION
* (CATEGORIES WITH FAMILIES) WHICH COMPUTES
******************************************/
constant symbol
Con : TYPE;
constant symbol
Ty : Con → TYPE;
constant symbol
◇ : Con;
injective symbol
▹ : Π (Γ : Con), Ty Γ → Con;
notation ▹ infix right 90;
constant symbol
Sub : Con → Con → TYPE;
symbol
∘ : Π [Δ Γ Θ], Sub Δ Γ → Sub Θ Δ → Sub Θ Γ;
notation ∘ infix right 80;
rule /* assoc */
$γ ∘ ($δ ∘ $θ) ↪ ($γ ∘ $δ) ∘ $θ;
constant symbol
id : Π [Γ], Sub Γ Γ;
rule /* idr */
$γ ∘ id ↪ $γ
with /* idl */
id ∘ $γ ↪ $γ;
symbol
'ᵀ_ : Π [Γ Δ], Ty Γ → Sub Δ Γ → Ty Δ;
notation 'ᵀ_ infix left 70;
rule /* 'ᵀ_-∘ */
$A 'ᵀ_ $γ 'ᵀ_ $δ ↪ $A 'ᵀ_( $γ ∘ $δ )
with /* 'ᵀ_-id */
$A 'ᵀ_ id ↪ $A;
constant symbol
Tm : Π (Γ : Con), Ty Γ → TYPE;
symbol
'ᵗ_ : Π [Γ A Δ], Tm Γ A → Π (γ : Sub Δ Γ), Tm Δ (A 'ᵀ_ γ);
notation 'ᵗ_ infix left 70;
rule /* 'ᵗ_-∘ */
$a 'ᵗ_ $γ 'ᵗ_ $δ ↪ $a 'ᵗ_( $γ ∘ $δ )
with /* 'ᵗ_-id */
$a 'ᵗ_ id ↪ $a;
injective symbol
ε : Π [Δ], Sub Δ ◇;
rule /* ε-∘ */
ε ∘ $γ ↪ ε
with /* ◇-η */
@ε ◇ ↪ id;
injective symbol
pₓ : Π [Γ A], Sub (Γ ▹ A) Γ;
injective symbol
qₓ : Π [Γ A], Tm (Γ ▹ A) (A 'ᵀ_ pₓ);
injective symbol
&ₓ : Π [Γ Δ A], Π (γ : Sub Δ Γ), Tm Δ (A 'ᵀ_ γ) → Sub Δ (Γ ▹ A);
notation &ₓ infix left 70;
rule /* &ₓ-∘ */
($γ &ₓ $a) ∘ $δ ↪ ($γ ∘ $δ &ₓ ($a 'ᵗ_ $δ));
rule /* ▹-β₁ */
pₓ ∘ ($γ &ₓ $a) ↪ $γ;
rule /* ▹-β₂ */
qₓ 'ᵗ_ ($γ &ₓ $a) ↪ $a;
rule /* ▹-η */
(@&ₓ _ _ $A (@pₓ _ $A) qₓ) ↪ id;
/*****************************************
* # CATEGORIES, FUNCTORS, ISOFIBRATIONS OF CATEGORIES
******************************************/
constant symbol cat : TYPE;
constant symbol func : Π (A B : cat), TYPE;
constant symbol func_type : Π (A B : cat), Type;
rule τ (@func_type $A $B) ↪ @func $A $B;
constant symbol catd: Π (X : cat), TYPE;
constant symbol funcd : Π [X Y : cat] (A : catd X) (F : func X Y) (B : catd Y), TYPE;
constant symbol funcd_type : Π [X Y : cat] (A : catd X) (F : func X Y) (B : catd Y), Type;
rule τ (@funcd_type $X $Y $A $F $B) ↪ (@funcd $X $Y $A $F $B);
/* -----
* ## categories and functors (objects) */
constant symbol Terminal_cat : cat;
constant symbol Id_func : Π [A : cat], func A A;
symbol ∘> : Π [A B C: cat], func A B → func B C → func A C;
notation ∘> infix left 90; // compo_func
rule $X ∘> ($G ∘> $H) ↪ ($X ∘> $G) ∘> $H
with $F ∘> Id_func ↪ $F
with Id_func ∘> $F ↪ $F;
injective symbol Terminal_func : Π (A : cat), func A Terminal_cat;
rule (@∘> $A $B $C $F (Terminal_func $B)) ↪ (Terminal_func $A)
with (Terminal_func (Terminal_cat)) ↪ Id_func;
/* -----
* ## fibred (dependent) categories */
constant symbol Terminal_catd : Π (A : cat), catd A;
symbol Fibre_catd : Π [X I : cat] (A : catd X) (x : func I X), catd I;
rule Fibre_catd $A Id_func ↪ $A
with Fibre_catd $A ($x ∘> $y) ↪ Fibre_catd (Fibre_catd $A $y) $x;
rule Fibre_catd (Terminal_catd _) _ ↪ (Terminal_catd _);
/* -----
* ## fibred (dependent) functors */
constant symbol Id_funcd : Π [X : cat] [A : catd X], funcd A Id_func A;
symbol ∘>d: Π [X Y Z : cat] [A : catd X] [B : catd Y] [C : catd Z] [F : func X Y]
[G : func Y Z], funcd A F B → funcd B G C → funcd A (F ∘> G) C;
notation ∘>d infix left 90; // compo_funcd
rule $X ∘>d ($G ∘>d $H) ↪ ($X ∘>d $G) ∘>d $H
with $F ∘>d Id_funcd ↪ $F
with Id_funcd ∘>d $F ↪ $F;
injective symbol Terminal_funcd : Π [X Y: cat] (A : catd X) (xy : func X Y), funcd A xy (Terminal_catd Y);
injective symbol Fibre_intro_funcd : Π [X I I' : cat] (A : catd X) (x : func I X) [J : catd I'] (i : func I' I) ,
funcd J (i ∘> x) A → funcd J i (Fibre_catd A x);
injective symbol Fibre_elim_funcd : Π [X I : cat] (A : catd X) (x : func I X), funcd (Fibre_catd A x) x A;
// naturality
rule $HH ∘>d (Fibre_intro_funcd $A $x _ $FF) ↪ (Fibre_intro_funcd $A $x _ ($HH ∘>d $FF))
with (Fibre_elim_funcd /*DON'T SPECIFY, ALLOW CONVERSION: (Fibre_catd $A $y) */ _ $x) ∘>d Fibre_elim_funcd $A $y ↪ Fibre_elim_funcd $A ($x ∘> $y);
// beta, eta
rule (Fibre_intro_funcd $A $x _ $FF) ∘>d (Fibre_elim_funcd $A $x) ↪ $FF
with (Fibre_intro_funcd $A $x Id_func (Fibre_elim_funcd $A $x)) ↪ Id_funcd;
rule Fibre_elim_funcd $A Id_func ↪ Id_funcd
with Fibre_intro_funcd $A Id_func $i $FF ↪ $FF
with (Fibre_intro_funcd /* (Fibre_catd $A $y) */ _ $x $i (Fibre_intro_funcd $A $y /* ($i ∘> $x) */ _ $FF))
↪ (Fibre_intro_funcd $A ($x ∘> $y) $i $FF);
rule (Terminal_funcd (Terminal_catd _) $xy) ↪ Fibre_elim_funcd (Terminal_catd _) $xy;
rule ($FF ∘>d (Terminal_funcd $B $xy)) ↪ (Terminal_funcd _ _);
rule (Terminal_funcd (Terminal_catd _) Id_func) ↪ Id_funcd; // confluent...
/*****************************************
* # CONTEXT EXTENSION FOR CATEGORIES
******************************************/
injective symbol Context_cat : Π [X : cat], catd X → cat;
injective symbol Context_elimCat_func : Π [X : cat] (A : catd X), func (Context_cat A) X;
injective symbol Context_elimCatd_funcd : Π [X : cat] (A : catd X), funcd (Terminal_catd _) (Context_elimCat_func A) A;
injective symbol Context_intro_func : Π [X Y : cat] [A : catd X] [B : catd Y] [xy : func X Y],
funcd A xy B → func (Context_cat A) (Context_cat B);
rule Context_cat (Terminal_catd $A) ↪ $A;
rule Context_elimCat_func (Terminal_catd $A) ↪ Id_func;
rule Context_elimCatd_funcd (Terminal_catd $A) ↪ Id_funcd;
rule Context_intro_func (Id_funcd) ↪ Id_func
with Context_intro_func (Terminal_funcd $A $xy) ↪ Context_elimCat_func $A ∘> $xy;
// definable symbols
injective symbol Context_intro_single_func [Y : cat] [B : catd Y] [X] (xy : func X Y)
(FF : funcd (Terminal_catd X) xy B) : func X (Context_cat B);
rule Context_intro_single_func _ $FF ↪ @Context_intro_func _ _ (Terminal_catd _) _ _ $FF;
injective symbol Context_intro_congr_func [Y : cat] [B : catd Y] [X] (xy : func X Y)
: func (Context_cat (Fibre_catd B xy)) (Context_cat B);
rule Context_intro_congr_func $xy ↪ Context_intro_func (Fibre_elim_funcd _ $xy);
// beta rules
rule (@Context_intro_func _ _ $A $B $F $FF) ∘> (Context_elimCat_func $B)
↪ (Context_elimCat_func $A) ∘> $F;
rule (Fibre_elim_funcd (Terminal_catd $X) (@Context_intro_func _ _ (Terminal_catd $X) $B $xy $FF)) ∘>d (Context_elimCatd_funcd $B)
↪ $FF;
// LAMBDAPI BUG? this unification rule doesnt work... so finding an alternative
// unif_rule Context_cat $B ≡ (Context_cat (Terminal_catd (Context_cat $X))) ↪ [ $B ≡ $X];
symbol rule_Context_cat_Terminal_catd_func [X: cat] (A: catd X)
: func (Context_cat (Terminal_catd (Context_cat A))) (Context_cat A)
≔ begin assume X A; simplify; refine Id_func; end;
// eta rules
rule Context_intro_func (Context_elimCatd_funcd $A)
↪ rule_Context_cat_Terminal_catd_func $A;
rule @Context_intro_func _ _ _ _ $xy (Fibre_elim_funcd (Terminal_catd _) _) ↪ $xy;
// naturality rules
// confluent ... and both rules required despite in meta the latter conversion is derivable from the former rules
rule (@Context_intro_func $X $Y $A $B $F $FF) ∘> (@Context_intro_func $Y $Z $B $C $G $GG)
↪ Context_intro_func ($FF ∘>d $GG)
with $z ∘> @Context_intro_func _ _ (Terminal_catd _) _ _ $FF
↪ Context_intro_func ( (Fibre_elim_funcd (Terminal_catd _) $z) ∘>d $FF );
assert [X Y : cat] [B : catd Y] [xy : func X Y] (FF : funcd (Terminal_catd X) xy B) [Z] [z : func Z X] ⊢
(@Context_intro_func _ _ _ _ z (Terminal_funcd (Terminal_catd Z) z)) ∘> Context_intro_func FF
≡ Context_intro_func ( (Terminal_funcd (Terminal_catd Z) z) ∘>d FF );
/*****************************************
* # SIGMA-SUM FOR (ISO)FIBRATIONS OF CATEGORIES
******************************************/
injective symbol Sigma_catd : Π [X : cat] (F : catd X) (Z : catd (Context_cat F)), catd X;
// ... beck-chevalley
rule Fibre_catd (Sigma_catd $F $Z) $G
↪ Sigma_catd (Fibre_catd $F $G) (Fibre_catd $Z (Context_intro_func (Fibre_elim_funcd $F $G))) ;
injective symbol Sigma_intro_funcd : Π [X : cat] (F : catd X) (Z : catd (Context_cat F)),
funcd Z (Context_elimCat_func F) (Sigma_catd F Z);
injective symbol Sigma_elim_funcd : Π [X : cat] (F : catd X) [Z : catd (Context_cat F)] [X'] (G : func X X') [C : catd X'],
funcd Z ((Context_elimCat_func F) ∘> G) C → funcd (Sigma_catd F Z) G C;
// naturality
rule (Sigma_elim_funcd $F $G $CC) ∘>d $DD ↪ (Sigma_elim_funcd $F _ ($CC ∘>d $DD));
// beta
rule (Sigma_intro_funcd $F $Z) ∘>d (Sigma_elim_funcd $F $G $CC) ↪ $CC;
/* -----
* ## TODO: SIGMA-SUM WHEN CARTESIAN FIBRATION (ALONG CARTESIAN FIBRATION) */
// constructions for derived isFibration_con isFibration_cov ...
/*****************************************
* # PI-PRODUCT FOR (ISO)FIBRATIONS OF CATEGORIES
******************************************/
injective symbol Pi_catd : Π [X : cat] (F : catd X) (Z : catd (Context_cat F)), catd X;
// ... beck-chevalley
rule Fibre_catd (Pi_catd $F $Z) $G
↪ Pi_catd (Fibre_catd $F $G) (Fibre_catd $Z (Context_intro_func (Fibre_elim_funcd $F $G))) ;
injective symbol Pi_elim_funcd : Π [X : cat] [F : catd X] [Z : catd (Context_cat F)] [X'] [x : func X' X] [E : catd X'],
funcd E x (Pi_catd F Z) →
funcd (Fibre_catd E (Context_elimCat_func (Fibre_catd F x))) (Context_intro_func (Fibre_elim_funcd F x)) Z;
// over general G required for naturality
injective symbol Pi_intro_funcd : Π [X' : cat] (C : catd X') [X : cat] (G : func X' X) (F : catd X) [Z : catd (Context_cat F)]
(CC : funcd (Fibre_catd C (Context_elimCat_func (Fibre_catd F G))) (Context_intro_func (Fibre_elim_funcd F G)) Z),
funcd C G (Pi_catd F Z);
rule Pi_elim_funcd (Pi_intro_funcd $C $G $F $CC ) ↪ $CC;
assert [X' : cat] (C : catd X') [X : cat] (G : func X' X) (F : catd X) [Z : catd (Context_cat F)]
(CC : funcd (Fibre_catd C (Context_elimCat_func (Fibre_catd F G))) (Context_intro_func (Fibre_elim_funcd F G)) Z) ⊢
Pi_elim_funcd (Pi_intro_funcd C G F CC ) ≡ CC;
// //this alternative version has problems to express the rewrite rule (bad, slow)
// constant symbol Pi_elim_funcd_v0 : Π [X : cat] (F : catd X) (Z : catd (Context_cat F)),
// funcd (Fibre_catd (Pi_catd F Z) (Context_elimCat_func F)) Id_func Z;
// type λ [X' : cat] (C : catd X') [X : cat] (G : func X' X) (F : catd X) [Z : catd (Context_cat F)]
// (CC : funcd (Fibre_catd C (Context_elimCat_func (Fibre_catd F G))) (Context_intro_func (Fibre_elim_funcd F G)) Z)
// [X''] [x' : func X'' X'] [C' : catd X''] [DD : funcd C' x' C] ,
// (Fibre_intro_funcd (Pi_catd F Z) (Context_elimCat_func F) (Context_intro_func (Fibre_elim_funcd F G))
// ((Fibre_elim_funcd C (Context_elimCat_func ((Fibre_catd F G) ))) ∘>d (Pi_intro_funcd C G F CC)))
// ∘>d (Pi_elim_funcd_v0 F Z)
// = CC;
//naturality
rule @∘>d _ _ _ $C' $C _ $x' $G $DD (Pi_intro_funcd $C $G $F $CC)
↪ Pi_intro_funcd $C' ($x' ∘> $G) $F
((Fibre_intro_funcd $C (Context_elimCat_func (Fibre_catd $F $G)) (Context_intro_func (Fibre_elim_funcd (Fibre_catd $F $G) $x'))
((Fibre_elim_funcd $C' (Context_elimCat_func ((Fibre_catd (Fibre_catd $F $G)) $x'))) ∘>d $DD))
∘>d $CC);
assert [X' : cat] (C : catd X') [X : cat] (G : func X' X) (F : catd X) [Z : catd (Context_cat F)]
(CC : funcd (Fibre_catd C (Context_elimCat_func (Fibre_catd F G))) (Context_intro_func (Fibre_elim_funcd F G)) Z)
[X''] [x' : func X'' X'] [C' : catd X''] [DD : funcd C' x' C] ⊢
@∘>d _ _ _ C' C _ x' G DD (Pi_intro_funcd C G F CC)
≡ Pi_intro_funcd C' (x' ∘> G) F
((Fibre_intro_funcd C (Context_elimCat_func (Fibre_catd F G)) (Context_intro_func (Fibre_elim_funcd (Fibre_catd F G) x'))
((Fibre_elim_funcd C' (Context_elimCat_func ((Fibre_catd (Fibre_catd F G)) x'))) ∘>d DD))
∘>d CC);
//TODO: redo naturality for Pi_elim_funcd
// rule $DD ∘>d (Pi_elim_funcd_v0 $C $G $F $CC) ↪ (Pi_elim_funcd_v0 _ _ $F ($DD ∘>d $CC));
/* -----
* ## TODO: PI-PRODUCT WHEN CARTESIAN FIBRATION (ALONG CARTESIAN OP-FIBRATION) */
// constructions for derived isFibration_con isFibration_cov ...
/*****************************************
* # MODULES (PROFUNCTORS), UNIT HOM MODULES, AND TRANSFORMATIONS,
* YONEDA ACTION
******************************************/
constant symbol mod : Π (A B : cat), TYPE;
constant symbol hom : Π [I A B : cat], func I A → mod A B → func I B → TYPE;
constant symbol hom_type : Π [I A B : cat], func I A → mod A B → func I B → Type;
rule τ (@hom_type $I $A $B $F $R $G) ↪ @hom $I $A $B $F $R $G;
constant symbol transf : Π [A' B' A B: cat], mod A' B' → func A' A → mod A B → func B' B → TYPE;
// when all conversions are in extensional form, this is not used
constant symbol transf_Type : Π [A' B' A B: cat], mod A' B' → func A' A → mod A B → func B' B → Type;
rule τ (@transf_Type $A' $B' $A $B $R' $F $R $G) ↪ @transf $A' $B' $A $B $R' $F $R $G;
symbol <∘ [A B C: cat] : func B C → func A B → func A C ≔ λ G F, F ∘> G;
notation <∘ infix right 90;
/* -----
* ## category/unit hom */
constant symbol Unit_mod : Π [X A B : cat], func A X → func B X → mod A B;
constant symbol Terminal_mod : Π (A B : cat), mod A B;
/* -----
* ## arrows in category/unit hom */
constant symbol Id_hom : Π [A B : cat] (F : func B A),
hom F (Unit_mod Id_func Id_func ) F;
symbol Func_con_hom : Π [A B A' : cat] (Z : func A A') (F : func B A),
hom F (Unit_mod Z Id_func) (Z <∘ F);
symbol Func_cov_hom : Π [A B A' : cat] (Z : func A A') (F : func B A),
hom (F ∘> Z) (Unit_mod Id_func Z) F;
constant symbol Terminal_hom : Π [A B I : cat] (F : func I A) (G : func I B), hom F (Terminal_mod A B) G;
/* -----
* ## transformations of modules */
constant symbol Id_transf : Π [A X : cat] (R : mod A X) ,
transf R Id_func R Id_func;
injective symbol Terminal_transf : Π [A B B': cat] (R : mod A B) (G : func B B'), transf R Id_func (Terminal_mod A B') G;
/* -----
* ## pullback/composition/substitution along functors into of modules. part 1 */
//Subst_cov_mod
symbol <<∘ : Π [A X C: cat], mod A X → func C X → mod A C;
//Subst_con_mod
symbol ∘>> : Π [X B C: cat], func C X → mod X B → mod C B;
notation <<∘ infix left 80; notation ∘>> infix right 80;
rule (Unit_mod $F $G) <<∘ $K ↪ Unit_mod $F ($G <∘ $K);
rule $K ∘>> (Unit_mod $F $G) ↪ Unit_mod ($K ∘> $F) $G;
rule $R <<∘ Id_func ↪ $R
with ($R <<∘ $H) <<∘ $K ↪ $R <<∘ ($H <∘ $K);
rule Id_func ∘>> $R ↪ $R
with $K ∘>> ($H ∘>> $R) ↪ ($K ∘> $H) ∘>> $R;
rule ($F ∘>> $R) <<∘ $G ↪ ($F ∘>> ($R <<∘ $G));
rule Terminal_mod _ _ <<∘ $H ↪ Terminal_mod _ _
with $H ∘>> Terminal_mod _ _ ↪ Terminal_mod _ _;
/* *** yoneda action (embedding), covariant and contravariant *** */
//Unit_cov_transf
injective symbol ∘>'_ : Π [I A B J : cat] [F : func I A] [R : mod A B] [G : func I B],
hom F R G → Π (N: func J B), transf (Unit_mod G N) F (R <<∘ N) Id_func;
//Unit_con_transf
injective symbol _'∘> : Π [I A B J : cat] [F : func I A] [R : mod A B] [G : func I B],
Π (M : func J A), hom F R G → transf ( Unit_mod M F) Id_func (M ∘>> R) G;
notation _'∘> infix right 80; notation ∘>'_ infix left 80;
/* *** substitution/composition along arrow into a transformation *** */
//Comp_hom
symbol '∘ : Π [A B' B I : cat] [S : mod A B'] [T : mod A B]
[X : func I A] [Y : func I B'] [G : func B' B],
hom X S Y → transf S Id_func T G → hom X T (G <∘ Y);
notation '∘ infix right 80;
symbol ∘' [A' B A I : cat] [S : mod A' B] [T : mod A B]
[X : func I A'] [Y : func I B] [F : func A' A] :
transf S F T Id_func → hom X S Y → hom (X ∘> F) T Y;
notation ∘' infix left 80;
/* *** substitution/composition along transformation into a transformation *** */
symbol ''∘ [ B'' B' A B : cat] [R : mod A B''] [S : mod A B'] [T : mod A B]
[Y : func B'' B'] [G : func B' B] :
transf R Id_func /*GEN HERE*/ S Y → transf S Id_func T G → transf R Id_func T (G <∘ Y);
// transf R X S Y → transf S Id_func T G → transf R X T (G <∘ Y);
notation ''∘ infix right 80;
symbol ∘'' : Π [A'' A' B A : cat] [R : mod A'' B] [S : mod A' B] [T : mod A B]
[X : func A'' A'] [F : func A' A],
transf S F T Id_func → transf R X S Id_func → transf R (X ∘> F) T Id_func;
notation ∘'' infix left 80;
rule $rs ''∘ ($st ''∘ $tu) ↪ ($rs ''∘ $st) ''∘ $tu
with ($tu ∘'' $st) ∘'' $rs ↪ $tu ∘'' ($st ∘'' $rs);
rule $r'r '∘ (Id_transf _) ↪ $r'r
with (Id_transf _) ∘' $r'r ↪ $r'r;
rule (Id_transf _) ''∘ $r'r ↪ $r'r
with $r'r ''∘ (Id_transf _) ↪ $r'r;
rule (Id_transf _) ∘'' $r'r ↪ $r'r
with $r'r ∘'' (Id_transf _) ↪ $r'r;
rule $r '∘ ($rs ''∘ $st)
↪ ($r '∘ $rs) '∘ $st
with ($st ∘'' $rs) ∘' $r
↪ $st ∘' ($rs ∘' $r);
/* *** composition/substitution along functors into module elements/arrows *** */
//Comp_func_hom
symbol ∘↓ : Π [I A B I' : cat] [R : mod A B] [F : func I A]
[G : func I B], hom F R G → Π (X : func I' I), hom (X ∘> F) R (G <∘ X);
notation ∘↓ infix left 120;
rule $r ∘↓ Id_func ↪ $r
with ($r ∘↓ $H) ∘↓ $K ↪ $r ∘↓ ($K ∘> $H )
with (Id_hom $F) ∘↓ $H ↪ Id_hom ($F <∘ $H)
with (Func_con_hom $Z $F) ∘↓ $H ↪ Func_con_hom $Z ($F <∘ $H)
with (Func_cov_hom $Z $F) ∘↓ $H ↪ Func_cov_hom $Z ($F <∘ $H);
rule ($a '∘ $t) ∘↓ $Z ↪ (($a ∘↓ $Z) '∘ $t)
with ($t ∘' $a) ∘↓ $Z ↪ ($t ∘' ($a ∘↓ $Z)) ;
/* *** accumulation, functoriality, naturality of operations *** */
//accumulation contravariant ; accumulation not really naturality, therefore can be dealt with generically
// t∘(g) ∘X0 - = t∘(g ∘X0 -)
rule ($M)_'∘> ($g '∘ (($X0)_'∘> $t))
↪ (($M)_'∘> $g) ''∘ (($M ∘> $X0)_'∘> $t)
with (($t ∘>'_ ($X0) ∘' $g)) ∘>'_($M)
↪ ($t ∘>'_($M ∘> $X0)) ∘'' ($g ∘>'_($M));
assert [L R J I I' I1 : cat] [T : mod R L]
[Y0 : func I1 R] [Y: func I' I1] [Z : func I1 L]
(M : func J I) [X: func I' I] (X0: func I R)
(t : hom Y0 T Z)
(g : hom X (Unit_mod X0 Y0) Y) ⊢ eq_refl _ : τ (
(M)_'∘> (g '∘ ((X0)_'∘> t))
= ((M)_'∘> g) ''∘ ((M ∘> X0)_'∘> t) );
//accumulation covariant ; accumulation not really naturality, therefore can be dealt with generically
// - ∘X0 (g)∘t = (- ∘X0 g)∘t
// rule ($g '∘ ($t ∘>'_($X0))) ∘>'_($M)
// ↪ ($t ∘>'_($X0 <∘ $M)) ∘'' ($g ∘>'_($M));
rule (($t ∘>'_($X0)) ∘' $g) ∘>'_($M)
↪ ($t ∘>'_($X0 <∘ $M)) ∘'' ($g ∘>'_($M));
// naturality part1
//naturality (of func_cov_hom ?) TOO REVIEW THIS
type λ [A B : cat] [R : mod A B] [y : func A B]
[J1] [G : func J1 B] [I] [y'y : func I J1] [y' : func I A] (y'y_ : hom y' (Unit_mod y G) y'y)
(s : hom Id_func R y)
[J] [x''x' : func J A] [x'] (x''x'_ : hom x''x' (Unit_mod Id_func y') x') ,
(s ∘>'_(_)) ∘' (x''x'_ '∘ ((Id_func)_'∘> ( y'y_ )))
= (x''x'_ '∘ ((Id_func)_'∘> ( ((∘>'_) [_] [_] [_] [_] [Id_func] s (_)) ∘' y'y_ ))) ;
rule ($x''x'_ '∘ ((Id_func)_'∘> ( ((∘>'_) [_] [_] [_] [_] [Id_func] $s (_)) ∘' $y'y_ )))
↪ ($s ∘>'_(_)) ∘' ($x''x'_ '∘ ((Id_func)_'∘> ( $y'y_ ))) ;
//functoriality/naturality covariant
rule (( ($Y ∘> $Y0)_'∘> (Func_con_hom ($Z_LAdj_func) $N)))
''∘ ((@'∘ _ _ _ _ _ _ _ $Y _ $g (($X0)_'∘> ((Func_con_hom $Z_LAdj_func $Y0)))) ∘>'_(Id_func))
↪ (($g '∘ (($X0)_'∘> (Id_hom $Y0))) ∘>'_($N))
''∘ (($X0)_'∘> ((Func_con_hom $Z_LAdj_func $N))) ;
assert [L I : cat] [Z_LAdj_func : func I L]
[J I1 I2 : cat] [X0: func J I] [Y: func J I2] [Y0 : func I2 I]
[g : hom Id_func (Unit_mod X0 Y0) Y] [J' : cat] [N : func J' I] ⊢ eq_refl _ : τ (
(( (Y ∘> Y0)_'∘> (Func_con_hom (Z_LAdj_func) N)))
''∘ ((g '∘ ((X0)_'∘> ((Func_con_hom Z_LAdj_func Y0)))) ∘>'_(Id_func))
= ((g '∘ ((X0)_'∘> (Id_hom Y0))) ∘>'_(N))
''∘ ((X0)_'∘> ((Func_con_hom Z_LAdj_func N))) );
/* *** pullback/composition/substitution along functors into of modules. part 2 *** */
constant symbol ∘>>_proj : Π [X Y X' : cat] (F : func X' X) (R : mod X Y),
transf (F ∘>> R) F R Id_func;
constant symbol ∘>>_intro : Π [X Y X' X'' Y': cat] (F : func X' X) (R : mod X Y) (F' : func X'' X') [G : func Y' Y] [S : mod X'' Y'],
transf S (F' ∘> F) R G →
/* G requires general '∘' ? or actual use will have one of F' id or G id */
transf S F' (F ∘>> R) G /* G */;
//extensional... there are reasons for this... (in particular, trying to mix non-id cov and non-id con will require extensional as there is none op composing mixed transf)
rule ( ∘>>_proj $F $R ) ∘' (( ∘>>_intro $F $R $F' $r_ ) ∘' $x) ↪ $r_ ∘' $x ;
// rule ( ∘>>_proj $F $R ) ∘'' ( ∘>>_intro $F $R $F' $r_ ) ↪ $r_ ;
// pullback-of-modules operation is functorially extends to transformations of modules
symbol <<∘1 : Π [X Y X' : cat] [F : func X X'] [R' : mod X' Y] [R : mod X Y] (r : transf R F R' Id_func) [Z : cat] (H : func Z Y),
transf (R <<∘ H) F (R' <<∘ H) Id_func;
notation <<∘1 infix left 80;
rule ($r ∘>'_($N)) <<∘1 $H ↪ $r ∘>'_($N <∘ $H);
rule $t <<∘1 Id_func ↪ $t
with ($t <<∘1 $H) <<∘1 $K ↪ $t <<∘1 ($H <∘ $K)
with (Id_transf $R) <<∘1 $K ↪ Id_transf ($R <<∘ $K);
symbol 1∘>> : Π [X Y Y' : cat] [G : func Y Y'] [R' : mod X Y'] [R : mod X Y] [Z : cat] (H : func Z X) (r : transf R Id_func R' G) ,
transf (H ∘>> R) Id_func (H ∘>> R') G;
notation 1∘>> infix right 80;
rule $H 1∘>> (($M) _'∘> $r ) ↪ ($H ∘> $M) _'∘> $r;
rule Id_func 1∘>> $t ↪ $t
with $K 1∘>> ($H 1∘>> $t) ↪ ($K ∘> $H) 1∘>> $t
with $K 1∘>> (Id_transf $R) ↪ (Id_transf ($K ∘>> $R));
rule ($F 1∘>> $t) <<∘1 $G ↪ ($F 1∘>> ($t <<∘1 $G));
rule ( ∘>>_proj $H $R' ) ∘' ($x '∘ ( @1∘>> _ _ _ $G $R' $R $Z $H $r_ ))
↪ (( ∘>>_proj $H $R ) ∘' $x ) '∘ $r_ ;
// more conversion rules on identity arrows of functors as profunctors
//TODO replaced this by multiple equations
rule Func_con_hom Id_func $F ↪ (Id_hom $F)
with Func_cov_hom Id_func $F ↪ (Id_hom $F);
rule (Func_cov_hom _ $G ) '∘ ((_) _'∘> Id_hom $F) ↪ Id_hom ($G ∘> $F);
rule (Id_hom $F ∘>'_ (_) ) ∘' (Func_con_hom _ $G ) ↪ Id_hom ($G ∘> $F);
//TODO: REVIEW NECESSITY OF ID_HOM. both cov id and con id without id_hom are ok because would never mix anyway ?
// or maybe formulation where all converge to id noop only in applied form ?
//WARNING slow in transf formulation
//WARNING rule ($M)_'∘> (Id_hom Id_func) ↪ (Id_transf _);
rule ($f '∘ ($M)_'∘> (Id_hom Id_func) ) ↪ $f
with ((Id_hom Id_func) ∘>'_ (_)) ∘' $f ↪ $f;
//TODO review if applied form only
rule $f '∘ (($M)_'∘> (Func_cov_hom $F Id_func) ) ↪ $f;
rule ((Func_con_hom $F Id_func) ∘>'_($M)) ∘' $f ↪ $f;
// idhom ''∘ funchom = idhom
rule (($M)_'∘> ((Func_con_hom $F $Z)) ) ''∘ (($M ∘> $F)_'∘> (Func_con_hom $F' Id_func))
↪ (($M)_'∘> ((Func_con_hom ($F ∘> $F') $Z))) ;
assert [A B : cat] (F : func B A) B' (Z : func B' B) I (M : func I B) C (F' : func A C) ⊢ eq_refl _ : τ (
((M)_'∘> ((Func_con_hom F Z)) ) ''∘ ((M ∘> F)_'∘> (Func_con_hom F' Id_func))
= ((M)_'∘> ((Func_con_hom (F ∘> F') Z))) );
// : ransf (Unit_mod M (Z ∘> Id_func)) (Id_func ∘> Id_func) ((M ∘> F) ∘>> Unit_mod F' Id_func) (F' <∘ (F <∘ Z))
//yoneda bijection half 1
// j-rule then applied to id_hom, both cov and con
// todo solved, erase this comment: note for confluence that already exists another rewrite that jrule of restr
rule (((Func_cov_hom $F $Z)) '∘ ((Id_func)_'∘> $r))
↪ $r ∘↓ $Z;
//REVIEW: also this rule because confluence question?
rule ($f ∘>'_(_)) ∘' Id_hom $Z ↪ $f ∘↓ $Z
with Id_hom $Z '∘ ((_)_'∘> $f) ↪ $f ∘↓ $Z ;
assert [I A B : cat] [F : func I A] [R : mod A B] [G : func I B]
(r : hom F R G ) J (Z : func J _ ) ⊢ eq_refl _ : τ (
(((Func_cov_hom F Z)) '∘ ((Id_func)_'∘> r))
= r ∘↓ Z );
//yoneda bijection half 2
// SOLVED: now can solve $Z ∘> $dom_t ≡ $Z
rule (Id_func)_'∘> (((Func_cov_hom $Z Id_func)) '∘ $t)
↪ $t;
assert [B : cat] I (M : func I B) f ⊢ eq_refl _ : τ ( //note as transf fail because reduction to Id_hom
(f '∘ (M)_'∘> (Func_con_hom Id_func Id_func) ) = f );
//todo: derivable restr ?
// type λ [A B : cat] (F : func B A) B' (Z : func B' B) I (M : func I B) C (F' : func A C) ,
// ((M)_'∘> ((Func_con_hom F) ∘↓ Z) ) ;
// id_cov_hom on id_func is id_transf
//nope todo erase see id_hom
// rule (($M)_'∘> (Func_con_hom Id_func Id_func) )
// ↪ (Id_transf _);
// assert [B : cat] I (M : func I B) ⊢ eq_refl _ : τ (
// ((M)_'∘> (Func_con_hom Id_func Id_func) )
// = (Id_transf (Unit_mod M Id_func)) );
/*****************************************
* # CUT-ELIMINATION AND ASSOCIATIVITY METATHEOREM
******************************************/
// See Kosta Dosen's "Cut-elimination in categories"
// it is a metatheorem by cases induction that the associativity propositional-equation is derivable,
// and it must not be assumed as rewrite/conversion rule
constant symbol associativity_con_metatheorem : Π [A B I : cat] [R : mod A B] [x : func I A] [y : func I B],
Π [J1] [G : func J1 B] [y'y : func I J1] (y'y_ : hom Id_func (Unit_mod y G) y'y) ,
Π (s : hom x R y),
Π [K0] [F' : func K0 A] [x''x' : func I K0] (x''x'_ : hom x''x' (Unit_mod F' x) Id_func) ,
τ (( (( x''x'_ '∘ ( (F')_'∘> s) ) ∘>'_(G)) ∘' y'y_ )
= (x''x'_ '∘ ((F')_'∘> ( (s ∘>'_(G)) ∘' y'y_ ))));
/*****************************************
* # PRODUCT CATEGORY
******************************************/
injective symbol Product_cat : Π (U : cat) (A : cat), cat;
symbol Product_projL_func : Π [A1 A2 B: cat], func B (Product_cat A1 A2) → func B A1 ;
symbol Product_projR_func : Π [A1 A2 B: cat], func B (Product_cat A1 A2) → func B A2 ;
injective symbol Product_pair_func : Π [A1 A2 I : cat] (F : func I A1) (G : func I A2),
func I (Product_cat A1 A2);
// naturality
rule $H ∘> (Product_pair_func $F $G) ↪ (Product_pair_func ($H ∘> $F) ($H ∘> $G))
with $H ∘> (Product_projL_func $F) ↪ (Product_projL_func ($H ∘> $F))
with $H ∘> (Product_projR_func $F) ↪ (Product_projR_func ($H ∘> $F));
// beta
rule (Product_projL_func (Product_pair_func $F $G)) ↪ $F
with (Product_projR_func (Product_pair_func $F $G)) ↪ $G;
// eta
rule Product_pair_func (Product_projL_func $F) (Product_projR_func $F) ↪ $F;
// convenient shortcuts
rule Product_cat Terminal_cat $A ↪ $A
with Product_cat $A Terminal_cat ↪ $A;
rule @Product_projL_func Terminal_cat $A _ $F ↪ Terminal_func _
with @Product_projR_func Terminal_cat $A _ $F ↪ $F
with @Product_pair_func Terminal_cat $A _ $F $G ↪ $G
with @Product_projL_func $A Terminal_cat _ $F ↪ $F
with @Product_projR_func $A Terminal_cat _ $F ↪ Terminal_func _
with @Product_pair_func $A Terminal_cat _ $F $G ↪ $F;
//TODO: REVIEW: IS SIMPLIFIED VERSION WITHOUT EXTRA INNER PARAMS N1 N2 ENOUGH ?
// see Product_pair_cov_hom_simple version below
injective symbol Product_pair_cov_hom : Π [A1 A2 I : cat] [J] [F' : func J A1] [G' : func J A2] [K] (X : func I K) [K'1] (M1 : func K K'1) [N1 : func K'1 A1] [K'2] (M2 : func K K'2) [N2 : func K'2 A2] (Y : func I J) ,
hom (X ∘> M1) (Unit_mod N1 F') Y →
hom (X ∘> M2) (Unit_mod N2 G') Y →
hom X (Unit_mod (Product_pair_func (M1 ∘> N1) (M2 ∘> N2)) (Product_pair_func F' G')) Y;
rule (Func_cov_hom (Product_projL_func Id_func) _ ) ∘>'_(_) ∘' (Product_pair_cov_hom $X $M1 $M2 $Y $h1 $h2) ↪ ((Id_hom _) ∘>'_(_)) ∘' $h1;
rule (Func_cov_hom (Product_projR_func Id_func) _ ) ∘>'_(_) ∘' (Product_pair_cov_hom $X $M1 $M2 $Y $h1 $h2) ↪ ((Id_hom _) ∘>'_(_)) ∘' $h2;
injective symbol Product_pair_con_hom : Π [A1 A2 I : cat] [J] [F' : func J A1] [G' : func J A2] [K] (X : func I K) [K'1] (M1 : func K K'1) [N1 : func K'1 A1] [K'2] (M2 : func K K'2) [N2 : func K'2 A2] (Y : func I J) ,
hom Y (Unit_mod F' N1) (X ∘> M1) →
hom Y (Unit_mod G' N2) (X ∘> M2) →
hom Y (Unit_mod (Product_pair_func F' G') (Product_pair_func (M1 ∘> N1) (M2 ∘> N2))) X;
rule (Product_pair_con_hom $X $M1 $M2 $Y $h1 $h2) '∘ (_)_'∘> (Func_con_hom (Product_projL_func Id_func) _ ) ↪ $h1 '∘ ((_)_'∘> (Id_hom _));
rule (Product_pair_con_hom $X $M1 $M2 $Y $h1 $h2) '∘ (_)_'∘> (Func_con_hom (Product_projR_func Id_func) _ ) ↪ $h2 '∘ ((_)_'∘> (Id_hom _));
injective symbol Product_pair_cov_hom_simple : Π [A1 A2 I : cat] [J] [F' : func J A1] [G' : func J A2] [X : func I _] [X'] [Y : func I J] ,
hom X (Unit_mod Id_func F') Y →
hom X' (Unit_mod Id_func G') Y →
hom (Product_pair_func X X') (Unit_mod Id_func (Product_pair_func F' G')) Y
≔ begin
assume A1 A2 I J F' G' X X' Y h1 h2;
refine (@Product_pair_cov_hom _ _ _ _ _ _ _ _ _ (Product_projL_func Id_func) Id_func _ (Product_projR_func Id_func) Id_func _ h1 h2);
end ;
/* -----
* ## ADDITIONAL DEFINABLE SYMBOLS*/
// (definable) operaton used in carterSolution15.lp for 1+2=3
// not really optional symbol, because injective keyword...
injective symbol Product_mapR_func : Π (A : cat) [B B' : cat] (F : func B B'), func (Product_cat A B) (Product_cat A B');
rule Product_mapR_func $A $G ↪ Product_pair_func (Product_projL_func Id_func) (Product_projR_func Id_func ∘> $G);
// DO NOT ERASE, FOR REFERENCE.
// THESE RULES ARE DERIVABLE:
assert (A : cat) [B B' : cat] (F : func B B') B'' (F' : func B' B'') ⊢
(Product_mapR_func A F) ∘> (Product_mapR_func A F') ≡ (Product_mapR_func A (F ∘> F'));
assert (A : cat) [B : cat] ⊢
(Product_mapR_func A (@Id_func B)) ≡ Id_func;
// rule (Product_mapR_func $A $F) ∘> (Product_mapR_func $A $G)
// ↪ (Product_mapR_func $A ($F ∘> $G))
// with (Product_mapR_func $A Id_func) ↪ Id_func ;
// DO NOT ERASE, FOR REFERENCE.
// THESE RULES ARE DERIVABLE:
assert (A : cat) [B B' : cat] (F : func B B') ⊢
(Product_projL_func (Product_mapR_func A F) ) ≡ (Product_projL_func Id_func);
assert [A1 A2 I : cat] (F : func I A1) (G : func I A2) A2' (K : func A2 A2') ⊢
Product_pair_func F G ∘> (Product_mapR_func _ K) ≡ Product_pair_func F (G ∘> K);
// rule (Product_projL_func (Product_mapR_func $A $F) ) ↪ (Product_projL_func Id_func);
// rule (Product_projR_func (Product_mapR_func $A $F)) ↪ (Product_projR_func Id_func) ∘> $F;
// rule (@Product_pair_func _ _ _ $F $G) ∘> (@Product_mapR_func _ _ _ $K) ↪ (@Product_pair_func _ _ _ $F ($G ∘> $K));
// injective symbol Product_pair_cov_hom_simple : Π [A1 A2 I : cat] [J] [F' : func J A1] [G' : func J A2] [K] (X : func I K) (M1 : func K A1) (M2 : func K A2) (Y : func I J) ,
// hom (X ∘> M1) (Unit_mod Id_func F') Y →
// hom (X ∘> M2) (Unit_mod Id_func G') Y →
// hom X (Unit_mod (Product_pair_func (M1 ) (M2 )) (Product_pair_func F' G')) Y
// ≔ begin ;
injective symbol Product_mapR_con_hom [A1 A2 I : cat] [G : func I A2] /* [J] */ [G' : func I A2] /* [Y] */
(h : hom G (Unit_mod Id_func G') Id_func) :
hom (Product_mapR_func A1 G) (Unit_mod Id_func (Product_mapR_func A1 G')) Id_func
≔ begin
assume A1 A2 I G G' h; simplify;
refine (Product_pair_cov_hom_simple
(Func_cov_hom (Product_projL_func Id_func) Id_func)
(h ∘>'_(_) ∘' (Func_cov_hom (Product_projR_func Id_func) Id_func)));
end;
// DO NOT ERASE, FOR REFERENCE.
// RULE IS DERIVABLE:
assert [A1 A2 I : cat] [G : func I A2] /* [J] */ [G' : func I A2] /* [Y] */
(h : hom G (Unit_mod Id_func G') Id_func) ⊢
(Func_cov_hom (Product_projR_func Id_func) _ ) ∘>'_(_) ∘' (Product_mapR_con_hom h )
≡ (h ∘>'_ Product_projR_func Id_func) ∘' Func_cov_hom (Product_projR_func Id_func) Id_func;
// rule (Func_cov_hom (Product_projR_func Id_func) _ ) ∘>'_(_) ∘' (Product_mapR_con_hom $h )
// ↪ $h ∘>'_(_) ∘' (Func_cov_hom (Product_projR_func Id_func) _ ) ;
// rule (Func_cov_hom (Product_projL_func Id_func) _ ) ∘>'_(_) ∘' (Product_mapR_con_hom $h )
// ↪ (Func_cov_hom (Product_projL_func Id_func) _ ) ;
/*****************************************
* # PRODUCT CATEGORY AS A TRIVIAL ISOFIBRATION
******************************************/
injective symbol Trivial_catd : Π (U : cat) (A : cat), catd U;
rule Trivial_catd $U Terminal_cat ↪ Terminal_catd _;
constant symbol Trivial_intro_funcd : Π [U A V : cat] (F : func V U) (G : func V A),
funcd (Terminal_catd V) F (Trivial_catd U A);
constant symbol Trivial_base_funcd : Π [U A V : cat] (Z : func U V),
funcd (Trivial_catd U A) Z (Trivial_catd V A);