-
Notifications
You must be signed in to change notification settings - Fork 0
/
cartierSolution1.v
1411 lines (1102 loc) · 52.4 KB
/
cartierSolution1.v
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
(** # #
#+TITLE: cartierSolution1.v
Proph
https://gitlab.com/1337777/cartier/blob/master/cartierSolution1.v
shows the general outline of the solutions to some question of CARTIER which is how to program « geometric homotopic parametrization modos » ...
The outline is along two examples : the comonad cut-elimination and the adjunction cut-elimination , both formulated in the common style of the pairing-projections cancellation for the cartesian-product .
OUTLINE ::
* Generating objects and generating morphisms
* Grammatical presentation of the objects
* Grammatical presentation of the morphisms
* Grammatical presentation of the conversions
* Linear total/asymptotic grade and the degradation lemma
* Solution morphisms
+ Solution morphisms without composition
+ Cases-refinement of morphisms with inner-instantiation of the domain object-index
* Composition/cut-elimination into polymorphic soiution by computational/total/asymptotic/reduction/(multi-step) resolution using conversions
-----
PART 1 : COMONAD (NON-IDEMPOTENT)
* Generating objects and generating morphisms
#+BEGIN_SRC coq :exports both :results silent # # **)
Require Import ssreflect ssrfun ssrbool.
Require Lia.
Module COMONAD. (** non-idempotent comonad *)
Set Implicit Arguments. Unset Strict Implicit. Unset Printing Implicit Defensive.
Set Primitive Projections.
Declare Scope poly_scope. Delimit Scope poly_scope with poly. Open Scope poly.
Module Mole.
Parameter obMod_Gen : Type.
Parameter morMod_Gen : forall F F' : obMod_Gen, Type.
Inductive obMod : Type :=
| ObMod_Gen : obMod_Gen -> obMod .
Reserved Notation "''Mod' ( F ~> F' )" (at level 0).
Section Section1.
Delimit Scope mole_scope with mole.
Inductive morMod : forall F F' : obMod, Type :=
| Composition : forall F F' : obMod, 'Mod( F ~> F' ) ->
forall F'' : obMod, 'Mod( F' ~> F'' ) -> 'Mod( F ~> F'' )
| MorMod_Gen : forall F F' : obMod_Gen, @morMod_Gen F F' ->
'Mod( ObMod_Gen F ~> ObMod_Gen F' )
where "''Mod' ( F ~> F' )" := (@morMod F F') : mole_scope.
End Section1.
Module Import Ex_Notations.
Delimit Scope mole_scope with mole.
Notation "''Mod' ( F ~> F' )" := (@morMod F F') : mole_scope.
Notation "ff_ o> ff'" := (@Composition _ _ ff_ _ ff')
(at level 40 , ff' at next level , left associativity) : mole_scope.
End Ex_Notations.
End Mole.
(** # #
#+END_SRC
* Grammatical presentation of the objects
#+BEGIN_SRC coq :exports both :results silent # # **)
Import Mole.Ex_Notations.
Inductive obMod : Type :=
ConstantOfProduct : obMod -> obMod
| ObMod_Mole : Mole.obMod -> obMod.
(** # #
#+END_SRC
* Grammatical presentation of the morphisms
#+BEGIN_SRC coq :exports both :results silent # # **)
Reserved Notation "''Mod' ( F ~> F' )" (at level 0).
Inductive morMod : forall F F' : obMod, Type :=
| Composition : forall F F' : obMod, 'Mod( F ~> F' ) -> forall F'' : obMod, 'Mod( F' ~> F'' ) -> 'Mod( F ~> F'' )
| Unit : forall F : obMod, 'Mod( F ~> F )
| Projections_PolyPost : forall F F' : obMod, 'Mod( F ~> F' ) -> 'Mod( ConstantOfProduct F ~> F' )
| ConstantOfPairing_aka_ReverseOfProjections_PolyPre :
forall F F' : obMod, 'Mod( ConstantOfProduct F ~> F' ) -> 'Mod( ConstantOfProduct F ~> ConstantOfProduct F' )
| MorMod_Mole : forall F F' : Mole.obMod,
'Mod( F ~> F' ) %mole -> 'Mod( ObMod_Mole F ~> ObMod_Mole F' )
where "''Mod' ( F ~> F' )" := (@morMod F F') : poly_scope.
Notation "ff_ o> ff'" := (@Composition _ _ ff_ _ ff')
(at level 40 , ff' at next level , left associativity) : poly_scope.
Notation "@ ''Unit' F" := (@Unit F)
(at level 10, F at next level, only parsing) : poly_scope.
Notation "''Unit'" := (@Unit _) (at level 0) : poly_scope.
Notation "''Projections' o> ff" :=
(@Projections_PolyPost _ _ ff) (at level 10, ff at next level) : poly_scope.
Notation "ff o> 'Pairing" :=
(@ConstantOfPairing_aka_ReverseOfProjections_PolyPre _ _ ff) (at level 4, right associativity) : poly_scope.
Notation "''MorMod_Mole' ff" :=
(@MorMod_Mole _ _ ff) (at level 10, ff at next level) : poly_scope.
(** # #
#+END_SRC
* Grammatical presentation of the conversions
#+BEGIN_SRC coq :exports both :results silent # # **)
Reserved Notation "ff' <~~ ff" (at level 70).
Inductive convMod : forall (F F' : obMod), 'Mod( F ~> F' ) -> 'Mod( F ~> F' ) -> Prop :=
(** ----- the total/(multi-step) conversions ----- **)
| convMod_Refl : forall (F F' : obMod), forall ff : 'Mod( F ~> F' ),
ff <~~ ff
| convMod_Trans : forall (F F' : obMod), forall ff ff0 ff_trans : 'Mod( F ~> F' ),
ff_trans <~~ ff -> ff0 <~~ ff_trans -> ff0 <~~ ff
(** ----- the congruences (recursive) conversions for morphisms ----- **)
| Composition_cong : forall F F' : obMod, forall ff ff0 : 'Mod( F ~> F' ), forall F'' : obMod, forall ff' ff'0 : 'Mod( F' ~> F'' ),
ff0 <~~ ff -> ff'0 <~~ ff' ->
( ff0 o> ff'0 ) <~~ ( ff o> ff' )
| Projections_PolyPost_cong : forall F F' : obMod, forall ff ff0 : 'Mod( F ~> F' ),
( ff0 ) <~~ ( ff ) ->
( 'Projections o> ff0 ) <~~ ( 'Projections o> ff )
| ConstantOfPairing_aka_ReverseOfProjections_PolyPre_cong :
forall F F' : obMod, forall ff ff0 : 'Mod( ConstantOfProduct F ~> F' ),
( ff0 ) <~~ ( ff ) ->
( ff0 o> 'Pairing ) <~~ ( ff o> 'Pairing )
(** ----- the constant conversions which are used during the polymorphism elimination -----
This polymorphism elimination proceeds by :
- firstly destructing the pre/left/input argument of the composition ,
- lastly destructing the post/right/operator argument of the composition .
The precedence is better for describing this non-idempotent comonad . *)
| Unit_comp_morMod : forall F F' : obMod, forall ff : 'Mod( F ~> F' ),
( ff ) <~~ ( 'Unit o> ff )
| Projections_PolyPost_comp_morMod : forall F F' : obMod, forall ff : 'Mod( F ~> F' ),
forall F'' : obMod , forall ff' : 'Mod( F' ~> F'' ),
( 'Projections o> ( ff o> ff' ) )
<~~ ( ( 'Projections o> ff ) o> ff' )
| morMod_comp_Unit :
forall F F' : obMod, forall ff : 'Mod( F ~> F' ),
( ff ) <~~ ( ff o> 'Unit )
| ConstantOfPairing_aka_ReverseOfProjections_comp_PolyPre_Projections_PolyPost :
forall F F' : obMod, forall ff : 'Mod( ConstantOfProduct F ~> F' ), forall F'' : obMod, forall ff' : 'Mod( F' ~> F'' ),
( ff o> ff' )
<~~ ( ( ff o> 'Pairing ) o> ( 'Projections o> ff' ) )
(** memo: the prefix morphism is not of general form , but is of the form of the form
[ConstantOfPairing_aka_ReverseOfProjections_PolyPre] because otherwise the sense is idempotent comonad ,
which produces some preorder *)
| ConstantOfPairing_aka_ReverseOfProjections_PolyPre_comp_ConstantOfPairing_aka_ReverseOfProjections_PolyPre :
forall F F' : obMod, forall ff : 'Mod( ConstantOfProduct F ~> F' ),
forall F'' : obMod, forall ff' : 'Mod( ConstantOfProduct F' ~> F'' ),
( ( ( ff o> 'Pairing ) o> ff' ) o> 'Pairing )
<~~ ( ( ff o> 'Pairing ) o> ( ff' o> 'Pairing ) )
| MorMod_Mole_comp_MorMod_Mole : forall F F' : Mole.obMod, forall ff : 'Mod( F ~> F' ) %mole, forall F'' : Mole.obMod, forall ff' : 'Mod( F' ~> F'' ) %mole,
( MorMod_Mole (ff o> ff')%mole )
<~~ ( ( MorMod_Mole ff ) o> ( MorMod_Mole ff' ) )
(** ----- the constant conversions which are not for polymorphism elimination
but are only for the wanted sense of extensionality for comonad ----- **)
| ConstantOfPairing_aka_ReverseOfProjections_subst_PolyPre_Projections_PolyPost :
forall F : obMod,
( @'Unit ( ConstantOfProduct F ) )
<~~ ( ( 'Projections o> ( @'Unit F ) ) o> 'Pairing )
where "ff' <~~ ff" := (@convMod _ _ ff ff').
Hint Constructors convMod : core.
(** # #
#+END_SRC
* Linear total/asymptotic grade and the degradation lemma
#+BEGIN_SRC coq :exports both :results silent # # **)
Arguments Nat.add : simpl nomatch.
Definition grade :
forall F F' : obMod, forall ff : 'Mod( F ~> F' ), nat .
Proof.
intros F F' ff. elim: F F' / ff.
- (**) intros F F' ff grade_ff F'' ff' grade_ff' .
exact: ( 2 * (S (grade_ff + grade_ff')%nat ) )%nat .
- intros F.
exact: (S O).
- intros F F' ff grade_ff.
exact: (S grade_ff).
- intros F F' ff grade_ff.
exact: (S grade_ff).
- intros F F' ff.
exact: (S O).
Defined.
Arguments grade : simpl nomatch.
Lemma grade_gt0 :
forall F F' : obMod, forall ff : 'Mod( F ~> F' ),
((S O) <= (grade ff))%nat .
Proof.
intros F F' ff. elim: F F' / ff ;
simpl; intros; abstract Lia.lia.
Qed.
Ltac tac_grade_gt0 :=
match goal with
| [ gg1 : 'Mod( _ ~> _ ) ,
gg2 : 'Mod( _ ~> _ ) ,
gg3 : 'Mod( _ ~> _ ) ,
gg4 : 'Mod( _ ~> _ ) |- _ ] =>
move : (@grade_gt0 _ _ gg1) (@grade_gt0 _ _ gg2)
(@grade_gt0 _ _ gg3)
(@grade_gt0 _ _ gg4)
| [ gg1 : 'Mod( _ ~> _ ) ,
gg2 : 'Mod( _ ~> _ ) ,
gg3 : 'Mod( _ ~> _ ) |- _ ] =>
move : (@grade_gt0 _ _ gg1) (@grade_gt0 _ _ gg2)
(@grade_gt0 _ _ gg3)
| [ gg1 : 'Mod( _ ~> _ ) ,
gg2 : 'Mod( _ ~> _ ) |- _ ] =>
move : (@grade_gt0 _ _ gg1) (@grade_gt0 _ _ gg2)
| [ gg1 : 'Mod( _ ~> _ ) |- _ ] =>
move : (@grade_gt0 _ _ gg1)
end.
Lemma degrade :
forall F F' : obMod, forall ff ff0 : 'Mod( F ~> F' ),
ff0 <~~ ff -> ( grade ff0 <= grade ff )%nat .
Proof.
intros F F' ff ff0 convMod_ff0_ff .
Time elim: F F' ff ff0 / convMod_ff0_ff;
try solve [simpl; try tac_grade_gt0;
simpl; intros; abstract Lia.lia].
(* "Finished transaction in 0.258 secs (0.258u,0.s) (successful)" *)
Qed.
(** # #
#+END_SRC
* Solution morphisms
** Solution morphisms without composition
#+BEGIN_SRC coq :exports both :results silent # # **)
Module Sol.
Section Section1.
Declare Scope sol_scope. Delimit Scope sol_scope with sol.
Inductive morMod : forall F F' : obMod, Type :=
| Unit : forall F : obMod, 'Mod( F ~> F )
| Projections_PolyPost : forall F F' : obMod, 'Mod( F ~> F' ) -> 'Mod( ConstantOfProduct F ~> F' )
| ConstantOfPairing_aka_ReverseOfProjections_PolyPre :
forall F F' : obMod, 'Mod( ConstantOfProduct F ~> F' ) -> 'Mod( ConstantOfProduct F ~> ConstantOfProduct F' )
| MorMod_Mole : forall F F' : Mole.obMod,
'Mod( F ~> F' ) %mole -> 'Mod( ObMod_Mole F ~> ObMod_Mole F' )
where "''Mod' ( F ~> F' )" := (@morMod F F') : sol_scope.
End Section1.
Module Export Ex_Notations.
Declare Scope sol_scope. Delimit Scope sol_scope with sol.
Notation "''Mod' ( F ~> F' )" := (@morMod F F') : sol_scope.
Notation "@ ''Unit' F" := (@Unit F)
(at level 10, F at next level, only parsing) : sol_scope.
Notation "''Unit'" := (@Unit _) (at level 0) : sol_scope.
Notation "''Projections' o> ff" :=
(@Projections_PolyPost _ _ ff) (at level 10, ff at next level) : sol_scope.
Notation "ff o> 'Pairing" :=
(@ConstantOfPairing_aka_ReverseOfProjections_PolyPre _ _ ff) (at level 4, right associativity) : sol_scope.
Notation "''MorMod_Mole' ff" :=
(@MorMod_Mole _ _ ff) (at level 10, ff at next level) : sol_scope.
End Ex_Notations.
Definition toPolyMor :
forall F F' : obMod, 'Mod( F ~> F' )%sol -> 'Mod( F ~> F' )%poly .
Proof.
intros F F' ff . elim: F F' / ff.
- (** Unit *) intros F .
exact: ( @'Unit F ) %poly.
- (** Projections_PolyPost *)
intros F F' ff toPolyMor_ff .
exact: ( 'Projections o> toPolyMor_ff ) %poly.
- (** ConstantOfPairing_aka_ReverseOfProjections_PolyPre *)
intros F F' ff toPolyMor_ff .
exact: ( toPolyMor_ff o> 'Pairing ) %poly.
- (** MorMod_Mole **) intros F F' ff.
exact: ( 'MorMod_Mole ff )%poly.
Defined.
Arguments toPolyMor : simpl nomatch.
(** # #
#+END_SRC
** Cases-refinement of morphisms with inner-instantiation of the domain object-index
#+BEGIN_SRC coq :exports both :results silent # # **)
Module MorMod_domConstantOfProduct.
Inductive morMod
: forall F F' : obMod, 'Mod( ConstantOfProduct F ~> F' )%sol -> Type :=
| Unit : forall F : obMod,
morMod ( @'Unit (ConstantOfProduct F) )%sol
| Projections_PolyPost : forall F F' : obMod, forall ff : 'Mod( F ~> F' )%sol,
morMod ( 'Projections o> ff )%sol
| ConstantOfPairing_aka_ReverseOfProjections_PolyPre :
forall F F' : obMod, forall ff : 'Mod( ConstantOfProduct F ~> F' )%sol,
morMod ( ff o> 'Pairing )%sol.
End MorMod_domConstantOfProduct.
Module MorMod_domObMod_Mole.
Inductive morMod
: forall (F : Mole.obMod) (F' : obMod), 'Mod( ObMod_Mole F ~> F' )%sol -> Type :=
| Unit : forall F : Mole.obMod,
morMod ( @'Unit (ObMod_Mole F) )%sol
| MorMod_Mole : forall F F' : Mole.obMod,
forall ff : 'Mod( F ~> F' ) %mole,
morMod ( 'MorMod_Mole ff )%sol.
End MorMod_domObMod_Mole.
Lemma morMod_domP
: forall F F' : obMod, forall ff : 'Mod( F ~> F' )%sol,
ltac:( destruct F; [ refine (MorMod_domConstantOfProduct.morMod ff)
| refine (MorMod_domObMod_Mole.morMod ff) ] ).
Proof.
intros. destruct ff.
- destruct F; [ constructor 1 | constructor 1].
- constructor 2.
- constructor 3.
- constructor 2.
Defined.
End Sol.
(** # #
#+END_SRC
* Composition/cut-elimination into polymorphic soiution by computational/total/asymptotic/reduction/(multi-step) resolution using conversions
#+BEGIN_SRC coq :exports both :results silent # # **)
Module Resolve.
Export Sol.Ex_Notations.
Ltac tac_degrade H_grade :=
intuition idtac;
repeat match goal with
| [ Hred : ( _ <~~ _ )%poly |- _ ] =>
move : (degrade Hred) ; clear Hred
end;
move: H_grade; clear; simpl;
intros; try tac_grade_gt0; intros; Lia.lia.
Ltac tac_simpl := simpl.
Ltac tac_reduce := tac_simpl; repeat (intro; tac_simpl); intuition eauto 9.
Fixpoint solveMod len {struct len} :
forall F F' : obMod, forall ff : 'Mod( F ~> F' ), forall grade_ff : (grade ff <= len)%nat,
{ ffSol : 'Mod( F ~> F' )%sol | (Sol.toPolyMor ffSol) <~~ ff } .
Proof.
case : len => [ | len ].
(** len is O **)
- intros F F' ff grade_ff; exfalso;
clear - grade_ff; abstract tac_degrade grade_ff.
(** len is (S len) **)
- intros F F' ff. case : F F' / ff;
[ intros F F' ff F'' ff' grade_ff
| intros F grade_ff
| intros F F' ff grade_ff
| intros F F' ff grade_ff
| intros F F' ff grade_ff ].
(** ff is (ff o> ff') *) all: cycle 1.
(** ff is (@'Unit F) **)
+ unshelve eexists. refine ( @'Unit F )%sol.
clear; abstract tac_reduce.
(** ff is ('Projections o> ff) **)
+ have [:blurb] ffSol_transp :=
(proj2_sig (solveMod len _ _ ff blurb));
first by clear -grade_ff; abstract tac_degrade grade_ff.
move: (sval (solveMod len _ _ ff blurb)) ffSol_transp => ffSol ffSol_transp .
clear solveMod.
unshelve eexists. refine ( 'Projections o> ffSol )%sol.
move: ffSol_transp; clear; abstract tac_reduce.
(** ff is (ff o> 'Pairing) **)
+ have [:blurb] ffSol_transp :=
(proj2_sig (solveMod len _ _ ff blurb));
first by clear -grade_ff; abstract tac_degrade grade_ff.
move: (sval (solveMod len _ _ ff blurb)) ffSol_transp => ffSol ffSol_transp .
clear solveMod.
unshelve eexists. refine ( ffSol o> 'Pairing )%sol.
move: ffSol_transp; clear; abstract tac_reduce.
(** ff is ('MorMod_Mole ff) **)
+ unshelve eexists. refine ( 'MorMod_Mole ff )%sol.
clear; abstract tac_reduce.
(** ff is (ff o> ff') **)
+ have [:blurb] ffSol_transp :=
(proj2_sig (solveMod len _ _ ff blurb));
first by clear -grade_ff; abstract tac_degrade grade_ff.
move: (sval (solveMod len _ _ ff blurb)) ffSol_transp => ffSol ffSol_transp .
have [:blurb] ff'Sol_transp :=
(proj2_sig (solveMod len _ _ ff' blurb));
first by clear -grade_ff; abstract tac_degrade grade_ff.
move: (sval (solveMod len _ _ ff' blurb)) ff'Sol_transp => ff'Sol ff'Sol_transp .
(** ff is (ff o> ff') , to (ffSol o> ff'Sol) **)
destruct ffSol as
[ F
| F F' ffSol
| F F' ffSol
| F F' ffSol ].
(** ff is (ff o> ff') , to (ffSol o> ff'Sol) ,
is ((@'Unit F) o> ff'Sol) **)
* unshelve eexists. refine (ff'Sol)%sol.
move:ffSol_transp ff'Sol_transp; clear;
abstract (tac_simpl; intros; eapply convMod_Trans with
(ff_trans := ('Unit) o> ff'); tac_reduce).
(** ff is (ff o> ff') , to (ffSol o> ff'Sol) ,
is ( ('Projections o> ffSol) o> ff'Sol **)
* have [:blurb] ffSol_o_ff'Sol_transp :=
(proj2_sig (solveMod len _ _ (Sol.toPolyMor ffSol o> Sol.toPolyMor ff'Sol) blurb));
first by clear -grade_ff ffSol_transp ff'Sol_transp; abstract tac_degrade grade_ff.
move: (sval (solveMod len _ _ (Sol.toPolyMor ffSol o> Sol.toPolyMor ff'Sol) blurb)) ffSol_o_ff'Sol_transp
=> ffSol_o_ff'Sol ffSol_o_ff'Sol_transp .
clear solveMod .
unshelve eexists.
refine ( 'Projections o> ffSol_o_ff'Sol )%sol.
move: ffSol_transp ff'Sol_transp ffSol_o_ff'Sol_transp; clear;
abstract (tac_simpl; intros; eapply convMod_Trans with
(ff_trans := ( 'Projections o> (Sol.toPolyMor ffSol) ) o> ( Sol.toPolyMor ff'Sol )); tac_reduce).
(** ff is (ff o> ff') , to (ffSol o> ff'Sol) ,
is ( (ffSol o> 'Pairing) o> ff'Sol ) **)
* move: (Sol.morMod_domP ff'Sol) => ff'Sol_morMod_domP.
{ destruct ff'Sol_morMod_domP as
[ _F
| _F F' ff'Sol
| _F F' ff'Sol ].
(** ff is (ff o> ff') , to (ffSol o> ff'Sol) ,
is ( (ffSol o> 'Pairing) o> ('Unit) ) **)
- unshelve eexists. refine (ffSol o> 'Pairing)%sol.
move: ffSol_transp ff'Sol_transp; clear;
abstract (tac_simpl; intros; eapply convMod_Trans with
(ff_trans := ( (Sol.toPolyMor ffSol) o> 'Pairing) o> ('Unit)); tac_reduce).
(** ff is (ff o> ff') , to (ffSol o> ff'Sol) ,
is ( (ffSol o> 'Pairing) o> ('Projections o> ff'Sol) ) **)
- have [:blurb] ffSol_o_ff'Sol_transp :=
(proj2_sig (solveMod len _ _ (Sol.toPolyMor ffSol o> Sol.toPolyMor ff'Sol) blurb));
first by clear -grade_ff ffSol_transp ff'Sol_transp; abstract tac_degrade grade_ff.
move: (sval (solveMod len _ _ (Sol.toPolyMor ffSol o> Sol.toPolyMor ff'Sol) blurb)) ffSol_o_ff'Sol_transp
=> ffSol_o_ff'Sol ffSol_o_ff'Sol_transp .
clear solveMod .
unshelve eexists.
refine ( ffSol_o_ff'Sol )%sol.
move: ffSol_transp ff'Sol_transp ffSol_o_ff'Sol_transp; clear;
abstract (tac_simpl; intros; eapply convMod_Trans with
(ff_trans := ((Sol.toPolyMor ffSol) o> 'Pairing) o> ('Projections o> (Sol.toPolyMor ff'Sol))); tac_reduce).
(** ff is (ff o> ff') , to (ffSol o> ff'Sol) ,
is ( (ffSol o> 'Pairing) o> (ff'Sol o> 'Pairing) ) **)
- pose Sol_toPolyMor_ffSol := ( (Sol.toPolyMor ffSol) o> 'Pairing ).
have [:blurb] ffSol_o_ff'Sol_transp :=
(proj2_sig (solveMod len _ _ (Sol_toPolyMor_ffSol o> (Sol.toPolyMor ff'Sol)) blurb));
first by clear -grade_ff ffSol_transp ff'Sol_transp; abstract tac_degrade grade_ff.
move: (sval (solveMod len _ _ (Sol_toPolyMor_ffSol o> (Sol.toPolyMor ff'Sol)) blurb)) ffSol_o_ff'Sol_transp
=> ffSol_o_ff'Sol ffSol_o_ff'Sol_transp .
clear solveMod .
unshelve eexists.
refine ( ffSol_o_ff'Sol o> 'Pairing )%sol.
move: ffSol_transp ff'Sol_transp ffSol_o_ff'Sol_transp; clear;
abstract (tac_simpl; intros; eapply convMod_Trans with
(ff_trans := Sol_toPolyMor_ffSol o> ((Sol.toPolyMor ff'Sol) o> 'Pairing));
subst Sol_toPolyMor_ffSol; tac_reduce).
}
(** ff is (ff o> ff') , to (ffSol o> ff'Sol) ,
is ( ('MorMod_Mole ffSol) o> ff'Sol ) **)
* move: (Sol.morMod_domP ff'Sol) => ff'Sol_morMod_domP.
{ destruct ff'Sol_morMod_domP as
[ _F
| _F F' ff'Sol ].
(** ff is (ff o> ff') , to (ffSol o> ff'Sol) ,
is ( ('MorMod_Mole ffSol) o> ('Unit) ) **)
- unshelve eexists. refine ( 'MorMod_Mole ffSol )%sol.
move: ffSol_transp ff'Sol_transp; clear;
abstract (tac_simpl; intros; eapply convMod_Trans with
(ff_trans := ( 'MorMod_Mole ffSol ) o> ('Unit)); tac_reduce).
(** ff is (ff o> ff') , to (ffSol o> ff'Sol) ,
is ( ('MorMod_Mole ffSol) o> ('MorMod_Mole ff'Sol) ) **)
- unshelve eexists. refine ( 'MorMod_Mole (ffSol o> ff'Sol)%mole )%sol.
move: ffSol_transp ff'Sol_transp; clear;
abstract (tac_simpl; intros; eapply convMod_Trans with
(ff_trans := ( 'MorMod_Mole ffSol ) o> ( 'MorMod_Mole ff'Sol )); tac_reduce).
}
Defined.
End Resolve.
End COMONAD.
(** # #
#+END_SRC
-----
PART 2 : ADJUNCTION
* Generating objects and generating morphisms
#+BEGIN_SRC coq :exports both :results silent # # **)
Module ADJUNCTION.
Set Implicit Arguments. Unset Strict Implicit. Unset Printing Implicit Defensive.
Set Primitive Projections.
Declare Scope poly_scope. Delimit Scope poly_scope with poly. Open Scope poly.
Module Mole.
Parameter obMod_Gen : Type.
Parameter morMod_Gen : forall F F' : obMod_Gen, Type.
Parameter obCoMod_Gen : Type.
Parameter morCoMod_Gen : forall S S' : obCoMod_Gen, Type.
Inductive obMod : Type :=
| ObMod_Gen : obMod_Gen -> obMod.
Inductive obCoMod : Type :=
| ObCoMod_Gen : obCoMod_Gen -> obCoMod.
Reserved Notation "''Mod' ( F ~> F' )" (at level 0).
Reserved Notation "''CoMod' ( S ~> S' )" (at level 0).
Section Section1.
Delimit Scope mole_scope with mole.
Inductive morMod : forall F F' : obMod, Type :=
| CompositionMod : forall F F' : obMod, 'Mod( F ~> F' ) -> forall F'' : obMod, 'Mod( F' ~> F'' ) -> 'Mod( F ~> F'' )
| MorMod_Gen : forall F F' : obMod_Gen, @morMod_Gen F F' ->
'Mod( ObMod_Gen F ~> ObMod_Gen F' )
where "''Mod' ( F ~> F' )" := (@morMod F F') : mole_scope.
Inductive morCoMod : forall S S' : obCoMod, Type :=
| CompositionCoMod : forall S S' : obCoMod, 'CoMod( S ~> S' ) -> forall S'' : obCoMod, 'CoMod( S' ~> S'' ) -> 'CoMod( S ~> S'' )
| MorCoMod_Gen : forall S S' : obCoMod_Gen, @morCoMod_Gen S S' ->
'CoMod( ObCoMod_Gen S ~> ObCoMod_Gen S' )
where "''CoMod' ( S ~> S' )" := (@morCoMod S S') : mole_scope.
End Section1.
Module Import Ex_Notations.
Delimit Scope mole_scope with mole.
Notation "''Mod' ( F ~> F' )" := (@morMod F F') : mole_scope.
Notation "''CoMod' ( S ~> S' )" := (@morCoMod S S') : mole_scope.
Notation "ff o> ff'" := (@CompositionMod _ _ ff _ ff')
(at level 40 , ff' at next level , left associativity) : mole_scope.
Notation "s o>' s'" := (@CompositionCoMod _ _ s _ s')
(at level 40 , s' at next level , left associativity) : mole_scope.
End Ex_Notations.
End Mole.
(** # #
#+END_SRC
* Grammatical presentation of the objects
#+BEGIN_SRC coq :exports both :results silent # # **)
Import Mole.Ex_Notations.
Inductive obMod : Type :=
Constant : obCoMod -> obMod
| ObMod_Mole : Mole.obMod -> obMod
with obCoMod : Type :=
Product : obMod -> obCoMod
| ObCoMod_Mole : Mole.obCoMod -> obCoMod.
(** # #
#+END_SRC
* Grammatical presentation of the morphisms
#+BEGIN_SRC coq :exports both :results silent # # **)
Reserved Notation "''Mod' ( F ~> F' )" (at level 0).
Reserved Notation "''CoMod' ( S ~> S' )" (at level 0).
Inductive morMod : forall F F' : obMod, Type :=
| CompositionMod : forall F F' : obMod, 'Mod( F ~> F' ) -> forall F'' : obMod, 'Mod( F' ~> F'' ) -> 'Mod( F ~> F'' )
| UnitMod : forall F : obMod, 'Mod( F ~> F )
| Constant_PolyMor : forall S S' : obCoMod, 'CoMod( S ~> S' ) -> 'Mod( Constant S ~> Constant S' )
| Projections_PolyPost : forall F F' : obMod, 'Mod( F ~> F' ) -> 'Mod( Constant (Product F) ~> F' )
| MorMod_Mole : forall F F' : Mole.obMod,
'Mod( F ~> F' ) %mole -> 'Mod( ObMod_Mole F ~> ObMod_Mole F' )
where "''Mod' ( F ~> F' )" := (@morMod F F') : poly_scope
with morCoMod : forall S S' : obCoMod, Type :=
| CompositionCoMod : forall S S' : obCoMod, 'CoMod( S ~> S' ) -> forall S'' : obCoMod, 'CoMod( S' ~> S'' ) -> 'CoMod( S ~> S'' )
| UnitCoMod : forall S : obCoMod, 'CoMod( S ~> S )
| Pairing_aka_ReverseOfProjections_PolyPre :
forall S : obCoMod, forall F : obMod, 'Mod( Constant S ~> F ) -> 'CoMod( S ~> Product F )
| MorCoMod_Mole : forall S S' : Mole.obCoMod,
'CoMod( S ~> S' ) %mole -> 'CoMod( ObCoMod_Mole S ~> ObCoMod_Mole S' )
where "''CoMod' ( S ~> S' )" := (@morCoMod S S') : poly_scope.
Notation "ff o> ff'" := (@CompositionMod _ _ ff _ ff')
(at level 40 , ff' at next level , left associativity) : poly_scope.
Notation "@ ''UnitMod' F" := (@UnitMod F)
(at level 10, F at next level, only parsing) : poly_scope.
Notation "''UnitMod'" := (@UnitMod _) (at level 0) : poly_scope.
Notation "( s )o>>" :=
(@Constant_PolyMor _ _ s) (at level 0) : poly_scope.
Notation "''Projections' o> ff" :=
(@Projections_PolyPost _ _ ff) (at level 10, ff at next level) : poly_scope.
Notation "''MorMod_Mole' ff" :=
(@MorMod_Mole _ _ ff) (at level 10, ff at next level) : poly_scope.
Notation "s o>' s'" := (@CompositionCoMod _ _ s _ s')
(at level 40 , s' at next level , left associativity) : poly_scope.
Notation "@ ''UnitCoMod' S" := (@UnitCoMod S)
(at level 10, S at next level, only parsing) : poly_scope.
Notation "''UnitCoMod'" := (@UnitCoMod _) (at level 0) : poly_scope.
Notation "ff o>' 'Pairing" :=
(@Pairing_aka_ReverseOfProjections_PolyPre _ _ ff) (at level 4, right associativity) : poly_scope.
Notation "''MorCoMod_Mole' s" :=
(@MorCoMod_Mole _ _ s) (at level 10, s at next level) : poly_scope.
(** # #
#+END_SRC
* Grammatical presentation of the conversions
#+BEGIN_SRC coq :exports both :results silent # # **)
Reserved Notation "ff' <~~ ff" (at level 70).
Reserved Notation "s' <~~' s" (at level 70).
Inductive convMod : forall (F F' : obMod), 'Mod( F ~> F' ) -> 'Mod( F ~> F' ) -> Prop :=
(** ----- the total/(multi-step) conversions ----- **)
| convMod_Refl : forall (F F' : obMod), forall ff : 'Mod( F ~> F' ),
ff <~~ ff
| convMod_Trans : forall (F F' : obMod), forall ff ff0 ff_trans : 'Mod( F ~> F' ),
ff_trans <~~ ff -> ff0 <~~ ff_trans -> ff0 <~~ ff
(** ----- the congruences (recursive) conversions for morphisms ----- **)
| CompositionMod_cong : forall F F' : obMod, forall ff ff0 : 'Mod( F ~> F' ), forall F'' : obMod, forall ff' ff'0 : 'Mod( F' ~> F'' ),
ff0 <~~ ff -> ff'0 <~~ ff' ->
( ff0 o> ff'0 ) <~~ ( ff o> ff' )
| Constant_PolyMor_cong : forall S S' : obCoMod, forall s s0 : 'CoMod( S ~> S' ),
s0 <~~' s -> ( s0 )o>> <~~ ( s )o>>
| Projections_PolyPost_cong : forall F F' : obMod, forall ff ff0 : 'Mod( F ~> F' ),
( ff0 ) <~~ ( ff ) ->
( 'Projections o> ff0 ) <~~ ( 'Projections o> ff )
(** ----- the constant conversions which are used during the polymorphism elimination -----
This polymorphism elimination proceeds by :
- firstly destructing the pre/left/input argument of the composition ,
- lastly destructing the post/right/operator argument of the composition . *)
| UnitMod_comp_morMod : forall F F' : obMod, forall ff : 'Mod( F ~> F' ),
( ff ) <~~ ( 'UnitMod o> ff )
| morMod_comp_UnitMod : forall F F' : obMod, forall ff : 'Mod( F ~> F' ),
( ff ) <~~ ( ff o> 'UnitMod )
| Constant_PolyMor_comp_Constant_PolyMor : forall S S' : obCoMod, forall s : 'CoMod( S ~> S' ),
forall S'' : obCoMod, forall s' : 'CoMod( S' ~> S'' ),
( ( s o>' s' )o>> ) <~~ ( ( s )o>> o> ( s' )o>> )
| Constant_PolyMor_subst_UnitCoMod_comp_morMod : forall S : obCoMod, forall F : obMod, forall ff : 'Mod( Constant S ~> F ),
( ff ) <~~ ( ( @'UnitCoMod S )o>> o> ff )
| Constant_PolyMor_subst_Pairing_aka_ReverseOfProjections_PolyPre_comp_Projections_PolyPost :
forall S : obCoMod, forall F : obMod, forall ff : 'Mod( Constant S ~> F ), forall F' : obMod, forall ff' : 'Mod( F ~> F' ),
( ff o> ff' )
<~~ ( ( ff o>' 'Pairing )o>> o> ( 'Projections o> ff' ) )
| Projections_PolyPost_comp_morMod : forall F F' : obMod, forall ff : 'Mod( F ~> F' ),
forall F'' : obMod , forall ff' : 'Mod( F' ~> F'' ),
( 'Projections o> ( ff o> ff' ) )
<~~ ( ( 'Projections o> ff ) o> ff' )
| MorMod_Mole_comp_MorMod_Mole : forall F F' : Mole.obMod, forall ff : 'Mod( F ~> F' ) %mole, forall F'' : Mole.obMod, forall ff' : 'Mod( F' ~> F'' ) %mole,
( MorMod_Mole (ff o> ff')%mole )
<~~ ( ( MorMod_Mole ff ) o> ( MorMod_Mole ff' ) )
where "ff' <~~ ff" := (@convMod _ _ ff ff')
with convCoMod : forall (S S' : obCoMod), 'CoMod( S ~> S' ) -> 'CoMod( S ~> S' ) -> Prop :=
(** ----- the total/(multi-step) conversions ----- **)
| convCoMod_Refl : forall (S S' : obCoMod), forall s : 'CoMod( S ~> S' ),
s <~~' s
| convCoMod_Trans : forall (S S' : obCoMod), forall s s0 s_trans : 'CoMod( S ~> S' ),
s_trans <~~' s -> s0 <~~' s_trans -> s0 <~~' s
(** ----- the congruences (recursive) conversions for morphisms ----- **)
| CompositionCoMod_cong : forall S S' : obCoMod, forall s s0 : 'CoMod( S ~> S' ), forall S'' : obCoMod, forall s' s'0 : 'CoMod( S' ~> S'' ),
s0 <~~' s -> s'0 <~~' s' ->
( s0 o>' s'0 ) <~~' ( s o>' s' )
| Pairing_aka_ReverseOfProjections_PolyPre_cong :
forall S : obCoMod, forall F : obMod, forall ff ff0 : 'Mod( Constant S ~> F ),
( ff0 ) <~~ ( ff ) ->
( ff0 o>' 'Pairing ) <~~' ( ff o>' 'Pairing )
(** ----- the constant conversions which are used during the polymorphism elimination -----
This polymorphism elimination proceeds by :
- firstly destructing the post/right/operator argument of the composition ,
- lastly destructing the pre/left/input argument of the composition . *)
| morCoMod_comp_UnitCoMod :
forall S S' : obCoMod, forall s : 'CoMod( S ~> S' ) ,
( s ) <~~' ( ( s ) o>' 'UnitCoMod )
| morCoMod_comp_Pairing_aka_ReverseOfProjections_PolyPre :
forall S S' : obCoMod, forall s : 'CoMod( S ~> S' ),
forall F : obMod, forall ff : 'Mod( Constant S' ~> F ),
( ( ( s )o>> o> ff ) o>' 'Pairing )
<~~' ( s o>' ( ff o>' 'Pairing ) )
| UnitCoMod_comp_morCoMod :
forall S S' : obCoMod, forall s : 'CoMod( S ~> S' ) ,
( s ) <~~' ( 'UnitCoMod o>' ( s ) )
| MorCoMod_Mole_comp_MorCoMod_Mole : forall S S' : Mole.obCoMod, forall s : 'CoMod( S ~> S' ) %mole, forall S'' : Mole.obCoMod, forall s' : 'CoMod( S' ~> S'' ) %mole,
( MorCoMod_Mole (s o>' s')%mole )
<~~' ( ( MorCoMod_Mole s ) o>' ( MorCoMod_Mole s' ) )
(** ----- the constant conversions which are not for polymorphism elimination
but are only for the wanted sense of extensionality for adjunction ----- **)
| Pairing_aka_ReverseOfProjections_PolyPre_subst_Projections_PolyPost :
forall F : obMod,
( @'UnitCoMod ( Product F ) )
<~~' ( ( 'Projections o> ( @'UnitMod F ) ) o>' 'Pairing )
where "s' <~~' s" := (@convCoMod _ _ s s').
Hint Constructors convMod convCoMod : core.
(** # #
#+END_SRC
* Linear total/asymptotic grade and the degradation lemma
#+BEGIN_SRC coq :exports both :results silent # # **)
Arguments Nat.add : simpl nomatch.
Fixpoint gradeMod (F F' : obMod) (ff : 'Mod( F ~> F' )) {struct ff} : nat
with gradeCoMod (T T' : obCoMod) (t : 'CoMod( T ~> T' )) {struct t} : nat .
Proof.
{ case: F F' / ff.
- intros F F' ff F'' ff'.
exact: ( 2 * (S (gradeMod _ _ ff + gradeMod _ _ ff')%nat ) )%nat .
- intros F.
exact: (S O).
- intros T T' t.
exact : (S (gradeCoMod _ _ t)).
- intros F F' ff.
exact: (S (S (gradeMod _ _ ff))).
- intros F F' ff.
exact: (S O). }
{ case: T T' / t.
- intros T T' t T'' t'.
exact: ( 2 * (S (gradeCoMod _ _ t + gradeCoMod _ _ t')%nat ) )%nat .
- intros T.
exact: (S O).
- intros T F ff.
exact : (S (S (gradeMod _ _ ff))).
- intros T T' t.
exact: (S O). }
Defined.
Arguments gradeMod : simpl nomatch.
Arguments gradeCoMod : simpl nomatch.
Lemma gradeMod_gt0 :
forall F F' : obMod, forall ff : 'Mod( F ~> F' ),
((S O) <= (gradeMod ff))%nat
with gradeCoMod_gt0 :
forall T T' : obCoMod, forall t : 'CoMod( T ~> T' ),
((S O) <= (gradeCoMod t))%nat .
Proof.
{ intros F F' ff. case: F F' / ff ;
simpl; intros; abstract Lia.lia. }
{ intros T T' s. case: T T' / s ;
simpl; intros; abstract Lia.lia. }
Qed.
Ltac tac_gradeMod_gt0 :=
match goal with
| [ gg1 : 'Mod( _ ~> _ ) ,
gg2 : 'Mod( _ ~> _ ) ,
gg3 : 'Mod( _ ~> _ ) ,
gg4 : 'Mod( _ ~> _ ) |- _ ] =>
move : (@gradeMod_gt0 _ _ gg1) (@gradeMod_gt0 _ _ gg2)
(@gradeMod_gt0 _ _ gg3)
(@gradeMod_gt0 _ _ gg4)
| [ gg1 : 'Mod( _ ~> _ ) ,
gg2 : 'Mod( _ ~> _ ) ,
gg3 : 'Mod( _ ~> _ ) |- _ ] =>
move : (@gradeMod_gt0 _ _ gg1) (@gradeMod_gt0 _ _ gg2)
(@gradeMod_gt0 _ _ gg3)
| [ gg1 : 'Mod( _ ~> _ ) ,
gg2 : 'Mod( _ ~> _ ) |- _ ] =>
move : (@gradeMod_gt0 _ _ gg1) (@gradeMod_gt0 _ _ gg2)
| [ gg1 : 'Mod( _ ~> _ ) |- _ ] =>
move : (@gradeMod_gt0 _ _ gg1)
end.
Ltac tac_gradeCoMod_gt0 :=
match goal with
| [ gg1 : 'CoMod( _ ~> _ ) ,
gg2 : 'CoMod( _ ~> _ ) ,
gg3 : 'CoMod( _ ~> _ ) ,
gg4 : 'CoMod( _ ~> _ ) |- _ ] =>
move : (@gradeCoMod_gt0 _ _ gg1) (@gradeCoMod_gt0 _ _ gg2)
(@gradeCoMod_gt0 _ _ gg3)
(@gradeCoMod_gt0 _ _ gg4)
| [ gg1 : 'CoMod( _ ~> _ ) ,
gg2 : 'CoMod( _ ~> _ ) ,
gg3 : 'CoMod( _ ~> _ ) |- _ ] =>
move : (@gradeCoMod_gt0 _ _ gg1) (@gradeCoMod_gt0 _ _ gg2)
(@gradeCoMod_gt0 _ _ gg3)
| [ gg1 : 'CoMod( _ ~> _ ) ,
gg2 : 'CoMod( _ ~> _ ) |- _ ] =>
move : (@gradeCoMod_gt0 _ _ gg1) (@gradeCoMod_gt0 _ _ gg2)
| [ gg1 : 'CoMod( _ ~> _ ) |- _ ] =>
move : (@gradeCoMod_gt0 _ _ gg1)
end.
Lemma degradeMod :
forall F F' : obMod, forall ff ff0 : 'Mod( F ~> F' ),
ff0 <~~ ff -> ( gradeMod ff0 <= gradeMod ff )%nat
with degradeCoMod :
forall S S' : obCoMod, forall s s0 : 'CoMod( S ~> S' ),
s0 <~~' s -> ( gradeCoMod s0 <= gradeCoMod s )%nat .
Proof.
Time all : [> intros F F' ff ff0 convMod_ff0_ff;
case: F F' ff ff0 / convMod_ff0_ff
| intros S S' s s0 convCoMod_s0_s;
case: S S' s s0 / convCoMod_s0_s ];
try solve [simpl; intuition idtac;
repeat match goal with
| [ Hred : ( _ <~~ _ )%poly |- _ ] =>
move : (degradeMod _ _ _ _ Hred) ; clear Hred
| [ Hred : ( _ <~~' _ )%poly |- _ ] =>
move : (degradeCoMod _ _ _ _ Hred) ; clear Hred
end;
clear; intros; try tac_gradeMod_gt0; try tac_gradeCoMod_gt0;
simpl; intros; abstract Lia.lia] .
(* Time: "Finished transaction in 0.938 secs (0.938u,0.s) (successful)" *)
Qed.
(** # #
#+END_SRC
* Solution morphisms
** Solution morphisms without composition
#+BEGIN_SRC coq :exports both :results silent # # **)
Module Sol.
Section Section1.
Declare Scope sol_scope. Delimit Scope sol_scope with sol.
Inductive morMod : forall F F' : obMod, Type :=
| UnitMod : forall F : obMod, 'Mod( F ~> F )
| Constant_PolyMor : forall S S' : obCoMod, 'CoMod( S ~> S' ) -> 'Mod( Constant S ~> Constant S' )
| Projections_PolyPost : forall F F' : obMod, 'Mod( F ~> F' ) -> 'Mod( Constant (Product F) ~> F' )
| MorMod_Mole : forall F F' : Mole.obMod,
'Mod( F ~> F' ) %mole -> 'Mod( ObMod_Mole F ~> ObMod_Mole F' )
where "''Mod' ( F ~> F' )" := (@morMod F F') : sol_scope
with morCoMod : forall S S' : obCoMod, Type :=
| UnitCoMod : forall S : obCoMod, 'CoMod( S ~> S )
| Pairing_aka_ReverseOfProjections_PolyPre :
forall S : obCoMod, forall F : obMod, 'Mod( Constant S ~> F ) -> 'CoMod( S ~> Product F )
| MorCoMod_Mole : forall S S' : Mole.obCoMod,
'CoMod( S ~> S' ) %mole -> 'CoMod( ObCoMod_Mole S ~> ObCoMod_Mole S' )
where "''CoMod' ( S ~> S' )" := (@morCoMod S S') : sol_scope.
End Section1.
Module Export Ex_Notations.
Declare Scope sol_scope. Delimit Scope sol_scope with sol.
Notation "''Mod' ( F ~> F' )" := (@morMod F F') : sol_scope.
Notation "@ ''UnitMod' F" := (@UnitMod F)
(at level 10, F at next level, only parsing) : sol_scope.
Notation "''UnitMod'" := (@UnitMod _) (at level 0) : sol_scope.
Notation "( s )o>>" :=
(@Constant_PolyMor _ _ s) (at level 0) : sol_scope.
Notation "''Projections' o> ff" :=
(@Projections_PolyPost _ _ ff) (at level 10, ff at next level) : sol_scope.
Notation "''MorMod_Mole' ff" :=
(@MorMod_Mole _ _ ff) (at level 10, ff at next level) : sol_scope.
Notation "''CoMod' ( S ~> S' )" := (@morCoMod S S') : sol_scope.