-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAOT_NaturalNumbers.thy
5508 lines (5294 loc) · 329 KB
/
AOT_NaturalNumbers.thy
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
(*<*)
theory AOT_NaturalNumbers
imports AOT_PossibleWorlds AOT_ExtendedRelationComprehension
abbrevs one-to-one = \<open>\<^sub>1\<^sub>-\<^sub>1\<close>
and onto = \<open>\<^sub>o\<^sub>n\<^sub>t\<^sub>o\<close>
begin
(*>*)
section\<open>Natural Numbers\<close>
AOT_define CorrelatesOneToOne :: \<open>\<tau> \<Rightarrow> \<tau> \<Rightarrow> \<tau> \<Rightarrow> \<phi>\<close> (\<open>_ |: _ \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow> _\<close>)
"1-1-cor": \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow> G \<equiv>\<^sub>d\<^sub>f R\<down> & F\<down> & G\<down> &
\<forall>x ([F]x \<rightarrow> \<exists>!y([G]y & [R]xy)) &
\<forall>y ([G]y \<rightarrow> \<exists>!x([F]x & [R]xy))\<close>
AOT_define MapsTo :: \<open>\<tau> \<Rightarrow> \<tau> \<Rightarrow> \<tau> \<Rightarrow> \<phi>\<close> (\<open>_ |: _ \<longrightarrow> _\<close>)
"fFG:1": \<open>R |: F \<longrightarrow> G \<equiv>\<^sub>d\<^sub>f R\<down> & F\<down> & G\<down> & \<forall>x ([F]x \<rightarrow> \<exists>!y([G]y & [R]xy))\<close>
AOT_define MapsToOneToOne :: \<open>\<tau> \<Rightarrow> \<tau> \<Rightarrow> \<tau> \<Rightarrow> \<phi>\<close> (\<open>_ |: _ \<^sub>1\<^sub>-\<^sub>1\<longrightarrow> _\<close>)
"fFG:2": \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow> G \<equiv>\<^sub>d\<^sub>f
R |: F \<longrightarrow> G & \<forall>x\<forall>y\<forall>z (([F]x & [F]y & [G]z) \<rightarrow> ([R]xz & [R]yz \<rightarrow> x = y))\<close>
AOT_define MapsOnto :: \<open>\<tau> \<Rightarrow> \<tau> \<Rightarrow> \<tau> \<Rightarrow> \<phi>\<close> (\<open>_ |: _ \<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>o _\<close>)
"fFG:3": \<open>R |: F \<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>o G \<equiv>\<^sub>d\<^sub>f R |: F \<longrightarrow> G & \<forall>y ([G]y \<rightarrow> \<exists>x([F]x & [R]xy))\<close>
AOT_define MapsOneToOneOnto :: \<open>\<tau> \<Rightarrow> \<tau> \<Rightarrow> \<tau> \<Rightarrow> \<phi>\<close> (\<open>_ |: _ \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>o _\<close>)
"fFG:4": \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>o G \<equiv>\<^sub>d\<^sub>f R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow> G & R |: F \<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>o G\<close>
AOT_theorem "eq-1-1": \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow> G \<equiv> R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>o G\<close>
proof(rule "\<equiv>I"; rule "\<rightarrow>I")
AOT_assume \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow> G\<close>
AOT_hence A: \<open>\<forall>x ([F]x \<rightarrow> \<exists>!y([G]y & [R]xy))\<close>
and B: \<open>\<forall>y ([G]y \<rightarrow> \<exists>!x([F]x & [R]xy))\<close>
using "\<equiv>\<^sub>d\<^sub>fE"[OF "1-1-cor"] "&E" by blast+
AOT_have C: \<open>R |: F \<longrightarrow> G\<close>
proof (rule "\<equiv>\<^sub>d\<^sub>fI"[OF "fFG:1"]; rule "&I")
AOT_show \<open>R\<down> & F\<down> & G\<down>\<close>
using "cqt:2[const_var]"[axiom_inst] "&I" by metis
next
AOT_show \<open>\<forall>x ([F]x \<rightarrow> \<exists>!y([G]y & [R]xy))\<close> by (rule A)
qed
AOT_show \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>o G\<close>
proof (rule "\<equiv>\<^sub>d\<^sub>fI"[OF "fFG:4"]; rule "&I")
AOT_show \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow> G\<close>
proof (rule "\<equiv>\<^sub>d\<^sub>fI"[OF "fFG:2"]; rule "&I")
AOT_show \<open>R |: F \<longrightarrow> G\<close> using C.
next
AOT_show \<open>\<forall>x\<forall>y\<forall>z ([F]x & [F]y & [G]z \<rightarrow> ([R]xz & [R]yz \<rightarrow> x = y))\<close>
proof(rule GEN; rule GEN; rule GEN; rule "\<rightarrow>I"; rule "\<rightarrow>I")
fix x y z
AOT_assume 1: \<open>[F]x & [F]y & [G]z\<close>
moreover AOT_assume 2: \<open>[R]xz & [R]yz\<close>
ultimately AOT_have 3: \<open>\<exists>!x ([F]x & [R]xz)\<close>
using B "&E" "\<forall>E" "\<rightarrow>E" by fast
AOT_show \<open>x = y\<close>
by (rule "uni-most"[THEN "\<rightarrow>E", OF 3, THEN "\<forall>E"(2)[where \<beta>=x],
THEN "\<forall>E"(2)[where \<beta>=y], THEN "\<rightarrow>E"])
(metis "&I" "&E" 1 2)
qed
qed
next
AOT_show \<open>R |: F \<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>o G\<close>
proof (rule "\<equiv>\<^sub>d\<^sub>fI"[OF "fFG:3"]; rule "&I")
AOT_show \<open>R |: F \<longrightarrow> G\<close> using C.
next
AOT_show \<open>\<forall>y ([G]y \<rightarrow> \<exists>x ([F]x & [R]xy))\<close>
proof(rule GEN; rule "\<rightarrow>I")
fix y
AOT_assume \<open>[G]y\<close>
AOT_hence \<open>\<exists>!x ([F]x & [R]xy)\<close>
using B[THEN "\<forall>E"(2), THEN "\<rightarrow>E"] by blast
AOT_hence \<open>\<exists>x ([F]x & [R]xy & \<forall>\<beta> (([F]\<beta> & [R]\<beta>y) \<rightarrow> \<beta> = x))\<close>
using "uniqueness:1"[THEN "\<equiv>\<^sub>d\<^sub>fE"] by blast
then AOT_obtain x where \<open>[F]x & [R]xy\<close>
using "\<exists>E"[rotated] "&E" by blast
AOT_thus \<open>\<exists>x ([F]x & [R]xy)\<close> by (rule "\<exists>I")
qed
qed
qed
next
AOT_assume \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>o G\<close>
AOT_hence \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow> G\<close> and \<open>R |: F \<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>o G\<close>
using "\<equiv>\<^sub>d\<^sub>fE"[OF "fFG:4"] "&E" by blast+
AOT_hence C: \<open>R |: F \<longrightarrow> G\<close>
and D: \<open>\<forall>x\<forall>y\<forall>z ([F]x & [F]y & [G]z \<rightarrow> ([R]xz & [R]yz \<rightarrow> x = y))\<close>
and E: \<open>\<forall>y ([G]y \<rightarrow> \<exists>x ([F]x & [R]xy))\<close>
using "\<equiv>\<^sub>d\<^sub>fE"[OF "fFG:2"] "\<equiv>\<^sub>d\<^sub>fE"[OF "fFG:3"] "&E" by blast+
AOT_show \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow> G\<close>
proof(rule "1-1-cor"[THEN "\<equiv>\<^sub>d\<^sub>fI"]; safe intro!: "&I" "cqt:2[const_var]"[axiom_inst])
AOT_show \<open>\<forall>x ([F]x \<rightarrow> \<exists>!y ([G]y & [R]xy))\<close>
using "\<equiv>\<^sub>d\<^sub>fE"[OF "fFG:1", OF C] "&E" by blast
next
AOT_show \<open>\<forall>y ([G]y \<rightarrow> \<exists>!x ([F]x & [R]xy))\<close>
proof (rule "GEN"; rule "\<rightarrow>I")
fix y
AOT_assume 0: \<open>[G]y\<close>
AOT_hence \<open>\<exists>x ([F]x & [R]xy)\<close>
using E "\<forall>E" "\<rightarrow>E" by fast
then AOT_obtain a where a_prop: \<open>[F]a & [R]ay\<close>
using "\<exists>E"[rotated] by blast
moreover AOT_have \<open>\<forall>z ([F]z & [R]zy \<rightarrow> z = a)\<close>
proof (rule GEN; rule "\<rightarrow>I")
fix z
AOT_assume \<open>[F]z & [R]zy\<close>
AOT_thus \<open>z = a\<close>
using D[THEN "\<forall>E"(2)[where \<beta>=z], THEN "\<forall>E"(2)[where \<beta>=a],
THEN "\<forall>E"(2)[where \<beta>=y], THEN "\<rightarrow>E", THEN "\<rightarrow>E"]
a_prop 0 "&E" "&I" by metis
qed
ultimately AOT_have \<open>\<exists>x ([F]x & [R]xy & \<forall>z ([F]z & [R]zy \<rightarrow> z = x))\<close>
using "&I" "\<exists>I"(2) by fast
AOT_thus \<open>\<exists>!x ([F]x & [R]xy)\<close>
using "uniqueness:1"[THEN "\<equiv>\<^sub>d\<^sub>fI"] by fast
qed
qed
qed
text\<open>We have already introduced the restricted type of Ordinary objects in the
Extended Relation Comprehension theory. However, make sure all variable names
are defined as expected (avoiding conflicts with situations
of possible world theory).\<close>
AOT_register_variable_names
Ordinary: u v r t s
AOT_theorem "equi:1": \<open>\<exists>!u \<phi>{u} \<equiv> \<exists>u (\<phi>{u} & \<forall>v (\<phi>{v} \<rightarrow> v =\<^sub>E u))\<close>
proof(rule "\<equiv>I"; rule "\<rightarrow>I")
AOT_assume \<open>\<exists>!u \<phi>{u}\<close>
AOT_hence \<open>\<exists>!x (O!x & \<phi>{x})\<close>.
AOT_hence \<open>\<exists>x (O!x & \<phi>{x} & \<forall>\<beta> (O!\<beta> & \<phi>{\<beta>} \<rightarrow> \<beta> = x))\<close>
using "uniqueness:1"[THEN "\<equiv>\<^sub>d\<^sub>fE"] by blast
then AOT_obtain x where x_prop: \<open>O!x & \<phi>{x} & \<forall>\<beta> (O!\<beta> & \<phi>{\<beta>} \<rightarrow> \<beta> = x)\<close>
using "\<exists>E"[rotated] by blast
{
fix \<beta>
AOT_assume beta_ord: \<open>O!\<beta>\<close>
moreover AOT_assume \<open>\<phi>{\<beta>}\<close>
ultimately AOT_have \<open>\<beta> = x\<close>
using x_prop[THEN "&E"(2), THEN "\<forall>E"(2)[where \<beta>=\<beta>]] "&I" "\<rightarrow>E" by blast
AOT_hence \<open>\<beta> =\<^sub>E x\<close>
using "ord-=E=:1"[THEN "\<rightarrow>E", OF "\<or>I"(1)[OF beta_ord],
THEN "qml:2"[axiom_inst, THEN "\<rightarrow>E"],
THEN "\<equiv>E"(1)]
by blast
}
AOT_hence \<open>(O!\<beta> \<rightarrow> (\<phi>{\<beta>} \<rightarrow> \<beta> =\<^sub>E x))\<close> for \<beta>
using "\<rightarrow>I" by blast
AOT_hence \<open>\<forall>\<beta>(O!\<beta> \<rightarrow> (\<phi>{\<beta>} \<rightarrow> \<beta> =\<^sub>E x))\<close>
by (rule GEN)
AOT_hence \<open>O!x & \<phi>{x} & \<forall>y (O!y \<rightarrow> (\<phi>{y} \<rightarrow> y =\<^sub>E x))\<close>
using x_prop[THEN "&E"(1)] "&I" by blast
AOT_hence \<open>O!x & (\<phi>{x} & \<forall>y (O!y \<rightarrow> (\<phi>{y} \<rightarrow> y =\<^sub>E x)))\<close>
using "&E" "&I" by meson
AOT_thus \<open>\<exists>u (\<phi>{u} & \<forall>v (\<phi>{v} \<rightarrow> v =\<^sub>E u))\<close>
using "\<exists>I" by fast
next
AOT_assume \<open>\<exists>u (\<phi>{u} & \<forall>v (\<phi>{v} \<rightarrow> v =\<^sub>E u))\<close>
AOT_hence \<open>\<exists>x (O!x & (\<phi>{x} & \<forall>y (O!y \<rightarrow> (\<phi>{y} \<rightarrow> y =\<^sub>E x))))\<close>
by blast
then AOT_obtain x where x_prop: \<open>O!x & (\<phi>{x} & \<forall>y (O!y \<rightarrow> (\<phi>{y} \<rightarrow> y =\<^sub>E x)))\<close>
using "\<exists>E"[rotated] by blast
AOT_have \<open>\<forall>y ([O!]y & \<phi>{y} \<rightarrow> y = x)\<close>
proof(rule GEN; rule "\<rightarrow>I")
fix y
AOT_assume \<open>O!y & \<phi>{y}\<close>
AOT_hence \<open>y =\<^sub>E x\<close>
using x_prop[THEN "&E"(2), THEN "&E"(2), THEN "\<forall>E"(2)[where \<beta>=y]]
"\<rightarrow>E" "&E" by blast
AOT_thus \<open>y = x\<close>
using "ord-=E=:1"[THEN "\<rightarrow>E", OF "\<or>I"(2)[OF x_prop[THEN "&E"(1)]],
THEN "qml:2"[axiom_inst, THEN "\<rightarrow>E"], THEN "\<equiv>E"(2)] by blast
qed
AOT_hence \<open>[O!]x & \<phi>{x} & \<forall>y ([O!]y & \<phi>{y} \<rightarrow> y = x)\<close>
using x_prop "&E" "&I" by meson
AOT_hence \<open>\<exists>x ([O!]x & \<phi>{x} & \<forall>y ([O!]y & \<phi>{y} \<rightarrow> y = x))\<close>
by (rule "\<exists>I")
AOT_hence \<open>\<exists>!x (O!x & \<phi>{x})\<close>
by (rule "uniqueness:1"[THEN "\<equiv>\<^sub>d\<^sub>fI"])
AOT_thus \<open>\<exists>!u \<phi>{u}\<close>.
qed
AOT_define CorrelatesEOneToOne :: \<open>\<tau> \<Rightarrow> \<tau> \<Rightarrow> \<tau> \<Rightarrow> \<phi>\<close> (\<open>_ |: _ \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E _\<close>)
"equi:2": \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E G \<equiv>\<^sub>d\<^sub>f R\<down> & F\<down> & G\<down> &
\<forall>u ([F]u \<rightarrow> \<exists>!v([G]v & [R]uv)) &
\<forall>v ([G]v \<rightarrow> \<exists>!u([F]u & [R]uv))\<close>
AOT_define EquinumerousE :: \<open>\<tau> \<Rightarrow> \<tau> \<Rightarrow> \<phi>\<close> (infixl "\<approx>\<^sub>E" 50)
"equi:3": \<open>F \<approx>\<^sub>E G \<equiv>\<^sub>d\<^sub>f \<exists>R (R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E G)\<close>
text\<open>Note: not explicitly in PLM.\<close>
AOT_theorem eq_den_1: \<open>\<Pi>\<down>\<close> if \<open>\<Pi> \<approx>\<^sub>E \<Pi>'\<close>
proof -
AOT_have \<open>\<exists>R (R |: \<Pi> \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E \<Pi>')\<close>
using "equi:3"[THEN "\<equiv>\<^sub>d\<^sub>fE"] that by blast
then AOT_obtain R where \<open>R |: \<Pi> \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E \<Pi>'\<close>
using "\<exists>E"[rotated] by blast
AOT_thus \<open>\<Pi>\<down>\<close>
using "equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "&E" by blast
qed
text\<open>Note: not explicitly in PLM.\<close>
AOT_theorem eq_den_2: \<open>\<Pi>'\<down>\<close> if \<open>\<Pi> \<approx>\<^sub>E \<Pi>'\<close>
proof -
AOT_have \<open>\<exists>R (R |: \<Pi> \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E \<Pi>')\<close>
using "equi:3"[THEN "\<equiv>\<^sub>d\<^sub>fE"] that by blast
then AOT_obtain R where \<open>R |: \<Pi> \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E \<Pi>'\<close>
using "\<exists>E"[rotated] by blast
AOT_thus \<open>\<Pi>'\<down>\<close>
using "equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "&E" by blast+
qed
AOT_theorem "eq-part:1": \<open>F \<approx>\<^sub>E F\<close>
proof (safe intro!: "&I" GEN "\<rightarrow>I" "cqt:2[const_var]"[axiom_inst]
"\<equiv>\<^sub>d\<^sub>fI"[OF "equi:3"] "\<equiv>\<^sub>d\<^sub>fI"[OF "equi:2"] "\<exists>I"(1))
fix x
AOT_assume 1: \<open>O!x\<close>
AOT_assume 2: \<open>[F]x\<close>
AOT_show \<open>\<exists>!v ([F]v & x =\<^sub>E v)\<close>
proof(rule "equi:1"[THEN "\<equiv>E"(2)];
rule "\<exists>I"(2)[where \<beta>=x];
safe dest!: "&E"(2)
intro!: "&I" "\<rightarrow>I" 1 2 Ordinary.GEN "ord=Eequiv:1"[THEN "\<rightarrow>E", OF 1])
AOT_show \<open>v =\<^sub>E x\<close> if \<open>x =\<^sub>E v\<close> for v
by (metis that "ord=Eequiv:2"[THEN "\<rightarrow>E"])
qed
next
fix y
AOT_assume 1: \<open>O!y\<close>
AOT_assume 2: \<open>[F]y\<close>
AOT_show \<open>\<exists>!u ([F]u & u =\<^sub>E y)\<close>
by(safe dest!: "&E"(2)
intro!: "equi:1"[THEN "\<equiv>E"(2)] "\<exists>I"(2)[where \<beta>=y]
"&I" "\<rightarrow>I" 1 2 GEN "ord=Eequiv:1"[THEN "\<rightarrow>E", OF 1])
qed(auto simp: "=E[denotes]")
AOT_theorem "eq-part:2": \<open>F \<approx>\<^sub>E G \<rightarrow> G \<approx>\<^sub>E F\<close>
proof (rule "\<rightarrow>I")
AOT_assume \<open>F \<approx>\<^sub>E G\<close>
AOT_hence \<open>\<exists>R R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E G\<close>
using "equi:3"[THEN "\<equiv>\<^sub>d\<^sub>fE"] by blast
then AOT_obtain R where \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E G\<close>
using "\<exists>E"[rotated] by blast
AOT_hence 0: \<open>R\<down> & F\<down> & G\<down> & \<forall>u ([F]u \<rightarrow> \<exists>!v([G]v & [R]uv)) &
\<forall>v ([G]v \<rightarrow> \<exists>!u([F]u & [R]uv))\<close>
using "equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fE"] by blast
AOT_have \<open>[\<lambda>xy [R]yx]\<down> & G\<down> & F\<down> & \<forall>u ([G]u \<rightarrow> \<exists>!v([F]v & [\<lambda>xy [R]yx]uv)) &
\<forall>v ([F]v \<rightarrow> \<exists>!u([G]u & [\<lambda>xy [R]yx]uv))\<close>
proof (AOT_subst \<open>[\<lambda>xy [R]yx]yx\<close> \<open>[R]xy\<close> for: x y;
(safe intro!: "&I" "cqt:2[const_var]"[axiom_inst] 0[THEN "&E"(2)]
0[THEN "&E"(1), THEN "&E"(2)]; "cqt:2[lambda]")?)
AOT_modally_strict {
AOT_have \<open>[\<lambda>xy [R]yx]xy\<close> if \<open>[R]yx\<close> for y x
by (auto intro!: "\<beta>\<leftarrow>C"(1) "cqt:2"
simp: "&I" "ex:1:a" prod_denotesI "rule-ui:3" that)
moreover AOT_have \<open>[R]yx\<close> if \<open>[\<lambda>xy [R]yx]xy\<close> for y x
using "\<beta>\<rightarrow>C"(1)[where \<phi>="\<lambda>(x,y). _ (x,y)" and \<kappa>\<^sub>1\<kappa>\<^sub>n="(_,_)",
simplified, OF that, simplified].
ultimately AOT_show \<open>[\<lambda>xy [R]yx]\<alpha>\<beta> \<equiv> [R]\<beta>\<alpha>\<close> for \<alpha> \<beta>
by (metis "deduction-theorem" "\<equiv>I")
}
qed
AOT_hence \<open>[\<lambda>xy [R]yx] |: G \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E F\<close>
using "equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fI"] by blast
AOT_hence \<open>\<exists>R R |: G \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E F\<close>
by (rule "\<exists>I"(1)) "cqt:2[lambda]"
AOT_thus \<open>G \<approx>\<^sub>E F\<close>
using "equi:3"[THEN "\<equiv>\<^sub>d\<^sub>fI"] by blast
qed
text\<open>Note: not explicitly in PLM.\<close>
AOT_theorem "eq-part:2[terms]": \<open>\<Pi> \<approx>\<^sub>E \<Pi>' \<rightarrow> \<Pi>' \<approx>\<^sub>E \<Pi>\<close>
using "eq-part:2"[unvarify F G] eq_den_1 eq_den_2 "\<rightarrow>I" by meson
declare "eq-part:2[terms]"[THEN "\<rightarrow>E", sym]
AOT_theorem "eq-part:3": \<open>(F \<approx>\<^sub>E G & G \<approx>\<^sub>E H) \<rightarrow> F \<approx>\<^sub>E H\<close>
proof (rule "\<rightarrow>I")
AOT_assume \<open>F \<approx>\<^sub>E G & G \<approx>\<^sub>E H\<close>
then AOT_obtain R\<^sub>1 and R\<^sub>2 where
\<open>R\<^sub>1 |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E G\<close>
and \<open>R\<^sub>2 |: G \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E H\<close>
using "equi:3"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "&E" "\<exists>E"[rotated] by metis
AOT_hence \<theta>: \<open>\<forall>u ([F]u \<rightarrow> \<exists>!v([G]v & [R\<^sub>1]uv)) & \<forall>v ([G]v \<rightarrow> \<exists>!u([F]u & [R\<^sub>1]uv))\<close>
and \<xi>: \<open>\<forall>u ([G]u \<rightarrow> \<exists>!v([H]v & [R\<^sub>2]uv)) & \<forall>v ([H]v \<rightarrow> \<exists>!u([G]u & [R\<^sub>2]uv))\<close>
using "equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fE", THEN "&E"(2)]
"equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fE", THEN "&E"(1), THEN "&E"(2)]
"&I" by blast+
AOT_have \<open>\<exists>R R = [\<lambda>xy O!x & O!y & \<exists>v ([G]v & [R\<^sub>1]xv & [R\<^sub>2]vy)]\<close>
by (rule "free-thms:3[lambda]") cqt_2_lambda_inst_prover
then AOT_obtain R where R_def: \<open>R = [\<lambda>xy O!x & O!y & \<exists>v ([G]v & [R\<^sub>1]xv & [R\<^sub>2]vy)]\<close>
using "\<exists>E"[rotated] by blast
AOT_have 1: \<open>\<exists>!v (([H]v & [R]uv))\<close> if a: \<open>[O!]u\<close> and b: \<open>[F]u\<close> for u
proof (rule "\<equiv>E"(2)[OF "equi:1"])
AOT_obtain b where
b_prop: \<open>[O!]b & ([G]b & [R\<^sub>1]ub & \<forall>v ([G]v & [R\<^sub>1]uv \<rightarrow> v =\<^sub>E b))\<close>
using \<theta>[THEN "&E"(1), THEN "\<forall>E"(2), THEN "\<rightarrow>E", THEN "\<rightarrow>E",
OF a b, THEN "\<equiv>E"(1)[OF "equi:1"]]
"\<exists>E"[rotated] by blast
AOT_obtain c where
c_prop: "[O!]c & ([H]c & [R\<^sub>2]bc & \<forall>v ([H]v & [R\<^sub>2]bv \<rightarrow> v =\<^sub>E c))"
using \<xi>[THEN "&E"(1), THEN "\<forall>E"(2)[where \<beta>=b], THEN "\<rightarrow>E",
OF b_prop[THEN "&E"(1)], THEN "\<rightarrow>E",
OF b_prop[THEN "&E"(2), THEN "&E"(1), THEN "&E"(1)],
THEN "\<equiv>E"(1)[OF "equi:1"]]
"\<exists>E"[rotated] by blast
AOT_show \<open>\<exists>v ([H]v & [R]uv & \<forall>v' ([H]v' & [R]uv' \<rightarrow> v' =\<^sub>E v))\<close>
proof (safe intro!: "&I" GEN "\<rightarrow>I" "\<exists>I"(2)[where \<beta>=c])
AOT_show \<open>O!c\<close> using c_prop "&E" by blast
next
AOT_show \<open>[H]c\<close> using c_prop "&E" by blast
next
AOT_have 0: \<open>[O!]u & [O!]c & \<exists>v ([G]v & [R\<^sub>1]uv & [R\<^sub>2]vc)\<close>
by (safe intro!: "&I" a c_prop[THEN "&E"(1)] "\<exists>I"(2)[where \<beta>=b]
b_prop[THEN "&E"(1)] b_prop[THEN "&E"(2), THEN "&E"(1)]
c_prop[THEN "&E"(2), THEN "&E"(1), THEN "&E"(2)])
AOT_show \<open>[R]uc\<close>
by (auto intro: "rule=E"[rotated, OF R_def[symmetric]]
intro!: "\<beta>\<leftarrow>C"(1) "cqt:2"
simp: "&I" "ex:1:a" prod_denotesI "rule-ui:3" 0)
next
fix x
AOT_assume ordx: \<open>O!x\<close>
AOT_assume \<open>[H]x & [R]ux\<close>
AOT_hence hx: \<open>[H]x\<close> and \<open>[R]ux\<close> using "&E" by blast+
AOT_hence \<open>[\<lambda>xy O!x & O!y & \<exists>v ([G]v & [R\<^sub>1]xv & [R\<^sub>2]vy)]ux\<close>
using "rule=E"[rotated, OF R_def] by fast
AOT_hence \<open>O!u & O!x & \<exists>v ([G]v & [R\<^sub>1]uv & [R\<^sub>2]vx)\<close>
by (rule "\<beta>\<rightarrow>C"(1)[where \<phi>="\<lambda>(\<kappa>,\<kappa>'). _ \<kappa> \<kappa>'" and \<kappa>\<^sub>1\<kappa>\<^sub>n="(_,_)", simplified])
then AOT_obtain z where z_prop: \<open>O!z & ([G]z & [R\<^sub>1]uz & [R\<^sub>2]zx)\<close>
using "&E" "\<exists>E"[rotated] by blast
AOT_hence \<open>z =\<^sub>E b\<close>
using b_prop[THEN "&E"(2), THEN "&E"(2), THEN "\<forall>E"(2)[where \<beta>=z]]
using "&E" "\<rightarrow>E" by metis
AOT_hence \<open>z = b\<close>
by (metis "=E-simple:2"[THEN "\<rightarrow>E"])
AOT_hence \<open>[R\<^sub>2]bx\<close>
using z_prop[THEN "&E"(2), THEN "&E"(2)] "rule=E" by fast
AOT_thus \<open>x =\<^sub>E c\<close>
using c_prop[THEN "&E"(2), THEN "&E"(2), THEN "\<forall>E"(2)[where \<beta>=x],
THEN "\<rightarrow>E", THEN "\<rightarrow>E", OF ordx]
hx "&I" by blast
qed
qed
AOT_have 2: \<open>\<exists>!u (([F]u & [R]uv))\<close> if a: \<open>[O!]v\<close> and b: \<open>[H]v\<close> for v
proof (rule "\<equiv>E"(2)[OF "equi:1"])
AOT_obtain b where
b_prop: \<open>[O!]b & ([G]b & [R\<^sub>2]bv & \<forall>u ([G]u & [R\<^sub>2]uv \<rightarrow> u =\<^sub>E b))\<close>
using \<xi>[THEN "&E"(2), THEN "\<forall>E"(2), THEN "\<rightarrow>E", THEN "\<rightarrow>E",
OF a b, THEN "\<equiv>E"(1)[OF "equi:1"]]
"\<exists>E"[rotated] by blast
AOT_obtain c where
c_prop: "[O!]c & ([F]c & [R\<^sub>1]cb & \<forall>v ([F]v & [R\<^sub>1]vb \<rightarrow> v =\<^sub>E c))"
using \<theta>[THEN "&E"(2), THEN "\<forall>E"(2)[where \<beta>=b], THEN "\<rightarrow>E",
OF b_prop[THEN "&E"(1)], THEN "\<rightarrow>E",
OF b_prop[THEN "&E"(2), THEN "&E"(1), THEN "&E"(1)],
THEN "\<equiv>E"(1)[OF "equi:1"]]
"\<exists>E"[rotated] by blast
AOT_show \<open>\<exists>u ([F]u & [R]uv & \<forall>v' ([F]v' & [R]v'v \<rightarrow> v' =\<^sub>E u))\<close>
proof (safe intro!: "&I" GEN "\<rightarrow>I" "\<exists>I"(2)[where \<beta>=c])
AOT_show \<open>O!c\<close> using c_prop "&E" by blast
next
AOT_show \<open>[F]c\<close> using c_prop "&E" by blast
next
AOT_have \<open>[O!]c & [O!]v & \<exists>u ([G]u & [R\<^sub>1]cu & [R\<^sub>2]uv)\<close>
by (safe intro!: "&I" a "\<exists>I"(2)[where \<beta>=b]
c_prop[THEN "&E"(1)] b_prop[THEN "&E"(1)]
b_prop[THEN "&E"(2), THEN "&E"(1), THEN "&E"(1)]
b_prop[THEN "&E"(2), THEN "&E"(1), THEN "&E"(2)]
c_prop[THEN "&E"(2), THEN "&E"(1), THEN "&E"(2)])
AOT_thus \<open>[R]cv\<close>
by (auto intro: "rule=E"[rotated, OF R_def[symmetric]]
intro!: "\<beta>\<leftarrow>C"(1) "cqt:2"
simp: "&I" "ex:1:a" prod_denotesI "rule-ui:3")
next
fix x
AOT_assume ordx: \<open>O!x\<close>
AOT_assume \<open>[F]x & [R]xv\<close>
AOT_hence hx: \<open>[F]x\<close> and \<open>[R]xv\<close> using "&E" by blast+
AOT_hence \<open>[\<lambda>xy O!x & O!y & \<exists>v ([G]v & [R\<^sub>1]xv & [R\<^sub>2]vy)]xv\<close>
using "rule=E"[rotated, OF R_def] by fast
AOT_hence \<open>O!x & O!v & \<exists>u ([G]u & [R\<^sub>1]xu & [R\<^sub>2]uv)\<close>
by (rule "\<beta>\<rightarrow>C"(1)[where \<phi>="\<lambda>(\<kappa>,\<kappa>'). _ \<kappa> \<kappa>'" and \<kappa>\<^sub>1\<kappa>\<^sub>n="(_,_)", simplified])
then AOT_obtain z where z_prop: \<open>O!z & ([G]z & [R\<^sub>1]xz & [R\<^sub>2]zv)\<close>
using "&E" "\<exists>E"[rotated] by blast
AOT_hence \<open>z =\<^sub>E b\<close>
using b_prop[THEN "&E"(2), THEN "&E"(2), THEN "\<forall>E"(2)[where \<beta>=z]]
using "&E" "\<rightarrow>E" "&I" by metis
AOT_hence \<open>z = b\<close>
by (metis "=E-simple:2"[THEN "\<rightarrow>E"])
AOT_hence \<open>[R\<^sub>1]xb\<close>
using z_prop[THEN "&E"(2), THEN "&E"(1), THEN "&E"(2)] "rule=E" by fast
AOT_thus \<open>x =\<^sub>E c\<close>
using c_prop[THEN "&E"(2), THEN "&E"(2), THEN "\<forall>E"(2)[where \<beta>=x],
THEN "\<rightarrow>E", THEN "\<rightarrow>E", OF ordx]
hx "&I" by blast
qed
qed
AOT_show \<open>F \<approx>\<^sub>E H\<close>
apply (rule "equi:3"[THEN "\<equiv>\<^sub>d\<^sub>fI"])
apply (rule "\<exists>I"(2)[where \<beta>=R])
by (auto intro!: 1 2 "equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fI"] "&I" "cqt:2[const_var]"[axiom_inst]
Ordinary.GEN "\<rightarrow>I" Ordinary.\<psi>)
qed
text\<open>Note: not explicitly in PLM.\<close>
AOT_theorem "eq-part:3[terms]": \<open>\<Pi> \<approx>\<^sub>E \<Pi>''\<close> if \<open>\<Pi> \<approx>\<^sub>E \<Pi>'\<close> and \<open>\<Pi>' \<approx>\<^sub>E \<Pi>''\<close>
using "eq-part:3"[unvarify F G H, THEN "\<rightarrow>E"] eq_den_1 eq_den_2 "\<rightarrow>I" "&I"
by (metis that(1) that(2))
declare "eq-part:3[terms]"[trans]
AOT_theorem "eq-part:4": \<open>F \<approx>\<^sub>E G \<equiv> \<forall>H (H \<approx>\<^sub>E F \<equiv> H \<approx>\<^sub>E G)\<close>
proof(rule "\<equiv>I"; rule "\<rightarrow>I")
AOT_assume 0: \<open>F \<approx>\<^sub>E G\<close>
AOT_hence 1: \<open>G \<approx>\<^sub>E F\<close> using "eq-part:2"[THEN "\<rightarrow>E"] by blast
AOT_show \<open>\<forall>H (H \<approx>\<^sub>E F \<equiv> H \<approx>\<^sub>E G)\<close>
proof (rule GEN; rule "\<equiv>I"; rule "\<rightarrow>I")
AOT_show \<open>H \<approx>\<^sub>E G\<close> if \<open>H \<approx>\<^sub>E F\<close> for H using 0
by (meson "&I" "eq-part:3" that "vdash-properties:6")
next
AOT_show \<open>H \<approx>\<^sub>E F\<close> if \<open>H \<approx>\<^sub>E G\<close> for H using 1
by (metis "&I" "eq-part:3" that "vdash-properties:6")
qed
next
AOT_assume \<open>\<forall>H (H \<approx>\<^sub>E F \<equiv> H \<approx>\<^sub>E G)\<close>
AOT_hence \<open>F \<approx>\<^sub>E F \<equiv> F \<approx>\<^sub>E G\<close> using "\<forall>E" by blast
AOT_thus \<open>F \<approx>\<^sub>E G\<close> using "eq-part:1" "\<equiv>E" by blast
qed
AOT_define MapsE :: \<open>\<tau> \<Rightarrow> \<tau> \<Rightarrow> \<tau> \<Rightarrow> \<phi>\<close> ("_ |: _ \<longrightarrow>E _")
"equi-rem:1":
\<open>R |: F \<longrightarrow>E G \<equiv>\<^sub>d\<^sub>f R\<down> & F\<down> & G\<down> & \<forall>u ([F]u \<rightarrow> \<exists>!v ([G]v & [R]uv))\<close>
AOT_define MapsEOneToOne :: \<open>\<tau> \<Rightarrow> \<tau> \<Rightarrow> \<tau> \<Rightarrow> \<phi>\<close> ("_ |: _ \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>E _")
"equi-rem:2":
\<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>E G \<equiv>\<^sub>d\<^sub>f
R |: F \<longrightarrow>E G & \<forall>t\<forall>u\<forall>v (([F]t & [F]u & [G]v) \<rightarrow> ([R]tv & [R]uv \<rightarrow> t =\<^sub>E u))\<close>
AOT_define MapsEOnto :: \<open>\<tau> \<Rightarrow> \<tau> \<Rightarrow> \<tau> \<Rightarrow> \<phi>\<close> ("_ |: _ \<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE _")
"equi-rem:3":
\<open>R |: F \<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE G \<equiv>\<^sub>d\<^sub>f R |: F \<longrightarrow>E G & \<forall>v ([G]v \<rightarrow> \<exists>u ([F]u & [R]uv))\<close>
AOT_define MapsEOneToOneOnto :: \<open>\<tau> \<Rightarrow> \<tau> \<Rightarrow> \<tau> \<Rightarrow> \<phi>\<close> ("_ |: _ \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE _")
"equi-rem:4":
\<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE G \<equiv>\<^sub>d\<^sub>f R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>E G & R |: F \<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE G\<close>
AOT_theorem "equi-rem-thm":
\<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E G \<equiv> R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE G\<close>
proof -
AOT_have \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E G \<equiv> R |: [\<lambda>x O!x & [F]x] \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow> [\<lambda>x O!x & [G]x]\<close>
proof(safe intro!: "\<equiv>I" "\<rightarrow>I" "&I")
AOT_assume \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E G\<close>
AOT_hence \<open>\<forall>u ([F]u \<rightarrow> \<exists>!v ([G]v & [R]uv))\<close>
and \<open>\<forall>v ([G]v \<rightarrow> \<exists>!u ([F]u & [R]uv))\<close>
using "equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "&E" by blast+
AOT_hence a: \<open>([F]u \<rightarrow> \<exists>!v ([G]v & [R]uv))\<close>
and b: \<open>([G]v \<rightarrow> \<exists>!u ([F]u & [R]uv))\<close> for u v
using "Ordinary.\<forall>E" by fast+
AOT_have \<open>([\<lambda>x [O!]x & [F]x]x \<rightarrow> \<exists>!y ([\<lambda>x [O!]x & [G]x]y & [R]xy))\<close> for x
apply (AOT_subst \<open>[\<lambda>x [O!]x & [F]x]x\<close> \<open>[O!]x & [F]x\<close>)
apply (rule "beta-C-meta"[THEN "\<rightarrow>E"])
apply "cqt:2[lambda]"
apply (AOT_subst \<open>[\<lambda>x [O!]x & [G]x]x\<close> \<open>[O!]x & [G]x\<close> for: x)
apply (rule "beta-C-meta"[THEN "\<rightarrow>E"])
apply "cqt:2[lambda]"
apply (AOT_subst \<open>O!y & [G]y & [R]xy\<close> \<open>O!y & ([G]y & [R]xy)\<close> for: y)
apply (meson "\<equiv>E"(6) "Associativity of &" "oth-class-taut:3:a")
apply (rule "\<rightarrow>I") apply (frule "&E"(1)) apply (drule "&E"(2))
by (fact a[unconstrain u, THEN "\<rightarrow>E", THEN "\<rightarrow>E", of x])
AOT_hence A: \<open>\<forall>x ([\<lambda>x [O!]x & [F]x]x \<rightarrow> \<exists>!y ([\<lambda>x [O!]x & [G]x]y & [R]xy))\<close>
by (rule GEN)
AOT_have \<open>([\<lambda>x [O!]x & [G]x]y \<rightarrow> \<exists>!x ([\<lambda>x [O!]x & [F]x]x & [R]xy))\<close> for y
apply (AOT_subst \<open>[\<lambda>x [O!]x & [G]x]y\<close> \<open>[O!]y & [G]y\<close>)
apply (rule "beta-C-meta"[THEN "\<rightarrow>E"])
apply "cqt:2[lambda]"
apply (AOT_subst \<open>[\<lambda>x [O!]x & [F]x]x\<close> \<open>[O!]x & [F]x\<close> for: x)
apply (rule "beta-C-meta"[THEN "\<rightarrow>E"])
apply "cqt:2[lambda]"
apply (AOT_subst \<open>O!x & [F]x & [R]xy\<close> \<open>O!x & ([F]x & [R]xy)\<close> for: x)
apply (meson "\<equiv>E"(6) "Associativity of &" "oth-class-taut:3:a")
apply (rule "\<rightarrow>I") apply (frule "&E"(1)) apply (drule "&E"(2))
by (fact b[unconstrain v, THEN "\<rightarrow>E", THEN "\<rightarrow>E", of y])
AOT_hence B: \<open>\<forall>y ([\<lambda>x [O!]x & [G]x]y \<rightarrow> \<exists>!x ([\<lambda>x [O!]x & [F]x]x & [R]xy))\<close>
by (rule GEN)
AOT_show \<open>R |: [\<lambda>x [O!]x & [F]x] \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow> [\<lambda>x [O!]x & [G]x]\<close>
by (safe intro!: "1-1-cor"[THEN "\<equiv>\<^sub>d\<^sub>fI"] "&I"
"cqt:2[const_var]"[axiom_inst] A B)
"cqt:2[lambda]"+
next
AOT_assume \<open>R |: [\<lambda>x [O!]x & [F]x] \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow> [\<lambda>x [O!]x & [G]x]\<close>
AOT_hence a: \<open>([\<lambda>x [O!]x & [F]x]x \<rightarrow> \<exists>!y ([\<lambda>x [O!]x & [G]x]y & [R]xy))\<close> and
b: \<open>([\<lambda>x [O!]x & [G]x]y \<rightarrow> \<exists>!x ([\<lambda>x [O!]x & [F]x]x & [R]xy))\<close> for x y
using "1-1-cor"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "&E" "\<forall>E"(2) by blast+
AOT_have \<open>[F]u \<rightarrow> \<exists>!v ([G]v & [R]uv)\<close> for u
proof (safe intro!: "\<rightarrow>I")
AOT_assume fu: \<open>[F]u\<close>
AOT_have 0: \<open>[\<lambda>x [O!]x & [F]x]u\<close>
by (auto intro!: "\<beta>\<leftarrow>C"(1) "cqt:2" "cqt:2[const_var]"[axiom_inst]
Ordinary.\<psi> fu "&I")
AOT_show \<open>\<exists>!v ([G]v & [R]uv)\<close>
apply (AOT_subst \<open>[O!]x & ([G]x & [R]ux)\<close>
\<open>([O!]x & [G]x) & [R]ux\<close> for: x)
apply (simp add: "Associativity of &")
apply (AOT_subst (reverse) \<open>[O!]x & [G]x\<close>
\<open>[\<lambda>x [O!]x & [G]x]x\<close> for: x)
apply (rule "beta-C-meta"[THEN "\<rightarrow>E"])
apply "cqt:2[lambda]"
using a[THEN "\<rightarrow>E", OF 0] by blast
qed
AOT_hence A: \<open>\<forall>u ([F]u \<rightarrow> \<exists>!v ([G]v & [R]uv))\<close>
by (rule Ordinary.GEN)
AOT_have \<open>[G]v \<rightarrow> \<exists>!u ([F]u & [R]uv)\<close> for v
proof (safe intro!: "\<rightarrow>I")
AOT_assume gu: \<open>[G]v\<close>
AOT_have 0: \<open>[\<lambda>x [O!]x & [G]x]v\<close>
by (auto intro!: "\<beta>\<leftarrow>C"(1) "cqt:2" "cqt:2[const_var]"[axiom_inst]
Ordinary.\<psi> gu "&I")
AOT_show \<open>\<exists>!u ([F]u & [R]uv)\<close>
apply (AOT_subst \<open>[O!]x & ([F]x & [R]xv)\<close> \<open>([O!]x & [F]x) & [R]xv\<close> for: x)
apply (simp add: "Associativity of &")
apply (AOT_subst (reverse) \<open>[O!]x & [F]x\<close>\<open>[\<lambda>x [O!]x & [F]x]x\<close> for: x)
apply (rule "beta-C-meta"[THEN "\<rightarrow>E"])
apply "cqt:2[lambda]"
using b[THEN "\<rightarrow>E", OF 0] by blast
qed
AOT_hence B: \<open>\<forall>v ([G]v \<rightarrow> \<exists>!u ([F]u & [R]uv))\<close> by (rule Ordinary.GEN)
AOT_show \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E G\<close>
by (safe intro!: "equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fI"] "&I" A B "cqt:2[const_var]"[axiom_inst])
qed
also AOT_have \<open>\<dots> \<equiv> R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE G\<close>
proof(safe intro!: "\<equiv>I" "\<rightarrow>I" "&I")
AOT_assume \<open>R |: [\<lambda>x [O!]x & [F]x] \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow> [\<lambda>x [O!]x & [G]x]\<close>
AOT_hence a: \<open>([\<lambda>x [O!]x & [F]x]x \<rightarrow> \<exists>!y ([\<lambda>x [O!]x & [G]x]y & [R]xy))\<close> and
b: \<open>([\<lambda>x [O!]x & [G]x]y \<rightarrow> \<exists>!x ([\<lambda>x [O!]x & [F]x]x & [R]xy))\<close> for x y
using "1-1-cor"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "&E" "\<forall>E"(2) by blast+
AOT_show \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE G\<close>
proof (safe intro!: "equi-rem:4"[THEN "\<equiv>\<^sub>d\<^sub>fI"] "&I" "equi-rem:3"[THEN "\<equiv>\<^sub>d\<^sub>fI"]
"equi-rem:2"[THEN "\<equiv>\<^sub>d\<^sub>fI"] "equi-rem:1"[THEN "\<equiv>\<^sub>d\<^sub>fI"]
"cqt:2[const_var]"[axiom_inst] Ordinary.GEN "\<rightarrow>I")
fix u
AOT_assume fu: \<open>[F]u\<close>
AOT_have 0: \<open>[\<lambda>x [O!]x & [F]x]u\<close>
by (auto intro!: "\<beta>\<leftarrow>C"(1) "cqt:2" "cqt:2[const_var]"[axiom_inst]
Ordinary.\<psi> fu "&I")
AOT_hence 1: \<open>\<exists>!y ([\<lambda>x [O!]x & [G]x]y & [R]uy)\<close>
using a[THEN "\<rightarrow>E"] by blast
AOT_show \<open>\<exists>!v ([G]v & [R]uv)\<close>
apply (AOT_subst \<open>[O!]x & ([G]x & [R]ux)\<close> \<open>([O!]x & [G]x) & [R]ux\<close> for: x)
apply (simp add: "Associativity of &")
apply (AOT_subst (reverse) \<open>[O!]x & [G]x\<close> \<open>[\<lambda>x [O!]x & [G]x]x\<close> for: x)
apply (rule "beta-C-meta"[THEN "\<rightarrow>E"])
apply "cqt:2[lambda]"
by (fact 1)
next
fix t u v
AOT_assume \<open>[F]t & [F]u & [G]v\<close> and rtv_tuv: \<open>[R]tv & [R]uv\<close>
AOT_hence oft: \<open>[\<lambda>x O!x & [F]x]t\<close> and
ofu: \<open>[\<lambda>x O!x & [F]x]u\<close> and
ogv: \<open>[\<lambda>x O!x & [G]x]v\<close>
by (auto intro!: "\<beta>\<leftarrow>C"(1) "cqt:2" "&I"
simp: Ordinary.\<psi> dest: "&E")
AOT_hence \<open>\<exists>!x ([\<lambda>x [O!]x & [F]x]x & [R]xv)\<close>
using b[THEN "\<rightarrow>E"] by blast
then AOT_obtain a where
a_prop: \<open>[\<lambda>x [O!]x & [F]x]a & [R]av &
\<forall>x (([\<lambda>x [O!]x & [F]x]x & [R]xv) \<rightarrow> x = a)\<close>
using "uniqueness:1"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "\<exists>E"[rotated] by blast
AOT_hence ua: \<open>u = a\<close>
using ofu rtv_tuv[THEN "&E"(2)] "\<forall>E"(2) "\<rightarrow>E" "&I" "&E"(2) by blast
moreover AOT_have ta: \<open>t = a\<close>
using a_prop oft rtv_tuv[THEN "&E"(1)] "\<forall>E"(2) "\<rightarrow>E" "&I" "&E"(2) by blast
ultimately AOT_have \<open>t = u\<close> by (metis "rule=E" id_sym)
AOT_thus \<open>t =\<^sub>E u\<close>
using "rule=E" id_sym "ord=Eequiv:1" Ordinary.\<psi> ta ua "\<rightarrow>E" by fast
next
fix u
AOT_assume \<open>[F]u\<close>
AOT_hence \<open>[\<lambda>x O!x & [F]x]u\<close>
by (auto intro!: "\<beta>\<leftarrow>C"(1) "cqt:2" "&I"
simp: "cqt:2[const_var]"[axiom_inst] Ordinary.\<psi>)
AOT_hence \<open>\<exists>!y ([\<lambda>x [O!]x & [G]x]y & [R]uy)\<close>
using a[THEN "\<rightarrow>E"] by blast
then AOT_obtain a where
a_prop: \<open>[\<lambda>x [O!]x & [G]x]a & [R]ua &
\<forall>x (([\<lambda>x [O!]x & [G]x]x & [R]ux) \<rightarrow> x = a)\<close>
using "uniqueness:1"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "\<exists>E"[rotated] by blast
AOT_have \<open>O!a & [G]a\<close>
by (rule "\<beta>\<rightarrow>C"(1)) (auto simp: a_prop[THEN "&E"(1), THEN "&E"(1)])
AOT_hence \<open>O!a\<close> and \<open>[G]a\<close> using "&E" by blast+
moreover AOT_have \<open>\<forall>v ([G]v & [R]uv \<rightarrow> v =\<^sub>E a)\<close>
proof(safe intro!: Ordinary.GEN "\<rightarrow>I"; frule "&E"(1); drule "&E"(2))
fix v
AOT_assume \<open>[G]v\<close> and ruv: \<open>[R]uv\<close>
AOT_hence \<open>[\<lambda>x [O!]x & [G]x]v\<close>
by (auto intro!: "\<beta>\<leftarrow>C"(1) "cqt:2" "&I" simp: Ordinary.\<psi>)
AOT_hence \<open>v = a\<close>
using a_prop[THEN "&E"(2), THEN "\<forall>E"(2), THEN "\<rightarrow>E", OF "&I"] ruv by blast
AOT_thus \<open>v =\<^sub>E a\<close>
using "rule=E" "ord=Eequiv:1" Ordinary.\<psi> "\<rightarrow>E" by fast
qed
ultimately AOT_have \<open>O!a & ([G]a & [R]ua & \<forall>v' ([G]v' & [R]uv' \<rightarrow> v' =\<^sub>E a))\<close>
using "\<exists>I" "&I" a_prop[THEN "&E"(1), THEN "&E"(2)] by simp
AOT_hence \<open>\<exists>v ([G]v & [R]uv & \<forall>v' ([G]v' & [R]uv' \<rightarrow> v' =\<^sub>E v))\<close>
by (rule "\<exists>I")
AOT_thus \<open>\<exists>!v ([G]v & [R]uv)\<close>
by (rule "equi:1"[THEN "\<equiv>E"(2)])
next
fix v
AOT_assume \<open>[G]v\<close>
AOT_hence \<open>[\<lambda>x O!x & [G]x]v\<close>
by (auto intro!: "\<beta>\<leftarrow>C"(1) "cqt:2" "&I" Ordinary.\<psi>)
AOT_hence \<open>\<exists>!x ([\<lambda>x [O!]x & [F]x]x & [R]xv)\<close>
using b[THEN "\<rightarrow>E"] by blast
then AOT_obtain a where
a_prop: \<open>[\<lambda>x [O!]x & [F]x]a & [R]av &
\<forall>y ([\<lambda>x [O!]x & [F]x]y & [R]yv \<rightarrow> y = a)\<close>
using "uniqueness:1"[THEN "\<equiv>\<^sub>d\<^sub>fE", THEN "\<exists>E"[rotated]] by blast
AOT_have \<open>O!a & [F]a\<close>
by (rule "\<beta>\<rightarrow>C"(1)) (auto simp: a_prop[THEN "&E"(1), THEN "&E"(1)])
AOT_hence \<open>O!a & ([F]a & [R]av)\<close>
using a_prop[THEN "&E"(1), THEN "&E"(2)] "&E" "&I" by metis
AOT_thus \<open>\<exists>u ([F]u & [R]uv)\<close>
by (rule "\<exists>I")
qed
next
AOT_assume \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE G\<close>
AOT_hence 1: \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>E G\<close>
and 2: \<open>R |: F \<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE G\<close>
using "equi-rem:4"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "&E" by blast+
AOT_hence 3: \<open>R |: F \<longrightarrow>E G\<close>
and A: \<open>\<forall>t \<forall>u \<forall>v ([F]t & [F]u & [G]v \<rightarrow> ([R]tv & [R]uv \<rightarrow> t =\<^sub>E u))\<close>
using "equi-rem:2"[THEN "\<equiv>\<^sub>d\<^sub>fE", OF 1] "&E" by blast+
AOT_hence B: \<open>\<forall>u ([F]u \<rightarrow> \<exists>!v ([G]v & [R]uv))\<close>
using "equi-rem:1"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "&E" by blast
AOT_have C: \<open>\<forall>v ([G]v \<rightarrow> \<exists>u ([F]u & [R]uv))\<close>
using "equi-rem:3"[THEN "\<equiv>\<^sub>d\<^sub>fE", OF 2] "&E" by blast
AOT_show \<open>R |: [\<lambda>x [O!]x & [F]x] \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow> [\<lambda>x [O!]x & [G]x]\<close>
proof (rule "1-1-cor"[THEN "\<equiv>\<^sub>d\<^sub>fI"];
safe intro!: "&I" "cqt:2" GEN "\<rightarrow>I")
fix x
AOT_assume 1: \<open>[\<lambda>x [O!]x & [F]x]x\<close>
AOT_have \<open>O!x & [F]x\<close>
by (rule "\<beta>\<rightarrow>C"(1)) (auto simp: 1)
AOT_hence \<open>\<exists>!v ([G]v & [R]xv)\<close>
using B[THEN "\<forall>E"(2), THEN "\<rightarrow>E", THEN "\<rightarrow>E"] "&E" by blast
then AOT_obtain y where
y_prop: \<open>O!y & ([G]y & [R]xy & \<forall>u ([G]u & [R]xu \<rightarrow> u =\<^sub>E y))\<close>
using "equi:1"[THEN "\<equiv>E"(1)] "\<exists>E"[rotated] by fastforce
AOT_hence \<open>[\<lambda>x O!x & [G]x]y\<close>
by (auto intro!: "\<beta>\<leftarrow>C"(1) "cqt:2" "&I" dest: "&E")
moreover AOT_have \<open>\<forall>z ([\<lambda>x O!x & [G]x]z & [R]xz \<rightarrow> z = y)\<close>
proof(safe intro!: GEN "\<rightarrow>I"; frule "&E"(1); drule "&E"(2))
fix z
AOT_assume 1: \<open>[\<lambda>x [O!]x & [G]x]z\<close>
AOT_have 2: \<open>O!z & [G]z\<close>
by (rule "\<beta>\<rightarrow>C"(1)) (auto simp: 1)
moreover AOT_assume \<open>[R]xz\<close>
ultimately AOT_have \<open>z =\<^sub>E y\<close>
using y_prop[THEN "&E"(2), THEN "&E"(2), THEN "\<forall>E"(2),
THEN "\<rightarrow>E", THEN "\<rightarrow>E", rotated, OF "&I"] "&E"
by blast
AOT_thus \<open>z = y\<close>
using 2[THEN "&E"(1)] by (metis "=E-simple:2" "\<rightarrow>E")
qed
ultimately AOT_have \<open>[\<lambda>x O!x & [G]x]y & [R]xy &
\<forall>z ([\<lambda>x O!x & [G]x]z & [R]xz \<rightarrow> z = y)\<close>
using y_prop[THEN "&E"(2), THEN "&E"(1), THEN "&E"(2)] "&I" by auto
AOT_hence \<open>\<exists>y ([\<lambda>x O!x & [G]x]y & [R]xy &
\<forall>z ([\<lambda>x O!x & [G]x]z & [R]xz \<rightarrow> z = y))\<close>
by (rule "\<exists>I")
AOT_thus \<open>\<exists>!y ([\<lambda>x [O!]x & [G]x]y & [R]xy)\<close>
using "uniqueness:1"[THEN "\<equiv>\<^sub>d\<^sub>fI"] by fast
next
fix y
AOT_assume 1: \<open>[\<lambda>x [O!]x & [G]x]y\<close>
AOT_have oy_gy: \<open>O!y & [G]y\<close>
by (rule "\<beta>\<rightarrow>C"(1)) (auto simp: 1)
AOT_hence \<open>\<exists>u ([F]u & [R]uy)\<close>
using C[THEN "\<forall>E"(2), THEN "\<rightarrow>E", THEN "\<rightarrow>E"] "&E" by blast
then AOT_obtain x where x_prop: \<open>O!x & ([F]x & [R]xy)\<close>
using "\<exists>E"[rotated] by blast
AOT_hence ofx: \<open>[\<lambda>x O!x & [F]x]x\<close>
by (auto intro!: "\<beta>\<leftarrow>C"(1) "cqt:2" "&I" dest: "&E")
AOT_have \<open>\<exists>\<alpha> ([\<lambda>x [O!]x & [F]x]\<alpha> & [R]\<alpha>y &
\<forall>\<beta> ([\<lambda>x [O!]x & [F]x]\<beta> & [R]\<beta>y \<rightarrow> \<beta> = \<alpha>))\<close>
proof (safe intro!: "\<exists>I"(2)[where \<beta>=x] "&I" GEN "\<rightarrow>I")
AOT_show \<open>[\<lambda>x O!x & [F]x]x\<close> using ofx.
next
AOT_show \<open>[R]xy\<close> using x_prop[THEN "&E"(2), THEN "&E"(2)].
next
fix z
AOT_assume 1: \<open>[\<lambda>x [O!]x & [F]x]z & [R]zy\<close>
AOT_have oz_fz: \<open>O!z & [F]z\<close>
by (rule "\<beta>\<rightarrow>C"(1)) (auto simp: 1[THEN "&E"(1)])
AOT_have \<open>z =\<^sub>E x\<close>
using A[THEN "\<forall>E"(2)[where \<beta>=z], THEN "\<rightarrow>E", THEN "\<forall>E"(2)[where \<beta>=x],
THEN "\<rightarrow>E", THEN "\<forall>E"(2)[where \<beta>=y], THEN "\<rightarrow>E",
THEN "\<rightarrow>E", THEN "\<rightarrow>E", OF oz_fz[THEN "&E"(1)],
OF x_prop[THEN "&E"(1)], OF oy_gy[THEN "&E"(1)], OF "&I", OF "&I",
OF oz_fz[THEN "&E"(2)], OF x_prop[THEN "&E"(2), THEN "&E"(1)],
OF oy_gy[THEN "&E"(2)], OF "&I", OF 1[THEN "&E"(2)],
OF x_prop[THEN "&E"(2), THEN "&E"(2)]].
AOT_thus \<open>z = x\<close>
by (metis "=E-simple:2" "vdash-properties:10")
qed
AOT_thus \<open>\<exists>!x ([\<lambda>x [O!]x & [F]x]x & [R]xy)\<close>
by (rule "uniqueness:1"[THEN "\<equiv>\<^sub>d\<^sub>fI"])
qed
qed
finally show ?thesis.
qed
AOT_theorem "empty-approx:1": \<open>(\<not>\<exists>u [F]u & \<not>\<exists>v [H]v) \<rightarrow> F \<approx>\<^sub>E H\<close>
proof(rule "\<rightarrow>I"; frule "&E"(1); drule "&E"(2))
AOT_assume 0: \<open>\<not>\<exists>u [F]u\<close> and 1: \<open>\<not>\<exists>v [H]v\<close>
AOT_have \<open>\<forall>u ([F]u \<rightarrow> \<exists>!v ([H]v & [R]uv))\<close> for R
proof(rule Ordinary.GEN; rule "\<rightarrow>I"; rule "raa-cor:1")
fix u
AOT_assume \<open>[F]u\<close>
AOT_hence \<open>\<exists>u [F]u\<close> using "Ordinary.\<exists>I" "&I" by fast
AOT_thus \<open>\<exists>u [F]u & \<not>\<exists>u [F]u\<close> using "&I" 0 by blast
qed
moreover AOT_have \<open>\<forall>v ([H]v \<rightarrow> \<exists>!u ([F]u & [R]uv))\<close> for R
proof(rule Ordinary.GEN; rule "\<rightarrow>I"; rule "raa-cor:1")
fix v
AOT_assume \<open>[H]v\<close>
AOT_hence \<open>\<exists>v [H]v\<close> using "Ordinary.\<exists>I" "&I" by fast
AOT_thus \<open>\<exists>v [H]v & \<not>\<exists>v [H]v\<close> using 1 "&I" by blast
qed
ultimately AOT_have \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E H\<close> for R
apply (safe intro!: "equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fI"] "&I" GEN "cqt:2[const_var]"[axiom_inst])
using "\<forall>E" by blast+
AOT_hence \<open>\<exists>R R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E H\<close> by (rule "\<exists>I")
AOT_thus \<open>F \<approx>\<^sub>E H\<close>
by (rule "equi:3"[THEN "\<equiv>\<^sub>d\<^sub>fI"])
qed
AOT_theorem "empty-approx:2": \<open>(\<exists>u [F]u & \<not>\<exists>v [H]v) \<rightarrow> \<not>(F \<approx>\<^sub>E H)\<close>
proof(rule "\<rightarrow>I"; frule "&E"(1); drule "&E"(2); rule "raa-cor:2")
AOT_assume 1: \<open>\<exists>u [F]u\<close> and 2: \<open>\<not>\<exists>v [H]v\<close>
AOT_obtain b where b_prop: \<open>O!b & [F]b\<close>
using 1 "\<exists>E"[rotated] by blast
AOT_assume \<open>F \<approx>\<^sub>E H\<close>
AOT_hence \<open>\<exists>R R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E H\<close>
by (rule "equi:3"[THEN "\<equiv>\<^sub>d\<^sub>fE"])
then AOT_obtain R where \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E H\<close>
using "\<exists>E"[rotated] by blast
AOT_hence \<theta>: \<open>\<forall>u ([F]u \<rightarrow> \<exists>!v ([H]v & [R]uv))\<close>
using "equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "&E" by blast+
AOT_have \<open>\<exists>!v ([H]v & [R]bv)\<close> for u
using \<theta>[THEN "\<forall>E"(2)[where \<beta>=b], THEN "\<rightarrow>E", THEN "\<rightarrow>E",
OF b_prop[THEN "&E"(1)], OF b_prop[THEN "&E"(2)]].
AOT_hence \<open>\<exists>v ([H]v & [R]bv & \<forall>u ([H]u & [R]bu \<rightarrow> u =\<^sub>E v))\<close>
by (rule "equi:1"[THEN "\<equiv>E"(1)])
then AOT_obtain x where \<open>O!x & ([H]x & [R]bx & \<forall>u ([H]u & [R]bu \<rightarrow> u =\<^sub>E x))\<close>
using "\<exists>E"[rotated] by blast
AOT_hence \<open>O!x & [H]x\<close> using "&E" "&I" by blast
AOT_hence \<open>\<exists>v [H]v\<close> by (rule "\<exists>I")
AOT_thus \<open>\<exists>v [H]v & \<not>\<exists>v [H]v\<close> using 2 "&I" by blast
qed
AOT_define FminusU :: \<open>\<Pi> \<Rightarrow> \<tau> \<Rightarrow> \<Pi>\<close> ("_\<^sup>-\<^sup>_")
"F-u": \<open>[F]\<^sup>-\<^sup>x =\<^sub>d\<^sub>f [\<lambda>z [F]z & z \<noteq>\<^sub>E x]\<close>
text\<open>Note: not explicitly in PLM.\<close>
AOT_theorem "F-u[den]": \<open>[F]\<^sup>-\<^sup>x\<down>\<close>
by (rule "=\<^sub>d\<^sub>fI"(1)[OF "F-u", where \<tau>\<^sub>1\<tau>\<^sub>n="(_,_)", simplified]; "cqt:2[lambda]")
AOT_theorem "F-u[equiv]": \<open>[[F]\<^sup>-\<^sup>x]y \<equiv> ([F]y & y \<noteq>\<^sub>E x)\<close>
by (auto intro: "F-u"[THEN "=\<^sub>d\<^sub>fI"(1), where \<tau>\<^sub>1\<tau>\<^sub>n="(_,_)", simplified]
intro!: "cqt:2" "beta-C-cor:2"[THEN "\<rightarrow>E", THEN "\<forall>E"(2)])
AOT_theorem eqP': \<open>F \<approx>\<^sub>E G & [F]u & [G]v \<rightarrow> [F]\<^sup>-\<^sup>u \<approx>\<^sub>E [G]\<^sup>-\<^sup>v\<close>
proof (rule "\<rightarrow>I"; frule "&E"(2); drule "&E"(1); frule "&E"(2); drule "&E"(1))
AOT_assume \<open>F \<approx>\<^sub>E G\<close>
AOT_hence \<open>\<exists>R R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E G\<close>
using "equi:3"[THEN "\<equiv>\<^sub>d\<^sub>fE"] by blast
then AOT_obtain R where R_prop: \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E G\<close>
using "\<exists>E"[rotated] by blast
AOT_hence A: \<open>\<forall>u ([F]u \<rightarrow> \<exists>!v ([G]v & [R]uv))\<close>
and B: \<open>\<forall>v ([G]v \<rightarrow> \<exists>!u ([F]u & [R]uv))\<close>
using "equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "&E" by blast+
AOT_have \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE G\<close>
using "equi-rem-thm"[THEN "\<equiv>E"(1), OF R_prop].
AOT_hence \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>E G & R |: F \<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE G\<close>
using "equi-rem:4"[THEN "\<equiv>\<^sub>d\<^sub>fE"] by blast
AOT_hence C: \<open>\<forall>t\<forall>u\<forall>v (([F]t & [F]u & [G]v) \<rightarrow> ([R]tv & [R]uv \<rightarrow> t =\<^sub>E u))\<close>
using "equi-rem:2"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "&E" by blast
AOT_assume fu: \<open>[F]u\<close>
AOT_assume gv: \<open>[G]v\<close>
AOT_have \<open>[\<lambda>z [\<Pi>]z & z \<noteq>\<^sub>E \<kappa>]\<down>\<close> for \<Pi> \<kappa>
by "cqt:2[lambda]"
note \<Pi>_minus_\<kappa>I = "rule-id-df:2:b[2]"[
where \<tau>=\<open>(\<lambda>(\<Pi>, \<kappa>). \<guillemotleft>[\<Pi>]\<^sup>-\<^sup>\<kappa>\<guillemotright>)\<close>, simplified, OF "F-u", simplified, OF this]
and \<Pi>_minus_\<kappa>E = "rule-id-df:2:a[2]"[
where \<tau>=\<open>(\<lambda>(\<Pi>, \<kappa>). \<guillemotleft>[\<Pi>]\<^sup>-\<^sup>\<kappa>\<guillemotright>)\<close>, simplified, OF "F-u", simplified, OF this]
AOT_have \<Pi>_minus_\<kappa>_den: \<open>[\<Pi>]\<^sup>-\<^sup>\<kappa>\<down>\<close> for \<Pi> \<kappa>
by (rule \<Pi>_minus_\<kappa>I) "cqt:2[lambda]"+
{
fix R
AOT_assume R_prop: \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E G\<close>
AOT_hence A: \<open>\<forall>u ([F]u \<rightarrow> \<exists>!v ([G]v & [R]uv))\<close>
and B: \<open>\<forall>v ([G]v \<rightarrow> \<exists>!u ([F]u & [R]uv))\<close>
using "equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "&E" by blast+
AOT_have \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE G\<close>
using "equi-rem-thm"[THEN "\<equiv>E"(1), OF R_prop].
AOT_hence \<open>R |: F \<^sub>1\<^sub>-\<^sub>1\<longrightarrow>E G & R |: F \<longrightarrow>\<^sub>o\<^sub>n\<^sub>t\<^sub>oE G\<close>
using "equi-rem:4"[THEN "\<equiv>\<^sub>d\<^sub>fE"] by blast
AOT_hence C: \<open>\<forall>t\<forall>u\<forall>v (([F]t & [F]u & [G]v) \<rightarrow> ([R]tv & [R]uv \<rightarrow> t =\<^sub>E u))\<close>
using "equi-rem:2"[THEN "\<equiv>\<^sub>d\<^sub>fE"] "&E" by blast
AOT_assume Ruv: \<open>[R]uv\<close>
AOT_have \<open>R |: [F]\<^sup>-\<^sup>u \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E [G]\<^sup>-\<^sup>v\<close>
proof(safe intro!: "equi:2"[THEN "\<equiv>\<^sub>d\<^sub>fI"] "&I" "cqt:2[const_var]"[axiom_inst]
\<Pi>_minus_\<kappa>_den Ordinary.GEN "\<rightarrow>I")
fix u'
AOT_assume \<open>[[F]\<^sup>-\<^sup>u]u'\<close>
AOT_hence 0: \<open>[\<lambda>z [F]z & z \<noteq>\<^sub>E u]u'\<close>
using \<Pi>_minus_\<kappa>E by fast
AOT_have 0: \<open>[F]u' & u' \<noteq>\<^sub>E u\<close>
by (rule "\<beta>\<rightarrow>C"(1)[where \<kappa>\<^sub>1\<kappa>\<^sub>n="AOT_term_of_var (Ordinary.Rep u')"]) (fact 0)
AOT_have \<open>\<exists>!v ([G]v & [R]u'v)\<close>
using A[THEN "Ordinary.\<forall>E"[where \<alpha>=u'], THEN "\<rightarrow>E", OF 0[THEN "&E"(1)]].
then AOT_obtain v' where
v'_prop: \<open>[G]v' & [R]u'v' & \<forall> t ([G]t & [R]u't \<rightarrow> t =\<^sub>E v')\<close>
using "equi:1"[THEN "\<equiv>E"(1)] "Ordinary.\<exists>E"[rotated] by fastforce
AOT_show \<open>\<exists>!v' ([[G]\<^sup>-\<^sup>v]v' & [R]u'v')\<close>
proof (safe intro!: "equi:1"[THEN "\<equiv>E"(2)] "Ordinary.\<exists>I"[where \<beta>=v']
"&I" Ordinary.GEN "\<rightarrow>I")
AOT_show \<open>[[G]\<^sup>-\<^sup>v]v'\<close>
proof (rule \<Pi>_minus_\<kappa>I;
safe intro!: "\<beta>\<leftarrow>C"(1) "cqt:2" "&I" "thm-neg=E"[THEN "\<equiv>E"(2)])
AOT_show \<open>[G]v'\<close> using v'_prop "&E" by blast
next
AOT_show \<open>\<not>v' =\<^sub>E v\<close>
proof (rule "raa-cor:2")
AOT_assume \<open>v' =\<^sub>E v\<close>
AOT_hence \<open>v' = v\<close> by (metis "=E-simple:2" "\<rightarrow>E")
AOT_hence Ruv': \<open>[R]uv'\<close> using "rule=E" Ruv id_sym by fast
AOT_have \<open>u' =\<^sub>E u\<close>
by (rule C[THEN "Ordinary.\<forall>E", THEN "Ordinary.\<forall>E",
THEN "Ordinary.\<forall>E"[where \<alpha>=v'], THEN "\<rightarrow>E", THEN "\<rightarrow>E"])
(safe intro!: "&I" 0[THEN "&E"(1)] fu
v'_prop[THEN "&E"(1), THEN "&E"(1)]
Ruv' v'_prop[THEN "&E"(1), THEN "&E"(2)])
moreover AOT_have \<open>\<not>(u' =\<^sub>E u)\<close>
using "0" "&E"(2) "\<equiv>E"(1) "thm-neg=E" by blast
ultimately AOT_show \<open>u' =\<^sub>E u & \<not>u' =\<^sub>E u\<close> using "&I" by blast
qed
qed
next
AOT_show \<open>[R]u'v'\<close> using v'_prop "&E" by blast
next
fix t
AOT_assume t_prop: \<open>[[G]\<^sup>-\<^sup>v]t & [R]u't\<close>
AOT_have gt_t_noteq_v: \<open>[G]t & t \<noteq>\<^sub>E v\<close>
apply (rule "\<beta>\<rightarrow>C"(1)[where \<kappa>\<^sub>1\<kappa>\<^sub>n="AOT_term_of_var (Ordinary.Rep t)"])
apply (rule \<Pi>_minus_\<kappa>E)
by (fact t_prop[THEN "&E"(1)])
AOT_show \<open>t =\<^sub>E v'\<close>
using v'_prop[THEN "&E"(2), THEN "Ordinary.\<forall>E", THEN "\<rightarrow>E",
OF "&I", OF gt_t_noteq_v[THEN "&E"(1)],
OF t_prop[THEN "&E"(2)]].
qed
next
fix v'
AOT_assume G_minus_v_v': \<open>[[G]\<^sup>-\<^sup>v]v'\<close>
AOT_have gt_t_noteq_v: \<open>[G]v' & v' \<noteq>\<^sub>E v\<close>
apply (rule "\<beta>\<rightarrow>C"(1)[where \<kappa>\<^sub>1\<kappa>\<^sub>n="AOT_term_of_var (Ordinary.Rep v')"])
apply (rule \<Pi>_minus_\<kappa>E)
by (fact G_minus_v_v')
AOT_have \<open>\<exists>!u([F]u & [R]uv')\<close>
using B[THEN "Ordinary.\<forall>E", THEN "\<rightarrow>E", OF gt_t_noteq_v[THEN "&E"(1)]].
then AOT_obtain u' where
u'_prop: \<open>[F]u' & [R]u'v' & \<forall>t ([F]t & [R]tv' \<rightarrow> t =\<^sub>E u')\<close>
using "equi:1"[THEN "\<equiv>E"(1)] "Ordinary.\<exists>E"[rotated] by fastforce
AOT_show \<open>\<exists>!u' ([[F]\<^sup>-\<^sup>u]u' & [R]u'v')\<close>
proof (safe intro!: "equi:1"[THEN "\<equiv>E"(2)] "Ordinary.\<exists>I"[where \<beta>=u'] "&I"
u'_prop[THEN "&E"(1), THEN "&E"(2)] Ordinary.GEN "\<rightarrow>I")
AOT_show \<open>[[F]\<^sup>-\<^sup>u]u'\<close>
proof (rule \<Pi>_minus_\<kappa>I;
safe intro!: "\<beta>\<leftarrow>C"(1) "cqt:2" "&I" "thm-neg=E"[THEN "\<equiv>E"(2)]
u'_prop[THEN "&E"(1), THEN "&E"(1)]; rule "raa-cor:2")
AOT_assume u'_eq_u: \<open>u' =\<^sub>E u\<close>
AOT_hence \<open>u' = u\<close>
using "=E-simple:2" "vdash-properties:10" by blast
AOT_hence Ru'v: \<open>[R]u'v\<close> using "rule=E" Ruv id_sym by fast
AOT_have \<open>v' \<noteq>\<^sub>E v\<close>
using "&E"(2) gt_t_noteq_v by blast
AOT_hence v'_noteq_v: \<open>\<not>(v' =\<^sub>E v)\<close> by (metis "\<equiv>E"(1) "thm-neg=E")
AOT_have \<open>\<exists>u ([G]u & [R]u'u & \<forall>v ([G]v & [R]u'v \<rightarrow> v =\<^sub>E u))\<close>
using A[THEN "Ordinary.\<forall>E", THEN "\<rightarrow>E",
OF u'_prop[THEN "&E"(1), THEN "&E"(1)],
THEN "equi:1"[THEN "\<equiv>E"(1)]].
then AOT_obtain t where
t_prop: \<open>[G]t & [R]u't & \<forall>v ([G]v & [R]u'v \<rightarrow> v =\<^sub>E t)\<close>
using "Ordinary.\<exists>E"[rotated] by meson
AOT_have \<open>v =\<^sub>E t\<close> if \<open>[G]v\<close> and \<open>[R]u'v\<close> for v
using t_prop[THEN "&E"(2), THEN "Ordinary.\<forall>E", THEN "\<rightarrow>E",
OF "&I", OF that].
AOT_hence \<open>v' =\<^sub>E t\<close> and \<open>v =\<^sub>E t\<close>
by (auto simp: gt_t_noteq_v[THEN "&E"(1)] Ru'v gv
u'_prop[THEN "&E"(1), THEN "&E"(2)])
AOT_hence \<open>v' =\<^sub>E v\<close>
using "rule=E" "=E-simple:2" id_sym "\<rightarrow>E" by fast
AOT_thus \<open>v' =\<^sub>E v & \<not>v' =\<^sub>E v\<close>
using v'_noteq_v "&I" by blast
qed
next
fix t
AOT_assume 0: \<open>[[F]\<^sup>-\<^sup>u]t & [R]tv'\<close>
moreover AOT_have \<open>[F]t & t \<noteq>\<^sub>E u\<close>
apply (rule "\<beta>\<rightarrow>C"(1)[where \<kappa>\<^sub>1\<kappa>\<^sub>n="AOT_term_of_var (Ordinary.Rep t)"])
apply (rule \<Pi>_minus_\<kappa>E)
by (fact 0[THEN "&E"(1)])
ultimately AOT_show \<open>t =\<^sub>E u'\<close>
using u'_prop[THEN "&E"(2), THEN "Ordinary.\<forall>E", THEN "\<rightarrow>E", OF "&I"]
"&E" by blast
qed
qed
AOT_hence \<open>\<exists>R R |: [F]\<^sup>-\<^sup>u \<^sub>1\<^sub>-\<^sub>1\<longleftrightarrow>\<^sub>E [G]\<^sup>-\<^sup>v\<close>
by (rule "\<exists>I")
} note 1 = this
moreover {
AOT_assume not_Ruv: \<open>\<not>[R]uv\<close>
AOT_have \<open>\<exists>!v ([G]v & [R]uv)\<close>
using A[THEN "Ordinary.\<forall>E", THEN "\<rightarrow>E", OF fu].
then AOT_obtain b where
b_prop: \<open>O!b & ([G]b & [R]ub & \<forall>t([G]t & [R]ut \<rightarrow> t =\<^sub>E b))\<close>
using "equi:1"[THEN "\<equiv>E"(1)] "\<exists>E"[rotated] by fastforce
AOT_hence ob: \<open>O!b\<close> and gb: \<open>[G]b\<close> and Rub: \<open>[R]ub\<close>
using "&E" by blast+
AOT_have \<open>O!t \<rightarrow> ([G]t & [R]ut \<rightarrow> t =\<^sub>E b)\<close> for t
using b_prop "&E"(2) "\<forall>E"(2) by blast
AOT_hence b_unique: \<open>t =\<^sub>E b\<close> if \<open>O!t\<close> and \<open>[G]t\<close> and \<open>[R]ut\<close> for t
by (metis Adjunction "modus-tollens:1" "reductio-aa:1" that)
AOT_have not_v_eq_b: \<open>\<not>(v =\<^sub>E b)\<close>
proof(rule "raa-cor:2")
AOT_assume \<open>v =\<^sub>E b\<close>
AOT_hence 0: \<open>v = b\<close>
by (metis "=E-simple:2" "\<rightarrow>E")
AOT_have \<open>[R]uv\<close>
using b_prop[THEN "&E"(2), THEN "&E"(1), THEN "&E"(2)]
"rule=E"[rotated, OF 0[symmetric]] by fast
AOT_thus \<open>[R]uv & \<not>[R]uv\<close>
using not_Ruv "&I" by blast
qed
AOT_have not_b_eq_v: \<open>\<not>(b =\<^sub>E v)\<close>
using "modus-tollens:1" not_v_eq_b "ord=Eequiv:2" by blast
AOT_have \<open>\<exists>!u ([F]u & [R]uv)\<close>
using B[THEN "Ordinary.\<forall>E", THEN "\<rightarrow>E", OF gv].
then AOT_obtain a where
a_prop: \<open>O!a & ([F]a & [R]av & \<forall>t([F]t & [R]tv \<rightarrow> t =\<^sub>E a))\<close>
using "equi:1"[THEN "\<equiv>E"(1)] "\<exists>E"[rotated] by fastforce
AOT_hence Oa: \<open>O!a\<close> and fa: \<open>[F]a\<close> and Rav: \<open>[R]av\<close>
using "&E" by blast+
AOT_have \<open>O!t \<rightarrow> ([F]t & [R]tv \<rightarrow> t =\<^sub>E a)\<close> for t
using a_prop "&E" "\<forall>E"(2) by blast
AOT_hence a_unique: \<open>t =\<^sub>E a\<close> if \<open>O!t\<close> and \<open>[F]t\<close> and \<open>[R]tv\<close> for t
by (metis Adjunction "modus-tollens:1" "reductio-aa:1" that)
AOT_have not_u_eq_a: \<open>\<not>(u =\<^sub>E a)\<close>
proof(rule "raa-cor:2")
AOT_assume \<open>u =\<^sub>E a\<close>
AOT_hence 0: \<open>u = a\<close>
by (metis "=E-simple:2" "\<rightarrow>E")
AOT_have \<open>[R]uv\<close>
using a_prop[THEN "&E"(2), THEN "&E"(1), THEN "&E"(2)]
"rule=E"[rotated, OF 0[symmetric]] by fast
AOT_thus \<open>[R]uv & \<not>[R]uv\<close>
using not_Ruv "&I" by blast
qed
AOT_have not_a_eq_u: \<open>\<not>(a =\<^sub>E u)\<close>
using "modus-tollens:1" not_u_eq_a "ord=Eequiv:2" by blast
let ?R = \<open>\<guillemotleft>[\<lambda>u'v' (u' \<noteq>\<^sub>E u & v' \<noteq>\<^sub>E v & [R]u'v') \<or>
(u' =\<^sub>E a & v' =\<^sub>E b) \<or>
(u' =\<^sub>E u & v' =\<^sub>E v)]\<guillemotright>\<close>
AOT_have \<open>[\<guillemotleft>?R\<guillemotright>]\<down>\<close> by "cqt:2[lambda]"
AOT_hence \<open>\<exists> \<beta> \<beta> = [\<guillemotleft>?R\<guillemotright>]\<close>
using "free-thms:1" "\<equiv>E"(1) by fast
then AOT_obtain R\<^sub>1 where R\<^sub>1_def: \<open>R\<^sub>1 = [\<guillemotleft>?R\<guillemotright>]\<close>
using "\<exists>E"[rotated] by blast
AOT_have Rxy1: \<open>[R]xy\<close> if \<open>[R\<^sub>1]xy\<close> and \<open>x \<noteq>\<^sub>E u\<close> and \<open>x \<noteq>\<^sub>E a\<close> for x y
proof -
AOT_have 0: \<open>[\<guillemotleft>?R\<guillemotright>]xy\<close>
by (rule "rule=E"[rotated, OF R\<^sub>1_def]) (fact that(1))
AOT_have \<open>(x \<noteq>\<^sub>E u & y \<noteq>\<^sub>E v & [R]xy) \<or> (x =\<^sub>E a & y =\<^sub>E b) \<or> (x =\<^sub>E u & y =\<^sub>E v)\<close>
using "\<beta>\<rightarrow>C"(1)[OF 0] by simp
AOT_hence \<open>x \<noteq>\<^sub>E u & y \<noteq>\<^sub>E v & [R]xy\<close> using that(2,3)
by (metis "\<or>E"(3) "Conjunction Simplification"(1) "\<equiv>E"(1)
"modus-tollens:1" "thm-neg=E")
AOT_thus \<open>[R]xy\<close> using "&E" by blast+
qed
AOT_have Rxy2: \<open>[R]xy\<close> if \<open>[R\<^sub>1]xy\<close> and \<open>y \<noteq>\<^sub>E v\<close> and \<open>y \<noteq>\<^sub>E b\<close> for x y
proof -
AOT_have 0: \<open>[\<guillemotleft>?R\<guillemotright>]xy\<close>
by (rule "rule=E"[rotated, OF R\<^sub>1_def]) (fact that(1))
AOT_have \<open>(x \<noteq>\<^sub>E u & y \<noteq>\<^sub>E v & [R]xy) \<or> (x =\<^sub>E a & y =\<^sub>E b) \<or> (x =\<^sub>E u & y =\<^sub>E v)\<close>
using "\<beta>\<rightarrow>C"(1)[OF 0] by simp
AOT_hence \<open>x \<noteq>\<^sub>E u & y \<noteq>\<^sub>E v & [R]xy\<close>
using that(2,3)