Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
File size: 148,982 Bytes
4365a98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
(*
Title:  Allen's qualitative temporal calculus
Author:  Fadoua Ghourabi (fadouaghourabi@gmail.com)
Affiliation: Ochanomizu University, Japan
*)

section \<open>Time interval relations\<close>


theory allen

imports

  Main axioms 
  "HOL-Eisbach.Eisbach_Tools"


begin

section \<open>Basic relations\<close>

text\<open>We  define 7 binary relations  between time intervals. 
Relations e, m, b, ov, d, s and f stand for equal, meets, before, overlaps, during, starts and finishes, respectively.\<close>

class arelations = interval + 
 fixes 
  e::"('a\<times>'a) set" and
  m::"('a\<times>'a) set" and 
  b::"('a\<times>'a) set" and
  ov::"('a\<times>'a) set" and
  d::"('a\<times>'a) set" and
  s::"('a\<times>'a) set" and
  f::"('a\<times>'a) set"  
assumes
  e:"(p,q) \<in> e = (p = q)" and
  m:"(p,q) \<in> m = p\<parallel>q" and
  b:"(p,q) \<in> b = (\<exists>t::'a. p\<parallel>t \<and> t\<parallel>q)" and
  ov:"(p,q) \<in> ov = (\<exists>k l u v t::'a. 
                   (k\<parallel>p \<and> p\<parallel>u \<and> u\<parallel>v) \<and> (k\<parallel>l \<and> l\<parallel>q \<and> q\<parallel>v) \<and> (l\<parallel>t \<and> t\<parallel>u))" and
  s:"(p,q) \<in> s =  (\<exists>k u v::'a. k\<parallel>p \<and> p\<parallel>u \<and> u\<parallel>v \<and> k\<parallel>q \<and> q\<parallel>v)" and
  f:"(p,q) \<in> f = (\<exists>k l  u ::'a. k\<parallel>l \<and> l\<parallel>p \<and> p\<parallel>u \<and> k\<parallel>q \<and> q\<parallel>u)" and
  d:"(p,q) \<in> d = (\<exists>k l u v::'a. k\<parallel>l \<and> l\<parallel>p \<and> p\<parallel>u \<and>u\<parallel>v \<and> k\<parallel>q \<and> q\<parallel>v)" 
 

(** e compositions **)
subsection \<open>e-composition\<close>
text \<open>Relation e is the identity relation for composition.\<close>

lemma cer:
assumes  "r \<in> {e,m,b,ov,s,f,d,m^-1,b^-1,ov^-1,s^-1,f^-1,d^-1}" 
shows "e O r = r"
proof -
  { fix x y assume a:"(x,y) \<in> e O r" 
    then obtain z where "(x,z) \<in> e" and "(z,y) \<in> r" by auto
    from \<open>(x,z) \<in> e\<close> have "x = z" using e by auto
    with \<open>(z,y)\<in> r\<close> have "(x,y) \<in> r" by simp} note c1 = this
  
 { fix x y assume a:"(x,y) \<in>  r"
   have "(x,x) \<in> e" using e by auto
   with a have "(x,y) \<in> e O r" by blast} note c2 = this
 
 from c1 c2 show ?thesis by auto
qed

lemma cre:
assumes  "r \<in> {e,m,b,ov,s,f,d,m^-1,b^-1,ov^-1,s^-1,f^-1,d^-1}"
shows " r O e = r"
proof -
  { fix x y assume a:"(x,y) \<in> r O e" 
    then obtain z where "(x,z) \<in> r" and "(z,y) \<in> e" by auto
    from \<open>(z,y) \<in> e\<close> have "z = y" using e by auto
    with \<open>(x,z)\<in> r\<close> have "(x,y) \<in> r" by simp} note c1 = this
  
 { fix x y assume a:"(x,y) \<in>  r"
   have "(y,y) \<in> e" using e by auto
   with a have "(x,y) \<in> r O e" by blast} note c2 = this
 
 from c1 c2 show ?thesis by auto
qed

lemmas ceb = cer[of b]
lemmas cebi = cer[of "b^-1"]
lemmas cem = cer[of m]
lemmas cemi = cer[of "m^-1"]
lemmas cee = cer[of e]
lemmas ces = cer[of s]
lemmas cesi = cer[of "s^-1"]
lemmas cef = cer[of f]
lemmas cefi = cer[of "f^-1"]
lemmas ceov = cer[of ov]
lemmas ceovi = cer[of "ov^-1"]
lemmas ced = cer[of d]
lemmas cedi = cer[of "d^-1"]
lemmas cbe = cre[of b]
lemmas cbie = cre[of "b^-1"]
lemmas cme = cre[of m]
lemmas cmie = cre[of "m^-1"]
lemmas cse = cre[of s]
lemmas csie = cre[of "s^-1"]
lemmas cfe = cre[of f]
lemmas cfie = cre[of "f^-1"]
lemmas cove = cre[of ov]
lemmas covie = cre[of "ov^-1"]
lemmas cde = cre[of d]
lemmas cdie = cre[of "d^-1"]

(*******)

(* composition with single relation *)
subsection \<open>r-composition\<close>
text \<open>We prove compositions of the form $r_1 \circ r_2 \subseteq r$, where $r$ is a basic relation.\<close>

method (in arelations) r_compose uses r1 r2 r3 = ((auto, (subst (asm) r1 ), (subst (asm) r2), (subst r3)) ,  (meson M5exist_var))


lemma (in arelations) cbb:"b O b \<subseteq> b"
  by (r_compose r1:b r2:b r3:b)

lemma  (in arelations)  cbm:"b O m \<subseteq> b"
  by (r_compose r1:b r2:m r3:b)

lemma cbov:"b O ov \<subseteq> b"
  apply (auto simp:b ov)
  using M1 M5exist_var by blast

lemma cbfi:"b O f^-1 \<subseteq> b"
  apply (auto simp:b f)
  by (meson M1 M5exist_var)

lemma cbdi:"b O d^-1 \<subseteq> b"
  apply (auto simp: b d)
  by (meson M1 M5exist_var)
 
lemma cbs:"b O s \<subseteq> b"
  apply (auto simp: b s)
  by (meson M1 M5exist_var)

lemma cbsi:"b O s^-1 \<subseteq> b"
  apply (auto simp: b s)
  by (meson M1 M5exist_var)

lemma (in arelations) cmb:"m O b \<subseteq> b"
  by (r_compose r1:m r2:b r3:b)

lemma cmm:"m O m \<subseteq> b"
  by (auto simp: b m)

lemma cmov:"m O ov \<subseteq> b"
  apply (auto simp:b m ov)
  using M1 M5exist_var by blast

lemma cmfi:"m O f^-1 \<subseteq> b"
  apply (r_compose r1:m r2:f r3:b)
  by (meson M1)

lemma cmdi:"m O d^-1 \<subseteq> b"
  apply (auto simp add:m d b)
  using M1 by blast

lemma cms:"m O s \<subseteq> m"
  apply (auto simp add:m s)
  using M1 by auto

lemma cmsi:"m O s^-1 \<subseteq> m"
  apply (auto simp add:m s)
  using M1 by blast

lemma covb:"ov O b \<subseteq> b"
  apply (auto simp:ov b)
  using M1 M5exist_var by blast

lemma covm:"ov O m \<subseteq> b"
  apply (auto simp:ov m b)
  using M1 by blast

lemma covs:"ov O s \<subseteq> ov" 
proof
  fix p::"'a\<times>'a" assume "p \<in> ov O s" then obtain x y z where p:"p = (x,z)" and xyov:"(x,y)\<in> ov" and yzs:"(y,z) \<in> s" by auto
  from xyov obtain r u v t k where rx:"r\<parallel>x" and xu:"x\<parallel>u" and uv:"u\<parallel>v" and rt:"r\<parallel>t" and tk:"t\<parallel>k" and ty:"t\<parallel>y" and yv:"y\<parallel>v" and ku:"k\<parallel>u" using ov by blast
  from yzs obtain l1 l2 where yl1:"y\<parallel>l1" and l1l2:"l1\<parallel>l2" and zl2:"z\<parallel>l2" using s by blast
  from uv yl1 yv have "u\<parallel>l1" using M1 by blast
  with xu l1l2 obtain ul1 where xul1:"x\<parallel>ul1" and ul1l2:"ul1\<parallel>l2" using M5exist_var by blast
  from ku xu xul1 l1l2 have kul1:"k\<parallel>ul1" using M1 by blast
  from ty yzs have "t\<parallel>z" using s M1 by blast
  with rx rt xul1 ul1l2 zl2 tk kul1 have "(x,z) \<in> ov" using ov by blast
  with p show "p \<in> ov" by simp
qed

lemma cfib:"f^-1 O b \<subseteq> b" 
  apply (auto simp:f b)
  using M1 by blast

lemma cfim:"f^-1 O m \<subseteq> m"
  apply (auto simp:f m)
  using M1 by auto

lemma cfiov:"f^-1 O ov \<subseteq> ov" 
proof 
    fix p::"'a\<times>'a" assume "p \<in> f^-1 O ov" then obtain x y z where p:"p = (x,z)" and xyfi:"(x,y)\<in> f^-1" and yzov:"(y,z) \<in> ov" by auto
    from xyfi yzov obtain t' r u   where tpr:"t'\<parallel>r" and ry:"r\<parallel>y" and yu:"y\<parallel>u" and tpx:"t'\<parallel>x" and xu:"x\<parallel>u"  using f  by blast
    from yzov  ry  obtain v k t u' where yup:"y\<parallel>u'" and upv:"u'\<parallel>v" and rk:"r\<parallel>k" and kz:"k\<parallel>z" and zv:"z\<parallel>v" and kt:"k\<parallel>t" and tup:"t\<parallel>u'" 
    using ov using M1 by blast
    from yu xu yup have xup:"x\<parallel>u'" using M1 by blast
    from tpr rk kt obtain r' where tprp:"t'\<parallel>r'" and rpt:"r'\<parallel>t" using M5exist_var by blast
    from kt rpt kz have rpz:"r'\<parallel>z" using M1 by blast
    from tprp rpz rpt tpx xup zv upv tup have "(x,z) \<in> ov" using ov by blast
    with p show "p \<in> ov" by simp
qed

lemma cfifi:"f^-1 O f^-1 \<subseteq> f^-1"
proof
  fix x::"'a\<times>'a" assume "x \<in> f^-1 O f^-1" then obtain p q z where x:"x = (p, q)" and "(p,z) \<in> f^-1" and "(z,q) \<in> f^-1" by auto
  from \<open>(p,z) \<in> f^-1\<close> obtain k l u  where kp:"k\<parallel>p" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and pu:"p\<parallel>u" and zu:"z\<parallel>u"  using f  by blast
  from \<open>(z,q) \<in> f^-1\<close> obtain k' u' l' where kpz:"k'\<parallel>z" and kplp:"k'\<parallel>l'" and lpq:"l'\<parallel>q" and qup:"q\<parallel>u'" and zup:"z\<parallel>u'"  using f  by blast
  from zu zup pu have "p\<parallel>u'" using M1 by blast
  from lz kpz kplp have "l\<parallel>l'" using M1 by blast
  with kl lpq obtain ll where "k\<parallel>ll" and "ll\<parallel>q" using M5exist_var by blast
  with kp \<open>p\<parallel>u'\<close> qup show "x \<in> f^-1" using x f by blast
qed

lemma cfidi:"f^-1 O d^-1 \<subseteq> d^-1"
proof
  fix x::"'a\<times>'a" assume "x : f^-1 O d^-1" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> f^-1" and "(z,q) \<in> d^-1" by auto
  then obtain k l u where kp:"k \<parallel> p" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and pu:"p \<parallel>u" and  zu:"z\<parallel>u" using f  by blast
  obtain k' l' u' v' where kpz:"k' \<parallel>z" and kplp:"k' \<parallel>l'" and lpq:"l' \<parallel>q" and  qup:"q \<parallel>u'" and  upvp:"u'\<parallel>v'" and zvp:"z\<parallel>v'" using d \<open>(z,q)\<in>d^-1\<close> by blast
  from lz kpz kplp have "l\<parallel>l'" using M1 by blast
  with kl lpq obtain ll where "k\<parallel>ll" and "ll\<parallel>q" using M5exist_var by blast
  moreover from zu zvp upvp have "u' \<parallel> u " using M1 by blast
  ultimately show "x \<in> d^-1" using x kp pu qup d  by blast
qed

lemma cfis:"f^-1 O s \<subseteq> ov"
proof
   fix x::"'a\<times>'a" assume "x \<in> f^-1 O s" then obtain p q z where x:"x = (p,q)" and "(p,z)\<in> f^-1" and "(z,q) \<in> s" by auto
   from \<open>(p,z)\<in> f^-1\<close> obtain k l u where kp:"k\<parallel>p" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and pu:"p\<parallel>u" and zu:"z\<parallel>u" using f by blast
   from \<open>(z,q)\<in> s\<close> obtain k' u' v' where kpz:"k'\<parallel>z" and kpq:"k'\<parallel>q" and zup:"z\<parallel>u'" and upvp:"u'\<parallel>v'" and qvp:"q\<parallel>v'" using s M1 by blast
   from pu zu zup have pup:"p\<parallel>u'" using M1 by blast
   moreover from lz kpz kpq have lq:"l\<parallel>q" using M1 by blast
   ultimately show "x \<in> ov" using x lz zup kp kl upvp upvp ov qvp by blast
qed

lemma cfisi:"f^-1 O s^-1 \<subseteq> d^-1"
proof
  fix x::"'a\<times>'a" assume "x \<in> f^-1 O s^-1" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> f^-1" and "(z,q) \<in> s^-1" by auto
  then obtain k l u where kp:"k \<parallel> p" and kl:"k\<parallel>l" and lz:"l\<parallel>z"  and pu:"p \<parallel>u" and  zu:"z\<parallel>u" using f  by blast
  obtain k' u' v' where kpz:"k' \<parallel>z" and kpq:"k' \<parallel>q" and qup:"q \<parallel>u'" and  upvp:"u'\<parallel>v'" and  zvp:"z\<parallel>v'" using s \<open>(z,q): s^-1\<close> by blast
  from zu zvp upvp have "u'\<parallel>u" using M1 by blast
  moreover from lz kpz kpq have "l \<parallel>q " using M1 by blast
  ultimately show "x \<in> d^-1" using x d kl kp qup  pu  by blast
qed

lemma cdifi:"d^-1 O f^-1 \<subseteq> d^-1"
proof
  fix x::"'a\<times>'a" assume "x : d^-1 O f^-1" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> d^-1" and "(z,q) \<in> f^-1" by auto
  then obtain k l u v  where kp:"k \<parallel> p" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and zu:"z \<parallel>u" and uv:"u\<parallel>v" and pv:"p\<parallel>v" using d  by blast
  obtain k' l' u' where kpz:"k' \<parallel>z" and kplp:"k' \<parallel>l'" and lpq:"l' \<parallel>q" and  qup:"q \<parallel>u'" and zup:"z\<parallel>u'" using f \<open>(z,q): f^-1\<close> by blast
  from lz kpz kplp  have "l\<parallel>l'" using M1 by blast
  with kl lpq obtain ll where "k\<parallel>ll" and "ll\<parallel>q" using M5exist_var by blast
  moreover from zu qup zup have "q \<parallel> u " using M1 by blast
  ultimately show "x \<in> d^-1" using x d kp uv pv  by blast
qed

lemma cdidi:"d^-1 O d^-1 \<subseteq> d^-1" 
proof
  fix x::"'a\<times>'a" assume "x : d^-1 O d^-1" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> d^-1" and "(z,q) \<in> d^-1" by auto
  then obtain k l u v where kp:"k \<parallel> p" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and zu:"z \<parallel>u" and uv:"u\<parallel>v" and pv:"p\<parallel>v" using d  by blast
  obtain k' l' u' v' where kpz:"k' \<parallel>z" and kplp:"k' \<parallel>l'" and lpq:"l' \<parallel>q" and  qup:"q \<parallel>u'" and upvp:"u' \<parallel>v'" and zvp:"z \<parallel>v'" using d \<open>(z,q): d^-1\<close> by blast
  from lz kpz kplp  have "l\<parallel>l'" using M1 by blast
  with kl lpq obtain ll where "k\<parallel>ll" and "ll\<parallel>q" using M5exist_var by blast
  moreover from zvp zu upvp have "u' \<parallel> u " using M1 by blast
  moreover with qup uv obtain uu where "q\<parallel>uu" and "uu\<parallel>v" using M5exist_var  by blast
  ultimately show "x \<in> d^-1" using x d kp pv   by blast
qed

