/
coherence2.v
1815 lines (1631 loc) · 93.6 KB
/
coherence2.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
(** SEMI ASSOCIATIVE COHERENCE -- coherence2.v COQ 8.4pl3
This COQ text shows the semiassociativity completeness and coherence internal some encoding where associative coherence is the meta:
- MACLANE PENTAGON IS SOME RECURSIVE SQUARE !! This recursive square is the "functorial" parallel to the normalization/flattening of binary trees.
- the associative coherence comes before anything else, before the semiassociative completeness and before the semiassociative coherence.
- the associative coherence, by the recursive square lemma, critically reduce to the classification of the endomorphisms in the semiassociative category. This associative coherence do not lack some "Newman-style" lemma.
- the associative category is the meta of the semiassociative category, and
- the statement of semiassociative completeness shows this very clearly,
- the semiassociative coherence is done in some internal ( "first/second order " ??) encoding relative to associative coherence, and it is possible to [Extraction] computation datatypes and programs, which would not be possible in some (yet to be found) too meta ( "higher-order" / COQ Gallina ) encoding
- the semiassociative coherence do lack some "Newman-style" lemma where the codomain object is in normal form
- this file use Chlipala CPDT [crush]-ing style tactics, which simplify any goal hypothesis which can be destructed-inverted/injected/discriminated back into one single goal, and which intantiate any goal hypothesis or some given lemmas using everything available in the local context.
- this file do not yet distinguish [Prop] or [Set] for computation and, even if this can be sometimes avoided, this file do not hesitate to use the library [Program.Equality] [dependent destruction] which is some [destruct] followed by inversion/injection/discriminate cleaning which may use [eq_rect_eq] logical [Prop] axiom which allows to destruct/rewrite equalities between two dependent pairs.
- and the [dependent destruction] tactic is indeed the critical tactic which allows the common/usual way of reasoning in mathematics textbook. this is the item of COQ which is still very experimental/fragile and lack future refinement
- Noson Yanofsky talks about some Catalan categories to solve associative coherence in hes doctor text, may be the "functorial" normalization/flattening here is related to hes Catalan categories
- going further into more coherences, the applications of all such would not be something similar to the AAC tactics or CoqMT which already come with COQ...
- but first of all, the usual termination/consistency restriction of COQ is something which is difficult to justify.
- going further into more coherences, the decidability/computability may be lost
- therefore the correct software may not be [COQ] but something like [DEDUKTI MODULO], Frederic Blanqui may be the next person for seeking references
*)
(** * Imports
Make use of CPDT tactics. Make use of [dependent destruction] from [Program.Equality] library, which sometimes uses som axiom for the destruction of equality between two dependent pairs. *)
Require Import List Omega Equality.
Require Import CpdtTactics.
Require Import coherence.
Set Implicit Arguments.
(** * Memory
Some reminders from eailier coherence.v for proving semiassociative completeness. *)
Infix "/\0" := up_0 (at level 59, right associativity). (*/!\ .. LEVEL OF /\0 /\1 <o ~ ~~ SHALL BE LOWER THAN = ,
Infix "/\1" := up_1 (at level 61, right associativity) *)
Infix "~~" := same (at level 69, no associativity). (* just below = *)
Lemma th001 : forall A B (f : arrows A B), forall x y : A, lt_right (f x) (f y) -> lt_right x y.
Proof.
exact lem033.
Defined. Hint Resolve th001.
Lemma th002 : forall A B (f: arrows A B), bracket_left_not_occurs_in f -> (bracket_left_occurs_in f -> Empty_set).
Proof.
exact lem004600.
Defined. Hint Resolve th002.
Lemma th003 : forall A B (f: arrows A B), (bracket_left_occurs_in f -> Empty_set) -> bracket_left_not_occurs_in f.
Proof.
exact lem004700.
Defined. Hint Resolve th003.
Lemma th004 : forall A B (f: arrows A B), bracket_left_occurs_in f + bracket_left_not_occurs_in f.
Proof.
exact lem004510.
Defined. Hint Resolve th004.
Lemma th005 : forall A B (f : arrows A B), (bracket_left_occurs_in f -> Empty_set) -> forall x y : A, x <r y -> f x <r f y.
Proof.
exact lem004800.
Defined. Hint Resolve th005.
Lemma th006 : forall A B (f : arrows A B), bracket_left_occurs_in f -> {x: A & {y : A & prod (x <r y) (f x <r f y -> Empty_set)}}.
Proof.
exact lem004500.
Defined. Hint Resolve th006.
Lemma th007 : forall A B (f : arrows A B), (bracket_left_not_occurs_in f) -> (forall x y : A, lt_right x y -> lt_right (f x) (f y)).
Proof.
intros; cut ((bracket_left_occurs_in f -> Empty_set)); auto. apply th002; auto.
Defined. Hint Resolve th007.
Lemma th008 : forall A B (f : arrows A B), bracket_left_occurs_in f -> {x: A & {y : A & prod (lt_right x y) (lt_right (f x) (f y) -> Empty_set)}}.
Proof.
intros; destruct (th006 H) as (x & y & ? & ?); exists x, y; auto.
Defined. Hint Resolve th008.
Lemma th009 : forall A B (f : arrows A B), (forall x y : A, lt_right x y -> lt_right (f x) (f y)) -> (bracket_left_not_occurs_in f).
Proof.
intros; cut (bracket_left_occurs_in f -> Empty_set); [auto | ].
intros Hf; apply th008 in Hf; firstorder.
Defined. Hint Resolve th009.
(** * Endomorphisms in semiassociative category, [lengthinr] invariant
Some other way to distinguish objects, other than [lt_right], is lacked. The type of this other way shall be something like [nat], which do not print the objects. *)
Lemma th010 : forall A B (f : arrows A B), bracket_left_not_occurs_in f
-> { Heq : B = A &
(match Heq in (_ = A0) return (arrows A A0) with
| eq_refl => f
end) ~~ (unitt A) }.
Proof.
induction 1; crush; esplit with (eq_refl _); crush;
repeat match goal with
| [ |- (_ /\1 _) ~~ unitt (?A /\0 ?A0) ] => apply same_trans with (g := (unitt A) /\1 (unitt A0)); auto
| [ |- (_ <o _) ~~ unitt ?A ] => apply same_trans with (g := (unitt A) <o (unitt A)); auto
end.
Defined. Hint Resolve th010.
Lemma th020 : forall A B (f : arrows A B), bracket_left_not_occurs_in f -> A = B.
Proof.
intros; destruct (th010 H); symmetry; assumption.
Defined.
Fixpoint lengthin (A : objects) : nat :=
match A with
| letter _ => 1
| A0 /\0 A1 => S (lengthin A0 + lengthin A1)
end.
Fixpoint lengthinr (A : objects) : nat :=
match A with
| letter _ => O
| A0 /\0 A1 => lengthin A1 + (lengthinr A0 + lengthinr A1)
end.
Lemma th030 : forall A B (f : arrows A B), lengthin B = lengthin A.
Proof.
induction 1; crush.
Defined. Hint Immediate th030. (*Hint Rewrite th030 using assumption.*)
Lemma th040 : forall len A B (f : arrows A B), coherence.length f <= len -> lengthinr B <= lengthinr A.
Proof.
induction len.
* intros; cut (2 <= coherence.length f) ; crush.
* destruct f; crush.
assert ( coherence.length f1 <= len).
{
cut ( coherence.length f1 * 2 <= S len );
cut ( coherence.length f1 * 2 <= coherence.length f1 * coherence.length f2);
cut (2 <= coherence.length f2);
auto with zarith.
}
assert ( coherence.length f2 <= len).
{
cut ( 2 * coherence.length f2 <= S len );
cut ( 2 * coherence.length f2 <= coherence.length f1 * coherence.length f2);
cut (2 <= coherence.length f1);
auto with zarith.
}
specialize (th030 f2).
crush' true fail.
Show.
assert ( coherence.length f1 <= len).
{
cut ( coherence.length f1 + 2 <= S len );
cut ( coherence.length f1 + 2 <= coherence.length f1 + coherence.length f2);
cut (2 <= coherence.length f2);
auto with zarith.
}
assert ( coherence.length f2 <= len).
{
cut ( 2 + coherence.length f2 <= S len );
cut ( 2 + coherence.length f2 <= coherence.length f1 + coherence.length f2);
cut (2 <= coherence.length f1);
auto with zarith.
}
crush' true fail.
Defined.
Lemma th050 : forall A B (f : arrows A B), lengthinr B <= lengthinr A.
Proof.
intros; eapply th040 with (f := f); eauto.
Defined. Hint Immediate th050.
Lemma th060 : forall A B (f : arrows A B), bracket_left_not_occurs_in f -> lengthinr B = lengthinr A.
Proof.
intros; symmetry; f_equal; eapply th020; eauto.
Defined. Hint Immediate th060. Hint Rewrite th060 using assumption.
Lemma th070 : forall len A B (f : arrows A B), coherence.length f <= len -> bracket_left_occurs_in f -> lengthinr B < lengthinr A.
Proof.
induction len.
* intros; cut (2 <= coherence.length f) ; crush.
* destruct f; crush' true bracket_left_occurs_in.
assert ( coherence.length f1 <= len).
{
cut ( coherence.length f1 * 2 <= S len );
cut ( coherence.length f1 * 2 <= coherence.length f1 * coherence.length f2);
cut (2 <= coherence.length f2);
auto with zarith.
}
assert ( coherence.length f2 <= len).
{
cut ( 2 * coherence.length f2 <= S len );
cut ( 2 * coherence.length f2 <= coherence.length f1 * coherence.length f2);
cut (2 <= coherence.length f1);
auto with zarith.
}
dependent destruction H0;
specialize th030 with (1:=f2);
assert (lengthinr B0 <= lengthinr A0) by auto;
assert (lengthinr B <= lengthinr A) by auto;
crush' true fail.
Show.
assert ( coherence.length f1 <= len).
{
cut ( coherence.length f1 + 2 <= S len );
cut ( coherence.length f1 + 2 <= coherence.length f1 + coherence.length f2);
cut (2 <= coherence.length f2);
auto with zarith.
}
assert ( coherence.length f2 <= len).
{
cut ( 2 + coherence.length f2 <= S len );
cut ( 2 + coherence.length f2 <= coherence.length f1 + coherence.length f2);
cut (2 <= coherence.length f1);
auto with zarith.
}
dependent destruction H0;
[ cut (lengthinr C < lengthinr B); [| apply IHlen with (f:=f2)]
| cut (lengthinr B < lengthinr A) ; [| apply IHlen with (f:=f1)] ];
cut (lengthinr B <= lengthinr A);
cut (lengthinr C <= lengthinr B); crush.
Defined.
Lemma th080 : forall A B (f : arrows A B), bracket_left_occurs_in f -> lengthinr B < lengthinr A.
Proof.
intros; eapply th070 with (f := f); eauto.
Defined. Hint Resolve th080.
Lemma th090 : forall A B (f : arrows A B), bracket_left_occurs_in f -> lengthinr B = lengthinr A -> Empty_set.
Proof.
intros; pose proof (th080); crush' true fail.
Defined. Hint Resolve th090.
Lemma th100 : forall A (f : arrows A A), bracket_left_not_occurs_in f.
Proof.
intros; specialize th090; cut (lengthinr A = lengthinr A); cut (bracket_left_occurs_in f + bracket_left_not_occurs_in f); crush' true fail.
Defined. Hint Resolve th100.
(* ABORT
Lemma th110 : forall A (f : arrows A A), forall x, f x = x.
Proof.
intros;
cut (bracket_left_not_occurs_in f); [|auto].
intros; revert x.
Abort.
*)
Lemma th110 : forall A B (f g : arrows A B), (f ~~ g) -> forall x : A, f x = g x.
Proof.
induction 1; intros;
repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end; crush.
Defined. Hint Resolve th110.
Lemma th120 : forall A (f : arrows A A), forall x, f x = x.
Proof.
intros; assert (bracket_left_not_occurs_in f) by auto;
destruct (th010 H) as [Heq Hsame];
dependent destruction Heq;
rewrite (th110 Hsame); reflexivity.
Defined. Hint Resolve th120.
(* ABORT
Lemma th130 : forall A B (f g : arrows A B), forall x, f x = g x.
Proof.
intros.
Fail assert ((com_assoc f (coherence.rev g)) x = x) by auto.
Abort All.
*)
(* ABORT
Require Import Bool.
Fixpoint arrows_assoc_b (A B : objects) : bool.
refine (orb _ _).
* Check eqb. Check objects_beq. Check objects_eq_dec. exact (objects_beq A B).
* refine (_ || _).
+ exact (match A, B with
| (A0 /\0 (B0 /\0 C0)) , ((A1 /\0 B1) /\0 C1) => (objects_beq A0 A1) && (objects_beq B0 B1) && (objects_beq C0 C1)
| _ , _ => false
end).
+ refine (_ || _).
- exact (match A, B with
| ((A0 /\0 B0) /\0 C0) , (A1 /\0 (B1 /\0 C1)) => (objects_beq A0 A1) && (objects_beq B0 B1) && (objects_beq C0 C1)
| _ , _ => false
end).
- { refine (_ || _).
* exact (match A, B with
| (A0 /\0 A1) , (B0 /\0 B1) => (arrows_assoc_b A0 B0) && (arrows_assoc_b A1 B1)
| _ , _ => false
end).
* Check existsb. Guarded.
(*
| unitt_assoc : forall A : objects, arrows_assoc A A
| bracket_left_assoc : forall A B C : objects, arrows_assoc (A /\ (B /\ C)) ((A /\ B) /\ C)
| bracket_right_assoc : forall A B C : objects, arrows_assoc ((A /\ B) /\ C) (A /\ (B /\ C))
| up_1_assoc : forall A B A0 B0 : objects, arrows_assoc A B -> arrows_assoc A0 B0 -> arrows_assoc (A /\ A0) (B /\ B0)
| com_assoc : forall A B C : objects, arrows_assoc A B -> arrows_assoc B C -> arrows_assoc A C.
*)
Abort All.
*)
(** * Functorial normalization for objects, which are simple binary trees *)
Inductive normal : objects -> Set :=
| normal_cons1 : forall l : letters, normal (letter l)
| normal_cons2 : forall (A : objects) (l : letters), normal A -> normal (A /\0 letter l).
Hint Constructors normal.
Reserved Notation "Z </\0 A" (at level 55, left associativity).
Fixpoint normalize_aux Z A {struct A} : objects :=
match A with
| letter l => Z /\0 letter l
| A1 /\0 A2 => (Z </\0 A1) </\0 A2
end
where "Z </\0 A" := (normalize_aux Z A).
Fixpoint normalize A : objects :=
match A with
| letter l => letter l
| A1 /\0 A2 => (normalize A1) </\0 A2
end.
Lemma th140 : forall A2 A1, normal A1 -> normal (A1 </\0 A2).
Proof.
induction A2; simpl in *; intuition.
Defined.
Hint Resolve th140.
Lemma th150 : forall A, normal (normalize A).
Proof.
induction A; simpl in *; intuition.
Defined.
Hint Resolve th150.
Lemma th151 : forall A, normal A -> normalize A = A.
Proof.
induction 1; simpl in *; [reflexivity|]; rewriter; reflexivity. (* [crush] /!\ bad *)
Defined.
Hint Resolve th151.
Lemma th152 : forall A, normalize (normalize A) = normalize A.
Proof.
intros; apply th151; auto.
Defined.
Hint Resolve th152.
Inductive normal_aux (Z : objects) : objects -> Set :=
| normal_aux_cons1 : normal_aux Z Z
| normal_aux_cons2 : forall A l, normal_aux Z A -> normal_aux Z (A /\0 letter l).
Hint Constructors normal_aux.
Lemma th160 : forall B A Z, normal_aux Z A -> normal_aux Z (A </\0 B).
Proof.
induction B; crush.
Defined.
Hint Resolve th160.
Lemma th170 : forall Z B, normal_aux Z (Z </\0 B).
Proof.
auto.
Defined.
Hint Resolve th170.
Reserved Notation "y </\1 A" (at level 57, left associativity).
Fixpoint normalize_aux_arrow Y Z (y : arrows Y Z) A : arrows (Y /\0 A) (Z </\0 A) :=
match A with
| letter l => y /\1 unitt (letter l)
| A1 /\0 A2 => ((y </\1 A1) </\1 A2) <o bracket_left Y A1 A2
end
where "y </\1 A" := (normalize_aux_arrow y A).
Fixpoint normalize_arrow A : arrows A (normalize A) :=
match A with
| letter l => unitt (letter l)
| A1 /\0 A2 => (normalize_arrow A1) </\1 A2
end.
(* OLD NO PROGRESS
Fixpoint normalize_arrow (A:objects) : arrows A (normalize A).
destruct A.
simpl in *. exact (unitt (letter l)).
simpl in *. induction A2 in A1 |- *.
simpl in *. exact ((normalize_arrow A1) /\1 (unitt (letter l))).
simpl in *. replace (normalize_aux A2_1 (normalize A1)) with (normalize (A1 /\0 A2_1)) by auto.
refine (_ <o bracket_left A1 A2_1 A2_2).
apply IHA2_2.
Defined (*/!\ NO PROGRESS *).
*)
(** * Simple normalization for developed arrows, which are more complicated than binary trees *)
Inductive developed_normal : forall A B, arrows A B -> Set :=
| developed_normal_unitt : forall A, developed_normal (unitt A)
| developed_normal_com : forall A B (g : arrows A B), term_bracket_left g -> forall C (f : arrows B C), developed_normal f -> developed_normal (f <o g).
Hint Constructors developed_normal.
Fixpoint developed_normal_coerce A B (f : arrows A B) (dev_normal_f : developed_normal f) {struct dev_normal_f} : developed f.
Proof.
destruct dev_normal_f.
constructor 1.
constructor 3; crush.
Defined.
Hint Resolve developed_normal_coerce.
Coercion developed_normal_coerce : developed_normal >-> developed.
Fixpoint developed_normalize_aux B C (fin : arrows B C) (dev_fin : developed fin) A (f : arrows A B) (dev_f : developed f) {struct dev_f} : {h : arrows A C & prod (developed h) ((fin <o f) ~~ h) }.
Proof.
destruct dev_f.
split with fin; crush.
split with (fin <o f); crush.
set (dev_fin_8f2 := (projT2 (developed_normalize_aux _ _ _ dev_fin _ _ dev_f2))) in |- ; simpl in dev_fin_8f2.
set (fin_8f2 := (projT1 (developed_normalize_aux _ _ _ dev_fin _ _ dev_f2))) in *.
set (dev_fin_8f2_8f1 := (projT2 (developed_normalize_aux _ _ _ (fst dev_fin_8f2) _ _ dev_f1))) in |- ; simpl in dev_fin_8f2_8f1.
set (fin_8f2_8f1 := (projT1 (developed_normalize_aux _ _ _ (fst dev_fin_8f2) _ _ dev_f1))) in *.
split with fin_8f2_8f1; crush; set (H_tmp := snd dev_fin_8f2) in |- ;
apply same_trans with (g := ((fin <o g) <o f)); [auto|] ;
apply same_trans with (g := fin_8f2 <o f); crush.
Defined.
Lemma th180 : forall A B (f : arrows A B) (dev_f : developed f) C (fin : arrows B C) (dev_fin : developed fin),
developed_normal fin -> developed_normal (projT1 (developed_normalize_aux dev_fin dev_f)).
Proof.
induction dev_f;
crush.
Defined.
Hint Resolve th180.
Lemma th190 : forall A B (f : arrows A B) (dev_f : developed f) C (fin : arrows B C) (dev_normal_fin : developed_normal fin),
developed_normal (projT1 (developed_normalize_aux dev_normal_fin dev_f)).
Proof.
auto.
Defined.
Hint Resolve th190.
Fixpoint developed_normalize A B (f : arrows A B) (dev_f : developed f) {struct dev_f} : {h : arrows A B & prod (developed_normal h) (f ~~ h) }.
Proof.
destruct dev_f.
split with (unitt A); crush.
split with ((unitt B) <o f); crush.
set (dev_normal_f2' := projT2 (developed_normalize _ _ _ dev_f2)) in |- ; simpl in (type of dev_normal_f2').
set (var_tmp := snd (projT2 (developed_normalize _ _ _ dev_f2))) in |- ; simpl in (type of var_tmp).
set (f2' := projT1 (developed_normalize _ _ _ dev_f2)) in * .
set (prop_f2'_f1' := snd (projT2 (developed_normalize_aux (fst dev_normal_f2') dev_f1))) in |- ; simpl in (type of prop_f2'_f1').
set (f2'_f1' := (projT1 (developed_normalize_aux (fst dev_normal_f2') dev_f1))) in *.
split with f2'_f1'; split; [subst f2'_f1'; trivial|].
apply same_trans with (g := (f2' <o f)); [auto | assumption].
Defined.
(** ** OOPS, forgot same'_nat naturality of bracket_left in coherence.v *)
Inductive same' : forall A B : objects, arrows A B -> arrows A B -> Set :=
| same'_refl : forall A B f, @same' A B f f
| same'_trans : forall A B f g h, @same' A B f g -> @same' A B g h -> @same' A B f h
| same'_sym : forall A B f g, @same' A B f g -> @same' A B g f
| same'_cong_com : forall A B C f f0 g g0, @same' A B f f0 -> @same' B C g g0 ->
@same' A C (g <o f) (g0 <o f0)
| same'_cong_up_1 : forall A B A0 B0 f f0 g g0, @same' A B f f0 -> @same' A0 B0 g g0 ->
@same' (A /\0 A0) (B /\0 B0) (f /\1 g) (f0 /\1 g0)
| same'_cat_left : forall A B, forall f : arrows A B, @same' A B ( (unitt B) <o f ) ( f )
| same'_cat_right : forall A B, forall f : arrows A B, @same' A B ( f <o (unitt A)) ( f )
| same'_cat_assoc : forall A B C D, forall (f : arrows A B) (g : arrows B C) (h : arrows C D), @same' A D ( h <o (g <o f) ) ( (h <o g) <o f )
| same'_bif_up_unit : forall A B, @same' (A /\0 B) (A /\0 B) ((unitt A) /\1 (unitt B)) (unitt (A /\0 B))
| same'_bif_up_com : forall A B C A0 B0 C0, forall (f : arrows A B) (g : arrows B C) (f0 : arrows A0 B0) (g0 : arrows B0 C0), @same' (A /\0 A0) (C /\0 C0) ( (g <o f) /\1 (g0 <o f0) ) ( (g /\1 g0) <o (f /\1 f0) )
| same'_bracket_left_5 : forall A B C D,
@same' (A /\0 (B /\0 (C /\0 D))) ((((A /\0 B) /\0 C) /\0 D))
( (bracket_left (A /\0 B) C D) <o (bracket_left A B (C /\0 D)) )
( (bracket_left A B C) /\1 (unitt D) <o (bracket_left A (B /\0 C) D) <o (unitt A) /\1 (bracket_left B C D) )
| same'_nat : forall A A' f B B' g C C' h, same' (bracket_left A B C <o (f /\1 (g /\1 h))) (((f /\1 g) /\1 h) <o bracket_left A' B' C').
Hint Constructors same'.
Infix "~~~" := same' (at level 69). (* just before = *)
Fixpoint same_to_same' A B (f g : arrows A B) (H_same_f_g : same f g) {struct H_same_f_g} : same' f g.
Proof.
destruct H_same_f_g.
constructor 1.
constructor 2 with (g := g); apply same_to_same'; assumption.
constructor 3; apply same_to_same'; assumption.
constructor 4; apply same_to_same'; assumption.
constructor 5; apply same_to_same'; assumption.
constructor 6.
constructor 7.
constructor 8.
constructor 9.
constructor 10.
constructor 11.
Defined.
Hint Resolve same_to_same'.
Coercion same_to_same' : same >-> same'.
(** ** Continue normalization for developed arrows *)
(* This was for training, not lacking anymore
Lemma th200_unrefined : forall N M1 (h1 : arrows N M1) (bra_h1 : term_bracket_left h1) M2 (h2 : arrows N M2) (bra_h2 : term_bracket_left h2),
{P : objects & {h1' : arrows M1 P & {h2' : arrows M2 P & ((h1' <o h1) ~~~ (h2' <o h2)) }}}.
Proof.
induction 1.
- intros; dependent destruction bra_h2 (* NO PROGRESS inversion bra_h2. *).
+ esplit. exists (unitt _), (unitt _). apply same'_refl. (* [3] (struct conv) *)
+ esplit. exists ((f /\1 (unitt _)) /\1 (unitt _)), (bracket_left _ _ _);
apply same'_trans with (g := (bracket_left _ B C <o f /\1 ((unitt _) /\1 (unitt _)))); crush (* [crush] bad when not [Prop] *). (* [2] (b nat) *)
+ dependent destruction bra_h2.
* esplit. exists ( (bracket_left (A /\0 B) B0 C0) ), ( ((bracket_left A B B0) /\1 (unitt _)) <o (bracket_left A (B /\0 B0) C0) ). eapply same'_trans; [|eapply same'_cat_assoc]; apply same'_bracket_left_5. (* [4] (b 5) *)
* esplit. exists (((unitt _) /\1 f0) /\1 (unitt _)), (bracket_left _ _ _). apply same'_sym, same'_nat. (* [2] (b nat) *)
* esplit. exists (((unitt _) /\1 (unitt _)) /\1 f0), (bracket_left _ _ _). apply same'_sym, same'_nat. (* [2] (b nat) *)
- intros; dependent destruction bra_h2.
+ esplit. exists (bracket_left _ _ _), ((f /\1 (unitt _)) /\1 (unitt _)). apply same'_trans with (g := bracket_left _ B0 C <o f /\1 (unitt _) /\1 (unitt _) ); crush. (* rev [2] (b nat) *)
+ esplit. set (prop_IH := (projT2 (projT2 (projT2 (IHbra_h1 _ _ bra_h2))))) in |- ; simpl in (type of prop_IH).
set (h2'_IH := (projT1 (projT2 (projT2 (IHbra_h1 _ _ bra_h2))))) in * ; simpl in (type of h2'_IH).
set (h1'_IH := (projT1 (projT2 (IHbra_h1 _ _ bra_h2)))) in * ; simpl in (type of h1'_IH).
set (P_IH := (projT1 (IHbra_h1 _ _ bra_h2))) in * ; simpl in (type of P_IH).
exists (h1'_IH /\1 (unitt _)), (h2'_IH /\1 (unitt _)).
apply same'_trans with (g := (h1'_IH <o f) /\1 (unitt _ <o unitt _)); [auto|].
apply same'_trans with (g := (h2'_IH <o f0) /\1 (unitt _ <o unitt _)); auto. (* (_ /\ unitt induction) *)
+ esplit. exists (unitt _ /\1 f0), (f /\1 unitt _).
apply same'_trans with (g := (unitt _ <o f) /\1 (f0 <o unitt _)); [auto|].
apply same'_trans with (g := (f <o unitt _) /\1 (unitt _ <o f0)); [|auto].
apply same'_trans with (g := f /\1 f0); auto. (* [1] (/\ 2 bif) *)
- intros; dependent destruction bra_h2.
+ dependent destruction bra_h1.
* esplit. exists ( bracket_left A B B0 /\1 unitt _ <o bracket_left A (B /\0 B0) C0 ), ( bracket_left (A /\0 B) B0 C0 ). apply same'_sym; eapply same'_trans; [|eapply same'_cat_assoc]; apply same'_bracket_left_5. (* rev [4] (b 5) *)
* esplit. exists (bracket_left _ _ _), ((unitt _ /\1 f0) /\1 unitt _). apply same'_nat. (* rev [2] (b nat) *)
* esplit. exists (bracket_left _ _ _), ((unitt _ /\1 unitt _) /\1 f0). apply same'_nat. (* rev [2] (b nat) *)
+ esplit. exists (f0 /\1 unitt _), (unitt _ /\1 f).
apply same'_trans with (g := (f0 <o unitt _) /\1 (unitt _ <o f)); [auto|].
apply same'_trans with (g := (unitt _ <o f0) /\1 (f <o unitt _)); [|auto].
apply same'_trans with (g := f0 /\1 f); auto. (* rev [1] (/\ 2 bif) *)
+ esplit. set (prop_IH := (projT2 (projT2 (projT2 (IHbra_h1 _ _ bra_h2))))) in |- ; simpl in (type of prop_IH).
set (h2'_IH := (projT1 (projT2 (projT2 (IHbra_h1 _ _ bra_h2))))) in * ; simpl in (type of h2'_IH).
set (h1'_IH := (projT1 (projT2 (IHbra_h1 _ _ bra_h2)))) in * ; simpl in (type of h1'_IH).
set (P_IH := (projT1 (IHbra_h1 _ _ bra_h2))) in * ; simpl in (type of P_IH).
exists (unitt _ /\1 h1'_IH), (unitt _ /\1 h2'_IH).
apply same'_trans with (g := (unitt _ <o unitt _) /\1 (h1'_IH <o f)); [auto|].
apply same'_trans with (g := (unitt _ <o unitt _) /\1 (h2'_IH <o f0)); auto. (* (unitt /\ _ induction) *)
Defined.
*)
Hint Unfold unitt_on_nodes.
Lemma th200 : forall N M1 (h1 : arrows N M1) (bra_h1 : term_bracket_left h1) M2 (h2 : arrows N M2) (bra_h2 : term_bracket_left h2),
{P : objects & {h1' : arrows M1 P & {h2' : arrows M2 P &
prod ((h1' <o h1) ~~~ (h2' <o h2))
(forall x y : nodes P, (lt_right ((rev h1') x) ((rev h1') y)) -> (lt_right ((rev h2') x) ((rev h2') y)) -> lt_right x y) }}}.
Proof.
induction 1.
- intros; dependent destruction bra_h2 (* NO PROGRESS inversion bra_h2. *).
+ esplit. exists (unitt _), (unitt _).
{ split.
- apply same'_refl. (* [3] (struct conv) *)
- crush.
}
+ esplit. exists ((f /\1 (unitt _)) /\1 (unitt _)), (bracket_left _ _ _).
{ split.
- apply same'_trans with (g := (bracket_left _ B C <o f /\1 ((unitt _) /\1 (unitt _)))); crush (* [crush] bad when not [Prop] *). (* [2] (b nat) *)
- intros; repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end; crush' false lt_right.
}
+ dependent destruction bra_h2.
* esplit. exists ( (bracket_left (A /\0 B) B0 C0) ), ( ((bracket_left A B B0) /\1 (unitt _)) <o (bracket_left A (B /\0 B0) C0) ).
{ split.
- eapply same'_trans; [|eapply same'_cat_assoc]; apply same'_bracket_left_5. (* [4] (b 5) *)
- intros; repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end; crush' false lt_right.
}
* esplit. exists (((unitt _) /\1 f0) /\1 (unitt _)), (bracket_left _ _ _).
{ split.
- apply same'_sym, same'_nat. (* [2] (b nat) *)
- intros; repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end; crush' false lt_right.
}
* esplit. exists (((unitt _) /\1 (unitt _)) /\1 f0), (bracket_left _ _ _).
{ split.
- apply same'_sym, same'_nat. (* [2] (b nat) *)
- intros; repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end; crush' false lt_right.
}
- intros; dependent destruction bra_h2.
+ esplit. exists (bracket_left _ _ _), ((f /\1 (unitt _)) /\1 (unitt _)).
{ split.
- apply same'_trans with (g := bracket_left _ B0 C <o f /\1 (unitt _) /\1 (unitt _) ); crush. (* rev [2] (b nat) *)
- intros; repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end; crush' false lt_right.
}
+ esplit. set (prop1_IH := fst (projT2 (projT2 (projT2 (IHbra_h1 _ _ bra_h2))))) in |- ; simpl in (type of prop1_IH).
set (prop2_IH := snd (projT2 (projT2 (projT2 (IHbra_h1 _ _ bra_h2))))) in |- .
set (h2'_IH := (projT1 (projT2 (projT2 (IHbra_h1 _ _ bra_h2))))) in (type of prop1_IH), (type of prop2_IH).
set (h1'_IH := (projT1 (projT2 (IHbra_h1 _ _ bra_h2)))) in (type of h2'_IH), (type of prop1_IH), (type of prop2_IH).
exists (h1'_IH /\1 (unitt _)), (h2'_IH /\1 (unitt _)).
set (P_IH := (projT1 (IHbra_h1 _ _ bra_h2))) in (type of h1'_IH), (type of h2'_IH), (type of prop1_IH), (type of prop2_IH) |- *.
{ split.
- apply same'_trans with (g := (h1'_IH <o f) /\1 (unitt _ <o unitt _)); [auto|].
apply same'_trans with (g := (h2'_IH <o f0) /\1 (unitt _ <o unitt _)); auto. (* (_ /\ unitt induction) *)
- Fail generalize dependent P_IH.
(* all these generalize because [crush] is bad with our fixed local definitions, for example [subst] ?? *)
generalize prop2_IH; clear prop2_IH.
generalize prop1_IH; clear prop1_IH.
generalize h2'_IH; clear h2'_IH.
generalize h1'_IH; clear h1'_IH.
generalize P_IH; clear P_IH.
clear bra_h2 IHbra_h1 bra_h1.
intros; repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end; crush' false lt_right.
(* OLD BAD MANUAL
intros;
repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end. (* crush' false lt_right. *)
+ crush' false lt_right. (*simpl in H. inversion H.*)
+ crush' false lt_right. (*simpl in H. inversion H.*)
+ crush' false lt_right. (*simpl in H. inversion H.*)
+ crush' false lt_right. (*simpl in H. inversion H.*)
+ constructor. simpl in H; inversion H. destruct H1. destruct H3. dependent destruction H4. dependent destruction H5.
simpl in H0; inversion H0. destruct H1. destruct H4. dependent destruction H5. dependent destruction H6.
apply prop2_IH_ghost. assumption. assumption.
+ crush' false lt_right. (*simpl in H. inversion H.*)
+ constructor.
+ crush' false lt_right. (*simpl in H. inversion H.*)
+ constructor. simpl in H; inversion H. destruct H1. destruct H3. dependent destruction H4. dependent destruction H5.
(* unfold unitt_on_nodes in * *)
assumption.
*)
}
+ esplit. exists (unitt _ /\1 f0), (f /\1 unitt _).
{ split.
- apply same'_trans with (g := (unitt _ <o f) /\1 (f0 <o unitt _)); [auto|].
apply same'_trans with (g := (f <o unitt _) /\1 (unitt _ <o f0)); [|auto].
apply same'_trans with (g := f /\1 f0); auto. (* [1] (/\ 2 bif) *)
- intros; repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end; crush' false lt_right.
}
- intros; dependent destruction bra_h2.
+ dependent destruction bra_h1.
* esplit. exists ( bracket_left A B B0 /\1 unitt _ <o bracket_left A (B /\0 B0) C0 ), ( bracket_left (A /\0 B) B0 C0 ).
{ split.
- apply same'_sym; eapply same'_trans; [|eapply same'_cat_assoc]; apply same'_bracket_left_5. (* rev [4] (b 5) *)
- intros; repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end; crush' false lt_right.
}
* esplit. exists (bracket_left _ _ _), ((unitt _ /\1 f0) /\1 unitt _).
{ split.
- apply same'_nat. (* rev [2] (b nat) *)
- intros; repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end; crush' false lt_right.
}
* esplit. exists (bracket_left _ _ _), ((unitt _ /\1 unitt _) /\1 f0).
{ split.
- apply same'_nat. (* rev [2] (b nat) *)
- intros; repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end; crush' false lt_right.
}
+ esplit. exists (f0 /\1 unitt _), (unitt _ /\1 f).
{ split.
- apply same'_trans with (g := (f0 <o unitt _) /\1 (unitt _ <o f)); [auto|].
apply same'_trans with (g := (unitt _ <o f0) /\1 (f <o unitt _)); [|auto].
apply same'_trans with (g := f0 /\1 f); auto. (* rev [1] (/\ 2 bif) *)
- intros; repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end; crush' false lt_right.
}
+ esplit. set (prop1_IH := fst (projT2 (projT2 (projT2 (IHbra_h1 _ _ bra_h2))))) in |- ; simpl in (type of prop1_IH).
set (prop2_IH := snd (projT2 (projT2 (projT2 (IHbra_h1 _ _ bra_h2))))) in |- .
set (h2'_IH := (projT1 (projT2 (projT2 (IHbra_h1 _ _ bra_h2))))) in (type of prop1_IH), (type of prop2_IH).
set (h1'_IH := (projT1 (projT2 (IHbra_h1 _ _ bra_h2)))) in (type of h2'_IH), (type of prop1_IH), (type of prop2_IH).
exists (unitt _ /\1 h1'_IH), (unitt _ /\1 h2'_IH).
set (P_IH := (projT1 (IHbra_h1 _ _ bra_h2))) in (type of h1'_IH), (type of h2'_IH), (type of prop1_IH), (type of prop2_IH) |- *.
{ split.
- apply same'_trans with (g := (unitt _ <o unitt _) /\1 (h1'_IH <o f)); [auto|].
apply same'_trans with (g := (unitt _ <o unitt _) /\1 (h2'_IH <o f0)); auto. (* (unitt /\ _ induction) *)
- generalize prop2_IH; clear prop2_IH.
generalize prop1_IH; clear prop1_IH.
generalize h2'_IH; clear h2'_IH.
generalize h1'_IH; clear h1'_IH.
generalize P_IH; clear P_IH.
clear bra_h2 IHbra_h1 bra_h1.
intros; repeat match goal with
| [xtac : nodes (_ /\0 _) |- _] => dep_destruct xtac; clear xtac
end; crush' false lt_right.
}
Defined.
Hint Immediate th200.
(** * First "direct" attempt at semiassociative coherence *)
(* simpl will do these next 4 lemmas, therefore not lacked *)
Lemma th210 : forall Z l, Z </\0 (letter l) = (Z /\0 (letter l)).
Proof. reflexivity. Defined.
Hint Rewrite th210.
Lemma th220 : forall Z A1 A2, Z </\0 (A1 /\0 A2) = (Z </\0 A1) </\0 A2.
Proof. reflexivity. Defined.
Hint Rewrite th220.
Lemma th221 : forall l, normalize (letter l) = letter l.
Proof. reflexivity. Defined.
Hint Rewrite th221.
Lemma th222 : forall A1 A2, normalize (A1 /\0 A2) = (normalize A1) </\0 A2.
Proof. reflexivity. Defined.
Hint Rewrite th222.
Lemma th223 : forall Y Z (y : arrows Y Z) l, (y </\1 (letter l)) = (y /\1 unitt (letter l)).
Proof. reflexivity. Defined.
Hint Rewrite th223.
Lemma th224 : forall Y Z (y : arrows Y Z) A1 A2, (y </\1 (A1 /\0 A2)) = (((y </\1 A1) </\1 A2) <o bracket_left Y A1 A2).
Proof. reflexivity. Defined.
Hint Rewrite th224.
Lemma th225 : forall l, normalize_arrow (letter l) = (unitt (letter l)).
Proof. reflexivity. Defined.
Hint Rewrite th225.
Lemma th227 : forall A1 A2, normalize_arrow (A1 /\0 A2) = ((normalize_arrow A1) </\1 A2).
Proof. reflexivity. Defined.
Hint Rewrite th227.
Lemma th230 : forall A1 l, normalize_arrow (A1 /\0 letter l) = ((normalize_arrow A1) /\1 (unitt (letter l))).
Proof. reflexivity. Defined.
Hint Rewrite th230.
Lemma th240 : forall A1 A2_1 A2_2, normalize_arrow (A1 /\0 (A2_1 /\0 A2_2)) = (normalize_arrow ((A1 /\0 A2_1) /\0 A2_2) <o bracket_left A1 A2_1 A2_2).
Proof. simpl. reflexivity. Defined.
Hint Rewrite th240. (*useful*)
Lemma th250 : forall N P, arrows_assoc N P -> forall M, normalize_aux M N = normalize_aux M P.
Proof.
induction 1; crush.
Defined.
Hint Immediate th250.
Lemma th260 : forall N P, arrows_assoc N P -> normalize N = normalize P.
Proof.
induction 1; crush.
Defined.
Hint Immediate th260.
Lemma normalize_arrow_alt0 : forall A B, arrows_assoc A B -> normal B -> arrows A B.
Proof.
intros; replace B with (normalize B) by auto.
replace (normalize B) with (normalize A) by auto.
exact (normalize_arrow A).
Defined.
Lemma normalize_arrow_alt : forall B A, arrows_assoc B A -> normal B -> arrows A B.
Proof.
intros; apply normalize_arrow_alt0 with (1 := (rev H)) (2 := H0).
Defined.
(* Hint Immediate normalize_arrow_alt *)
(** BAD LACK ANOTHER TRANSPORT MAP WHICH IS COHERENT, SOME TRANSPORT MAP OTHER THAT [eq_rect].
[[
Fail Scheme Induction for normal Sort Set.
Lemma th270 : forall A (H_normal : normal A), normalize_arrow A ~~~
match (th151 H_normal) in _ = A0 return arrows A A0 -> arrows A (normalize A) with
| eq_refl => fun f => f
end (unitt A).
Proof.
induction H_normal; crush.
Abort.
]]
**)
(** * This directeness lemma, which is some Newman-style lemma, is really lacked for semiassociative cohence
But this lemma is NOT lacked for associative coherence. The directedness lemma is the semiassociative coherence where the codomain is normal, *)
Lemma th270 : forall A B (f : arrows A B), lengthinr B = lengthinr A -> bracket_left_not_occurs_in f.
Proof.
intros; assert (Htemp : bracket_left_occurs_in f + bracket_left_not_occurs_in f) by apply th004.
destruct Htemp; [elimtype Empty_set; eapply th090; eassumption | assumption].
Defined.
Hint Resolve th270.
Lemma th280 : forall A B (f : arrows A B), term_bracket_left f -> bracket_left_occurs_in f.
Proof.
induction 1; auto.
Defined.
Hint Resolve th280.
(** From earlier coherence.development *)
Lemma development2 : forall A B (f : arrows A B), {dev_f : arrows A B & prod (developed dev_f) (same' f dev_f)}.
Proof.
intros. split with (projT1 (development f (le_n (length f)))).
split. exact (fst (projT2 (development f (le_n (length f))))).
exact ((snd (snd (projT2 (development f (le_n (length f))))))).
Defined.
Lemma development3 : forall A B (f : arrows A B), {dev_normal_f : arrows A B & prod (developed_normal dev_normal_f) (same' f dev_normal_f)}.
Proof.
intros. split with (projT1 (developed_normalize (fst (projT2 (development2 f))))).
split. exact (fst (projT2 (developed_normalize (fst (projT2 (development2 f)))))).
eapply same'_trans. 2: eapply (same_to_same' (snd (projT2 (developed_normalize (fst (projT2 (development2 f))))))).
exact (snd (projT2 (development2 f))).
Defined.
Lemma lemma_directedness : forall P, (normal P) -> forall len N, (lengthinr N - lengthinr P <= len) -> forall h k : arrows N P, h ~~~ k.
Proof.
induction len.
- intros. cut (bracket_left_not_occurs_in h); cut (bracket_left_not_occurs_in k);
cut (lengthinr P = lengthinr N); cut (lengthinr P <= lengthinr N); crush.
destruct (th010 H4) as (-> & ?).
destruct (th010 H3) as (Htemp & ?); dependent destruction Htemp.
apply same'_trans with (g := (unitt N)); [apply same_to_same' | apply same'_sym, same_to_same']; assumption.
- intros. set (H_dev_normal_h := (fst (projT2 (development3 h)))) in |- .
set (H_same_h := (snd (projT2 (development3 h)))) in |- .
set (h_dev := (projT1 (development3 h))) in (type of H_dev_normal_h), (type of H_same_h).
set (H_dev_normal_k := (fst (projT2 (development3 k)))) in |- .
set (H_same_k := (snd (projT2 (development3 k)))) in |- .
set (k_dev := (projT1 (development3 k))) in (type of H_dev_normal_k), (type of H_same_k).
cut (h_dev ~~~ k_dev);
[ intros; apply same'_trans with (g := h_dev); [|apply same'_trans with (g := k_dev)]; auto |];
clear H_same_k H_same_h; clearbody H_dev_normal_k; clearbody k_dev; clearbody H_dev_normal_h; clearbody h_dev; clear h k.
remember h_dev as h_memo in |- ; destruct H_dev_normal_h.
(* shorter trick than to exfalso the 2 symmetric cases [developed_normal (g <o f) ~~~ unitt] *)
+ cut (bracket_left_not_occurs_in k_dev); [|auto].
intros Htemp1; destruct (th010 Htemp1) as (Htemp2 & ?); dependent destruction Htemp2; auto.
+ destruct H_dev_normal_k.
* rewrite <- Heqh_memo.
cut (bracket_left_not_occurs_in h_memo); [|auto].
intros Htemp1; destruct (th010 Htemp1) as (Htemp2 & ?); dependent destruction Htemp2; auto.
* { clear H_dev_normal_h H_dev_normal_k h_memo Heqh_memo.
set (H_th200 := th200 t t0) in |- .
set (prop1_H_th200 := fst (projT2 (projT2 (projT2 (H_th200))))) in |- .
set (prop2_H_th200 := snd (projT2 (projT2 (projT2 (H_th200))))) in |- .
set (g0' := projT1 (projT2 (projT2 (H_th200)))) in (type of prop2_H_th200), (type of prop1_H_th200).
set (g' := projT1 (projT2 (H_th200))) in (type of prop2_H_th200), (type of prop1_H_th200), g0'.
set (P' := projT1 (H_th200)) in (type of prop2_H_th200), (type of prop1_H_th200), g0', g'.
set (h := normalize_arrow_alt (com_assoc (rev f) g') H) in |- .
clearbody h;
clear prop2_H_th200 (* not lacked in this directed lemma *);
clearbody prop1_H_th200;
clearbody g0'; clearbody g'; clearbody P'; clear H_th200.
assert (H_len_f : lengthinr B - lengthinr C <= len);
[ cut (lengthinr B < lengthinr A); eauto; omega |].
set (H_same_f_h_g := IHlen _ H_len_f f (h <o g')) in |- .
assert (H_len_f0 : lengthinr B0 - lengthinr C <= len);
[ cut (lengthinr B0 < lengthinr A); eauto; omega |].
set (H_same_f0_h_g0 := IHlen _ H_len_f0 f0 (h <o g0')) in |- .
clearbody H_same_f0_h_g0; clearbody H_same_f_h_g; clear H_len_f H_len_f0.
apply same'_trans with (g := ((h <o g') <o g)); [auto|].
apply same'_trans with (g := (h <o (g' <o g))); [auto|].
apply same'_trans with (g := ((h <o g0') <o g0)); [|auto].
apply same'_trans with (g := (h <o (g0' <o g0))); [|auto]. auto.
}
Defined.
Print lemma_directedness.
(** NOTE: for FIXPOINT, [set] and [let _ in _] instead of [destruct as] because sometimes unfolding and simpl of the fixpoint is done badly when [destruct] is used directly onto the fixpoint hypothesis **)
Lemma lemma_directedness0 : forall B, (normal B) -> forall A (f g : arrows A B), f ~~~ g.
Proof. (* Print Implicit lemma_directedness. *)
intros; exact (lemma_directedness H (le_n (lengthinr A - lengthinr B)) f g).
Defined.
(** * Now for associative coherence *)
Infix "/\1a" := up_1_assoc (at level 63, right associativity).
Notation "g '<oa' f" := (@com_assoc _ _ _ f g) (at level 65, right associativity). (* reminder '<o' is too high, even higher than = , very bad *)
Inductive same_assoc : forall A B : objects, arrows_assoc A B -> arrows_assoc A B -> Set :=
| same_assoc_refl : forall A B f, @same_assoc A B f f
| same_assoc_trans : forall A B f g h, @same_assoc A B f g -> @same_assoc A B g h -> @same_assoc A B f h
| same_assoc_sym : forall A B f g, @same_assoc A B f g -> @same_assoc A B g f
| same_assoc_cong_com : forall A B C f f0 g g0, @same_assoc A B f f0 -> @same_assoc B C g g0 ->
@same_assoc A C (g <oa f) (g0 <oa f0)
| same_assoc_cong_up_1 : forall A B A0 B0 f f0 g g0, @same_assoc A B f f0 -> @same_assoc A0 B0 g g0 ->
@same_assoc (A /\0 A0) (B /\0 B0) (f /\1a g) (f0 /\1a g0)
| same_assoc_cat_left : forall A B, forall f : arrows_assoc A B, @same_assoc A B ( (unitt_assoc B) <oa f ) ( f )
| same_assoc_cat_right : forall A B, forall f : arrows_assoc A B, @same_assoc A B ( f <oa (unitt_assoc A)) ( f )
| same_assoc_cat_assoc : forall A B C D, forall (f : arrows_assoc A B) (g : arrows_assoc B C) (h : arrows_assoc C D), @same_assoc A D ( h <oa (g <oa f) ) ( (h <oa g) <oa f )
| same_assoc_bif_up_unit : forall A B, @same_assoc (A /\0 B) (A /\0 B) ((unitt_assoc A) /\1a (unitt_assoc B)) (unitt_assoc (A /\0 B))
| same_assoc_bif_up_com : forall A B C A0 B0 C0, forall (f : arrows_assoc A B) (g : arrows_assoc B C) (f0 : arrows_assoc A0 B0) (g0 : arrows_assoc B0 C0), @same_assoc (A /\0 A0) (C /\0 C0) ( (g <oa f) /\1a (g0 <oa f0) ) ( (g /\1a g0) <oa (f /\1a f0) )
| same_assoc_bracket_left_5 : forall A B C D,
@same_assoc (A /\0 (B /\0 (C /\0 D))) ((((A /\0 B) /\0 C) /\0 D))
( (bracket_left_assoc (A /\0 B) C D) <oa (bracket_left_assoc A B (C /\0 D)) )
( (bracket_left_assoc A B C) /\1a (unitt_assoc D) <oa (bracket_left_assoc A (B /\0 C) D) <oa (unitt_assoc A) /\1a (bracket_left_assoc B C D) )
| same_assoc_nat : forall A A' f B B' g C C' h, same_assoc (bracket_left_assoc A B C <oa (f /\1a (g /\1a h))) (((f /\1a g) /\1a h) <oa bracket_left_assoc A' B' C')
| same_assoc_bracket_right_bracket_left : forall A B C, same_assoc (bracket_right_assoc A B C <oa bracket_left_assoc A B C) (unitt_assoc (A /\0 (B /\0 C)))
| same_assoc_bracket_left_bracket_right : forall A B C, same_assoc (bracket_left_assoc A B C <oa bracket_right_assoc A B C) (unitt_assoc ((A /\0 B) /\0 C)).
Hint Constructors same_assoc.
Infix "~~~a" := same_assoc (at level 69, no associativity). (* just before = which is at 70 *)
(* OLD, ALTERNATIVE BELOW
Lemma same_assoc_nat_right0 : forall A A' f B B' g C C' h, same_assoc ((f /\1a (g /\1a h)) <oa bracket_right_assoc A' B' C') (bracket_right_assoc A B C <oa ((f /\1a g) /\1a h)).
Proof.
intros. apply same_assoc_sym.
apply same_assoc_trans with (g := bracket_right_assoc A B C <oa ((((f /\1a g) /\1a h) <oa bracket_left_assoc A' B' C') <oa bracket_right_assoc A' B' C')); [eauto 11 |].
apply same_assoc_trans with (g := bracket_right_assoc A B C <oa ((bracket_left_assoc A B C <oa f /\1a g /\1a h) <oa bracket_right_assoc A' B' C')); [| eauto 16]. eauto.
Defined.
Hint Resolve same_assoc_nat_right0.
*)
Lemma th290 : forall A B (f : arrows_assoc A B), (f <oa (rev f) ~~~a (unitt_assoc _)).
Proof.
induction f; simpl in *; eauto;
match goal with
[ |- (_ <oa _ <oa _) ~~~a _ ] => apply same_assoc_trans with (g := f2 <oa (f1 <oa rev f1) <oa rev f2); eauto
end.
Defined.
Hint Immediate th290.
Lemma th300 : forall A B (f : arrows_assoc A B), ((rev f) <oa f ~~~a (unitt_assoc _)).
Proof.
intros; pattern f at 1; replace f with (rev (rev f)) by auto; auto 1.
Defined.
Hint Immediate th300.
Lemma th310 : forall A B (f g : arrows_assoc A B), f ~~~a g -> rev f ~~~a rev g.
Proof.
intros.
assert (f <oa (rev f) ~~~a (unitt_assoc _)) by auto.
assert ((rev g) <oa g ~~~a (unitt_assoc _)) by auto.
apply same_assoc_trans with (g := ((rev g <oa g) <oa rev f)); [eauto |].
apply same_assoc_trans with (g := ((rev g <oa f) <oa rev f)); [| eauto]. eauto.
Defined.
Hint Resolve th310.
Lemma same_assoc_bracket_right_5 : forall A B C D, bracket_right_assoc A B (C /\0 D) <oa bracket_right_assoc (A /\0 B) C D ~~~a
(unitt_assoc A /\1a bracket_right_assoc B C D <oa
bracket_right_assoc A (B /\0 C) D) <oa
bracket_right_assoc A B C /\1a unitt_assoc D.
Proof.
intros; apply (th310 (same_assoc_bracket_left_5 A B C D)).
Defined.
Hint Immediate same_assoc_bracket_right_5.
Lemma same_assoc_nat_right : forall A A' f B B' g C C' h, same_assoc ((f /\1a (g /\1a h)) <oa bracket_right_assoc A' B' C') (bracket_right_assoc A B C <oa ((f /\1a g) /\1a h)).
Proof.
intros; replace f with (rev (rev f)) by auto; replace g with (rev (rev g)) by auto; replace h with (rev (rev h)) by auto.
apply (th310 (same_assoc_nat (rev f) (rev g) (rev h))).
Defined.
Hint Immediate same_assoc_nat_right.
(** Aborted. Lack better transport map which is coherent, than this [eq_rect]
[[
Lemma lemma_coherence_assoc0 : forall N P (h : arrows_assoc N P), h ~~~a ( (match (th260 h) in _ = NN0 return arrows_assoc NN0 P -> arrows_assoc (normalize N) P with | eq_refl => fun x => x end) (rev (normalize_arrow P)) <oa normalize_arrow N).
Proof.
intros. set (var1 := th260 h). clearbody var1. dependent destruction var1.
Check objects_same. Abort.
Fixpoint arrows_assoc_map (A A0 : objects) (H_objects_same_dom : objects_same A A0) B B0 (H_objects_same_cod : objects_same B B0) {struct H_objects_same_dom} : arrows_assoc A B -> arrows_assoc A0 B0.
Proof. Abort All.
]]
*)
(** ** Some training using semiassociativity *)
Lemma th320 : forall A Y Z (y1 y2 : arrows Y Z), y1 ~~~ y2 -> ((y1 </\1 A) ~~~ (y2 </\1 A)).
Proof.
induction A; simpl in *; eauto.
Defined.
Hint Resolve th320.
Lemma th330 : forall A Y Z (y1 y2 : arrows Y Z), y1 ~~~a y2 -> ((y1 </\1 A) ~~~a (y2 </\1 A)).
Proof.
induction A; simpl in *; eauto.
Defined.
Hint Resolve th330.
Lemma th340 : forall A X Y (x : arrows X Y) Z (y : arrows Y Z), (y <o x) </\1 A ~~~ ((y </\1 A) <o (x /\1 unitt A)).
Proof.
induction A; intros; simpl in *.
- eauto. (* /\1 bif *)
- cut ( ((y <o x) </\1 A1 </\1 A2 <o bracket_left X A1 A2) ~~~
(y </\1 A1 </\1 A2 <o (bracket_left Y A1 A2 <o x /\1 (unitt A1 /\1 unitt A2))) ); [eauto |]. (* /\1 bif unitt, <o assoc *)
cut ( ((y <o x) </\1 A1 </\1 A2 <o bracket_left X A1 A2) ~~~
((y </\1 A1 </\1 A2 <o (x /\1 unitt A1) /\1 unitt A2) <o bracket_left X A1 A2) ); [eauto |]. (* b nat *)
cut ( ((y <o x) </\1 A1 </\1 A2) ~~~
((y </\1 A1 </\1 A2 <o (x /\1 unitt A1) /\1 unitt A2)) ); [eauto |]. (* cong *)
cut ( ( (y </\1 A1 <o x /\1 unitt A1) ) </\1 A2 ~~~
(y </\1 A1 </\1 A2 <o (x /\1 unitt A1) /\1 unitt A2) ); [eauto |]. (* IHA1 *)
apply IHA2. (* IHA2 *)