lemma cdisi:"d^-1 O s^-1 \<subseteq> d^-1"
proof
  fix x::"'a\<times>'a" assume "x : d^-1 O s^-1" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> d^-1" and "(z,q) \<in> s^-1" by auto
  then obtain k l  u v where kp:"k \<parallel>p" and kl:"k\<parallel>l"  and lz:"l\<parallel>z" and zu:"z\<parallel>u" and uv:"u\<parallel>v" and pv:"p\<parallel>v" using d by blast
  obtain k' u' v' where kpz:"k' \<parallel>z" and kpq:"k' \<parallel>q" and  qup:"q \<parallel>u'" and upvp:"u' \<parallel>v'" and zvp:"z \<parallel>v'" using s \<open>(z,q): s^-1\<close> by blast
  from upvp zvp zu have "u'\<parallel>u" using M1 by blast
  with qup uv obtain uu where "q\<parallel>uu" and "uu\<parallel>v" using M5exist_var by blast
  moreover from kpz lz kpq have "l \<parallel>q " using M1 by blast
  ultimately show "x \<in> d^-1" using x d kp kl pv  by blast
qed

lemma csb:"s O b \<subseteq> b"
apply (auto simp:s b)
using M1 M5exist_var by blast

lemma csm:"s O m \<subseteq> b"
apply (auto simp:s m b)
using M1 by blast

lemma css:"s O s \<subseteq> s"
proof
  fix x::"'a\<times>'a" assume "x \<in> s O s" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> s" and "(z,q) \<in> s" by auto
  from \<open>(p,z) \<in> s\<close> obtain k u v where kp:"k\<parallel>p" and kz:"k\<parallel>z" and pu:"p\<parallel>u" and uv:"u\<parallel>v" and zv:"z\<parallel>v" using s by blast
  from \<open>(z,q) \<in> s\<close> obtain k' u' v' where kpq:"k'\<parallel>q" and kpz:"k'\<parallel>z" and zup:"z\<parallel>u'" and upvp:"u'\<parallel>v'" and qvp:"q\<parallel>v'" using s by blast
  from kp kpz kz have "k'\<parallel>p" using M1 by blast
  moreover from uv zup zv have "u\<parallel>u'" using M1 by blast
  moreover with pu upvp obtain uu where "p\<parallel>uu" and "uu\<parallel>v'" using M5exist_var by blast
  ultimately show "x \<in> s" using x s kpq qvp  by blast
qed

lemma csifi:"s^-1 O f^-1 \<subseteq> d^-1"
proof
  fix x::"'a\<times>'a" assume "x : s^-1 O f^-1" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> s^-1" and "(z,q) \<in> f^-1" by auto
  then obtain k u v where kp:"k \<parallel> p" and kz:"k\<parallel>z" and zu:"z \<parallel>u" and uv:"u\<parallel>v" and pv:"p\<parallel>v" using s  by blast
  obtain k' l' u' where kpz:"k' \<parallel>z" and kplp:"k' \<parallel>l'" and lpq:"l' \<parallel>q"  and zup:"z\<parallel>u'" and qup:"q\<parallel>u'" using f \<open>(z,q): f^-1\<close> by blast
  from kz kpz kplp have "k\<parallel>l'" using M1 by blast
  moreover from qup zup zu have "q \<parallel> u " using M1 by blast
  ultimately show "x \<in> d^-1" using x d kp lpq pv uv by blast
qed

lemma csidi:"s^-1 O d^-1 \<subseteq> d^-1"
proof
  fix x::"'a\<times>'a" assume "x : s^-1 O d^-1" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> s^-1" and "(z,q) \<in> d^-1" by auto
  then obtain k u v where kp:"k \<parallel> p" and kz:"k\<parallel>z"  and zu:"z \<parallel>u" and uv:"u\<parallel>v" and pv:"p\<parallel>v" using s  by blast
  obtain k' l' u' v' where kpz:"k' \<parallel>z" and kplp:"k' \<parallel>l'" and lpq:"l'\<parallel>q" and qup:"q \<parallel>u'" and upvp:"u' \<parallel>v'" and zvp:"z\<parallel>v'" using d \<open>(z,q): d^-1\<close> by blast
  from zvp upvp zu have "u'\<parallel>u" using M1 by blast
  with qup uv obtain uu where "q\<parallel>uu" and "uu\<parallel>v" using M5exist_var by blast
  moreover from kz kpz kplp have "k \<parallel>l' " using M1 by blast
  ultimately show "x \<in> d^-1" using x d kp lpq pv  by blast
qed

lemma cdb:"d O b \<subseteq> b"
apply (auto simp:d b)
using M1 M5exist_var by blast

lemma cdm:"d O m \<subseteq> b"
apply (auto simp:d m b)
using M1 by blast

lemma cfb:"f O b \<subseteq> b"
apply (auto simp:f b)
using M1 by blast

lemma cfm:"f O m \<subseteq> m"
proof 
  fix x::"'a\<times>'a" assume "x \<in> f O m" then obtain p q z where x:"x = (p,q)" and 1:"(p,z) \<in> f" and 2:"(z,q) \<in> m" by auto
  from 1 obtain u where pu:"p\<parallel>u" and zu:"z\<parallel>u" using f by auto
  with 2   have "(p,q) \<in> m" using M1 m by blast
  thus "x\<in> m" using x by auto
qed


(* ========= $\alpah_1$ compositions ============ *)
subsection \<open>$\alpha$-composition\<close>
text \<open>We prove compositions of the form $r_1 \circ r_2 \subseteq s \cup ov \cup d$.\<close>


lemma (in arelations) cmd:"m O d \<subseteq> s \<union> ov \<union> d"
proof 
  fix x::"'a\<times>'a" assume a:"x \<in> m O d" then obtain p q z where x:"x =(p,q)" and 1:"(p,z) \<in> m" and 2:"(z,q) \<in> d" by auto
  then obtain k l u v  where pz:"p\<parallel>z" and kq:"k\<parallel>q" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and zu:"z\<parallel>u" and uv:"u\<parallel>v" and qv:"q\<parallel>v" using m d by blast
  obtain k' where kpp:"k'\<parallel>p" using M3 meets_wd pz by blast
  from pz zu uv obtain zu where pzu:"p\<parallel>zu" and zuv:"zu\<parallel>v" using M5exist_var  by blast
  from kpp kq have "k'\<parallel>q \<oplus> ((\<exists>t. k'\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast 
  then have "(?A\<and>\<not>?B\<and>\<not>?C)\<or>(\<not>?A\<and>?B\<and>\<not>?C)\<or>(\<not>?A\<and>\<not>?B\<and>?C)"  using local.meets_atrans xor_distr_L[of ?A ?B ?C]  by blast
  thus "x \<in> s \<union> ov \<union> d"    
  proof (elim disjE)
    {assume "(?A\<and>\<not>?B\<and>\<not>?C)" then have "?A" by simp 
     then have "(p,q) \<in> s" using  s qv kpp pzu zuv by blast
     thus ?thesis using x by simp }
    next
    {assume "(\<not>?A\<and>?B\<and>\<not>?C)" then have "?B" by simp
     then obtain t where kpt:"k'\<parallel>t" and tq:"t\<parallel>q" by auto
     moreover from kq kl tq have "t\<parallel>l" using M1 by blast
     moreover from lz pz pzu have "l\<parallel>zu" using M1 by blast
     ultimately have "(p,q) \<in> ov" using ov kpp qv pzu zuv by blast
     thus ?thesis using x by simp}
    next
    {assume "(\<not>?A\<and>\<not>?B\<and>?C)" then have "?C" by simp
     then obtain t where kt:"k\<parallel>t" and tp:"t\<parallel>p" by auto
     with kq pzu zuv qv  have "(p,q)\<in>d" using d by blast
     thus ?thesis using x by simp}
  qed
qed

lemma (in arelations) cmf:"m O f \<subseteq> s \<union> ov \<union> d"
proof
  fix x::"'a\<times>'a" assume a:"x \<in> m O f" then obtain p q z where x:"x =(p,q)" and 1:"(p,z) \<in> m" and 2:"(z,q) \<in> f" by auto
  then obtain k l u   where pz:"p\<parallel>z" and kq:"k\<parallel>q" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and zu:"z\<parallel>u" and qu:"q\<parallel>u" using m f by blast
  obtain k' where kpp:"k'\<parallel>p" using M3 meets_wd pz by blast
  from kpp kq have "k'\<parallel>q \<oplus> ((\<exists>t. k'\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast 
  then have "(?A\<and>\<not>?B\<and>\<not>?C)\<or>(\<not>?A\<and>?B\<and>\<not>?C)\<or>(\<not>?A\<and>\<not>?B\<and>?C)" using local.meets_atrans xor_distr_L[of ?A ?B ?C]  by blast
  thus "x \<in> s \<union> ov \<union> d"    
  proof (elim disjE)
    {assume "(?A\<and>\<not>?B\<and>\<not>?C)" then have "?A" by simp 
     then have "(p,q) \<in> s" using  s qu kpp pz zu by blast
     thus ?thesis using x by simp }
    next
    {assume "(\<not>?A\<and>?B\<and>\<not>?C)" then have "?B" by simp
     then obtain t where kpt:"k'\<parallel>t" and tq:"t\<parallel>q" by auto
     moreover from kq kl tq have "t\<parallel>l" using M1 by blast 
     moreover from lz pz pz have "l\<parallel>z" using M1 by blast
     ultimately have "(p,q) \<in> ov" using ov kpp qu pz zu by blast
     thus ?thesis using x by simp}
    next
    {assume "(\<not>?A\<and>\<not>?B\<and>?C)" then have "?C" by simp
     then obtain t where kt:"k\<parallel>t" and tp:"t\<parallel>p" by auto
     with kq pz zu qu  have "(p,q)\<in>d" using d by blast
     thus ?thesis using x by simp}
  qed
qed

lemma cmovi:"m O ov^-1  \<subseteq> s \<union> ov \<union> d"
proof 
  fix x::"'a\<times>'a" assume a:"x \<in> m O ov^-1" then obtain p q z where x:"x =(p,q)" and 1:"(p,z) \<in> m" and 2:"(z,q) \<in> ov^-1" by auto
  then obtain k l c u v  where pz:"p\<parallel>z" and kq:"k\<parallel>q" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and qu:"q\<parallel>u" and uv:"u\<parallel>v" and zv:"z\<parallel>v" and lc:"l\<parallel>c" and cu:"c\<parallel>u" using m ov by blast
  obtain k' where kpp:"k'\<parallel>p" using M3 meets_wd pz by blast
  from lz lc pz have pc:"p\<parallel>c" using M1 by auto
  from kpp kq have "k'\<parallel>q \<oplus> ((\<exists>t. k'\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast 
  then have "(?A\<and>\<not>?B\<and>\<not>?C)\<or>(\<not>?A\<and>?B\<and>\<not>?C)\<or>(\<not>?A\<and>\<not>?B\<and>?C)" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> s \<union> ov \<union> d"    
  proof (elim disjE)
    {assume "(?A\<and>\<not>?B\<and>\<not>?C)" then have "?A" by simp 
     then have "(p,q) \<in> s" using s kpp qu cu pc by blast
     thus ?thesis using x by simp }
    next
    {assume "(\<not>?A\<and>?B\<and>\<not>?C)" then have "?B" by simp
     then obtain t where kpt:"k'\<parallel>t" and tq:"t\<parallel>q" by auto
     moreover from kq kl tq have "t\<parallel>l" using M1 by auto
     ultimately have "(p,q) \<in> ov" using ov kpp qu cu lc pc by blast
     thus ?thesis using x by simp}
    next
    {assume "(\<not>?A\<and>\<not>?B\<and>?C)" then have "?C" by simp
     then obtain t where kt:"k\<parallel>t" and tp:"t\<parallel>p" by auto
     then  have "(p,q)\<in>d" using d kq cu qu pc by blast
     thus ?thesis using x by simp}
  qed
qed

lemma covd:"ov O d \<subseteq> s \<union> ov \<union> d"
proof
  fix x::"'a\<times>'a" assume "x \<in> ov O d" then obtain p q z where x:"x=(p,q)" and "(p,z) \<in> ov" and "(z,q) \<in> d" by auto
  from \<open>(p,z) \<in> ov\<close> obtain k u v l c where kp:"k\<parallel>p" and pu:"p\<parallel>u" and uv:"u\<parallel>v" and zv:"z\<parallel>v" and lc:"l\<parallel>c" and cu:"c\<parallel>u" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and cu:"c\<parallel>u" using ov by blast
  from \<open>(z,q) \<in> d\<close> obtain k' l' u' v' where kpq:"k'\<parallel>q" and kplp:"k'\<parallel>l'" and lpz:"l'\<parallel>z" and qvp:"q\<parallel>v'" and zup:"z\<parallel>u'" and upvp:"u'\<parallel>v'" using d by blast
  from uv zv zup have "u\<parallel>u'" using M1 by auto
  from pu upvp obtain uu where puu:"p\<parallel>uu" and uuvp:"uu\<parallel>v'" using \<open>u\<parallel>u'\<close> using M5exist_var by blast
  from kp kpq have "k\<parallel>q \<oplus> ((\<exists>t. k\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in>  s \<union> ov \<union> d"
  proof (elim disjE)
    { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
      then have "(p,q) \<in> s" using s kp qvp puu uuvp by blast
      thus ?thesis using x by blast}
    next
    { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
      then obtain t where kt:"k\<parallel>t" and tq:"t\<parallel>q" by auto
      from cu pu puu have "c\<parallel>uu" using M1 by auto
      moreover from kpq tq kplp have "t\<parallel>l'" using M1 by auto
      moreover from lpz lz lc have lpc:"l'\<parallel>c" using M1 by auto
      ultimately obtain lc where "t\<parallel>lc" and "lc\<parallel>uu" using M5exist_var by blast
      then have "(p,q) \<in> ov" using ov kp kt tq puu uuvp qvp  by blast
      thus ?thesis using x by auto}
    next
    { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
      then obtain t where "k'\<parallel>t" and "t\<parallel>p" by auto
      with puu uuvp qvp kpq have "(p,q) \<in> d" using d by blast
      thus ?thesis using x by auto}
  qed
qed


lemma covf:"ov O f \<subseteq> s \<union> ov \<union> d"
proof
  fix x::"'a\<times>'a" assume "x \<in> ov O f" then obtain p q z where x:"x=(p,q)" and "(p,z) \<in> ov" and "(z,q) \<in> f" by auto
  from \<open>(p,z) \<in> ov\<close> obtain k u v l c where kp:"k\<parallel>p" and pu:"p\<parallel>u" and uv:"u\<parallel>v" and zv:"z\<parallel>v" and lc:"l\<parallel>c" and cu:"c\<parallel>u" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and cu:"c\<parallel>u" using ov by blast
  from \<open>(z,q) \<in> f\<close> obtain k' l' u'  where kpq:"k'\<parallel>q" and kplp:"k'\<parallel>l'" and lpz:"l'\<parallel>z" and qup:"q\<parallel>u'" and zup:"z\<parallel>u'" using f by blast
  from uv zv zup have uu:"u\<parallel>u'" using M1 by auto
  from kp kpq have "k\<parallel>q \<oplus> ((\<exists>t. k\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in>  s \<union> ov \<union> d"
  proof (elim disjE)
    { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
      then have "(p,q) \<in> s" using s kp qup uu pu by blast
      thus ?thesis using x by blast}
    next
    { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
      then obtain t where kt:"k\<parallel>t" and tq:"t\<parallel>q" by auto
      moreover from kpq tq kplp have "t\<parallel>l'" using M1 by auto
      moreover from lpz lz lc have lpc:"l'\<parallel>c" using M1 by auto
      ultimately obtain lc where "t\<parallel>lc" and "lc\<parallel>u" using cu M5exist_var by blast
      then have "(p,q) \<in> ov" using ov kp kt tq pu uu qup  by blast
      thus ?thesis using x by auto}
    next
    { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
      then obtain t where "k'\<parallel>t" and "t\<parallel>p" by auto
      with pu uu qup kpq have "(p,q) \<in> d" using d by blast
      thus ?thesis using x by auto}
  qed
qed

lemma cfid:"f^-1 O d \<subseteq> s \<union> ov \<union> d"
proof
  fix x::"'a\<times>'a" assume "x \<in> f^-1 O d" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> f^-1" and "(z,q)\<in> d" by auto
  from \<open>(p,z) \<in> f^-1\<close> obtain k l u where "k\<parallel>l" and "l\<parallel>z" and kp:"k\<parallel>p" and pu:"p\<parallel>u" and zu:"z\<parallel>u" using f by blast
  from \<open>(z,q) \<in> d\<close> obtain k' l' u' v where kplp:"k'\<parallel>l'" and kpq:"k'\<parallel>q" and lpz:"l'\<parallel>z" and zup:"z\<parallel>u'" and upv:"u'\<parallel>v" and qv:"q\<parallel>v" using d by blast
  from pu zu zup have pup:"p\<parallel>u'" using M1 by blast
  from kp kpq have "k\<parallel>q \<oplus> ((\<exists>t. k\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> s \<union> ov \<union> d"
  proof (elim disjE)
    { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
      with pup upv kp qv have "(p,q) \<in> s" using s by blast
      thus ?thesis using x by auto}
    next
    { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
      then obtain t where kt:"k\<parallel>t" and tq:"t\<parallel>q" by auto
      from tq kpq kplp have "t\<parallel>l'" using M1 by blast
      with lpz zup obtain lpz where "t\<parallel>lpz" and "lpz\<parallel>u'" using M5exist_var by blast
      with kp pup upv kt tq qv have "(p,q)\<in>ov" using ov by blast
      thus ?thesis using x by blast}
       next
    { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
      then obtain t where "k'\<parallel>t" and "t\<parallel>p" by auto
      with pup upv kpq qv have "(p,q) \<in> d" using d by blast
      thus ?thesis using x by auto}
    qed
qed

lemma cfov:"f O ov \<subseteq> ov \<union> s \<union> d"
proof
    fix x::"'a\<times>'a" assume "x \<in> f O ov" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> f" and "(z,q)\<in> ov" by auto
    from \<open>(p,z) \<in> f\<close> obtain  k l u where "k\<parallel>l" and kz:"k\<parallel>z" and lp:"l\<parallel>p" and pu:"p\<parallel>u" and zu:"z\<parallel>u" using f by blast
    from \<open>(z,q) \<in> ov\<close> obtain k' l' c  u' v where "k'\<parallel>l'" and kpz:"k'\<parallel>z" and lpq:"l'\<parallel> q" and  zup:"z\<parallel>u'" and upv:"u'\<parallel>v" and qv:"q\<parallel>v" and lpc:"l'\<parallel>c" and cup:"c\<parallel>u'"  using  ov by blast
    from pu zu zup have pup:"p\<parallel>u'" using M1 by blast
    from lp lpq have "l\<parallel>q \<oplus> ((\<exists>t. l\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. l'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
    then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
    thus "x \<in> ov \<union> s \<union> d"
    proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with  lp pup upv qv have "(p,q) \<in> s" using s by blast
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
      then obtain t where lt:"l\<parallel>t" and tq:"t\<parallel>q" by auto
      from tq lpq lpc have "t\<parallel>c" using M1 by blast
      with lp lt tq pup upv qv cup have "(p,q)\<in>ov" using ov by blast
      thus ?thesis using x by blast}
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
      then obtain t where "l'\<parallel>t" and "t\<parallel>p" by auto
      with lpq pup upv qv have "(p,q) \<in> d" using d by blast
      thus ?thesis using x by auto}
    qed
qed

(* ========= $\alpha_2$ composition ========== *)
text \<open>We prove compositions of the form $r_1 \circ r_2 \subseteq ov \cup f^{-1} \cup d^{-1}$.\<close>

lemma covsi:"ov O s^-1 \<subseteq> ov \<union> f^-1 \<union> d^-1"
proof
    fix x::"'a\<times>'a" assume "x \<in> ov O s^-1" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> ov" and "(z,q) \<in> s^-1" by auto
    from \<open>(p,z) \<in> ov\<close> obtain k l c u  where kp:"k\<parallel>p" and pu:"p\<parallel>u" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and lc:"l\<parallel>c" and cu:"c\<parallel>u" using ov by blast
    from \<open>(z,q) \<in> s^-1\<close> obtain k' u' v' where kpz:"k'\<parallel>z" and kpq:"k'\<parallel>q" and kpz:"k'\<parallel>z" and  zup:"z\<parallel>u'"  and qvp:"q\<parallel>v'" using s by blast
    from lz kpz kpq have lq:"l\<parallel>q" using M1 by blast
    from pu qvp have "p\<parallel>v' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>v') \<oplus> (\<exists>t. q\<parallel>t \<and> t\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
    then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
    thus "x \<in> ov \<union> f^-1 \<union> d^-1"
    proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with qvp kp kl lq have "(p,q) \<in> f^-1" using f by blast
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where ptp:"p\<parallel>t" and "t\<parallel>v'" by auto
        moreover with pu cu have "c\<parallel>t" using M1 by blast
        ultimately have "(p,q)\<in> ov" using kp kl lc cu lq qvp  ov by blast
        thus ?thesis using x by auto}        
     next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where qt:"q\<parallel>t" and "t\<parallel>u" by auto
        with kp kl lq pu  have "(p,q) \<in> d^-1" using d by blast 
        thus ?thesis using x by auto}
      qed
qed


lemma cdim:"d^-1 O m \<subseteq>  ov \<union> d^-1 \<union> f^-1"
proof 
    fix x::"'a\<times>'a" assume "x \<in> d^-1 O m" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> d^-1" and "(z,q) \<in> m" by auto
    from \<open>(p,z) \<in> d^-1\<close> obtain k l u v where kp:"k\<parallel>p" and pv:"p\<parallel>v" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and zu:"z\<parallel>u" and uv:"u\<parallel>v" using d by blast
    from \<open>(z,q) \<in> m\<close>  have zq:"z\<parallel>q" using m by blast
    obtain v' where qvp:"q\<parallel>v'" using M3 meets_wd zq by blast
    from kl lz zq obtain lz where klz:"k\<parallel>lz" and lzq:"lz\<parallel>q" using M5exist_var  by blast
    from pv qvp have "p\<parallel>v' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>v') \<oplus> (\<exists>t. q\<parallel>t \<and> t\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
    then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
    thus "x \<in>  ov \<union> d^-1 \<union> f^-1"
    proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with qvp kp klz lzq\<open>?A\<close> have "(p,q) \<in> f^-1" using f by blast
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where pt:"p\<parallel>t" and tvp:"t\<parallel>v'" by auto
        from zq lzq zu have "lz\<parallel>u" using M1 by auto
        moreover from pt pv uv have "u\<parallel>t" using M1 by auto
        ultimately have "(p,q)\<in> ov" using kp klz lzq pt tvp qvp ov by blast
        thus ?thesis using x by auto}        
     next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where qt:"q\<parallel>t" and "t\<parallel>v" by auto
        with kp klz lzq pv have "(p,q) \<in> d^-1" using d by blast 
        thus ?thesis using x by auto}
      qed
qed

lemma cdiov:"d^-1 O ov \<subseteq> ov \<union> f^-1 \<union> d^-1"
proof
    fix x::"'a\<times>'a" assume "x \<in> d^-1 O ov" then obtain p q r where x:"x = (p,r)" and "(p,q) \<in> d^-1" and "(q,r) \<in> ov" by auto
    from \<open>(p,q) \<in> d^-1\<close> obtain u v k l  where kp:"k\<parallel>p" and pv:"p\<parallel>v" and kl:"k\<parallel>l" and lq:"l\<parallel>q"  and qu:"q\<parallel>u" and uv:"u\<parallel>v" using d by blast
    from \<open>(q,r) \<in> ov\<close> obtain k' l' t u' v' where lpr:"l'\<parallel>r" and kpq:"k'\<parallel>q" and kplp:"k'\<parallel>l'" and qup:"q\<parallel>u'" and "u'\<parallel>v'" and rvp:"r\<parallel>v'" and lpt:"l'\<parallel>t" and tup:"t\<parallel>u'" using ov by blast
    from lq kplp kpq have "l\<parallel>l'" using M1 by blast
    with kl lpr  obtain ll where  kll:"k\<parallel>ll" and llr:"ll\<parallel>r"  using M5exist_var by blast
    from pv rvp have "p\<parallel>v' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>v') \<oplus> (\<exists>t'. r\<parallel>t' \<and> t'\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
    then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
    thus "x \<in> ov \<union> f^-1 \<union> d^-1"
    proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with rvp llr kp kll have "(p,r) \<in> f^-1" using f by blast
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t' where ptp:"p\<parallel>t'" and tpvp:"t'\<parallel>v'" by auto
        moreover from lpt lpr llr have llt:"ll\<parallel>t" using M1 by blast
        moreover from ptp uv pv have utp:"u\<parallel>t'" using M1 by blast
        moreover from qu tup qup have "t\<parallel>u" using M1 by blast
        moreover with utp llt obtain tu where "ll\<parallel>tu" and "tu\<parallel>t'" using M5exist_var by blast
        with kp ptp tpvp kll llr rvp  have "(p,r)\<in> ov" using  ov by blast
        thus ?thesis using x by auto}        
     next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t' where rtp:"r\<parallel>t'" and "t'\<parallel>v" by auto
        with kll llr kp pv have "(p,r) \<in> d^-1" using d by blast 
        thus ?thesis using x by auto}
      qed
qed

lemma cdis:"d^-1 O s \<subseteq> ov \<union> f^-1 \<union> d^-1"
proof
  fix x::"'a\<times>'a" assume "x \<in> d^-1 O s" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> d^-1" and "(z,q) \<in> s" by auto
  from \<open>(p,z)\<in>d^-1\<close> obtain k l u v where kl:"k\<parallel>l" and lz:"l\<parallel>z" and kp:"k\<parallel>p" and zu:"z\<parallel>u" and uv:"u\<parallel>v" and pv:"p\<parallel>v" using d by blast
  from \<open>(z,q) \<in> s\<close> obtain l'  v' where lpz:"l'\<parallel>z" and lpq:"l'\<parallel>q" and qvp:"q\<parallel>v'" using s by blast
  from lz lpz lpq have lq:"l\<parallel>q" using M1 by blast
  from pv qvp have "p\<parallel>v' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>v') \<oplus> (\<exists>t. q\<parallel>t \<and> t\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> ov \<union> f^-1 \<union> d^-1"
    proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with kl lq qvp kp have "(p,q) \<in> f^-1" using f by blast
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where pt:"p\<parallel>t" and tvp:"t\<parallel>v'" by auto
        from pt pv uv have "u\<parallel>t" using M1 by blast
        with lz zu obtain zu where "l\<parallel>zu" and "zu\<parallel>t" using M5exist_var by blast
        with kp pt tvp kl lq qvp have "(p,q) \<in> ov" using ov by blast
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "q\<parallel>t" and "t\<parallel>v" by auto
        with kl lq kp pv have "(p,q)\<in>d^-1" using d by blast
        thus ?thesis using x by auto}
      qed
qed

lemma csim:"s^-1 O m \<subseteq> ov \<union> f^-1 \<union> d^-1"
proof 
  fix x::"'a\<times>'a" assume "x \<in> s^-1 O m" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> s^-1" and "(z,q) \<in> m" by auto
  from \<open>(p,z)\<in>s^-1\<close> obtain k u v where kp:"k\<parallel>p" and kz:"k\<parallel>z" and zu:"z\<parallel>u" and uv:"u\<parallel>v" and pv:"p\<parallel>v" using s by blast
  from \<open>(z,q) \<in> m\<close> have zq:"z\<parallel>q" using m by auto
  obtain v' where qvp:"q\<parallel>v'" using M3 meets_wd zq by blast
  from pv qvp have "p\<parallel>v' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>v') \<oplus> (\<exists>t. q\<parallel>t \<and> t\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> ov \<union> f^-1 \<union> d^-1"
    proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with kp kz zq qvp have "(p,q) \<in> f^-1" using f by blast
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where pt:"p\<parallel>t" and tvp:"t\<parallel>v'" by auto
        from pt pv uv have "u\<parallel>t" using M1 by blast
        with kp pt tvp kz zq qvp zu  have "(p,q) \<in> ov" using ov by blast
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "q\<parallel>t" and "t\<parallel>v" by auto
        with kp kz zq pv have "(p,q)\<in>d^-1" using d by blast
        thus ?thesis using x by auto}
      qed
qed
 
lemma csiov:"s^-1 O ov \<subseteq> ov \<union> f^-1 \<union> d^-1"
proof 
  fix x::"'a\<times>'a" assume "x \<in> s^-1 O ov" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> s^-1" and "(z,q) \<in> ov" by auto
  from \<open>(p,z)\<in>s^-1\<close> obtain k u v where kp:"k\<parallel>p" and kz:"k\<parallel>z" and zu:"z\<parallel>u" and uv:"u\<parallel>v" and pv:"p\<parallel>v" using s by blast
  from \<open>(z,q) \<in> ov\<close> obtain k' l' u' v' c where kpz:"k'\<parallel>z" and zup:"z\<parallel>u'" and upvp:"u'\<parallel>v'" and kplp:"k'\<parallel>l'" and lpq:"l'\<parallel>q" and qvp:"q\<parallel>v'" and lpc:"l'\<parallel>c" and cup:"c\<parallel>u'" using ov by blast
  from kz kpz kplp have klp:"k\<parallel>l'" using M1 by auto
  from pv qvp have "p\<parallel>v' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>v') \<oplus> (\<exists>t. q\<parallel>t \<and> t\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> ov \<union> f^-1 \<union> d^-1"
    proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with kp kplp lpq qvp klp have "(p,q) \<in> f^-1" using f by blast
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where pt:"p\<parallel>t" and tvp:"t\<parallel>v'" by auto
        from pt pv uv have "u\<parallel>t" using M1 by blast
        moreover from cup zup zu have cu:"c\<parallel>u" using M1 by auto
        ultimately obtain cu where "l'\<parallel>cu" and "cu\<parallel>t" using lpc M5exist_var by blast
        with kp pt tvp klp lpq qvp have "(p,q) \<in> ov" using ov by blast
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "q\<parallel>t" and "t\<parallel>v" by auto
        with kp klp lpq pv have "(p,q)\<in>d^-1" using d by blast
        thus ?thesis using x by auto}
      qed
qed

lemma covim:"ov^-1 O m \<subseteq> ov \<union> f^-1 \<union> d^-1"
proof
    fix x::"'a\<times>'a" assume "x \<in> ov^-1 O m" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> ov^-1" and "(z,q) \<in> m" by auto
    from \<open>(p,z) \<in> ov^-1\<close> obtain k l c u v  where kz:"k\<parallel>z" and zu:"z\<parallel>u" and kl:"k\<parallel>l" and lp:"l\<parallel>p" and lc:"l\<parallel>c" and cu:"c\<parallel>u" and pv:"p\<parallel>v" and uv:"u\<parallel>v" using ov by blast
    from \<open>(z,q) \<in> m\<close>  have zq:"z\<parallel>q" using m by auto
    obtain v' where qvp:"q\<parallel>v'" using M3 meets_wd zq by blast
    from zu zq cu have cq:"c\<parallel>q" using M1 by blast
    from pv qvp have "p\<parallel>v' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>v') \<oplus> (\<exists>t. q\<parallel>t \<and> t\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
    then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
    thus "x \<in> ov \<union> f^-1 \<union> d^-1"
    proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with lp lc cq qvp have "(p,q) \<in> f^-1" using f by blast
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where ptp:"p\<parallel>t" and "t\<parallel>v'" by auto
        moreover with pv uv have "u\<parallel>t" using M1 by blast
        ultimately have "(p,q)\<in> ov" using lp lc cq qvp cu ov by blast
        thus ?thesis using x by auto}        
     next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where qt:"q\<parallel>t" and "t\<parallel>v" by auto
        with lp lc cq pv have "(p,q) \<in> d^-1" using d by blast 
        thus ?thesis using x by auto}
      qed
qed

(* =========$\alpha_3$ compositions========== *)
text \<open>We prove compositions of the form $r_1 \circ r_2 \subseteq b \cup m \cup ov$.\<close>

lemma covov:"ov O ov \<subseteq> b \<union> m \<union> ov"
proof
   fix x::"'a\<times>'a" assume "x \<in> ov O ov" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> ov" and "(z,q)\<in> ov" by auto
   from \<open>(p,z) \<in> ov\<close> obtain k u l t v where kp:"k\<parallel>p" and pu:"p\<parallel>u" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and "l\<parallel>t" and "t\<parallel>u" and uv:"u\<parallel>v" and zv:"z\<parallel>v" using ov by blast
   from  \<open>(z,q) \<in> ov\<close> obtain k' l' y u' v' where kplp:"k'\<parallel>l'" and kpz:"k'\<parallel>z" and lpq:"l'\<parallel>q" and lpy:"l'\<parallel>y" and "y\<parallel>u'" and zup:"z\<parallel>u'" and upvp:"u'\<parallel>v'" and qvp:"q\<parallel>v'" using ov by blast
   from lz kplp kpz have llp:"l\<parallel>l'" using M1 by blast
   from uv zv zup have "u\<parallel>u'" using M1 by blast
   with pu upvp obtain uu where puu:"p\<parallel>uu" and uuv:"uu\<parallel>v'" using M5exist_var by blast
   from puu lpq have "p\<parallel>q \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>q) \<oplus> (\<exists>t'. l'\<parallel>t' \<and> t'\<parallel>uu))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
    then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
    thus "x \<in> b \<union> m \<union> ov"
    proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        then have "(p,q) \<in> m" using m by auto
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then have "(p,q) \<in> b" using b by auto
        thus ?thesis using x by auto}
     next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t' where lptp:"l'\<parallel>t'" and "t'\<parallel>uu" by auto
        from kl llp lpq obtain ll where  kll:"k\<parallel>ll" and llq:"ll\<parallel>q" using M5exist_var by blast
        with lpq lptp  have "ll\<parallel>t'" using M1 by blast
        with kp puu uuv kll llq qvp \<open>t'\<parallel>uu\<close> have "(p,q) \<in> ov" using ov by blast
        thus ?thesis using x by auto}
      qed
qed

lemma covfi:"ov O f^-1 \<subseteq> b \<union> m \<union> ov"
proof
   fix x::"'a\<times>'a" assume "x \<in> ov O f^-1" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> ov" and "(z,q)\<in> f^-1" by auto
   from \<open>(p,z) \<in> ov\<close> obtain k u l c v where kp:"k\<parallel>p" and pu:"p\<parallel>u" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and "l\<parallel>c" and "c\<parallel>u" and uv:"u\<parallel>v" and zv:"z\<parallel>v" using ov by blast
   from  \<open>(z,q) \<in> f^-1\<close> obtain k' l' v'  where kplp:"k'\<parallel>l'" and kpz:"k'\<parallel>z" and lpq:"l'\<parallel>q"  and qvp:"q\<parallel>v'" and zvp:"z\<parallel>v'" using f by blast
   from lz kplp kpz have llp:"l\<parallel>l'" using M1 by blast
   from  zv qvp zvp have qv:"q\<parallel>v" using M1 by blast
   from pu lpq have "p\<parallel>q \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. l'\<parallel>t \<and> t\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
    then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
    thus "x \<in> b \<union> m \<union> ov"
    proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        then have "(p,q) \<in> m" using m by auto
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then have "(p,q) \<in> b" using b by auto
        thus ?thesis using x by auto}
     next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where lptp:"l'\<parallel>t" and "t\<parallel>u" by auto
        from kl llp lpq obtain ll where  kll:"k\<parallel>ll" and llr:"ll\<parallel>q" using M5exist_var by blast
        with lpq lptp  have "ll\<parallel>t" using M1 by blast
        with kp pu uv kll llr qv \<open>t\<parallel>u\<close> have "(p,q) \<in> ov" using ov by blast
        thus ?thesis using x by auto}
      qed
qed


lemma csov:"s O ov \<subseteq> b \<union> m \<union> ov"
proof
   fix x::"'a\<times>'a" assume "x \<in> s O ov" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> s" and "(z,q)\<in> ov" by auto
   from \<open>(p,z) \<in> s\<close> obtain k u v where kp:"k\<parallel>p" and kz:"k\<parallel>z" and  pu:"p\<parallel>u" and uv:"u\<parallel>v" and zv:"z\<parallel>v" using s by blast
   from  \<open>(z,q) \<in> ov\<close> obtain k' l'  u' v'   where kpz:"k'\<parallel>z"  and kplp:"k'\<parallel>l'" and lpq:"l'\<parallel>q" and zup:"z\<parallel>u'"  and qvp:"q\<parallel>v'" and upvp:"u'\<parallel>v'" using ov by blast
   from  kz kpz kplp have klp:"k\<parallel>l'" using M1 by blast
   from  uv zv zup  have uup:"u\<parallel>u'" using M1 by blast
   with pu upvp obtain uu where puu:"p\<parallel>uu" and uuvp:"uu\<parallel>v'" using M5exist_var by blast
   from pu lpq have "p\<parallel>q \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. l'\<parallel>t \<and> t\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
   then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
   thus "x \<in> b \<union> m \<union> ov"
   proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        then have "(p,q) \<in> m" using m by auto
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then have "(p,q) \<in> b" using b by auto
        thus ?thesis using x by auto}
     next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where lpt:"l'\<parallel>t" and "t\<parallel>u" by auto
        with pu puu have "t\<parallel>uu" using M1 by blast
        with lpt kp puu uuvp klp lpq qvp  have "(p,q) \<in> ov" using ov by blast
        thus ?thesis using x by auto}
      qed
qed


lemma csfi:"s O f^-1 \<subseteq> b \<union> m \<union> ov"
proof
   fix x::"'a\<times>'a" assume "x \<in> s O f^-1" then obtain p q r where x:"x = (p,r)" and "(p,q) \<in> s" and "(q,r)\<in> f^-1" by auto
   from \<open>(p,q) \<in> s\<close> obtain k u v where kp:"k\<parallel>p" and kq:"k\<parallel>q" and  pu:"p\<parallel>u" and uv:"u\<parallel>v"  and qv:"q\<parallel>v"  using s by blast
   from  \<open>(q,r) \<in> f^-1\<close> obtain k' l  v'  where kpq:"k'\<parallel>q"  and kpl:"k'\<parallel>l" and lr:"l\<parallel>r"   and rvp:"r\<parallel>v'" and qvp:"q\<parallel>v'" using f by blast
   from kpq kpl kq have kl:"k\<parallel>l" using M1 by blast 
   from qvp qv uv have uvp:"u\<parallel>v'" using M1 by blast
   from pu lr have "p\<parallel>r \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>r) \<oplus> (\<exists>t'. l\<parallel>t' \<and> t'\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
   then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
   thus "x \<in> b \<union> m \<union> ov"
   proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        then have "(p,r) \<in> m" using m by auto
        thus ?thesis using x by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then have "(p,r) \<in> b" using b by auto
        thus ?thesis using x by auto}
     next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t' where ltp:"l\<parallel>t'" and "t'\<parallel>u" by auto
        with kp pu uvp kl lr rvp have "(p,r) \<in> ov" using ov by blast
        thus ?thesis using x by auto}
      qed
qed

(* =========$\alpha_4$ compositions========== *)
text \<open>We prove compositions of the form $r_1 \circ r_2 \subseteq f \cup f^{-1} \cup e$.\<close>

lemma cmmi:"m O m^-1 \<subseteq> f \<union> f^-1 \<union> e"
proof 
  fix x::"'a\<times>'a" assume a:"x \<in> m O m^-1" then obtain p q z where x:"x =(p,q)" and 1:"(p,z) \<in> m" and 2:"(z,q) \<in> m^-1" by auto
  then have pz:"p\<parallel>z" and qz:"q\<parallel>z" using m by auto
  obtain k k' where kp:"k\<parallel>p" and kpq:"k'\<parallel>q" using M3 meets_wd qz pz by blast
  from kp kpq have "k\<parallel>q \<oplus> ((\<exists>t. k\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast 
  then have "(?A\<and>\<not>?B\<and>\<not>?C)\<or>(\<not>?A\<and>?B\<and>\<not>?C)\<or>(\<not>?A\<and>\<not>?B\<and>?C)" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in>f \<union> f^-1 \<union> e"    
  proof (elim disjE)
    {assume "(?A\<and>\<not>?B\<and>\<not>?C)" then have "?A" by simp 
     then have "p = q" using M4 kp pz qz by blast 
     then have "(p,q) \<in> e" using e by auto
     thus ?thesis using x by simp }
    next
    {assume "(\<not>?A\<and>?B\<and>\<not>?C)" then have "?B" by simp
     then obtain t where kt:"k\<parallel>t" and tq:"t\<parallel>q" by auto
     then have "(p,q) \<in> f^-1" using f qz pz kp by blast
     thus ?thesis using x by simp}
    next
    {assume "(\<not>?A\<and>\<not>?B\<and>?C)" then have "?C" by simp
     then obtain t where kt:"k'\<parallel>t" and tp:"t\<parallel>p" by auto
     with kpq pz qz have "(p,q)\<in>f" using f by blast
     thus ?thesis using x by simp}
  qed
qed
  

lemma cfif:"f^-1 O f \<subseteq> e \<union> f^-1 \<union> f"
proof
  fix x::"'a\<times>'a" assume a:"x \<in> f^-1 O f" then obtain p q z where x:"x =(p,q)" and 1:"(p,z) \<in> f^-1" and 2:"(z,q) \<in> f" by auto
  from 1 obtain k l u where kp:"k\<parallel>p" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and zu:"z\<parallel>u" and pu:"p\<parallel>u" using f by blast
  from 2 obtain k' l' u' where kpq:"k'\<parallel>q" and kplp:"k'\<parallel>l'" and lpz:"l'\<parallel>z" and zup:"z\<parallel>u'" and qup:"q\<parallel>u'" using f by blast
  from zu zup qup have qu:"q\<parallel>u" using M1 by auto
  from kp kpq have "k\<parallel>q \<oplus> ((\<exists>t. k\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast 
  then have "(?A\<and>\<not>?B\<and>\<not>?C)\<or>(\<not>?A\<and>?B\<and>\<not>?C)\<or>(\<not>?A\<and>\<not>?B\<and>?C)" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> e \<union> f^-1 \<union> f"    
  proof (elim disjE)
    {assume "(?A\<and>\<not>?B\<and>\<not>?C)" then have "?A" by simp 
     then have "p = q" using M4 kp pu qu by blast 
     then have "(p,q) \<in> e" using e by auto
     thus ?thesis using x by simp }
    next
    {assume "(\<not>?A\<and>?B\<and>\<not>?C)" then have "?B" by simp
     then obtain t where kt:"k\<parallel>t" and tq:"t\<parallel>q" by auto
     then have "(p,q) \<in> f^-1" using f qu pu kp by blast
     thus ?thesis using x by simp}
    next
    {assume "(\<not>?A\<and>\<not>?B\<and>?C)" then have "?C" by simp
     then obtain t where kt:"k'\<parallel>t" and tp:"t\<parallel>p" by auto
     with kpq pu qu have "(p,q)\<in>f" using f by blast
     thus ?thesis using x by simp}
  qed
qed

lemma cffi:"f O f^-1 \<subseteq> e \<union> f \<union> f^-1"
proof
   fix x::"'a\<times>'a" assume "x \<in> f O f^-1" then obtain p q r where x:"x = (p,r)" and "(p,q)\<in>f" and "(q,r) \<in>f^-1" by auto
   from \<open>(p,q)\<in>f\<close> \<open>(q,r) \<in> f^-1\<close> obtain k k' where kp:"k\<parallel>p" and kpr:"k'\<parallel>r" using f by blast
   from \<open>(p,q)\<in>f\<close> \<open>(q,r) \<in> f^-1\<close> obtain u where pu:"p\<parallel>u" and "q\<parallel>u" and ru:"r\<parallel>u" using f M1 by blast
   from kp kpr have "k\<parallel>r \<oplus> ((\<exists>t. k\<parallel>t \<and> t\<parallel>r) \<oplus> (\<exists>t. k'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
   then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
   thus "x \<in> e \<union> f \<union> f^-1"
   proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with pu ru kp have "p = r" using M4 by auto
        thus ?thesis using x e by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where kt:"k\<parallel>t" and tr:"t\<parallel>r" by auto
        with ru kp pu show ?thesis using x f by blast}
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where rtp:"k'\<parallel>t" and "t\<parallel>p" by auto
        with kpr ru pu show ?thesis using x f by blast}
    qed
qed

(* =========$\alpha_5$ composition========== *)
text \<open>We prove compositions of the form $r_1 \circ r_2 \subseteq e \cup s \cup s^{-1}$.\<close>

lemma cssi:"s O s^-1 \<subseteq> e \<union> s \<union> s^-1"
proof
   fix x::"'a\<times>'a" assume "x \<in> s O s^-1" then obtain p q r where x:"x = (p,r)" and "(p,q)\<in>s" and "(q,r) \<in>s^-1" by auto
   from \<open>(p,q)\<in>s\<close> \<open>(q,r) \<in> s^-1\<close> obtain k  where kp:"k\<parallel>p" and kr:"k\<parallel>r" and kq:"k\<parallel>q" using s M1  by blast
   from \<open>(p,q)\<in>s\<close> \<open>(q,r) \<in> s^-1\<close> obtain u u' where pu:"p\<parallel>u" and  rup:"r\<parallel>u'" using s by blast
   then have "p\<parallel>u' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>u') \<oplus> (\<exists>t. r\<parallel>t \<and> t\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
   then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
   thus "x \<in> e \<union> s \<union> s^-1"
   proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with rup kp kr have "p = r" using M4 by auto
        thus ?thesis using x e by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where kt:"p\<parallel>t" and tr:"t\<parallel>u'" by auto
        with rup kp kr  show ?thesis using x s by blast}
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where rtp:"r\<parallel>t" and "t\<parallel>u" by auto
        with pu kp kr show ?thesis using x s  by blast}
    qed
qed

lemma csis:"s^-1 O s \<subseteq> e \<union> s \<union> s^-1"
proof
   fix x::"'a\<times>'a" assume "x \<in> s^-1 O s" then obtain p q r where x:"x = (p,r)" and "(p,q)\<in>s^-1" and "(q,r) \<in>s" by auto
   from \<open>(p,q)\<in>s^-1\<close> \<open>(q,r) \<in> s\<close> obtain k  where kp:"k\<parallel>p" and kr:"k\<parallel>r" and kq:"k\<parallel>q" using s M1  by blast
   from \<open>(p,q)\<in>s^-1\<close> \<open>(q,r) \<in> s\<close> obtain u u' where pu:"p\<parallel>u" and  rup:"r\<parallel>u'" using s by blast
   then have "p\<parallel>u' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>u') \<oplus> (\<exists>t. r\<parallel>t \<and> t\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
   then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
   thus "x \<in> e \<union> s \<union> s^-1"
   proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with rup kp kr have "p = r" using M4 by auto
        thus ?thesis using x e by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where kt:"p\<parallel>t" and tr:"t\<parallel>u'" by auto
        with rup kp kr  show ?thesis using x s by blast}
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where rtp:"r\<parallel>t" and "t\<parallel>u" by auto
        with pu kp kr show ?thesis using x s  by blast}
    qed
qed

lemma cmim:"m^-1 O m \<subseteq> s \<union> s^-1 \<union> e"
proof
   fix x::"'a\<times>'a" assume "x \<in> m^-1 O m" then obtain p q r where x:"x = (p,r)" and "(p,q)\<in>m^-1" and "(q,r) \<in>m" by auto
   from \<open>(p,q)\<in>m^-1\<close> \<open>(q,r) \<in> m\<close>  have qp:"q\<parallel>p" and qr:"q\<parallel>r" using m  by auto
   obtain u u'  where pu:"p\<parallel>u" and  rup:"r\<parallel>u'" using M3 meets_wd qp qr by fastforce
   then have "p\<parallel>u' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>u') \<oplus> (\<exists>t. r\<parallel>t \<and> t\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
   then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
   thus "x \<in>  s \<union> s^-1 \<union> e"
   proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with rup qp qr have "p = r" using M4 by auto
        thus ?thesis using x e by auto}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where kt:"p\<parallel>t" and tr:"t\<parallel>u'" by auto
        with rup qp qr  show ?thesis using x s by blast}
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where rtp:"r\<parallel>t" and "t\<parallel>u" by auto
        with pu qp qr show ?thesis using x s  by blast}
    qed
qed

(* =========$\beta_1$ composition========== *)
subsection \<open>$\beta$-composition\<close>
text \<open>We prove compositions of the form $r_1 \circ r_2 \subseteq b \cup m \cup ov \cup s \cup d$.\<close>

lemma cbd:"b O d \<subseteq> b \<union> m \<union> ov \<union> s \<union> d"
proof 
  fix x::"'a\<times>'a" assume "x \<in> b O d" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> b" and "(z,q) \<in> d" by auto
  from \<open>(p,z) \<in> b\<close> obtain c where pc:"p\<parallel>c" and cz:"c\<parallel>z" using b by auto
  obtain a where ap:"a\<parallel>p" using M3 meets_wd pc by blast
  from \<open>(z,q) \<in> d\<close> obtain k l u v where "k\<parallel>l" and "l\<parallel>z" and kq:"k\<parallel>q" and zu:"z\<parallel>u" and uv:"u\<parallel>v" and qv:"q\<parallel>v" using d by blast
  from pc cz zu obtain cz where pcz:"p\<parallel>cz" and czu:"cz\<parallel>u" using M5exist_var by blast
  with uv obtain czu where pczu:"p\<parallel>czu" and czuv:"czu\<parallel>v" using M5exist_var by blast
  from ap kq  have "a\<parallel>q \<oplus> ((\<exists>t. a\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> b \<union> m \<union> ov \<union> s \<union> d"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with ap pczu czuv uv qv have "(p,q) \<in> s" using s by blast
        thus ?thesis using x  by auto} 
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where at:"a\<parallel>t" and tq:"t\<parallel>q" by auto
        from pc  tq have "p\<parallel>q \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>q) \<oplus> (\<exists>t'. t\<parallel>t' \<and> t'\<parallel>c))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus "x \<in> b \<union> m \<union> ov \<union> s \<union> d"
        proof (elim disjE)
           { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
             thus ?thesis using x m by auto}
           next
           { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
             thus ?thesis using x b by auto}
           next
           { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
             then obtain t' where "t\<parallel>t'" and "t'\<parallel>c" by auto
             with pc pczu have "t'\<parallel>czu" using M1 by auto
             with at tq ap pczu czuv qv \<open>t\<parallel>t'\<close> have "(p,q)\<in>ov" using ov by blast
             thus ?thesis using x by auto}
        qed
        }  
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "k\<parallel>t" and "t\<parallel>p" by auto
        with kq pczu czuv uv qv have "(p,q) \<in> d" using d by blast
        thus ?thesis using x  by auto}
       qed
qed

lemma cbf:"b O f \<subseteq> b \<union> m \<union> ov \<union> s \<union> d"
proof 
  fix x::"'a\<times>'a" assume "x \<in> b O f" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> b" and "(z,q) \<in> f" by auto
  from \<open>(p,z) \<in> b\<close> obtain c where pc:"p\<parallel>c" and cz:"c\<parallel>z" using b by auto
  obtain a where ap:"a\<parallel>p" using M3 meets_wd pc by blast
  from \<open>(z,q) \<in> f\<close> obtain k l u  where "k\<parallel>l" and "l\<parallel>z" and kq:"k\<parallel>q" and zu:"z\<parallel>u" and qu:"q\<parallel>u" using f  by blast
  from pc cz zu obtain cz where pcz:"p\<parallel>cz" and czu:"cz\<parallel>u" using M5exist_var by blast
  from ap kq  have "a\<parallel>q \<oplus> ((\<exists>t. a\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> b \<union> m \<union> ov \<union> s \<union> d"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with ap pcz czu  qu have "(p,q) \<in> s" using s by blast
        thus ?thesis using x  by auto} 
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where at:"a\<parallel>t" and tq:"t\<parallel>q" by auto
        from pc  tq have "p\<parallel>q \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>q) \<oplus> (\<exists>t'. t\<parallel>t' \<and> t'\<parallel>c))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus "x \<in> b \<union> m \<union> ov \<union> s \<union> d"
        proof (elim disjE)
           { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
             thus ?thesis using x m by auto}
           next
           { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
             thus ?thesis using x b by auto}
           next
           { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
             then obtain t' where "t\<parallel>t'" and "t'\<parallel>c" by auto
             with pc pcz have "t'\<parallel>cz" using M1 by auto
             with at tq ap pcz czu qu \<open>t\<parallel>t'\<close> have "(p,q)\<in>ov" using ov by blast
             thus ?thesis using x by auto}
        qed
        }  
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "k\<parallel>t" and "t\<parallel>p" by auto
        with kq pcz czu  qu have "(p,q) \<in> d" using d by blast
        thus ?thesis using x  by auto}
       qed
qed

lemma cbovi:"b O ov^-1 \<subseteq> b \<union> m \<union> ov \<union> s \<union> d"
proof 
  fix x::"'a\<times>'a" assume "x \<in> b O ov^-1" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> b" and "(z,q) \<in> ov^-1" by auto
  from \<open>(p,z) \<in> b\<close> obtain c where pc:"p\<parallel>c" and cz:"c\<parallel>z" using b by auto
  obtain a where ap:"a\<parallel>p" using M3 meets_wd pc by blast
  from \<open>(z,q) \<in> ov^-1\<close> obtain k l u v w where "k\<parallel>l" and lz:"l\<parallel>z" and kq:"k\<parallel>q" and zv:"z\<parallel>v" and qu:"q\<parallel>u" and uv:"u\<parallel>v" and lw:"l\<parallel>w" and wu:"w\<parallel>u" using ov  by blast
  from cz lz lw have "c\<parallel>w" using M1 by auto
  with pc wu obtain cw where pcw:"p\<parallel>cw" and cwu:"cw\<parallel>u" using M5exist_var by blast
  from ap kq  have "a\<parallel>q \<oplus> ((\<exists>t. a\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> b \<union> m \<union> ov \<union> s \<union> d"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with ap qu pcw cwu  have "(p,q) \<in> s" using s by blast
        thus ?thesis using x  by auto} 
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where at:"a\<parallel>t" and tq:"t\<parallel>q" by auto
        from pc  tq have "p\<parallel>q \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>q) \<oplus> (\<exists>t'. t\<parallel>t' \<and> t'\<parallel>c))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus "x \<in> b \<union> m \<union> ov \<union> s \<union> d"
        proof (elim disjE)
           { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
             thus ?thesis using x m by auto}
           next
           { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
             thus ?thesis using x b by auto}
           next
           { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
             then obtain t' where "t\<parallel>t'" and "t'\<parallel>c" by auto
             with pc pcw have "t'\<parallel>cw" using M1 by auto
             with at tq ap pcw cwu qu \<open>t\<parallel>t'\<close> have "(p,q)\<in>ov" using ov by blast
             thus ?thesis using x by auto}
        qed
        }  
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "k\<parallel>t" and "t\<parallel>p" by auto
        with kq pcw cwu  qu have "(p,q) \<in> d" using d by blast
        thus ?thesis using x  by auto}
       qed
qed

lemma cbmi:"b O m^-1 \<subseteq> b \<union> m \<union> ov \<union> s \<union> d"
proof 
   fix x::"'a\<times>'a" assume "x \<in> b O m^-1" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> b" and "(z,q) \<in> m^-1" by auto
   from \<open>(p,z) \<in> b\<close> obtain c where pc:"p\<parallel>c" and cz:"c\<parallel>z" using b by auto
   obtain k where kp:"k\<parallel>p" using M3 meets_wd pc by blast
   from \<open>(z,q) \<in> m^-1\<close> have qz:"q\<parallel>z" using m by auto
   obtain k' where kpq:"k'\<parallel>q" using M3 meets_wd qz by blast 
   from kp kpq  have "k\<parallel>q \<oplus> ((\<exists>t. k\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
   then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
   thus "x \<in> b \<union> m \<union> ov \<union> s \<union> d"
   proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with kp pc cz qz  have "(p,q) \<in> s" using s by blast
        thus ?thesis using x  by auto} 
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where kt:"k\<parallel>t" and tq:"t\<parallel>q" by auto
        from pc tq have "p\<parallel>q \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>q) \<oplus> (\<exists>t'. t\<parallel>t' \<and> t'\<parallel>c))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus "x \<in> b \<union> m \<union> ov \<union> s \<union> d"
        proof (elim disjE)
           { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
             thus ?thesis using x m by auto}
           next
           { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
             thus ?thesis using x b by auto}
           next
           { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
             then obtain t' where "t\<parallel>t'" and "t'\<parallel>c" by auto
             with pc cz qz kt tq kp have "(p,q) \<in> ov" using ov by blast
             thus ?thesis using x by auto}
        qed
        }  
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "k'\<parallel>t" and "t\<parallel>p" by auto
        with kpq pc cz qz have "(p,q) \<in> d" using d by blast
        thus ?thesis using x  by auto}
       qed
qed

lemma cdov:"d O ov \<subseteq>b \<union> m \<union> ov \<union> s \<union> d"
proof
   fix x::"'a\<times>'a" assume "x \<in> d O ov" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> d" and "(z,q) \<in> ov" by auto
   from \<open>(p,z) \<in> d\<close> obtain k l u v where kl:"k\<parallel>l" and lp:"l\<parallel>p" and kz:"k\<parallel>z" and pu:"p\<parallel>u" and uv:"u\<parallel>v" and zv:"z\<parallel>v" using d by blast
   from \<open>(z,q) \<in> ov\<close> obtain k' l' u' v' c where kplp:"k'\<parallel>l'" and kpz:"k'\<parallel>z" and lpq:"l'\<parallel>q" and zup:"z\<parallel>u'" and upvp:"u'\<parallel>v'" and qvp:"q\<parallel>v'" and "l'\<parallel>c" and "c\<parallel>u'" using ov by blast
   from zup zv uv have "u\<parallel>u'" using M1 by auto
   with pu upvp obtain uu where puu:"p\<parallel>uu" and uuvp:"uu\<parallel>v'" using M5exist_var by blast
   from lp lpq  have "l\<parallel>q \<oplus> ((\<exists>t. l\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. l'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
   then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
   thus "x \<in> b \<union> m \<union> ov \<union> s \<union> d"
   proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with lp puu uuvp qvp  have "(p,q) \<in> s" using s by blast
        thus ?thesis using x  by auto} 
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where lt:"l\<parallel>t" and tq:"t\<parallel>q" by auto
        from pu tq have "p\<parallel>q \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>q) \<oplus> (\<exists>t'. t\<parallel>t' \<and> t'\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus "x \<in> b \<union> m \<union> ov \<union> s \<union> d"
        proof (elim disjE)
           { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
             thus ?thesis using x m by auto}
           next
           { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
             thus ?thesis using x b by auto}
           next
           { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
             then obtain t' where ttp:"t\<parallel>t'" and "t'\<parallel>u" by auto
             with pu puu have "t'\<parallel>uu" using M1 by auto
             with lp puu qvp uuvp lt tq  ttp have "(p,q) \<in> ov" using ov by blast
             thus ?thesis using x by auto}
        qed
        }  
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "l'\<parallel>t" and "t\<parallel>p" by auto
         with lpq puu uuvp qvp have "(p,q) \<in> d" using d by blast
        thus ?thesis using x  by auto}
       qed
qed

lemma cdfi:"d O f^-1 \<subseteq> b \<union> m \<union> ov \<union> s \<union> d"
proof
   fix x::"'a\<times>'a" assume "x \<in> d O f^-1" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> d" and "(z,q) \<in> f^-1" by auto
   from \<open>(p,z) \<in> d\<close> obtain k l u v where kl:"k\<parallel>l" and lp:"l\<parallel>p" and kz:"k\<parallel>z" and pu:"p\<parallel>u" and uv:"u\<parallel>v" and zv:"z\<parallel>v" using d by blast
   from \<open>(z,q) \<in> f^-1\<close> obtain k' l' u'  where kpz:"k'\<parallel>z" and kplp:"k'\<parallel>l'" and lpq:"l'\<parallel>q" and zup:"z\<parallel>u'" and  qup:"q\<parallel>u'" using f by blast
   from zup zv uv have uup:"u\<parallel>u'" using M1 by auto
   from lp lpq  have "l\<parallel>q \<oplus> ((\<exists>t. l\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. l'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
   then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
   thus "x \<in> b \<union> m \<union> ov \<union> s \<union> d"
   proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with lp pu uup qup  have "(p,q) \<in> s" using s by blast
        thus ?thesis using x  by auto} 
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where lt:"l\<parallel>t" and tq:"t\<parallel>q" by auto
        from pu tq have "p\<parallel>q \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>q) \<oplus> (\<exists>t'. t\<parallel>t' \<and> t'\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus "x \<in> b \<union> m \<union> ov \<union> s \<union> d"
        proof (elim disjE)
           { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
             thus ?thesis using x m by auto}
           next
           { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
             thus ?thesis using x b by auto}
           next
           { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
             then obtain t' where ttp:"t\<parallel>t'" and tpu:"t'\<parallel>u" by auto
             with lt tq lp pu uup qup  have "(p,q) \<in> ov" using ov by blast
             thus ?thesis using x by auto}
        qed
        }  
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "l'\<parallel>t" and "t\<parallel>p" by auto
        with lpq pu uup qup  have "(p,q) \<in> d" using d by blast
        thus ?thesis using x  by auto}
       qed
qed

(* =========$\beta_2$ composition ==========*)
text \<open>We prove compositions of the form $r_1 \circ r_2 \subseteq b \cup m \cup ov \cup f^{-1} \cup d^{-1}$.\<close>

lemma covdi:"ov O d^-1 \<subseteq> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
proof
  fix x::"'a\<times>'a" assume "x \<in> ov O d^-1" then obtain p q z where "(p,z) : ov" and "(z,q) : d^-1" and x:"x = (p,q)" by auto
  from \<open>(p,z) : ov\<close> obtain k l u v c  where kp:"k\<parallel>p" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and pu:"p\<parallel>u" and uv:"u\<parallel>v"  and zv:"z\<parallel>v" and lc:"l\<parallel>c" and cu:"c\<parallel>u" using ov by blast
  from \<open>(z,q) : d^-1\<close> obtain l' k' u' v'  where lpq:"l'\<parallel>q" and kplp:"k'\<parallel>l'" and kpz:"k'\<parallel>z" and qup:"q\<parallel>u'" and upvp:"u'\<parallel>v'" and zvp:"z\<parallel>v'"  using d  by blast
  from lz kpz kplp have "l\<parallel>l'" using M1 by auto
  with kl lpq obtain ll where kll:"k\<parallel>ll" and llq:"ll\<parallel>q" using M5exist_var by blast
  from pu qup  have "p\<parallel>u' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>u') \<oplus> (\<exists>t. q\<parallel>t \<and> t\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with qup kll llq kp  have "(p,q) \<in> f^-1" using f by blast
        thus ?thesis using x  by auto} 
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where pt:"p\<parallel>t" and tup:"t\<parallel>u'" by auto
        from pt lpq have "p\<parallel>q \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>q) \<oplus> (\<exists>t'. l'\<parallel>t' \<and> t'\<parallel>t))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus "x \<in> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
        proof (elim disjE)
           { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
             thus ?thesis using x m by auto}
           next
           { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
             thus ?thesis using x b by auto}
           next
           { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
             then obtain t' where lptp:"l'\<parallel>t'" and tpt:"t'\<parallel>t" by auto
             from lpq lptp llq have "ll\<parallel>t'" using M1 by auto
             with kp kll llq pt tup qup tpt  have "(p,q) \<in> ov" using ov by blast
             thus ?thesis using x by auto}
        qed
        }  
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "q\<parallel>t" and "t\<parallel>u" by auto
        with pu kll llq kp   have "(p,q) \<in> d^-1" using d by blast
        thus ?thesis using x  by auto}
       qed
qed

lemma cdib:"d^-1 O b \<subseteq> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
proof
  fix x::"'a\<times>'a" assume "x \<in> d^-1 O b" then obtain p q z where "(p,z) : d^-1" and "(z,q) : b" and x:"x = (p,q)" by auto
  from \<open>(p,z) : d^-1\<close> obtain k l u v  where kp:"k\<parallel>p" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and pv:"p\<parallel>v" and uv:"u\<parallel>v"  and zu:"z\<parallel>u"  using d by blast
  from \<open>(z,q) : b\<close> obtain c  where  zc:"z\<parallel>c" and cq:"c\<parallel>q"  using b by blast
  with kl lz obtain lzc where klzc:"k\<parallel>lzc" and lzcq:"lzc\<parallel>q" using M5exist_var by blast
  obtain v' where qvp:"q\<parallel>v'" using M3 meets_wd cq by blast
  from pv qvp  have "p\<parallel>v' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>v') \<oplus> (\<exists>t. q\<parallel>t \<and> t\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with qvp kp klzc lzcq  have "(p,q) \<in> f^-1" using f by blast
        thus ?thesis using x  by auto} 
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where pt:"p\<parallel>t" and tvp:"t\<parallel>v'" by auto
        from pt cq have "p\<parallel>q \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>q) \<oplus> (\<exists>t'. c\<parallel>t' \<and> t'\<parallel>t))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus "x \<in> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
        proof (elim disjE)
           { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
             thus ?thesis using x m by auto}
           next
           { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
             thus ?thesis using x b by auto}
           next
           { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
             then obtain t' where ctp:"c\<parallel>t'" and tpt:"t'\<parallel>t" by auto
             from lzcq cq ctp have "lzc\<parallel>t'" using M1 by auto
             with pt tvp qvp kp klzc lzcq tpt have "(p,q) \<in> ov" using ov by blast
             thus ?thesis using x by auto}
        qed
        }  
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "q\<parallel>t" and "t\<parallel>v" by auto
        with pv kp klzc lzcq  have "(p,q) \<in> d^-1" using d by blast
        thus ?thesis using x  by auto}
       qed
qed

lemma csdi:"s O d^-1 \<subseteq> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
proof
  fix x::"'a\<times>'a" assume "x \<in> s O d^-1" then obtain p q z where "(p,z) : s" and "(z,q) : d^-1" and x:"x = (p,q)" by auto
  from \<open>(p,z) : s\<close> obtain k  u v  where kp:"k\<parallel>p" and kz:"k\<parallel>z" and pu:"p\<parallel>u" and uv:"u\<parallel>v"  and zv:"z\<parallel>v"  using s by blast
  from \<open>(z,q) : d^-1\<close> obtain l' k' u' v'  where lpq:"l'\<parallel>q" and kplp:"k'\<parallel>l'" and kpz:"k'\<parallel>z" and qup:"q\<parallel>u'" and upvp:"u'\<parallel>v'" and zvp:"z\<parallel>v'"  using d  by blast
  from kp kz kpz have kpp:"k'\<parallel>p" using M1 by auto
  from pu qup  have "p\<parallel>u' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>u') \<oplus> (\<exists>t. q\<parallel>t \<and> t\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with qup kpp kplp lpq  have "(p,q) \<in> f^-1" using f by blast
        thus ?thesis using x  by auto} 
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where pt:"p\<parallel>t" and tup:"t\<parallel>u'" by auto
        from pt lpq have "p\<parallel>q \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>q) \<oplus> (\<exists>t'. l'\<parallel>t' \<and> t'\<parallel>t))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus "x \<in> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
        proof (elim disjE)
           { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
             thus ?thesis using x m by auto}
           next
           { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
             thus ?thesis using x b by auto}
           next
           { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
             then obtain t' where lptp:"l'\<parallel>t'" and tpt:"t'\<parallel>t" by auto
             with pt tup qup kpp kplp lpq  have "(p,q) \<in> ov" using ov by blast
             thus ?thesis using x by auto}
        qed
        }  
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "q\<parallel>t" and "t\<parallel>u" by auto
        with pu kpp kplp lpq   have "(p,q) \<in> d^-1" using d by blast
        thus ?thesis using x  by auto}
       qed
qed

lemma csib:"s^-1 O b \<subseteq> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
proof
  fix x::"'a\<times>'a" assume "x \<in> s^-1 O b" then obtain p q z where "(p,z) : s^-1" and "(z,q) : b" and x:"x = (p,q)" by auto
  from \<open>(p,z) : s^-1\<close> obtain k  u v  where kp:"k\<parallel>p" and kz:"k\<parallel>z" and zu:"z\<parallel>u" and uv:"u\<parallel>v"  and pv:"p\<parallel>v"  using s by blast
  from \<open>(z,q) : b\<close> obtain c  where  zc:"z\<parallel>c" and cq:"c\<parallel>q"  using b by blast
  from kz zc cq obtain zc where kzc:"k\<parallel>zc" and zcq:"zc\<parallel>q" using M5exist_var by blast
  obtain v' where qvp:"q\<parallel>v'" using M3 meets_wd cq by blast
  from pv qvp  have "p\<parallel>v' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>v') \<oplus> (\<exists>t. q\<parallel>t \<and> t\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with qvp kp kzc zcq  have "(p,q) \<in> f^-1" using f by blast
        thus ?thesis using x  by auto} 
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where pt:"p\<parallel>t" and tvp:"t\<parallel>v'" by auto
        from pt cq have "p\<parallel>q \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>q) \<oplus> (\<exists>t'. c\<parallel>t' \<and> t'\<parallel>t))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus "x \<in> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
        proof (elim disjE)
           { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
             thus ?thesis using x m by auto}
           next
           { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
             thus ?thesis using x b by auto}
           next
           { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
             then obtain t' where ctp:"c\<parallel>t'" and tpt:"t'\<parallel>t" by auto
             from zcq cq ctp have "zc\<parallel>t'" using M1 by auto
             with zcq  pt tvp qvp kzc kp ctp tpt have "(p,q) \<in> ov" using ov by blast
             thus ?thesis using x by auto}
        qed
        }  
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "q\<parallel>t" and "t\<parallel>v" by auto
        with pv kp kzc zcq   have "(p,q) \<in> d^-1" using d by blast
        thus ?thesis using x  by auto}
       qed
qed

lemma covib:"ov^-1 O b \<subseteq> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
proof
  fix x::"'a\<times>'a" assume "x \<in> ov^-1 O b" then obtain p q z where "(p,z) : ov^-1" and "(z,q) : b" and x:"x = (p,q)" by auto
  from \<open>(p,z) : ov^-1\<close> obtain k l u v c  where kz:"k\<parallel>z" and kl:"k\<parallel>l" and lp:"l\<parallel>p" and zu:"z\<parallel>u" and uv:"u\<parallel>v"  and pv:"p\<parallel>v" and lc:"l\<parallel>c" and cu:"c\<parallel>u" using ov by blast
  from \<open>(z,q) : b\<close> obtain w  where  zw:"z\<parallel>w" and wq:"w\<parallel>q"  using b by blast
  from cu zu zw have cw:"c\<parallel>w" using M1 by auto
  with lc wq obtain cw where lcw:"l\<parallel>cw" and cwq:"cw\<parallel>q" using M5exist_var by blast
  obtain v' where qvp:"q\<parallel>v'" using M3 meets_wd wq by blast
  from pv qvp  have "p\<parallel>v' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>v') \<oplus> (\<exists>t. q\<parallel>t \<and> t\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with qvp lp lcw cwq  have "(p,q) \<in> f^-1" using f by blast
        thus ?thesis using x  by auto} 
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where pt:"p\<parallel>t" and tvp:"t\<parallel>v'" by auto
        from pt wq have "p\<parallel>q \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>q) \<oplus> (\<exists>t'. w\<parallel>t' \<and> t'\<parallel>t))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus "x \<in> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
        proof (elim disjE)
           { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
             thus ?thesis using x m by auto}
           next
           { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
             thus ?thesis using x b by auto}
           next
           { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
             then obtain t' where wtp:"w\<parallel>t'" and tpt:"t'\<parallel>t" by auto
             moreover with wq cwq have "cw\<parallel>t'" using M1 by auto
             ultimately have "(p,q) \<in> ov" using ov cwq lp lcw pt tvp qvp by blast
             thus ?thesis using x by auto}
        qed
        }  
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "q\<parallel>t" and "t\<parallel>v" by auto
        with pv lp lcw cwq  have "(p,q) \<in> d^-1" using d by blast
        thus ?thesis using x  by auto}
       qed
qed

lemma cmib:"m^-1 O b \<subseteq> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
proof
  fix x::"'a\<times>'a" assume "x \<in> m^-1 O b" then obtain p q z where "(p,z) : m^-1" and "(z,q) : b" and x:"x = (p,q)" by auto
  from \<open>(p,z) : m^-1\<close> have zp:"z\<parallel>p" using m by auto
  from \<open>(z,q) : b\<close> obtain w  where  zw:"z\<parallel>w" and wq:"w\<parallel>q"  using b by blast
  obtain v where pv:"p\<parallel>v" using M3 meets_wd zp  by blast
  obtain v' where qvp:"q\<parallel>v'" using M3 meets_wd wq by blast

  from pv qvp  have "p\<parallel>v' \<oplus> ((\<exists>t. p\<parallel>t \<and> t\<parallel>v') \<oplus> (\<exists>t. q\<parallel>t \<and> t\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
        with zp zw wq qvp  have "(p,q) \<in> f^-1" using f by blast
        thus ?thesis using x  by auto} 
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp 
        then obtain t where pt:"p\<parallel>t" and tvp:"t\<parallel>v'" by auto
        from pt wq have "p\<parallel>q \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>q) \<oplus> (\<exists>t'. w\<parallel>t' \<and> t'\<parallel>t))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus "x \<in> b \<union> m \<union> ov \<union> f^-1 \<union> d^-1"
        proof (elim disjE)
           { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
             thus ?thesis using x m by auto}
           next
           { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
             thus ?thesis using x b by auto}
           next
           { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
             then obtain t' where wtp:"w\<parallel>t'" and tpt:"t'\<parallel>t" by auto
             with zp zw wq pt tvp qvp have "(p,q) \<in> ov" using ov  by blast
             thus ?thesis using x by auto}
        qed
        }  
      next
      { assume "\<not>?A \<and> \<not>?B \<and> ?C" then have ?C by simp
        then obtain t where "q\<parallel>t" and "t\<parallel>v" by auto
        with zp zw wq pv   have "(p,q) \<in> d^-1" using d by blast
        thus ?thesis using x  by auto}
       qed
qed

(*==========$\gamma$ composition =======*)
subsection \<open>$\gamma$-composition\<close>
text \<open>We prove compositions of the form $r_1 \circ r_2 \subseteq ov \cup s \cup d \cup f \cup e \cup f^{-1} \cup d^{-1} \cup s^{-1} \cup ov^{-1}$.\<close>

lemma covovi:"ov O ov^-1 \<subseteq> e \<union> ov \<union> ov^-1 \<union> d \<union> d^-1 \<union> s \<union> s^-1 \<union> f \<union> f^-1 "
proof
  fix x::"'a\<times>'a" assume "x \<in> ov O ov^-1" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> ov" and "(z, q) \<in> ov^-1" by auto
  from \<open>(p,z) \<in> ov\<close> obtain k l c u  where kp:"k\<parallel>p" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and lc:"l\<parallel>c" and pu:"p\<parallel>u" and cu:"c\<parallel>u"  using ov by blast
  from \<open>(z,q) \<in> ov^-1\<close> obtain k' l' c' u'  where kpq:"k'\<parallel>q" and kplp:"k'\<parallel>l'" and lpz:"l'\<parallel>z" and lpcp:"l'\<parallel>c'" and qup:"q\<parallel>u'" and cpup:"c'\<parallel>u'"  using ov by blast

  from kp kpq  have "k\<parallel>q \<oplus> ((\<exists>t. k\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> e \<union> ov \<union> ov^-1 \<union> d \<union> d^-1 \<union> s \<union> s^-1 \<union> f \<union> f^-1"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have kq:?A by simp
        from pu qup have "p\<parallel>u' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>u') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
            with kq kp qup have "p = q" using M4 by auto
            thus ?thesis using x e by auto}
          next
          { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
            with kq kp qup show ?thesis using x s by blast}
          next
          { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
            with kq kp pu show ?thesis using x s by blast}
        qed}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
        then obtain t where kt:"k\<parallel>t" and tq:"t\<parallel>q" by auto
        from pu qup have "p\<parallel>u' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>u') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
            with qup kp kt tq  show ?thesis using x f  by blast}
          next
          { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
            then obtain t' where ptp:"p\<parallel>t'" and tpup:"t'\<parallel>u'" by auto
            from tq kpq kplp have "t\<parallel>l'" using M1 by auto
            moreover with lpz lz lc have "l'\<parallel>c" using M1 by auto
            moreover with cu pu ptp have "c\<parallel>t'" using M1 by auto
            ultimately obtain lc where "t\<parallel>lc" and "lc\<parallel>t'" using M5exist_var by blast
            with ptp tpup kp kt tq qup  show ?thesis using x ov by blast}
          next
          { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
            with pu kp kt tq  show ?thesis using x d  by blast}

        qed}
      next
      {assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by auto
       then obtain t where kpt:"k'\<parallel>t" and tp:"t\<parallel>p" by auto
        from pu qup have "p\<parallel>u' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>u') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
            with kpq kpt tp qup show ?thesis using x f  by blast}
          next
          { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
            then obtain t' where "p\<parallel>t'" and "t'\<parallel>u'" by auto
            with  kpq kpt tp qup show ?thesis using x d by blast}
          next
          { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
            then obtain t' where qtp:"q\<parallel>t'" and tpu:"t'\<parallel>u" by auto
            from tp kp kl have "t\<parallel>l" using M1 by auto
            moreover with lpcp lpz lz have "l\<parallel>c'" using M1 by auto
            moreover with cpup qup qtp have "c'\<parallel>t'" using M1 by auto
            ultimately obtain lc where "t\<parallel>lc" and "lc\<parallel>t'" using M5exist_var by blast
            with kpt tp kpq qtp tpu pu show ?thesis using x ov by blast}
          qed}
      qed
qed


lemma cdid:"d^-1 O d \<subseteq> e \<union> ov \<union> ov^-1 \<union> d \<union> d^-1 \<union> s \<union> s^-1 \<union> f \<union> f^-1 "
proof
  fix x::"'a\<times>'a" assume "x \<in> d^-1 O d" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> d^-1" and "(z, q) \<in> d" by auto
  from \<open>(p,z) \<in> d^-1\<close> obtain k l u v where kp:"k\<parallel>p" and kl:"k\<parallel>l" and lz:"l\<parallel>z" and pv:"p\<parallel>v" and zu:"z\<parallel>u" and uv:"u\<parallel>v"  using d by blast
  from \<open>(z,q) \<in> d\<close> obtain k' l'  u' v'  where kpq:"k'\<parallel>q" and kplp:"k'\<parallel>l'" and lpz:"l'\<parallel>z"  and qvp:"q\<parallel>v'" and zup:"z\<parallel>u'" and upvp:"u'\<parallel>v'"  using d by blast

  from kp kpq  have "k\<parallel>q \<oplus> ((\<exists>t. k\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> e \<union> ov \<union> ov^-1 \<union> d \<union> d^-1 \<union> s \<union> s^-1 \<union> f \<union> f^-1"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have kq:?A by simp
        from pv qvp have "p\<parallel>v' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>v') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
            with kq kp qvp have "p = q" using M4 by auto
            thus ?thesis using x e by auto}
          next
          { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
            with kq kp qvp show ?thesis using x s by blast}
          next
          { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
            with kq kp pv show ?thesis using x s by blast}
        qed}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
        then obtain t where kt:"k\<parallel>t" and tq:"t\<parallel>q" by auto
        from pv qvp have "p\<parallel>v' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>v') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
            with qvp kp kt tq  show ?thesis using x f  by blast}
          next
          { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
            then obtain t' where ptp:"p\<parallel>t'" and tpvp:"t'\<parallel>v'" by auto
            from tq kpq kplp have "t\<parallel>l'" using M1 by auto
            moreover with ptp pv uv have "u\<parallel>t'" using M1 by auto
            moreover with lpz zu \<open>t\<parallel>l'\<close> obtain lzu where "t\<parallel>lzu" and "lzu\<parallel>t'" using  M5exist_var   by blast
            ultimately  show ?thesis using x ov kt tq kp ptp tpvp qvp by blast}
          next
          { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
            with pv kp kt tq  show ?thesis using x d  by blast}

        qed}
      next
      {assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by auto
       then obtain t where kpt:"k'\<parallel>t" and tp:"t\<parallel>p" by auto
        from pv qvp have "p\<parallel>v' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>v') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
            with kpq kpt tp qvp show ?thesis using x f  by blast}
          next
          { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
            then obtain t' where "p\<parallel>t'" and "t'\<parallel>v'" by auto
            with  kpq kpt tp qvp show ?thesis using x d by blast}
          next
          { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
            then obtain t' where qtp:"q\<parallel>t'" and tpv:"t'\<parallel>v" by auto
            from tp kp kl have "t\<parallel>l" using M1 by auto
            moreover with qtp qvp upvp have "u'\<parallel>t'" using M1 by auto
            moreover with lz zup \<open>t\<parallel>l\<close> obtain lzu where "t\<parallel>lzu" and "lzu\<parallel>t'" using  M5exist_var by blast
            ultimately show ?thesis using x ov kpt tp kpq qtp tpv pv  by blast}
          qed}
      qed
qed

lemma coviov:"ov^-1 O ov \<subseteq> e \<union> ov \<union> ov^-1 \<union> d \<union> d^-1 \<union> s \<union> s^-1 \<union> f \<union> f^-1"
proof
  fix x::"'a\<times>'a" assume "x \<in> ov^-1 O ov" then obtain p q z where x:"x = (p,q)" and "(p,z) \<in> ov^-1" and "(z, q) \<in> ov" by auto
  from \<open>(p,z) \<in> ov^-1\<close> obtain k l c u v where kz:"k\<parallel>z" and kl:"k\<parallel>l" and lp:"l\<parallel>p" and lc:"l\<parallel>c" and zu:"z\<parallel>u" and pv:"p\<parallel>v" and cu:"c\<parallel>u" and uv:"u\<parallel>v"  using ov by blast
  from \<open>(z,q) \<in> ov\<close> obtain k' l' c' u' v' where kpz:"k'\<parallel>z" and kplp:"k'\<parallel>l'" and lpq:"l'\<parallel>q" and lpcp:"l'\<parallel>c'" and qvp:"q\<parallel>v'" and zup:"z\<parallel>u'" and cpup:"c'\<parallel>u'" and upvp:"u'\<parallel>v'" using ov by blast

  from lp lpq  have "l\<parallel>q \<oplus> ((\<exists>t. l\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. l'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in> e \<union> ov \<union> ov^-1 \<union> d \<union> d^-1 \<union> s \<union> s^-1 \<union> f \<union> f^-1"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have lq:?A by simp
        from pv qvp have "p\<parallel>v' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>v') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
            with lq lp qvp have "p = q" using M4 by auto
            thus ?thesis using x e by auto}
          next
          { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
            with lq lp qvp show ?thesis using x s by blast}
          next
          { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
            with lq lp pv show ?thesis using x s by blast}
        qed}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
        then obtain t where lt:"l\<parallel>t" and tq:"t\<parallel>q" by auto
        from pv qvp have "p\<parallel>v' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>v') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
            with qvp lp lt tq  show ?thesis using x f  by blast}
          next
          { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
            then obtain t' where ptp:"p\<parallel>t'" and tpvp:"t'\<parallel>v'" by auto
            from tq lpq lpcp have "t\<parallel>c'" using M1 by auto
            moreover with cpup zup zu have "c'\<parallel>u" using M1 by auto
            moreover with ptp pv uv have "u\<parallel>t'" using M1 by auto
            ultimately obtain cu where "t\<parallel>cu" and "cu\<parallel>t'" using M5exist_var by blast
            with lt tq lp ptp tpvp qvp  show ?thesis using x ov by blast}
          next
          { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
            with pv lp lt tq  show ?thesis using x d  by blast}

        qed}
      next
      {assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by auto
       then obtain t where lpt:"l'\<parallel>t" and tp:"t\<parallel>p" by auto
        from pv qvp have "p\<parallel>v' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>v') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>v))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          { assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
            with qvp lpq lpt tp show ?thesis using x f  by blast}
          next
          { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
            then obtain t' where "p\<parallel>t'" and "t'\<parallel>v'" by auto
            with  qvp lpq lpt tp show ?thesis using x d by blast}
          next
          { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
            then obtain t' where qtp:"q\<parallel>t'" and tpv:"t'\<parallel>v" by auto
            from tp lp lc have "t\<parallel>c" using M1 by auto
            moreover with cu zu zup have "c\<parallel>u'" using M1 by auto
            moreover with qtp qvp upvp have "u'\<parallel>t'" using M1 by auto
            ultimately obtain cu where "t\<parallel>cu" and "cu\<parallel>t'" using M5exist_var by blast
            with lpt tp lpq pv qtp tpv show ?thesis using x ov by blast}
          qed}
      qed
qed

(* ===========$\delta$ composition =========*)
subsection \<open>$\gamma$-composition\<close>
text \<open>We prove compositions of the form $r_1 \circ r_2 \subseteq b \cup m \cup ov \cup s \cup d \cup f \cup e \cup f^{-1} \cup d^{-1} \cup s^{-1} \cup ov^{-1} \cup b^{-1} \cup m^{-1}$.\<close>


lemma cbbi:"b O b^-1 \<subseteq> b \<union> b^-1 \<union> m \<union> m^-1 \<union> e \<union> ov \<union> ov^-1 \<union> s \<union> s^-1 \<union> d \<union> d^-1 \<union> f \<union> f^-1" (is "b O b^-1 \<subseteq> ?R")
proof
  fix x::"'a\<times>'a" assume "x \<in> b O b^-1" then obtain p q z::'a where x:"x = (p,q)" and "(p,z) \<in> b" and "(z,q) \<in> b^-1" by auto
  from \<open>(p,z)\<in>b\<close> obtain c where pc:"p\<parallel>c" and "c\<parallel>z" using b  by blast
  from \<open>(z,q) \<in> b^-1\<close> obtain c' where qcp:"q\<parallel>c'" and "c'\<parallel>z" using b  by blast
  obtain k k' where kp:"k\<parallel>p" and kpq:"k'\<parallel>q" using M3 meets_wd pc qcp by fastforce
  then have "k\<parallel>q \<oplus> ((\<exists>t. k\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. k'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in>?R"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have kq:?A by simp
        from pc qcp have "p\<parallel>c' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>c') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>c))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          {assume "(?A\<and>\<not>?B\<and>\<not>?C)" then have "?A" by simp
           with kp kq qcp have "p = q" using M4 by auto
           thus ?thesis using x e  by auto}
          next
          {assume "\<not>?A\<and>?B\<and>\<not>?C" then have "?B" by simp
           with kq kp qcp show ?thesis using x s by blast}
          next
          {assume "(\<not>?A\<and>\<not>?B\<and>?C)" then have "?C" by simp
           with kq kp pc show ?thesis using x s by blast}
        qed}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
        then obtain t where kt:"k\<parallel>t" and tq:"t\<parallel>q" by auto
        from pc qcp have "p\<parallel>c' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>c') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>c))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          {assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
           with kp qcp kt tq show ?thesis using f x by blast}
          next
          {assume "\<not>?A\<and>?B\<and>\<not>?C"  then have ?B by simp
           then obtain t' where ptp:"p\<parallel>t'" and tpcp:"t'\<parallel>c'" by auto
           from pc tq  have "p\<parallel>q \<oplus> ((\<exists>t''. p\<parallel>t'' \<and> t''\<parallel>q) \<oplus> (\<exists>t''. t\<parallel>t'' \<and> t''\<parallel>c))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
           then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
           thus ?thesis
           proof (elim disjE)
              {assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
               thus ?thesis using x m by auto}
              next
              {assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
               thus ?thesis using x b by auto}
              next
              { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
                then obtain g where "t\<parallel>g" and "g\<parallel>c" by auto
                moreover with pc ptp have "g\<parallel>t'" using M1 by blast
                ultimately  show ?thesis using x ov kt tq kp ptp tpcp qcp   by blast}
           qed}
         next
          {assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
           then obtain t' where "q\<parallel>t'" and "t'\<parallel>c" by auto
           with kp  kt tq pc show ?thesis using d x by blast}
         qed}
      next
      { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
        then obtain t where kpt:"k'\<parallel>t" and tp:"t\<parallel>p" by auto
        from  pc qcp have "p\<parallel>c' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>c') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>c))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          {assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
           with qcp kpt tp kpq show ?thesis using x f by blast}
          next
          {assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
           with qcp kpt tp kpq show ?thesis using x d by blast}
          next
          {assume "\<not>?A\<and>\<not>?B\<and>?C" then obtain t' where qt':"q\<parallel>t'" and tpc:"t'\<parallel>c" by auto
           from qcp tp have "q\<parallel>p \<oplus> ((\<exists>t''. q\<parallel>t'' \<and> t''\<parallel>p) \<oplus> (\<exists>t''. t\<parallel>t'' \<and> t''\<parallel>c'))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
           then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
           thus ?thesis
           proof (elim disjE)
              {assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
               thus ?thesis using x m by auto}
              next
              {assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
               thus ?thesis using x b by auto}
              next
              { assume "\<not>?A\<and>\<not>?B\<and>?C" then obtain g where tg:"t\<parallel>g" and "g\<parallel>c'" by auto
                with qcp qt' have "g\<parallel>t'" using M1 by blast
                with qt' tpc pc kpq kpt tp tg show ?thesis using x ov by blast}
          qed}
     qed}
 qed
qed
       


lemma cbib:"b^-1 O b \<subseteq> b \<union> b^-1 \<union> m \<union> m^-1 \<union> e \<union> ov \<union> ov^-1 \<union> s \<union> s^-1 \<union> d \<union> d^-1 \<union> f \<union> f^-1" (is "b^-1 O b \<subseteq> ?R")
proof
  fix x::"'a\<times>'a" assume "x \<in> b^-1 O b" then obtain p q z::'a where x:"x = (p,q)" and "(p,z) \<in> b^-1" and "(z,q) \<in> b" by auto
  from \<open>(p,z)\<in>b^-1\<close> obtain c where zc:"z\<parallel>c" and cp:"c\<parallel>p" using b  by blast
  from \<open>(z,q) \<in> b\<close> obtain c' where zcp:"z\<parallel>c'" and cpq:"c'\<parallel>q" using b  by blast
  obtain u u' where pu:"p\<parallel>u" and qup:"q\<parallel>u'" using M3 meets_wd cp cpq by fastforce
  from cp cpq have "c\<parallel>q \<oplus> ((\<exists>t. c\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. c'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in>?R"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have cq:?A by simp
        from pu qup have "p\<parallel>u' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>u') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          {assume "(?A\<and>\<not>?B\<and>\<not>?C)" then have "?A" by simp
           with cq cp qup have "p = q" using M4 by auto
           thus ?thesis using x e  by auto}
          next
          {assume "\<not>?A\<and>?B\<and>\<not>?C" then have "?B" by simp
           with cq cp qup show ?thesis using x s by blast}
          next
          {assume "(\<not>?A\<and>\<not>?B\<and>?C)" then have "?C" by simp
           with pu cq cp show ?thesis using x s by blast}
        qed}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
        then obtain t where ct:"c\<parallel>t" and tq:"t\<parallel>q" by auto
        from pu qup have "p\<parallel>u' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>u') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          {assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
           with qup ct tq cp show ?thesis using f x by blast}
          next
          {assume "\<not>?A\<and>?B\<and>\<not>?C"  then have ?B by simp
           then obtain t' where ptp:"p\<parallel>t'" and tpup:"t'\<parallel>u'" by auto
           from pu tq  have "p\<parallel>q \<oplus> ((\<exists>t''. p\<parallel>t'' \<and> t''\<parallel>q) \<oplus> (\<exists>t''. t\<parallel>t'' \<and> t''\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
           then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
           thus ?thesis
           proof (elim disjE)
              {assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
               thus ?thesis using x m by auto}
              next
              {assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
               thus ?thesis using x b by auto}
              next
              { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
                then obtain g where "t\<parallel>g" and "g\<parallel>u" by auto
                moreover with pu ptp have "g\<parallel>t'" using M1 by blast
                ultimately  show ?thesis using x ov ct tq cp ptp tpup qup   by blast}
           qed}
         next
          {assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
           then obtain t' where "q\<parallel>t'" and "t'\<parallel>u" by auto
           with cp  ct tq pu  show ?thesis using d x by blast}
         qed}
      next
      { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
        then obtain t where cpt:"c'\<parallel>t" and tp:"t\<parallel>p" by auto
        from  pu qup have "p\<parallel>u' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>u') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          {assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
           with qup cpt tp cpq show ?thesis using x f by blast}
          next
          {assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
           with qup cpt tp cpq show ?thesis using x d by blast}
          next
          {assume "\<not>?A\<and>\<not>?B\<and>?C" then obtain t' where qt':"q\<parallel>t'" and tpc:"t'\<parallel>u" by auto
           from qup tp have "q\<parallel>p \<oplus> ((\<exists>t''. q\<parallel>t'' \<and> t''\<parallel>p) \<oplus> (\<exists>t''. t\<parallel>t'' \<and> t''\<parallel>u'))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
           then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
           thus ?thesis
           proof (elim disjE)
              {assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
               thus ?thesis using x m by auto}
              next
              {assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
               thus ?thesis using x b by auto}
              next
              { assume "\<not>?A\<and>\<not>?B\<and>?C" then obtain g where tg:"t\<parallel>g" and "g\<parallel>u'" by auto
                with qup qt' have "g\<parallel>t'" using M1 by blast
                with qt' tpc pu cpq cpt tp tg show ?thesis using x ov by blast}
          qed}
     qed}
 qed
qed

lemma cddi:"d O d^-1 \<subseteq> b \<union> b^-1 \<union> m \<union> m^-1 \<union> e \<union> ov \<union> ov^-1 \<union> s \<union> s^-1 \<union> d \<union> d^-1 \<union> f \<union> f^-1" (is "d O d^-1 \<subseteq> ?R")
proof
  fix x::"'a\<times>'a" assume "x \<in> d O d^-1" then obtain p q z::'a where x:"x = (p,q)" and "(p,z) \<in> d" and "(z,q) \<in> d^-1" by auto
  from \<open>(p,z) \<in> d\<close> obtain k l u v where lp:"l\<parallel>p" and kl:"k\<parallel>l" and kz:"k\<parallel>z" and pu:"p\<parallel>u" and uv:"u\<parallel>v" and zv:"z\<parallel>v"  using d  by blast
  from \<open>(z,q) \<in> d^-1\<close> obtain k' l' u' v' where lpq:"l'\<parallel>q" and kplp:"k'\<parallel>l'" and kpz:"k'\<parallel>z" and qup:"q\<parallel>u'" and upvp:"u'\<parallel>v'" and zv':"z\<parallel>v'"  using d  by blast
  from lp lpq have "l\<parallel>q \<oplus> ((\<exists>t. l\<parallel>t \<and> t\<parallel>q) \<oplus> (\<exists>t. l'\<parallel>t \<and> t\<parallel>p))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
  then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
  thus "x \<in>?R"
  proof (elim disjE)
      { assume "?A\<and>\<not>?B\<and>\<not>?C" then have lq:?A by simp
        from pu qup have "p\<parallel>u' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>u') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          {assume "(?A\<and>\<not>?B\<and>\<not>?C)" then have "?A" by simp
           with lq lp qup have "p = q" using M4 by auto
           thus ?thesis using x e  by auto}
          next
          {assume "\<not>?A\<and>?B\<and>\<not>?C" then have "?B" by simp
           with lq lp qup show ?thesis using x s by blast}
          next
          {assume "(\<not>?A\<and>\<not>?B\<and>?C)" then have "?C" by simp
           with pu lq lp show ?thesis using x s by blast}
        qed}
      next
      { assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
        then obtain t where lt:"l\<parallel>t" and tq:"t\<parallel>q" by auto
        from pu qup have "p\<parallel>u' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>u') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          {assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
           with qup lt tq lp show ?thesis using f x by blast}
          next
          {assume "\<not>?A\<and>?B\<and>\<not>?C"  then have ?B by simp
           then obtain t' where ptp:"p\<parallel>t'" and tpup:"t'\<parallel>u'" by auto
           from pu tq  have "p\<parallel>q \<oplus> ((\<exists>t''. p\<parallel>t'' \<and> t''\<parallel>q) \<oplus> (\<exists>t''. t\<parallel>t'' \<and> t''\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
           then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
           thus ?thesis
           proof (elim disjE)
              {assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
               thus ?thesis using x m by auto}
              next
              {assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
               thus ?thesis using x b by auto}
              next
              { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
                then obtain g where "t\<parallel>g" and "g\<parallel>u" by auto
                moreover with pu ptp have "g\<parallel>t'" using M1 by blast
                ultimately  show ?thesis using x ov lt tq lp ptp tpup qup by blast}
           qed}
         next
          {assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
           then obtain t' where "q\<parallel>t'" and "t'\<parallel>u" by auto
           with lp  lt tq pu  show ?thesis using d x by blast}
         qed}
      next
      { assume "\<not>?A\<and>\<not>?B\<and>?C" then have ?C by simp
        then obtain t where lpt:"l'\<parallel>t" and tp:"t\<parallel>p" by auto
        from  pu qup have "p\<parallel>u' \<oplus> ((\<exists>t'. p\<parallel>t' \<and> t'\<parallel>u') \<oplus> (\<exists>t'. q\<parallel>t' \<and> t'\<parallel>u))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
        then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
        thus ?thesis
        proof (elim disjE)
          {assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
           with qup lpt tp lpq show ?thesis using x f by blast}
          next
          {assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
           with qup lpt tp lpq show ?thesis using x d by blast}
          next
          {assume "\<not>?A\<and>\<not>?B\<and>?C" then obtain t' where qt':"q\<parallel>t'" and tpc:"t'\<parallel>u" by auto
           from qup tp have "q\<parallel>p \<oplus> ((\<exists>t''. q\<parallel>t'' \<and> t''\<parallel>p) \<oplus> (\<exists>t''. t\<parallel>t'' \<and> t''\<parallel>u'))" (is "?A \<oplus> (?B \<oplus> ?C)") using M2 by blast
           then have "(?A\<and>\<not>?B\<and>\<not>?C) \<or> ((\<not>?A\<and>?B\<and>\<not>?C) \<or> (\<not>?A\<and>\<not>?B\<and>?C))" by (insert xor_distr_L[of ?A ?B ?C], auto simp:elimmeets)
           thus ?thesis
           proof (elim disjE)
              {assume "?A\<and>\<not>?B\<and>\<not>?C" then have ?A by simp
               thus ?thesis using x m by auto}
              next
              {assume "\<not>?A\<and>?B\<and>\<not>?C" then have ?B by simp
               thus ?thesis using x b by auto}
              next
              { assume "\<not>?A\<and>\<not>?B\<and>?C" then obtain g where tg:"t\<parallel>g" and "g\<parallel>u'" by auto
                with qup qt' have "g\<parallel>t'" using M1 by blast
                with qt' tpc pu lpq lpt tp tg show ?thesis using x ov by blast}
          qed}
     qed}
 qed
qed


(* ========= inverse ========== *)
subsection \<open>The rest of the composition table\<close>
text \<open>Because of the symmetry $(r_1 \circ r_2)^{-1} = r_2^{-1} \circ r_1^{-1} $, the rest of the compositions is easily deduced.\<close>


lemma cmbi:"m O b^-1 \<subseteq> b^-1 \<union> m^-1 \<union> s^-1 \<union> ov^-1 \<union> d^-1"
  using cbmi by auto


lemma covmi:"ov O m^-1 \<subseteq> ov^-1 \<union> d^-1 \<union> s^-1"
  using  cmovi by auto

lemma covbi:"ov O b^-1 \<subseteq> b^-1 \<union> m^-1 \<union> s^-1 \<union> ov^-1 \<union> d^-1"
  using cbovi by auto

lemma cfiovi:"f^-1 O ov^-1 \<subseteq> ov^-1 \<union> s^-1 \<union> d^-1"
  using covf by auto

lemma cfimi:"(f^-1 O m^-1) \<subseteq> s^-1 \<union> ov^-1 \<union> d^-1"
  using cmf by auto

lemma cfibi:"f^-1 O b^-1 \<subseteq> b^-1 \<union> m^-1 \<union> ov^-1 \<union> s^-1 \<union> d^-1"
  using cbf by auto

lemma cdif:"d^-1 O f \<subseteq> ov^-1 \<union> s^-1 \<union> d^-1"
  using cfid by auto

lemma cdiovi:"d^-1 O ov ^-1 \<subseteq> ov^-1 \<union> s^-1 \<union> d^-1"
  using covd by auto

lemma cdimi:"d^-1 O m^-1 \<subseteq> s^-1 \<union> ov^-1 \<union> d^-1 "
  using cmd by auto

lemma cdibi:"d^-1 O b^-1 \<subseteq> b^-1 \<union> m^-1 \<union> ov^-1 \<union> s^-1 \<union> d^-1"
  using cbd by auto 

lemma csd:"s O d \<subseteq> d"
  using cdisi by auto

lemma csf:"s O f \<subseteq> d"
  using cfisi by auto

lemma csovi:"s O ov^-1 \<subseteq> ov^-1 \<union> f \<union> d"
  using covsi by auto

lemma csmi:"s O m^-1 \<subseteq> m^-1"
  using cmsi by auto

lemma csbi:"s O b^-1 \<subseteq> b^-1"
  using cbsi by auto

lemma csisi:"s^-1 O s^-1 \<subseteq> s^-1"
  using css by auto

lemma csid:"s^-1 O d \<subseteq> ov^-1 \<union> f \<union> d"
  using cdis by auto

lemma csif:"s^-1 O f \<subseteq> ov^-1"
  using cfis by auto

lemma csiovi:"s^-1 O ov^-1 \<subseteq> ov^-1"
  using covs by auto

lemma csimi:"s^-1 O m^-1 \<subseteq> m^-1"
  using cms by auto

lemma csibi:"s^-1 O b^-1 \<subseteq> b^-1"
  using cbs by auto

lemma cds:"d O s \<subseteq> d"
  using csidi by auto

lemma cdsi:"d O s^-1 \<subseteq> b^-1 \<union> m^-1 \<union> ov^-1 \<union> f \<union> d"
  using csdi by auto

lemma cdd:"d O d \<subseteq> d"
  using cdidi by auto

lemma cdf:"d O f \<subseteq> d" 
  using cfidi by auto

lemma cdovi:"d O ov^-1 \<subseteq> b^-1 \<union> m^-1 \<union> ov^-1 \<union> f \<union> d"
  using covdi by auto

lemma cdmi:"d O m^-1 \<subseteq> b^-1"
  using cmdi by auto

lemma cdbi:"d O b^-1 \<subseteq> b^-1"
  using cbdi by auto

lemma cfdi:"f O d^-1 \<subseteq>  b^-1 \<union> m^-1 \<union> ov^-1 \<union> s^-1 \<union> d^-1 "
  using cdfi by auto

lemma cfs:"f O s \<subseteq> d"
  using csifi by auto

lemma cfsi:"f O s^-1 \<subseteq> b ^-1 \<union> m^-1 \<union> ov ^-1"
  using csfi by auto

lemma cfd:"f O d \<subseteq> d"
  using cdifi by auto


lemma cff:"f O f \<subseteq> f"
  using cfifi by auto

lemma cfovi:"f O ov^-1 \<subseteq> b^-1 \<union> m^-1 \<union> ov^-1"
  using covfi by auto

lemma cfmi:"f O m^-1 \<subseteq> b^-1"
  using cmfi by auto

lemma cfbi:"f O b^-1 \<subseteq> b^-1"
  using cbfi by auto

lemma covifi:"ov^-1 O f^-1 \<subseteq> ov^-1 \<union> s^-1 \<union> d^-1"
  using cfov by auto

lemma covidi:"ov^-1 O d^-1 \<subseteq> b^-1 \<union> m^-1 \<union> s^-1 \<union> ov^-1 \<union> d^-1"
  using cdov by auto

lemma covis:"ov^-1 O s \<subseteq> ov^-1 \<union> f \<union> d"
  using csiov by auto

lemma covisi:"ov^-1 O s^-1 \<subseteq> b^-1 \<union> m^-1 \<union> ov^-1"
  using csov by auto

lemma covid:"ov^-1 O d \<subseteq> ov^-1 \<union> f \<union> d"
  using cdiov by auto

lemma covif:"ov^-1 O f \<subseteq> ov^-1"
  using cfiov by auto

lemma coviovi:"ov^-1 O ov^-1 \<subseteq> b^-1 \<union> m^-1 \<union> ov^-1"
  using covov by auto

lemma covimi:"ov^-1 O m^-1 \<subseteq> b^-1"
  using cmov by auto

lemma covibi:"ov^-1 O b^-1 \<subseteq> b^-1"
  using cbov by auto

lemma cmiov:"m^-1 O ov \<subseteq> ov^-1 \<union> d \<union> f"
  using covim by auto

lemma cmifi:"m^-1 O f^-1 \<subseteq> m^-1"
  using cfm by auto

lemma cmidi:"m^-1 O d^-1 \<subseteq> b^-1"
  using cdm by auto

lemma cmis:"m^-1 O s \<subseteq> ov^-1 \<union> d \<union> f"
  using csim by auto

lemma cmisi:"m^-1 O s^-1 \<subseteq> b^-1"
  using csm by auto

lemma cmid:"m^-1 O d \<subseteq> ov^-1 \<union> d \<union> f"
  using cdim by auto

lemma cmif:"m^-1 O f \<subseteq> m^-1"
  using cfim by auto

lemma cmiovi:"m^-1 O ov^-1 \<subseteq> b^-1"
  using covm by auto

lemma cmimi:"m^-1 O m^-1 \<subseteq> b^-1"
  using cmm by auto

lemma cmibi:"m^-1 O b^-1 \<subseteq> b^-1"
  using cbm by auto

lemma cbim:"b^-1 O m \<subseteq> b^-1 \<union> m^-1 \<union> ov^-1 \<union> f \<union> d"
  using cmib by auto

lemma cbiov:"b^-1 O ov \<subseteq> b^-1 \<union> m^-1 \<union> ov^-1 \<union> f \<union> d"
  using covib by auto

lemma cbifi:"b^-1 O f^-1 \<subseteq> b^-1"
  using cfb by auto

lemma cbidi:"b^-1 O d^-1 \<subseteq> b^-1"
  using cdb by auto

lemma cbis:"b^-1 O s \<subseteq> b^-1 \<union> m^-1 \<union> ov^-1 \<union> f \<union> d"
  using csib by auto

lemma cbisi:"b^-1 O s^-1 \<subseteq> b^-1"
  using csb by auto

lemma cbid:"b^-1 O d  \<subseteq> b^-1 \<union> m^-1 \<union> ov^-1 \<union> f \<union> d"
  using cdib by auto

lemma cbif:"b^-1 O f \<subseteq> b^-1"
  using cfib by auto

lemma cbiovi:"b^-1 O ov^-1 \<subseteq> b^-1"
  using covb by auto

lemma cbimi:"b^-1 O m^-1 \<subseteq> b^-1"
  using cmb by auto

lemma cbibi:"b^-1 O b^-1 \<subseteq> b^-1"
  using cbb by auto 

(****)

subsection \<open>Composition rules\<close> 
named_theorems ce_rules declare cem[ce_rules] and ceb[ce_rules] and ceov[ce_rules] and ces[ce_rules] and cef[ce_rules] and ced[ce_rules] and 
cemi[ce_rules] and cebi[ce_rules] and ceovi[ce_rules] and cesi[ce_rules] and cefi[ce_rules] and cedi[ce_rules]

named_theorems cm_rules declare cme[cm_rules] and cmb[cm_rules] and cmm[cm_rules] and cmov[cm_rules] and cms [cm_rules] and cmd[cm_rules] and cmf[cm_rules] and
cmbi[cm_rules] and cmmi[cm_rules] and cmovi[cm_rules] and cmsi[cm_rules] and cmdi[cm_rules] and cmfi[cm_rules]

named_theorems cb_rules declare cbe[cb_rules] and cbm[cb_rules] and cbb[cb_rules] and cbov[cb_rules] and cbs [cb_rules] and cbd[cb_rules] and cbf[cb_rules] and
cbbi[cb_rules] and cbbi[cb_rules] and cbovi[cb_rules] and cbsi[cb_rules] and cbdi[cb_rules] and cbfi[cb_rules]

named_theorems cov_rules declare cove[cov_rules] and covb[cov_rules] and covb[cov_rules] and covov[cov_rules] and covs [cov_rules] and covd[cov_rules] and covf[cov_rules] and
covbi[cov_rules] and covbi[cov_rules] and covovi[cov_rules] and covsi[cov_rules] and covdi[cov_rules] and covfi[cov_rules]

named_theorems cs_rules declare cse[cs_rules] and csb[cs_rules] and csb[cs_rules] and csov[cs_rules] and css [cs_rules] and csd[cs_rules] and csf[cs_rules] and
csbi[cs_rules] and csbi[cs_rules] and csovi[cs_rules] and cssi[cs_rules] and csdi[cs_rules] and csfi[cs_rules]

named_theorems cf_rules declare cfe[cf_rules] and cfb[cf_rules] and cfb[cf_rules] and cfov[cf_rules] and cfs [cf_rules] and cfd[cf_rules] and cff[cf_rules] and
cfbi[cf_rules] and cfbi[cf_rules] and cfovi[cf_rules] and cfsi[cf_rules] and cfdi[cf_rules] and cffi[cf_rules]

named_theorems cd_rules declare cde[cd_rules] and cdb[cd_rules] and cdb[cd_rules] and cdov[cd_rules] and cds [cd_rules] and cdd[cd_rules] and cdf[cd_rules] and
cdbi[cd_rules] and cdbi[cd_rules] and cdovi[cd_rules] and cdsi[cd_rules] and cddi[cd_rules] and cdfi[cd_rules]

named_theorems cmi_rules declare cmie[cmi_rules] and cmib[cmi_rules] and cmib[cmi_rules] and cmiov[cmi_rules] and cmis [cmi_rules] and cmid[cmi_rules] and cmif[cmi_rules] and
cmibi[cmi_rules] and cmibi[cmi_rules] and cmiovi[cmi_rules] and cmisi[cmi_rules] and cmidi[cmi_rules] and cmifi[cmi_rules]

named_theorems cbi_rules declare cbie[cbi_rules] and cbim[cbi_rules] and cbib[cbi_rules] and cbiov[cbi_rules] and cbis [cbi_rules] and cbid[cbi_rules] and cbif[cbi_rules] and
cbimi[cbi_rules] and cbibi[cbi_rules] and cbiovi[cbi_rules] and cbisi[cbi_rules] and cbidi[cbi_rules] and cbifi[cbi_rules]

named_theorems covi_rules declare covie[covi_rules] and covib[covi_rules] and covib[covi_rules] and coviov[covi_rules] and covis [covi_rules] and covid[covi_rules] and covif[covi_rules] and
covibi[covi_rules] and covibi[covi_rules] and coviovi[covi_rules] and covisi[covi_rules] and covidi[covi_rules] and covifi[covi_rules]

named_theorems csi_rules declare csie[csi_rules] and csib[csi_rules] and csib[csi_rules] and csiov[csi_rules] and csis [csi_rules] and csid[csi_rules] and csif[csi_rules] and
csibi[csi_rules] and csibi[csi_rules] and csiovi[csi_rules] and csisi[csi_rules] and csidi[csi_rules] and csifi[csi_rules]

named_theorems cfi_rules declare cfie[cfi_rules] and cfib[cfi_rules] and cfib[cfi_rules] and cfiov[cfi_rules] and cfis [cfi_rules] and cfid[cfi_rules] and cfif[cfi_rules] and
cfibi[cfi_rules] and cfibi[cfi_rules] and cfiovi[cfi_rules] and cfisi[cfi_rules] and cfidi[cfi_rules] and cfifi[cfi_rules]

named_theorems cdi_rules declare cdie[cdi_rules] and cdib[cdi_rules] and cdib[cdi_rules] and cdiov[cdi_rules] and cdis [cdi_rules] and cdid[cdi_rules] and cdif[cdi_rules] and
cdibi[cdi_rules] and cdibi[cdi_rules] and cdiovi[cdi_rules] and cdisi[cdi_rules] and cdidi[cdi_rules] and cdifi[cdi_rules]
(**)
named_theorems cre_rules declare cee[cre_rules] and cme[cre_rules] and cbe[cre_rules] and cove[cre_rules] and cse[cre_rules] and cfe[cre_rules] and cde[cre_rules] and 
cmie[cre_rules] and cbie[cre_rules] and covie[cre_rules] and csie[cre_rules] and cfie[cre_rules] and cdie[cre_rules]

named_theorems crm_rules declare cem[crm_rules] and cbm[crm_rules] and cmm[crm_rules]  and covm[crm_rules] and csm[crm_rules] and cfm[crm_rules] and cdm[crm_rules] and 
cmim[crm_rules] and cbim[crm_rules] and covim[crm_rules] and csim[crm_rules] and cfim[crm_rules] and cdim[crm_rules]

named_theorems crmi_rules declare cemi[crmi_rules] and cbmi[crmi_rules] and cmmi[crmi_rules]  and covmi[crmi_rules] and csmi[crmi_rules] and cfmi[crmi_rules] and cdmi[crmi_rules] and 
cmimi[crmi_rules] and cbimi[crmi_rules] and covimi[crmi_rules] and csimi[crmi_rules] and cfimi[crmi_rules] and cdimi[crmi_rules]

named_theorems crs_rules declare ces[crs_rules] and cbs[crs_rules] and cms[crs_rules]  and covs[crs_rules] and css[crs_rules] and cfs[crs_rules] and cds[crs_rules] and 
cmis[crs_rules] and cbis[crs_rules] and covis[crs_rules] and csis[crs_rules] and cfis[crs_rules] and cdis[crs_rules]

named_theorems crsi_rules declare cesi[crsi_rules] and cbsi[crsi_rules] and cmsi[crsi_rules]  and covsi[crsi_rules] and cssi[crsi_rules] and cfsi[crsi_rules] and cdsi[crsi_rules] and 
cmisi[crsi_rules] and cbisi[crsi_rules] and covisi[crsi_rules] and csisi[crsi_rules] and cfisi[crsi_rules] and cdisi[crsi_rules]

named_theorems crb_rules declare ceb[crb_rules] and cbb[crb_rules] and cmb[crb_rules]  and covb[crb_rules] and csb[crb_rules] and cfb[crb_rules] and cdb[crb_rules] and 
cmib[crb_rules] and cbib[crb_rules] and covib[crb_rules] and csib[crb_rules] and cfib[crb_rules] and cdib[crb_rules]

named_theorems crbi_rules declare cebi[crbi_rules] and cbbi[crbi_rules] and cmbi[crbi_rules]  and covbi[crbi_rules] and csbi[crbi_rules] and cfbi[crbi_rules] and cdbi[crbi_rules] and 
cmibi[crbi_rules] and cbibi[crbi_rules] and covibi[crbi_rules] and csibi[crbi_rules] and cfibi[crbi_rules] and cdibi[crbi_rules]

named_theorems crov_rules declare ceov[crov_rules] and cbov[crov_rules] and cmov[crov_rules]  and covov[crov_rules] and csov[crov_rules] and cfov[crov_rules] and cdov[crov_rules] and 
cmiov[crov_rules] and cbiov[crov_rules] and coviov[crov_rules] and csiov[crov_rules] and cfiov[crov_rules] and cdiov[crov_rules]

named_theorems crovi_rules declare ceovi[crovi_rules] and cbovi[crovi_rules] and cmovi[crovi_rules]  and covovi[crovi_rules] and csovi[crovi_rules] and cfovi[crovi_rules] and cdovi[crovi_rules] and 
cmiovi[crovi_rules] and cbiovi[crovi_rules] and coviovi[crovi_rules] and csiovi[crovi_rules] and cfiovi[crovi_rules] and cdiovi[crovi_rules]

named_theorems crf_rules declare cef[crf_rules] and cbf[crf_rules] and cmf[crf_rules]  and covf[crf_rules] and csf[crf_rules] and cff[crf_rules] and cdf[crf_rules] and 
cmif[crf_rules] and cbif[crf_rules] and covif[crf_rules] and csif[crf_rules] and cfif[crf_rules] and cdif[crf_rules]

named_theorems crfi_rules declare cefi[crfi_rules] and cbfi[crfi_rules] and cmfi[crfi_rules]  and covfi[crfi_rules] and csfi[crfi_rules] and cffi[crfi_rules] and cdfi[crfi_rules] and 
cmifi[crfi_rules] and cbifi[crfi_rules] and covifi[crfi_rules] and csifi[crfi_rules] and cfifi[crfi_rules] and cdifi[crfi_rules]

named_theorems crd_rules declare ced[crd_rules] and cbd[crd_rules] and cmd[crd_rules]  and covd[crd_rules] and csd[crd_rules] and cfd[crd_rules] and cdd[crd_rules] and 
cmid[crd_rules] and cbid[crd_rules] and covid[crd_rules] and csid[crd_rules] and cfid[crd_rules] and cdid[crd_rules]

named_theorems crdi_rules declare cedi[crdi_rules] and cbdi[crdi_rules] and cmdi[crdi_rules]  and covdi[crdi_rules] and csdi[crdi_rules] and cfdi[crdi_rules] and cddi[crdi_rules] and 
cmidi[crdi_rules] and cbidi[crdi_rules] and covidi[crdi_rules] and csidi[crdi_rules] and cfidi[crdi_rules] and cdidi[crdi_rules]



end