-
Notifications
You must be signed in to change notification settings - Fork 1
/
12-proof-system-p.mm1
1635 lines (1395 loc) · 80.4 KB
/
12-proof-system-p.mm1
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
import "01-propositional.mm1";
import "11-definedness-normalization.mm1";
theorem negative_in_not {X: SVar} (phi: Pattern X)
(h: $ _Positive X phi $): $ _Negative X (~ phi) $ =
'(negative_in_imp h negative_disjoint);
theorem positive_in_or {X: SVar} (phi1 phi2: Pattern X)
(h1: $ _Positive X phi1 $)
(h2: $ _Positive X phi2 $):
$ _Positive X (phi1 \/ phi2) $ =
'(positive_in_imp (negative_in_not h1) h2);
theorem eFresh_ceil {x: EVar} (phi: Pattern x)
(h: $ _eFresh x phi $):
$ _eFresh x (|^ phi ^|) $ =
'(eFresh_app eFresh_disjoint h);
theorem eFresh_floor {x: EVar} (phi: Pattern x)
(h: $ _eFresh x phi $):
$ _eFresh x (|_ phi _|) $ =
'(eFresh_not @ eFresh_app eFresh_disjoint @ eFresh_not h);
theorem eFresh_mem {x y: EVar} (phi: Pattern x y)
(h: $ _eFresh x phi $):
$ _eFresh x (y in phi) $ =
'(eFresh_ceil @ eFresh_and_r h);
theorem eFresh_ctximp_same_var {box: SVar} (ctx phi: Pattern box):
$ _eFresh x (ctximp_app box ctx phi) $ =
'(eFresh_exists_same_var);
theorem eFresh_subset {x: EVar} (phi psi: Pattern x)
(h1: $ _eFresh x phi $)
(h2: $ _eFresh x psi $):
$ _eFresh x (phi C= psi) $ =
'(eFresh_not @ eFresh_ceil @ eFresh_not @ eFresh_imp h1 h2);
theorem sFresh_ceil {X: SVar} (phi: Pattern X)
(h: $ _sFresh X phi $):
$ _sFresh X (|^ phi ^|) $ =
'(sFresh_app sFresh_disjoint h);
theorem sFresh_mem {X: SVar} {y: EVar} (phi: Pattern X y)
(h: $ _sFresh X phi $):
$ _sFresh X (y in phi) $ =
'(sFresh_ceil @ sFresh_and_r h);
theorem _eSubst_ceil {x: EVar} (phi psi rho: Pattern x)
(h: $ Norm (e[ phi / x ] psi) rho $):
$ Norm (e[ phi / x ] (|^ psi ^|)) (|^ rho ^|) $ =
'(_eSubst_app eSubstitution_disjoint h);
theorem _eSubst_floor {x: EVar} (phi psi rho: Pattern x)
(h: $ Norm (e[ phi / x ] psi) rho $):
$ Norm (e[ phi / x ] (|_ psi _|)) (|_ rho _|) $ =
'(_eSubst_not @ _eSubst_ceil @ _eSubst_not h);
theorem _eSubst_mem {x y: EVar} (phi phi2 psi2: Pattern x y)
(h: $ Norm (e[ phi / x ] phi2) psi2 $):
$ Norm (e[ phi / x ] (y in phi2)) (y in psi2) $ =
'(_eSubst_ceil @ _eSubst_and eSubstitution_disjoint h);
theorem _eSubst_mem_same_var {x: EVar} (phi phi2 psi2: Pattern x)
(h: $ Norm (e[ phi / x ] phi2) psi2 $):
$ Norm (e[ phi / x ] (x in phi2)) (|^ phi /\ psi2 ^|) $ =
'(_eSubst_ceil @ _eSubst_and (eSubstitution_in_same_eVar) h);
theorem _eSubst_subset {x: EVar} (phi phi1 phi2 psi1 psi2: Pattern x)
(h1: $ Norm (e[ phi / x ] phi1) psi1 $)
(h2: $ Norm (e[ phi / x ] phi2) psi2 $):
$ Norm (e[ phi / x ] (phi1 C= phi2)) (psi1 C= psi2) $ =
'(_eSubst_floor @ _eSubst_imp h1 h2);
theorem _eSubst_eq {x: EVar} (phi phi1 phi2 psi1 psi2: Pattern x)
(h1: $ Norm (e[ phi / x ] phi1) psi1 $)
(h2: $ Norm (e[ phi / x ] phi2) psi2 $):
$ Norm (e[ phi / x ] (phi1 == phi2)) (psi1 == psi2) $ =
'(_eSubst_floor @ _eSubst_equiv h1 h2);
theorem KT_subst {X: SVar} (phi psi rho: Pattern X)
(h_pos: $ _Positive X phi $)
(h_subst: $ Norm (s[ psi / X ] phi) rho $)
(h: $ rho -> psi $):
$ (mu X phi) -> psi $ =
'(KT h_pos @ norm (norm_sym @ norm_imp_l h_subst) h);
--- prop_44
theorem imp_cong_of_equiv_not: $(phi1 <-> phi2) -> (~phi1 <-> ~phi2)$ = 'noteq;
theorem imp_cong_of_equiv_imp_l: $(phi1 <-> phi2) -> ((phi1 -> psi) <-> (phi2 -> psi))$ = '(rsyl ancom @ anim imim1 imim1);
theorem imp_cong_of_equiv_imp_r: $(phi1 <-> phi2) -> ((psi -> phi1) <-> (psi -> phi2))$ = '(anim imim2 imim2);
theorem imp_cong_of_equiv_imp: $(phi1 <-> phi2) -> (psi1 <-> psi2) -> ((phi1 -> psi1) <-> (phi2 -> psi2))$ = '(syl5 imp_cong_of_equiv_imp_r @ syl bitr imp_cong_of_equiv_imp_l);
theorem imp_cong_of_equiv_or_l: $(phi1 <-> phi2) -> ((phi1 \/ psi) <-> (phi2 \/ psi))$ = 'oreq1d;
theorem imp_cong_of_equiv_or_r: $(phi1 <-> phi2) -> ((psi \/ phi1) <-> (psi \/ phi2))$ = 'oreq2d;
theorem imp_cong_of_equiv_or: $(phi1 <-> phi2) -> (psi1 <-> psi2) -> ((phi1 \/ psi1) <-> (phi2 \/ psi2))$ = 'oreq;
theorem imp_cong_of_equiv_and: $(phi1 <-> phi2) -> (psi1 <-> psi2) -> ((phi1 /\ psi1) <-> (phi2 /\ psi2))$ = 'aneq;
theorem imp_cong_of_equiv_and_l: $(phi1 <-> phi2) -> ((phi1 /\ psi) <-> (phi2 /\ psi))$ = '(com12 aneq biid);
theorem imp_cong_of_equiv_and_r: $(phi1 <-> phi2) -> ((psi /\ phi1) <-> (psi /\ phi2))$ = '(aneq biid);
theorem imp_cong_of_equiv_equiv: $(phi1 <-> phi2) -> (psi1 <-> psi2) -> ((phi1 <-> psi1) <-> (phi2 <-> psi2))$ = 'bieq;
theorem imp_cong_of_equiv_equiv_l: $(phi1 <-> phi2) -> ((phi1 <-> psi) <-> (phi2 <-> psi))$ = 'bieq1;
theorem imp_cong_of_equiv_equiv_r: $(phi1 <-> phi2) -> ((psi <-> phi1) <-> (psi <-> phi2))$ = 'bieq2;
-- The following exist for optimization reasons
theorem cong_of_equiv_not (h: $phi1 <-> phi2$): $~phi1 <-> ~phi2$ = '(imp_cong_of_equiv_not h);
theorem cong_of_equiv_imp_l (h: $phi1 <-> phi2$): $(phi1 -> psi) <-> (phi2 -> psi)$ = '(imp_cong_of_equiv_imp_l h);
theorem cong_of_equiv_imp_r (h: $phi1 <-> phi2$): $(psi -> phi1) <-> (psi -> phi2)$ = '(imp_cong_of_equiv_imp_r h);
theorem cong_of_equiv_imp (h1: $phi1 <-> phi2$) (h2: $psi1 <-> psi2$): $(phi1 -> psi1) <-> (phi2 -> psi2)$ = '(imp_cong_of_equiv_imp h1 h2);
theorem cong_of_equiv_or_l (h: $phi1 <-> phi2$): $(phi1 \/ psi) <-> (phi2 \/ psi)$ = '(imp_cong_of_equiv_or_l h);
theorem cong_of_equiv_or_r (h: $phi1 <-> phi2$): $(psi \/ phi1) <-> (psi \/ phi2)$ = '(imp_cong_of_equiv_or_r h);
theorem cong_of_equiv_or (h1: $phi1 <-> phi2$) (h2: $psi1 <-> psi2$): $(phi1 \/ psi1) <-> (phi2 \/ psi2)$ = '(imp_cong_of_equiv_or h1 h2);
theorem cong_of_equiv_and_l (h: $phi1 <-> phi2$): $(phi1 /\ psi) <-> (phi2 /\ psi)$ = '(imp_cong_of_equiv_and_l h);
theorem cong_of_equiv_and_r (h: $phi1 <-> phi2$): $(psi /\ phi1) <-> (psi /\ phi2)$ = '(imp_cong_of_equiv_and_r h);
theorem cong_of_equiv_and (h1: $phi1 <-> phi2$) (h2: $psi1 <-> psi2$): $(phi1 /\ psi1) <-> (phi2 /\ psi2)$ = '(imp_cong_of_equiv_and h1 h2);
theorem cong_of_equiv_equiv (h1: $phi1 <-> phi2$) (h2: $psi1 <-> psi2$): $(phi1 <-> psi1) <-> (phi2 <-> psi2)$ = '(imp_cong_of_equiv_equiv h1 h2);
theorem cong_of_equiv_equiv_l (h: $phi1 <-> phi2$): $(phi1 <-> psi) <-> (phi2 <-> psi)$ = '(imp_cong_of_equiv_equiv_l h);
theorem cong_of_equiv_equiv_r (h: $phi1 <-> phi2$): $(psi <-> phi1) <-> (psi <-> phi2)$ = '(imp_cong_of_equiv_equiv_r h);
theorem cong_of_equiv_nnimp (h1: $phi1 <-> phi2$) (h2: $psi1 <-> psi2$): $(~phi1 \/ psi1) <-> (~phi2 \/ psi2)$ =
'(cong_of_equiv_or (cong_of_equiv_not h1) h2);
--- Appendix C: Properties of Proof System H
--------------------------------------------
theorem propag_exists_def {x: EVar} (phi: Pattern x):
$ |^ exists x phi ^| -> exists x (|^ phi ^|) $ =
'(norm (norm_imp defNorm @ norm_exists defNorm) (! propag_exists_disjoint box));
theorem swap_exists {x y: EVar} (phi: Pattern x y): $ exists x (exists y phi) -> exists y (exists x phi) $ =
'(exists_generalization (eFresh_exists eFresh_exists_same_var) @ exists_framing exists_intro_same_var);
theorem swap_exists_bi {x y: EVar} (phi: Pattern x y): $ exists x (exists y phi) <-> exists y (exists x phi) $ =
'(ibii swap_exists swap_exists);
theorem swap_forall {x y: EVar} (phi: Pattern x y): $ forall x (forall y phi) -> forall y (forall x phi) $ =
'(con3 @ rsyl (exists_framing dne) @ rsyl swap_exists @ exists_framing notnot1);
theorem swap_forall_bi {x y: EVar} (phi: Pattern x y): $ forall x (forall y phi) <-> forall y (forall x phi) $ =
'(ibii swap_forall swap_forall);
theorem prop_43_bot (rho: Pattern): $ bot -> rho $ = 'absurdum;
theorem prop_43_or {box: SVar} (ctx: Pattern box) (phi1 phi2: Pattern):
$ (app[ phi1 / box ] ctx \/ app[ phi2 / box ] ctx) -> app[ phi1 \/ phi2 / box ] ctx $ =
'(eori (framing orl) (framing orr));
theorem prop_43_exists {box: SVar} {x: EVar} (ctx: Pattern box) (phi: Pattern box x):
$ (exists x (app[ phi / box ] ctx)) -> app[ exists x phi / box ] ctx $ =
'(exists_generalization (eFresh_appCtx eFresh_disjoint eFresh_exists_same_var) (framing exists_intro_same_var));
theorem prop_43_exists_var_in_ctx {box: SVar} {x: EVar} (ctx phi: Pattern box x):
$ (exists x (app[ phi / box ] ctx)) -> exists x (app[ exists x phi / box ] ctx) $ =
'(exists_framing @ framing exists_intro_same_var);
theorem prop_43_exists_fresh {box: SVar} {x: EVar} (ctx phi: Pattern box x)
(ctx_fresh: $ _eFresh x ctx $):
$ (exists x (app[ phi / box ] ctx)) -> app[ exists x phi / box ] ctx $ =
'(exists_generalization (eFresh_appCtx ctx_fresh eFresh_exists_same_var) (framing exists_intro_same_var));
theorem exists_appCtx {x: EVar} {box: SVar} (ctx: Pattern box) (phi: Pattern x):
$ (app[ exists x phi / box ] ctx) <-> exists x (app[ phi / box ] ctx) $ =
'(ibii propag_exists_disjoint prop_43_exists);
theorem or_appCtx {box: SVar} (ctx: Pattern box) (phi psi: Pattern):
$ (app[ phi \/ psi / box ] ctx) <-> (app[ phi / box ] ctx) \/ (app[ psi / box ] ctx) $ =
'(ibii propag_or prop_43_or);
theorem or_appCtx2 {box: SVar} (ctx: Pattern box) (phi psi: Pattern):
$ (app[ phi \/ psi \/ rho / box ] ctx) <-> (app[ phi / box ] ctx) \/ (app[ psi / box ] ctx) \/ (app[ rho / box ] ctx) $ =
'(bitr or_appCtx @ cong_of_equiv_or_l or_appCtx);
theorem or_appCtx2_r {box: SVar} (ctx: Pattern box) (phi psi: Pattern):
$ (app[ phi \/ (psi \/ rho) / box ] ctx) <-> (app[ phi / box ] ctx) \/ ((app[ psi / box ] ctx) \/ (app[ rho / box ] ctx)) $ =
'(bitr or_appCtx @ cong_of_equiv_or_r or_appCtx);
theorem prop_43_or_def (phi1 phi2: Pattern):
$ (|^ phi1 ^| \/ |^ phi2 ^|) -> |^ phi1 \/ phi2 ^| $ =
'(eori (framing_def orl) (framing_def orr));
theorem prop_43_exists_def {x: EVar} (phi: Pattern x):
$ (exists x (|^ phi ^|)) -> |^ exists x phi ^| $ =
'(exists_generalization (eFresh_app eFresh_disjoint eFresh_exists_same_var) (framing_def exists_intro_same_var));
theorem forall_floor {x: EVar} (phi: Pattern x):
$ |_ forall x phi _| <-> forall x (|_ phi _|) $ =
'(ian
(con3 @ rsyl (exists_framing dne) @ rsyl prop_43_exists_def @ framing_def notnot1)
(con3 @ rsyl (framing_def dne) @ rsyl propag_exists_def @ exists_framing notnot1));
do {
(def (ex_appCtx_subst subst) '(norm (norm_equiv ,subst @ norm_exists ,subst) exists_appCtx))
(def (or_appCtx_subst subst) '(norm (norm_equiv ,subst @ norm_or ,subst ,subst) or_appCtx))
(def (or_appCtx2_subst subst) '(norm (norm_equiv ,subst @ norm_or (norm_or ,subst ,subst) ,subst) or_appCtx2))
(def (or_appCtx2_r_subst subst) '(norm (norm_equiv ,subst @ norm_or ,subst (norm_or ,subst ,subst)) or_appCtx2_r))
(def (framing_subst hyp subst) '(norm (norm_imp ,subst ,subst) @ framing ,hyp))
};
do {
(def (exists_intro_subst subst) '(norm (norm_imp_l ,subst) exists_intro))
};
theorem exists_intro_l_bi_disjoint {x: EVar} (phi: Pattern x) (psi: Pattern)
(h: $ phi <-> psi $):
$ (exists x phi) <-> psi $ =
'(ibii
(exists_generalization_disjoint @ anl h)
(syl exists_intro_same_var @ anr h));
theorem propag_and_floor: $ |_ phi /\ psi _| <-> |_ phi _| /\ |_ psi _| $ =
'(ibii
(iand (framing_floor anl) (framing_floor anr))
(rsyl (anr notor) @ rsyl (con3 @ anl propag_or_def) @ con3 @ framing_def @ anl notan)
);
theorem prop_43_or_def_rev (phi1 phi2: Pattern):
$ |^ phi1 \/ phi2 ^| -> (|^ phi1 ^| \/ |^ phi2 ^|) $ =
'(syl (orim (framing_def dne) (framing_def dne)) @ rsyl (framing_def @ orim notnot1 notnot1) @ con4 @ rsyl (anl notor) @ rsyl (anr propag_and_floor) @ con3 @ framing_def (anr notan));
theorem appCtxLR {box: SVar} (phi2 phi3: Pattern) (phi1 phi4: Pattern box):
$ Norm (app[ phi1 / box ] (app (app phi3 phi4) phi2)) (app (app phi3 (app[ phi1 / box ] phi4)) phi2) $ =
'(norm_trans appCtxL_disjoint @ norm_app_l appCtxR_disjoint);
theorem appCtxLVar {box: SVar} (phi1 phi2: Pattern):
$ Norm (app[ phi1 / box ] (app (sVar box) phi2)) (app phi1 phi2) $ =
'(norm_trans appCtxL_disjoint @ norm_app appCtxVar norm_refl);
theorem appCtxRVar {box: SVar} (phi1 phi2: Pattern):
$ Norm (app[ phi2 / box ] (app phi1 (sVar box))) (app phi1 phi2) $ =
'(norm_trans appCtxR_disjoint @ norm_app norm_refl appCtxVar);
theorem appCtxLRVar {box: SVar} (phi1 phi2 phi3: Pattern):
$ Norm (app[ phi1 / box ] (app (app phi3 (sVar box)) phi2)) (app (app phi3 phi1) phi2) $ =
'(norm_trans appCtxL_disjoint @ norm_app appCtxRVar norm_refl);
theorem appCtxRLRVar {box: SVar} (phi1 phi2 phi3 phi4: Pattern):
$ Norm (app[ phi1 / box ] (app phi4 (app (app phi3 (sVar box)) phi2))) (app phi4 (app (app phi3 phi1) phi2)) $ =
'(norm_trans appCtxR_disjoint @ norm_app norm_refl appCtxLRVar);
theorem app_framing_l (h: $phi1 -> phi2$): $(app phi1 psi) -> (app phi2 psi)$ =
'(norm (norm_imp appCtxLVar appCtxLVar) (! framing box _ _ _ h));
theorem app_framing_r (h: $phi1 -> phi2$): $(app psi phi1) -> (app psi phi2)$ =
'(norm (norm_imp appCtxRVar appCtxRVar) (! framing box _ _ _ h));
theorem sSubst_ctx_framing{X: SVar} (phi phi1 phi2: Pattern X)
(h: $ phi1 -> phi2 $): $ (s[ phi / X ] phi1) -> (s[ phi / X ] phi2) $ =
'(norm sSubstitution_in_imp @ set_var_subst h);
theorem mu_framing {X: SVar} (phi1 phi2: Pattern X)
(pos1: $ _Positive X phi1 $)
(pos2: $ _Positive X phi2 $)
(h: $ phi1 -> phi2 $):
$ mu X phi1 -> mu X phi2 $ =
'(KT pos1 @ rsyl (sSubst_ctx_framing h) (pre_fixpoint pos2));
theorem mu_framing_disjoint {X: SVar} (phi1 phi2: Pattern)
(h: $ phi1 -> phi2 $):
$ mu X phi1 -> mu X phi2 $ =
'(mu_framing positive_disjoint positive_disjoint h);
theorem cong_of_equiv_app_l (h: $phi1 <-> phi2$): $(app phi1 psi) <-> (app phi2 psi)$ = '(ibii
(app_framing_l @ anl h)
(app_framing_l @ anr h));
theorem cong_of_equiv_app_r (h: $phi1 <-> phi2$): $(app psi phi1) <-> (app psi phi2)$ = '(ibii
(app_framing_r @ anl h)
(app_framing_r @ anr h));
theorem cong_of_equiv_app (h1: $phi1 <-> phi2$) (h2: $psi1 <-> psi2$): $(app phi1 psi1) <-> (app phi2 psi2)$ =
'(bitr (cong_of_equiv_app_l h1) (cong_of_equiv_app_r h2));
theorem cong_of_equiv_exists {x: EVar} (phi1 phi2: Pattern x)
(h: $ phi1 <-> phi2 $): $ (exists x phi1) <-> (exists x phi2) $ =
'(iani (exists_framing @ anl h) (exists_framing @ anr h));
theorem cong_of_equiv_forall {x: EVar} (phi1 phi2: Pattern x)
(h: $ phi1 <-> phi2 $): $ (forall x phi1) <-> (forall x phi2) $ =
'(cong_of_equiv_not @ cong_of_equiv_exists @ cong_of_equiv_not h);
theorem cong_of_equiv_sSubst_ctx {X: SVar} (phi phi1 phi2: Pattern X)
(h: $ phi1 <-> phi2 $): $ (s[ phi / X ] phi1) <-> (s[ phi / X ] phi2) $ = '(ibii
(sSubst_ctx_framing @ anl h)
(sSubst_ctx_framing @ anr h));
theorem cong_of_equiv_mu {X: SVar} (phi1 phi2: Pattern X)
(pos1: $ _Positive X phi1 $)
(pos2: $ _Positive X phi2 $)
(h: $ phi1 <-> phi2 $): $ (mu X phi1) <-> (mu X phi2) $ = '(ibii
(mu_framing pos1 pos2 @ anl h)
(mu_framing pos2 pos1 @ anr h));
theorem cong_of_equiv_appCtx {box: SVar} (phi: Pattern box)
(h: $ phi1 <-> phi2 $):
$ (app[ phi1 / box ] phi) <-> app[ phi2 / box ] phi $ = '(ibii
(framing @ anl h)
(framing @ anr h));
theorem cong_of_equiv_def (h: $ phi1 <-> phi2 $):
$ |^ phi1 ^| <-> |^ phi2 ^| $ = '(ibii
(framing_def @ anl h)
(framing_def @ anr h));
theorem cong_of_equiv_floor (h: $ phi1 <-> phi2 $):
$ |_ phi1 _| <-> |_ phi2 _| $ =
'(cong_of_equiv_not @ cong_of_equiv_def @ cong_of_equiv_not h);
theorem cong_of_equiv_subset (h1: $phi1 <-> phi2$) (h2: $psi1 <-> psi2$):
$ (phi1 C= psi1) <-> (phi2 C= psi2) $ =
'(cong_of_equiv_floor @ cong_of_equiv_imp h1 h2);
theorem cong_of_equiv_mem {x: EVar} (phi1 phi2: Pattern x)
(h: $ phi1 <-> phi2 $):
$ (x in phi1) <-> (x in phi2) $ = '(cong_of_equiv_def @ cong_of_equiv_and_r h);
theorem cong_of_equiv_eq (h1: $phi1 <-> phi2$) (h2: $psi1 <-> psi2$): $(phi1 == psi1) <-> (phi2 == psi2)$ =
'(cong_of_equiv_not @ cong_of_equiv_def @ cong_of_equiv_not @ cong_of_equiv_equiv h1 h2);
theorem univ_gene {x: EVar} (phi: Pattern x)
(p: $ phi $):
$ forall x phi $ = '(exists_generalization_disjoint @ notnot1 p);
theorem var_subst {x y: EVar} (phi: Pattern x y):
$ (forall x phi) -> e[ eVar y / x ] phi $ =
'(con1 @ norm (norm_imp eSubstitution_in_not norm_refl) exists_intro);
theorem var_subst_same_var {x: EVar} (phi: Pattern x):
$ (forall x phi) -> phi $ = '(con1 exists_intro_same_var);
theorem imp_forall_fresh {x: EVar} (phi1 phi2: Pattern x) (freshness_phi1: $ _eFresh x phi1 $):
$ (phi1 -> forall x phi2) <-> forall x (phi1 -> phi2) $ =
'(con2b @ bitr (cong_of_equiv_exists @ con3b @ imeq2i notnot) @ and_exists_fresh freshness_phi1);
theorem imp_r_forall_disjoint {x: EVar} (phi1: Pattern) (phi2: Pattern x):
$ (phi1 -> forall x phi2) <-> forall x (phi1 -> phi2) $ =
'(imp_forall_fresh eFresh_disjoint);
theorem or_r_forall_disjoint {x: EVar} (phi1: Pattern) (phi2: Pattern x):
$ (phi1 \/ forall x phi2) <-> forall x (phi1 \/ phi2) $ = 'imp_r_forall_disjoint;
theorem and_r_forall_disjoint {x: EVar} (phi1: Pattern) (phi2: Pattern x):
$ (phi1 /\ forall x phi2) <-> forall x (phi1 /\ phi2) $ =
'(con3b @ bitr (cong_of_equiv_imp_r @ bicom notnot) @ bitr imp_exists_disjoint @ cong_of_equiv_exists notnot);
theorem forall_ceil {x: EVar} (phi: Pattern x):
$ |^ forall x phi ^| -> forall x (|^ phi ^|) $ =
'(anr (imp_forall_fresh @ eFresh_ceil eFresh_forall_same_var) @ univ_gene @ framing_def var_subst_same_var);
theorem and_forall {x: EVar} (phi psi: Pattern x):
$ (forall x (phi /\ psi)) <-> (forall x phi) /\ (forall x psi) $ =
'(ibii
(iand (forall_framing anl) (forall_framing anr)) @
anr (imp_forall_fresh @ eFresh_and eFresh_forall_same_var eFresh_forall_same_var) @
univ_gene @
anim var_subst_same_var var_subst_same_var);
theorem forall_imp_distr {x: EVar} (phi psi: Pattern x):
$ (forall x (phi -> psi)) -> (forall x phi) -> (forall x psi) $ =
'(exp @ rsyl (anr and_forall) (forall_framing (rsyl ancom appl)));
theorem s_forall_imp_distr {x: EVar} (phi psi rho: Pattern x):
$ (forall x (rho -> (phi -> psi))) -> (forall x (rho -> phi)) -> (forall x (rho -> psi)) $ =
'(rsyl (forall_framing prop_2) forall_imp_distr);
theorem appCtx_dual_taut (phi: Pattern) {box: SVar} (ctx: Pattern box)
(p : $ phi $):
$ ~ (app[ (~ phi) / box ] ctx) $ = '(syl propag_bot @ framing @ notnot1 p);
theorem floor_taut (h: $ phi $): $ |_ phi _| $ =
'(norm (norm_not @ ! defNorm box) @ appCtx_dual_taut h);
theorem imp_to_subset (h: $ phi -> psi $): $ phi C= psi $ = '(floor_taut h);
theorem equiv_to_eq (h: $ phi <-> psi $): $ phi == psi $ = '(floor_taut h);
theorem eq_imp_subset: $ (phi == psi) -> (phi C= psi) $ = '(framing_floor anl);
theorem subset_to_eq: $ (phi C= psi) -> (psi C= phi) -> (phi == psi) $ = '(exp @ anr propag_and_floor);
theorem subset_refl: $ phi C= phi $ = '(imp_to_subset id);
theorem eq_refl: $ phi == phi $ = '(equiv_to_eq biid);
theorem functional_same_var: $ exists x (eVar x == eVar x) $ = '(exists_intro_same_var eq_refl);
theorem functional_var: $ is_func (eVar x) $ =
(named '(exists_intro @ norm (norm_sym @ _eSubst_eq eSubstitution_in_same_eVar eSubstitution_disjoint) eq_refl));
theorem eq_sym: $ (phi1 == phi2) -> (phi2 == phi1) $ =
'(con3 @ framing_def @ con3 bicom);
theorem subset_imp_subset_or_l:
$(phi C= psi) -> (phi C= (psi \/ rho))$ =
'(framing_floor @ imim2i orl);
theorem subset_imp_subset_or_r:
$(phi C= psi) -> (phi C= (rho \/ psi))$ =
'(framing_floor @ imim2i orr);
theorem subset_imp_or_subset_l:
$(phi C= psi) -> ((psi \/ phi) C= psi)$ =
'(framing_floor @ eor id);
theorem subset_imp_or_subset_r:
$(phi C= psi) -> ((phi \/ psi) C= psi)$ =
'(framing_floor @ com12 eor id);
theorem subset_and: $ (phi C= (psi1 /\ psi2)) -> (phi C= psi1) /\ (phi C= psi2) $ =
'(iand (framing_subset id anl) (framing_subset id anr));
theorem and_subset: $ (phi1 C= psi) /\ (phi2 C= psi) <-> (phi1 \/ phi2 C= psi) $ =
'(ibii (rsyl (anr propag_and_floor) @ framing_floor @ curry eor) @
iand (framing_floor @ imim1 orl) (framing_floor @ imim1 orr));
theorem taut_equiv_top (h: $ phi $): $ phi <-> top $ =
'(ibii imp_top @ a1i h);
theorem taut_and_equiv (h: $ phi $): $ phi /\ psi <-> psi $ =
'(bitr (cong_of_equiv_and_l @ taut_equiv_top h) an_top_bi_r);
theorem taut_is_top (h: $ phi $): $ phi == top $ =
'(equiv_to_eq @ taut_equiv_top h);
theorem absurd_and_equiv_bot (h: $ ~ phi $): $ phi /\ psi <-> bot $ =
'(ibii (syl h anl) absurdum);
theorem membership_elim {x: EVar} (phi: Pattern)
(h: $ forall x (x in phi) $):
$ phi $ =
'(dne @ exists_generalization_disjoint (dne @ dne (norm (norm_not @ norm_and (! defNorm box1) (! appCtxVar box2)) singleton) @ var_subst_same_var h) existence);
theorem membership_elim_implicit {x: EVar} (phi: Pattern)
(h: $ x in phi $):
$ phi $ =
'(membership_elim @ univ_gene h);
theorem membership_var_forward {x y: EVar}: $ (x in (eVar y)) -> (eVar x == eVar y) $
= '( rsyl (iand (dne singletonDef) (imim1i (framing_def ancom) @ dne @ norm (norm_not @ norm_and defNorm defNorm) (! singleton box1 box2)))
@ rsyl (anri not_distr_or)
@ rsyl (con3 @ norm (norm_imp norm_refl @ norm_or defNorm defNorm) propag_or)
@ con3
@ norm (norm_imp defNorm norm_refl)
(! framing box _ _ _ @ anr lemma_51));
theorem membership_var_reverse {x y: EVar}: $ (eVar x == eVar y) -> (x in (eVar y)) $
= '(anl propag_or_def @ framing_def or_imp_xor_and @ norm defNorm @ prop_43_or @ norm (norm_sym @ norm_or defNorm (! defNorm box)) @ orl definedness);
theorem membership_var_bi {x y: EVar}:
$ (x in (eVar y)) <-> (eVar x == eVar y) $
= '(iani membership_var_forward membership_var_reverse);
theorem membership_var {x y: EVar}:
$ (x in (eVar y)) == (eVar x == eVar y) $
= '(equiv_to_eq membership_var_bi);
theorem membership_same_var: $ x in eVar x $ = '(framing_def (iand id id) definedness);
theorem membership_not_forward {x: EVar} (phi: Pattern x):
$(x in ~phi) -> ~(x in phi) $ = '(con2 @ dne singletonDef);
theorem membership_not_reverse {x: EVar} (phi: Pattern x):
$~(x in phi) -> (x in ~phi) $ =
'(anl propag_or_def @ framing_def (exp @ iand anl @ curry @ com12 dne) definedness);
theorem membership_not_bi {x: EVar} (phi: Pattern x):
$ (x in ~phi) <-> ~(x in phi) $ =
'(iani membership_not_forward membership_not_reverse);
theorem membership_not {x: EVar} (phi: Pattern x):
$ (x in ~phi) == ~(x in phi) $ =
'(equiv_to_eq membership_not_bi);
theorem framing_in {x: EVar} (phi1 phi2: Pattern x)
(h: $ phi1 -> phi2 $):
$ (x in phi1) -> (x in phi2)$ =
'(framing_def @ anim2 h);
--- (membership and)
theorem membership_and_forward {x: EVar} (phi1 phi2: Pattern x):
$ x in (phi1 /\ phi2) -> (x in phi1) /\ (x in phi2) $
= '(iand (framing_def @ iand anl anrl) (framing_def @ iand anl anrr));
theorem membership_and_reverse {x: EVar} (phi1 phi2: Pattern x):
$ (x in phi1) /\ (x in phi2) -> x in (phi1 /\ phi2) $
='(syl dne @ con2 @ rsyl membership_not_reverse @ rsyl (framing_in @ anl notan) @ rsyl
(framing_def @ anl andi)
(rsyl (norm (norm_imp defNorm @ norm_or defNorm defNorm) (! propag_or box)) @ rsyl (orim (con2 @ dne singletonDef) (con2 @ dne singletonDef)) (anr notan)));
theorem membership_and_bi {x: EVar} (phi1 phi2: Pattern x):
$ x in (phi1 /\ phi2) <-> (x in phi1) /\ (x in phi2) $
= '(iani membership_and_forward membership_and_reverse);
theorem membership_and {x: EVar} (phi1 phi2: Pattern x):
$ x in (phi1 /\ phi2) == (x in phi1) /\ (x in phi2) $ =
'(equiv_to_eq membership_and_bi);
theorem membership_imp_forward {x: EVar} (phi1 phi2: Pattern x):
$ x in (phi1 -> phi2) -> (x in phi1) -> (x in phi2) $ =
'(exp @ rsyl membership_and_reverse @ framing_in @ impcom @ syl mpcom id );
theorem membership_imp_reverse {x: EVar} (phi1 phi2: Pattern x):
$((x in phi1) -> (x in phi2)) -> x in (phi1 -> phi2)$ =
'(imp_to_or @ eori (rsyl membership_not_reverse @ framing_in absurd)
(framing_in @ com12 idd ) );
theorem membership_imp_bi {x: EVar} (phi1 phi2: Pattern x):
$ x in (phi1 -> phi2) <-> (x in phi1) -> (x in phi2) $ =
'(iani membership_imp_forward membership_imp_reverse);
theorem membership_imp {x: EVar} (phi1 phi2: Pattern x):
$ x in (phi1 -> phi2) == (x in phi1) -> (x in phi2) $ =
'(equiv_to_eq membership_imp_bi);
theorem membership_or_bi {x: EVar} (phi1 phi2: Pattern x):
$ x in (phi1 \/ phi2) <-> (x in phi1) \/ (x in phi2) $
= '(bitr membership_imp_bi @ cong_of_equiv_imp_l membership_not_bi);
theorem membership_or {x: EVar} (phi1 phi2: Pattern x):
$ x in (phi1 \/ phi2) == (x in phi1) \/ (x in phi2) $
= '(equiv_to_eq membership_or_bi);
theorem membership_exists_forward {x y: EVar} (phi: Pattern x y):
$ (x in (exists y phi)) -> exists y (x in phi) $
= '(rsyl (framing_def and_exists_disjoint_reverse) propag_exists_def);
theorem membership_exists_reverse {x y: EVar} (phi: Pattern x y):
$ (exists y (x in phi) -> x in (exists y phi)) $
= '(rsyl prop_43_exists_def @ framing_def and_exists_disjoint_forwards);
theorem membership_exists_bi {x y: EVar} (phi: Pattern x y):
$ (x in (exists y phi)) <-> exists y (x in phi) $
= '(iani membership_exists_forward membership_exists_reverse);
theorem membership_exists {x y: EVar} (phi: Pattern x y):
$ (x in (exists y phi)) == exists y (x in phi) $
= '(equiv_to_eq membership_exists_bi);
theorem membership_equiv_bi {x: EVar} (phi1 phi2: Pattern x):
$ x in (phi1 <-> phi2) <-> ((x in phi1) <-> (x in phi2)) $
= '(bitr membership_and_bi @ cong_of_equiv_and membership_imp_bi membership_imp_bi);
theorem membership_equiv {x: EVar} (phi1 phi2: Pattern x):
$ x in (phi1 <-> phi2) == ((x in phi1) <-> (x in phi2)) $
= '(equiv_to_eq membership_equiv_bi);
theorem eVar_in_subset {x: EVar} (phi: Pattern x):
$ (x in phi) <-> (eVar x C= phi) $ =
'(con2b @ bitr (cong_of_equiv_def @ cong_of_equiv_not @ cong_of_equiv_imp_r notnot) membership_not_bi);
theorem eVar_in_subset_rev {x: EVar} (phi: Pattern x):
$ (eVar x C= phi) <-> (x in phi) $ =
'(bicom eVar_in_subset);
theorem eVar_in_subset_forward {x: EVar} (phi: Pattern x):
$ (x in phi) -> (eVar x C= phi) $
= '(bi1i eVar_in_subset);
theorem eVar_in_subset_reverse {x: EVar} (phi: Pattern x):
$ (eVar x C= phi) -> (x in phi) $
= '(bi2i eVar_in_subset);
theorem eVars_subset_eq_forward {x y: EVar}:
$ (eVar x C= eVar y) -> (eVar x == eVar y) $ =
'(rsyl eVar_in_subset_reverse membership_var_forward);
theorem eVars_subset_eq_reverse {x y: EVar}:
$ (eVar x == eVar y) -> (eVar x C= eVar y) $ =
'eq_imp_subset;
theorem eVars_subset_eq {x y: EVar}:
$ (eVar x C= eVar y) <-> (eVar x == eVar y) $ =
'(ibii eVars_subset_eq_forward eVars_subset_eq_reverse);
theorem membership_intro_implicit_imp {x: EVar} (phi: Pattern x):
$ |_ phi _| -> x in phi $ =
'(syl eVar_in_subset_reverse @ framing_floor prop_1);
theorem membership_intro_implicit {x: EVar} (phi: Pattern x)
(h: $ phi $):
$ x in phi $ =
'(membership_intro_implicit_imp @ floor_taut h);
theorem membership_intro {x: EVar} (phi: Pattern x)
(h: $ phi $):
$ forall x (x in phi) $ =
'(univ_gene @ membership_intro_implicit h);
theorem lemma_exists_and: $ phi <-> exists x (eVar x /\ phi) $ =
'(ibii
(rsyl notnot1 @ anr or_exists_disjoint @ exists_framing
(expcom @ iand appl @ rsyl anl dne)
@ anl or_exists_disjoint @ orr existence)
(exists_generalization_disjoint anr));
theorem lemma_ceil_exists_membership:
$ |^ phi ^| <-> exists x (x in phi) $ =
'(bitr (cong_of_equiv_def lemma_exists_and) @
ibii propag_exists_def prop_43_exists_def);
theorem lemma_56 {box: SVar} (phi ctx: Pattern box)
: $ (app[ phi / box ] ctx) -> |^ phi ^| $ =
'(rsyl (rsyl (framing @ anl lemma_exists_and) @ propag_exists eFresh_disjoint)
(exists_generalization eFresh_disjoint @ rsyl
(dne @ singleton_norm norm_refl (! defNorm box2))
(anl propag_or_def @ framing_def (anl com12b @ rsyl dne @ imim2i dne) (! definedness x))
));
theorem ceil_imp (phi: Pattern): $ phi -> |^ phi ^| $ =
'(norm (norm_imp_l appCtxVar) (! lemma_56 box));
theorem floor_imp (phi: Pattern): $ |_ phi _| -> phi $ =
'(con1 ceil_imp);
theorem not_ceil_floor_bi: $ ~ |^ phi ^| <-> |_ ~ phi _| $ = '(con3b @ cong_of_equiv_def notnot);
theorem def_idem: $ |^ (|^ phi ^|) ^| <-> |^ phi ^| $ =
'(ibii (norm (norm_imp_l defNorm2) (! lemma_56 box _ _)) @ framing_def ceil_imp);
theorem floor_idem: $ |_ (|_ phi _|) _| <-> |_ phi _| $ =
'(bitr (bicom not_ceil_floor_bi) @ con3b def_idem);
theorem subset_to_imp: $ (phi C= psi) -> (phi -> psi) $ = 'floor_imp;
--- lemma 60
theorem lemma_60_forward {x: EVar} {box: SVar} (ctx phi1 phi2: Pattern box x):
$ (app[ phi1 /\ (x in phi2) / box ] ctx) -> ((app[ phi1 / box ] ctx) /\ (x in phi2)) $ =
'(iand (framing anl) @
rsyl (framing anr) @ rsyl (norm (
norm_imp (norm_trans appCtxNested_disjoint @ norm_ctxApp_pt norm_refl (! defNorm box1)) @ norm_not (! defNorm box2)
) @ dne singleton) @ anl propag_or_def @ framing_def lemma_60_helper_1 definedness);
theorem lemma_60_reverse {x: EVar} {box: SVar} (ctx phi2: Pattern box x) (phi1: Pattern x):
$ ((app[ phi1 / box ] ctx) /\ (x in phi2)) -> app[ phi1 /\ (x in phi2) / box ] ctx $ =
'(rsyl (anim2 @
syl (con3 @ framing @ membership_not_reverse) @
norm (norm_imp (! defNorm box1) @ norm_not @ norm_trans appCtxNested_disjoint @ norm_ctxApp_pt norm_refl (! defNorm box2)) @
dne singleton) @ curry @ syl propag_or @ framing lemma_60_helper_2);
theorem lemma_60 {x: EVar} {box: SVar} (ctx: Pattern box x) (phi1 phi2: Pattern x):
$ (app[ phi1 /\ (x in phi2) / box ] ctx) <-> ((app[ phi1 / box ] ctx) /\ (x in phi2)) $ =
'(ibii lemma_60_forward lemma_60_reverse);
theorem lemma_60_b {x: EVar} {box: SVar} (ctx: Pattern box x) (phi1 phi2: Pattern x):
$ (app[ (x in phi2) /\ phi1 / box ] ctx) <-> ((x in phi2) /\ (app[ phi1 / box ] ctx)) $ =
'(bitr (cong_of_equiv_appCtx ancomb) @ bitr lemma_60 ancomb);
theorem lemma_60_subset {x: EVar} {box: SVar} (ctx: Pattern box x) (phi1 phi2: Pattern x):
$ (app[ phi1 /\ (eVar x C= phi2) / box ] ctx) <-> ((app[ phi1 / box ] ctx) /\ (eVar x C= phi2)) $ =
'(bisquare (cong_of_equiv_appCtx @ cong_of_equiv_and_r eVar_in_subset_rev) (cong_of_equiv_and_r eVar_in_subset_rev) lemma_60);
do {
(def (lemma_60_subst subst) '(norm (norm_equiv ,subst @ norm_and_l ,subst) lemma_60))
(def (lemma_60_subset_subst subst) '(norm (norm_equiv ,subst @ norm_and_l ,subst) lemma_60_subset))
(def (lemma_60_b_subst subst) '(norm (norm_equiv ,subst @ norm_and_r ,subst) lemma_60_b))
};
theorem ceil_appCtx {box: SVar} (ctx: Pattern box) (phi: Pattern):
$ (app[ |^ phi ^| / box ] ctx) -> |^ phi ^| $ =
(named '(syl (anr lemma_ceil_exists_membership) @ rsyl (framing (anl lemma_ceil_exists_membership)) @ rsyl propag_exists_disjoint @ exists_framing @
syl anr @ syl lemma_60_forward @ framing top_and));
--- Lemma 62
theorem lemma_62_forward {x: EVar} (phi: Pattern):
$ (exists x ((x in phi) /\ eVar x)) -> phi $ =
'(exists_generalization_disjoint @ syl dne @ dne @ con3 (bi1i anass) (singleton_norm (! defNorm box1) (! appCtxVar box2)));
theorem lemma_62_reverse {y: EVar} (phi: Pattern) {.box: SVar}:
$ phi -> (exists y ((y in phi) /\ eVar y))$
= '( ! membership_elim x _
@ exists_generalization eFresh_disjoint
@ notnot1
@ membership_imp_reverse
@ syl membership_exists_reverse
@ syl (bi2i @ cong_of_equiv_exists membership_and_bi)
@ syl (bi2i @ cong_of_equiv_exists @ cong_of_equiv_and_r membership_var_bi)
@ syl (! exists_intro y x)
@ norm (norm_imp norm_refl @ norm_sym @ norm_trans eSubstitution_in_and
@ norm_and (norm_trans eSubstitution_in_app @ norm_app
eSubstitution_disjoint
@ norm_trans eSubstitution_in_and @ norm_and eSubstitution_disjoint
@ norm_trans eSubstitution_in_app @ norm_app eSubstitution_disjoint
@ norm_trans eSubstitution_in_and @ norm_and
eSubstitution_in_same_eVar
eSubstitution_disjoint)
( norm_trans eSubstitution_in_not @ norm_not
@ norm_trans eSubstitution_in_app @ norm_app eSubstitution_disjoint
@ norm_trans eSubstitution_in_not @ norm_not
@ norm_trans eSubstitution_in_and @ norm_and
(norm_trans eSubstitution_in_imp @ norm_imp
eSubstitution_disjoint eSubstitution_in_same_eVar )
(norm_trans eSubstitution_in_imp @ norm_imp
eSubstitution_in_same_eVar eSubstitution_disjoint ) )
)
@ iand ( syl (norm (norm_imp (norm_and defNorm norm_refl) @ defNorm) (! lemma_60_reverse _ box) )
@ iand (a1i definedness)
id
)
(a1i eq_refl)
);
theorem lemma_62_b_forward:
$ (exists x (eVar x /\ x in phi)) -> phi $ =
'(syl lemma_62_forward @ exists_framing ancom);
theorem lemma_62_b_reverse:
$ phi -> (exists y (eVar y /\ y in phi)) $ =
'(rsyl lemma_62_reverse @ exists_framing ancom);
theorem lemma_62: $ (exists x ((x in phi) /\ eVar x)) <-> phi $ = '(ibii lemma_62_forward lemma_62_reverse);
theorem lemma_62_b: $ (exists x (eVar x /\ (x in phi))) <-> phi $ = '(ibii lemma_62_b_forward lemma_62_b_reverse);
theorem lemma_14 {box: SVar} (ctx psi phi1 phi2: Pattern box)
(h: $ |_ psi _| -> phi1 -> phi2 $):
$ |_ psi _| -> (app[ phi1 / box ] ctx) -> app[ phi2 / box ] ctx $ =
'(com12 @ con1d @ rsyl
(syl propag_or @ framing @ syl (imim2 dne) @ con3d @ com12 h)
(imim2 @ norm (norm_imp_l @ norm_trans appCtxNested_disjoint @ norm_ctxApp_pt norm_refl defNorm) (! lemma_56 box2))
);
theorem appCtx_pointwise {box: SVar} {x: EVar} (ctx: Pattern box) (phi: Pattern):
$ app[ phi / box ] ctx <-> exists x ((app[ eVar x / box ] ctx) /\ x in phi) $ =
'(bitr (cong_of_equiv_appCtx (bicom lemma_62)) @
bitr exists_appCtx @
bitr (cong_of_equiv_exists @ lemma_60_b) @
cong_of_equiv_exists ancomb);
do {
(def (appCtx_pointwise_subst subst) '(norm (norm_equiv ,subst @ norm_exists @ norm_and_l ,subst) appCtx_pointwise))
};
-- Equality reasoning
do {
(def (cong_eq_lift pf to_eq) '(equiv_to_eq @ ,pf (floor_imp ,to_eq)))
(def (cong_eq_lift2 pf to_eq1 to_eq2) '(equiv_to_eq @ ,pf (floor_imp ,to_eq1) (floor_imp ,to_eq2)))
};
theorem cong_of_eq_exists {x: EVar} (phi1 phi2: Pattern x)
(h: $ phi1 == phi2 $): $ (exists x phi1) == (exists x phi2) $ =
(cong_eq_lift 'cong_of_equiv_exists 'h);
theorem in_refl: $ x in eVar x $ =
'(framing_def (iand id id) definedness);
theorem eq_trans: $(phi1 == phi2) -> (phi2 == phi3) -> (phi1 == phi3)$ =
'(exp @ rsyl (anr propag_and_floor) @ framing_floor @ curry bitr);
theorem subset_trans: $(phi1 C= phi2) -> (phi2 C= phi3) -> (phi1 C= phi3)$ =
'(exp @ rsyl (anr propag_and_floor) @ framing_floor @ curry imim1);
theorem eq_to_intro:
$ (phi1 == phi2) -> (phi1 -> phi2) $ =
'(syl anl floor_imp);
theorem eq_to_intro_rev:
$ (phi1 == phi2) -> (phi2 -> phi1) $ =
'(syl anr floor_imp);
theorem eq_to_taut (h: $ phi $): $ (phi1 == phi2) -> phi $ = '(a1i h);
theorem eq_to_id: $ (phi1 == phi2) -> (phi -> phi) $ = '(eq_to_taut id);
theorem eq_to_id_bi: $ (phi1 == phi2) -> (phi <-> phi) $ = '(eq_to_taut biid);
theorem eq_to_appCtx {box: SVar} (ctx: Pattern box) (phi1 phi2 psi1 psi2: Pattern)
(h: $ (phi1 == phi2) -> (psi1 -> psi2) $):
$ (phi1 == phi2) -> (app[ psi1 / box ] ctx) -> app[ psi2 / box ] ctx $ =
'(lemma_14 h);
theorem eq_to_framing {box: SVar} (ctx: Pattern box) (phi1 phi2: Pattern):
$ (phi1 == phi2) -> ((app[ phi1 / box ] ctx) -> app[ phi2 / box ] ctx) $ =
'(eq_to_appCtx eq_to_intro);
theorem eq_to_def
(h: $ (phi1 == phi2) -> (psi1 -> psi2) $):
$ (phi1 == phi2) -> (|^ psi1 ^| -> |^ psi2 ^|) $ =
'(norm (norm_imp_r @ norm_imp defNorm defNorm) (! eq_to_appCtx box _ _ _ _ _ h));
theorem eq_to_and
(h1: $ (phi1 == phi2) -> (psi1 -> psi2) $)
(h2: $ (phi1 == phi2) -> (rho1 -> rho2) $):
$ (phi1 == phi2) -> ((psi1 /\ rho1) -> (psi2 /\ rho2)) $ =
'(animd h1 h2);
theorem eq_to_and_l
(h: $ (phi1 == phi2) -> (psi1 -> psi2) $):
$ (phi1 == phi2) -> ((psi1 /\ rho) -> (psi2 /\ rho)) $ =
'(anim1d h);
theorem eq_to_and_r
(h: $ (phi1 == phi2) -> (psi1 -> psi2) $):
$ (phi1 == phi2) -> ((rho /\ psi1) -> (rho /\ psi2)) $ =
'(anim2d h);
theorem eq_to_imp
(h1: $ (phi1 == phi2) -> (psi2 -> psi1) $)
(h2: $ (phi1 == phi2) -> (rho1 -> rho2) $):
$ (phi1 == phi2) -> ((psi1 -> rho1) -> (psi2 -> rho2)) $ =
'(imimd h1 h2);
theorem eq_to_imp_l
(h: $ (phi1 == phi2) -> (psi2 -> psi1) $):
$ (phi1 == phi2) -> ((psi1 -> rho) -> (psi2 -> rho)) $ =
'(imim1d h);
theorem eq_to_imp_r
(h: $ (phi1 == phi2) -> (psi1 -> psi2) $):
$ (phi1 == phi2) -> ((rho -> psi1) -> (rho -> psi2)) $ =
'(imim2d h);
theorem eq_to_not
(h: $ (phi1 == phi2) -> (psi2 -> psi1) $):
$ (phi1 == phi2) -> ((~ psi1) -> (~ psi2)) $ =
'(eq_to_imp_l h);
theorem eq_to_or
(h1: $ (phi1 == phi2) -> (psi1 -> psi2) $)
(h2: $ (phi1 == phi2) -> (rho1 -> rho2) $):
$ (phi1 == phi2) -> ((psi1 \/ rho1) -> (psi2 \/ rho2)) $ =
'(orimd h1 h2);
theorem eq_to_or_l
(h: $ (phi1 == phi2) -> (psi1 -> psi2) $):
$ (phi1 == phi2) -> ((psi1 \/ rho) -> (psi2 \/ rho)) $ =
'(orim1d h);
theorem eq_to_or_r
(h: $ (phi1 == phi2) -> (psi1 -> psi2) $):
$ (phi1 == phi2) -> ((rho \/ psi1) -> (rho \/ psi2)) $ =
'(orim2d h);
theorem eq_to_app_l
(h: $ (phi1 == phi2) -> (psi1 -> psi2) $):
$ (phi1 == phi2) -> ((app psi1 rho) -> (app psi2 rho)) $ =
'(norm
(norm_imp_r @ norm_imp (norm_trans appCtxL_disjoint @ norm_app appCtxVar norm_refl) (norm_trans appCtxL_disjoint @ norm_app appCtxVar norm_refl))
(! eq_to_appCtx box _ _ _ _ _ h));
theorem eq_to_app_r
(h: $ (phi1 == phi2) -> (psi1 -> psi2) $):
$ (phi1 == phi2) -> ((app rho psi1) -> (app rho psi2)) $ =
'(norm
(norm_imp_r @ norm_imp (norm_trans appCtxR_disjoint @ norm_app norm_refl appCtxVar) (norm_trans appCtxR_disjoint @ norm_app norm_refl appCtxVar))
(! eq_to_appCtx box _ _ _ _ _ h));
theorem eq_to_app
(h1: $ (phi1 == phi2) -> (psi1 -> psi2) $)
(h2: $ (phi1 == phi2) -> (rho1 -> rho2) $):
$ (phi1 == phi2) -> ((app psi1 rho1) -> (app psi2 rho2)) $ =
'(syld (eq_to_app_l h1) (eq_to_app_r h2));
theorem eq_to_exists_fresh {x: EVar} (phi psi1 psi2: Pattern x)
(freshness: $_eFresh x phi$)
(h: $ phi -> (psi1 -> psi2) $):
$ phi -> ((exists x psi1) -> (exists x psi2)) $ =
'(exp @ rsyl (and_exists_fresh_reverse freshness) @ exists_framing @ curry h);
theorem eq_to_exists {x: EVar} (phi: Pattern) (psi1 psi2: Pattern x)
(h: $ phi -> (psi1 -> psi2) $):
$ phi -> ((exists x psi1) -> (exists x psi2)) $ =
'(eq_to_exists_fresh eFresh_disjoint h);
do {
(def (bi_lift pf to_equiv) '(iand (,pf @ syl anl ,to_equiv) (,pf @ syl anr ,to_equiv)))
(def (bi_lift2 pf to_equiv1 to_equiv2) '(iand (,pf (syl anl ,to_equiv1) (syl anl ,to_equiv2)) (,pf (syl anr ,to_equiv1) (syl anr ,to_equiv2))))
(def (eq_lift pf to_eq) '(rsyl (bi2 floor_idem) @ framing_floor @ ,pf (syl floor_imp ,to_eq)))
(def (eq_lift2 pf to_eq1 to_eq2) '(rsyl (bi2 floor_idem) @ framing_floor @ ,pf (syl floor_imp ,to_eq1) (syl floor_imp ,to_eq2)))
(def (cong_of_eq pf) (eq_lift pf 'id))
};
theorem eq_to_intro_bi:
$ (phi1 == phi2) -> (phi1 <-> phi2) $ =
'floor_imp;
theorem eq_to_intro_rev_bi:
$ (phi1 == phi2) -> (phi2 <-> phi1) $ =
'(syl bicom floor_imp);
theorem eq_to_appCtx_bi {box: SVar} (ctx: Pattern box) (phi1 phi2 psi1 psi2: Pattern)
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((app[ psi1 / box ] ctx) <-> app[ psi2 / box ] ctx) $ = (bi_lift 'eq_to_appCtx 'h);
theorem eq_to_framing_bi {box: SVar} (ctx: Pattern box) (phi1 phi2: Pattern):
$ (phi1 == phi2) -> ((app[ phi1 / box ] ctx) <-> app[ phi2 / box ] ctx) $ = '(eq_to_appCtx_bi eq_to_intro_bi);
theorem eq_to_def_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> (|^ psi1 ^| <-> |^ psi2 ^|) $ = (bi_lift 'eq_to_def 'h);
theorem eq_to_and_bi
(h1: $ (phi1 == phi2) -> (psi1 <-> psi2) $)
(h2: $ (phi1 == phi2) -> (rho1 <-> rho2) $):
$ (phi1 == phi2) -> ((psi1 /\ rho1) <-> (psi2 /\ rho2)) $ = (bi_lift2 'eq_to_and 'h1 'h2);
theorem eq_to_and_l_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((psi1 /\ rho) <-> (psi2 /\ rho)) $ = (bi_lift 'eq_to_and_l 'h);
theorem eq_to_and_r_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((rho /\ psi1) <-> (rho /\ psi2)) $ = (bi_lift 'eq_to_and_r 'h);
theorem eq_to_imp_bi
(h1: $ base -> (psi1 <-> psi2) $)
(h2: $ base -> (rho1 <-> rho2) $):
$ base -> ((psi1 -> rho1) <-> (psi2 -> rho2)) $ = '(sylc imp_cong_of_equiv_imp h1 h2);
theorem eq_to_imp_l_bi
(h: $ base -> (psi1 <-> psi2) $):
$ base -> ((psi1 -> rho) <-> (psi2 -> rho)) $ = '(syl imp_cong_of_equiv_imp_l h);
theorem eq_to_imp_r_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((rho -> psi1) <-> (rho -> psi2)) $ = (bi_lift 'eq_to_imp_r 'h);
theorem eq_to_not_bi
(h: $ base -> (psi1 <-> psi2) $):
$ base -> ((~ psi1) <-> (~ psi2)) $ = '(eq_to_imp_l_bi h);
theorem eq_to_floor_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> (|_ psi1 _| <-> |_ psi2 _|) $ = '(eq_to_not_bi @ eq_to_def_bi @ eq_to_not_bi h);
theorem eq_to_or_bi
(h1: $ (phi1 == phi2) -> (psi1 <-> psi2) $)
(h2: $ (phi1 == phi2) -> (rho1 <-> rho2) $):
$ (phi1 == phi2) -> ((psi1 \/ rho1) <-> (psi2 \/ rho2)) $ = (bi_lift2 'eq_to_or 'h1 'h2);
theorem eq_to_or_l_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((psi1 \/ rho) <-> (psi2 \/ rho)) $ = (bi_lift 'eq_to_or_l 'h);
theorem eq_to_or_r_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((rho \/ psi1) <-> (rho \/ psi2)) $ = (bi_lift 'eq_to_or_r 'h);
theorem eq_to_app_l_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((app psi1 rho) <-> (app psi2 rho)) $ = (bi_lift 'eq_to_app_l 'h);
theorem eq_to_app_r_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((app rho psi1) <-> (app rho psi2)) $ = (bi_lift 'eq_to_app_r 'h);
theorem eq_to_app_bi
(h1: $ (phi1 == phi2) -> (psi1 <-> psi2) $)
(h2: $ (phi1 == phi2) -> (rho1 <-> rho2) $):
$ (phi1 == phi2) -> ((app psi1 rho1) <-> (app psi2 rho2)) $ = (bi_lift2 'eq_to_app 'h1 'h2);
theorem eq_to_equiv_bi
(h1: $ (phi1 == phi2) -> (psi1 <-> psi2) $)
(h2: $ (phi1 == phi2) -> (rho1 <-> rho2) $):
$ (phi1 == phi2) -> ((psi1 <-> rho1) <-> (psi2 <-> rho2)) $ = '(sylc bieq h1 h2);
theorem eq_to_equiv_l_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((psi1 <-> rho) <-> (psi2 <-> rho)) $ = '(eq_to_equiv_bi h eq_to_id_bi);
theorem eq_to_equiv_r_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((rho <-> psi1) <-> (rho <-> psi2)) $ = '(eq_to_equiv_bi eq_to_id_bi h);
theorem eq_to_eq_bi
(h1: $ (phi1 == phi2) -> (psi1 <-> psi2) $)
(h2: $ (phi1 == phi2) -> (rho1 <-> rho2) $):
$ (phi1 == phi2) -> ((psi1 == rho1) <-> (psi2 == rho2)) $ =
'(eq_to_not_bi @ eq_to_def_bi @ eq_to_not_bi @ eq_to_equiv_bi h1 h2);
theorem eq_to_eq_l_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((psi1 == rho) <-> (psi2 == rho)) $ = '(eq_to_eq_bi h eq_to_id_bi);
theorem eq_to_eq_r_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((rho == psi1) <-> (rho == psi2)) $ = '(eq_to_eq_bi eq_to_id_bi h);
theorem eq_to_exists_bi_fresh {x: EVar} (phi psi1 psi2: Pattern x)
(freshness: $ _eFresh x phi $)
(h: $ phi -> (psi1 <-> psi2) $):
$ phi -> ((exists x psi1) <-> (exists x psi2)) $ = '(iand (eq_to_exists_fresh freshness @ syl anl h) (eq_to_exists_fresh freshness @ syl anr h));
theorem eq_to_exists_bi {x: EVar} (phi: Pattern) (psi1 psi2: Pattern x)
(h: $ phi -> (psi1 <-> psi2) $):
$ phi -> ((exists x psi1) <-> (exists x psi2)) $ = '(eq_to_exists_bi_fresh eFresh_disjoint h);
theorem eq_to_forall_bi {x: EVar} (phi1 phi2: Pattern) (psi1 psi2: Pattern x)
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((forall x psi1) <-> (forall x psi2)) $ =
'(eq_to_not_bi @ eq_to_exists_bi @ eq_to_not_bi h);
theorem eq_to_func_bi
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((is_func psi1) <-> (is_func psi2)) $ = (named '(eq_to_exists_bi @ eq_to_eq_r_bi h));
theorem eq_to_mem_bi {x: EVar} (phi1 phi2 psi1 psi2: Pattern x)
(h: $ (phi1 == phi2) -> (psi1 <-> psi2) $):
$ (phi1 == phi2) -> ((x in psi1) <-> (x in psi2)) $ =
'(eq_to_def_bi @ eq_to_and_bi eq_to_id_bi h);
theorem eq_to_gen_mem_bi
(h1: $ (phi1 == phi2) -> (psi1 <-> psi2) $)
(h2: $ (phi1 == phi2) -> (rho1 <-> rho2) $):
$ (phi1 == phi2) -> ((|^ psi1 /\ rho1 ^|) <-> (|^ psi2 /\ rho2 ^|)) $ =
'(eq_to_def_bi @ eq_to_and_bi h1 h2);
theorem eq_to_subset_bi
(h1: $ (phi1 == phi2) -> (psi1 <-> psi2) $)
(h2: $ (phi1 == phi2) -> (rho1 <-> rho2) $):
$ (phi1 == phi2) -> ((psi1 C= rho1) <-> (psi2 C= rho2)) $ =
'(eq_to_not_bi @ eq_to_def_bi @ eq_to_not_bi @ eq_to_imp_bi h1 h2);
-- theorem eq_to_eq_app_l
-- (h: $ (phi1 == phi2) -> (psi1 == psi2) $):
-- $ (phi1 == phi2) -> ((app psi1 rho) == (app psi2 rho)) $ =
-- '(syl equiv_to_eq @ ibid (eq_to_app_l @ syl eq_to_intro h) (eq_to_app_l @ syl eq_to_intro @ syl eq_sym h));
theorem cong_of_eq_ceil: $ (phi == psi) -> (|^ phi ^| == |^ psi ^|) $ =
(cong_of_eq 'eq_to_def_bi);
theorem cong_of_eq_floor: $ (phi == psi) -> (|_ phi _| == |_ psi _|) $ =
'(rsyl ,(cong_of_eq 'eq_to_not_bi) @ rsyl ,(cong_of_eq 'eq_to_def_bi) ,(cong_of_eq 'eq_to_not_bi));
theorem not_exists_bot: $ ~ exists x bot $ =
'(exists_generalization_disjoint taut);
theorem ceil_mem_imp_mem {x: EVar} (phi: Pattern x):
$ |^ x in phi ^| -> x in phi $ =
'(syl (con1 membership_not_reverse) @ norm (norm_imp (! defNorm2 box1) @ norm_not (! defNorm box2)) @ dne singleton);
theorem mem_imp_floor_mem {x: EVar} (phi: Pattern x):
$ (x in phi) -> |_ x in phi _| $ =
'(con2 @ imim (framing_def membership_not_reverse) membership_not_forward ceil_mem_imp_mem);
theorem lemma_in_in_forward {x y: EVar} (phi: Pattern x y):
$ (x in (y in phi)) -> y in phi $ =
'(syl ceil_mem_imp_mem @ framing_def anr);
theorem lemma_in_in_forward_same_var {x: EVar} (phi: Pattern x):
$ (x in (x in phi)) -> x in phi $ =
'(syl ceil_mem_imp_mem @ framing_def anr);
theorem lemma_in_in_reverse {x y: EVar} (phi: Pattern x y):
$ (y in phi) -> x in (y in phi) $ =
'(rsyl mem_imp_floor_mem @ anl propag_or_def @
framing_def lemma_in_in_reverse_helper @ prop_43_or_def @ orr definedness);
theorem lemma_in_in_reverse_same_var {x: EVar} (phi: Pattern x):
$ (x in phi) -> x in (x in phi) $ =
'(rsyl mem_imp_floor_mem @ anl propag_or_def @
framing_def lemma_in_in_reverse_helper @ prop_43_or_def @ orr definedness);
theorem lemma_in_in {x y: EVar} (phi: Pattern x y):
$ (x in (y in phi)) <-> y in phi $ =
'(ibii lemma_in_in_forward lemma_in_in_reverse);
theorem lemma_in_in_same_var {x: EVar} (phi: Pattern x):
$ (x in (x in phi)) <-> x in phi $ =
'(ibii lemma_in_in_forward_same_var lemma_in_in_reverse_same_var);
theorem membership_appCtx {x y: EVar} {box: SVar} (ctx: Pattern box x) (phi: Pattern x):
$ (x in app[ phi / box ] ctx) <-> exists y ((y in phi) /\ (x in app[ eVar y / box ] ctx)) $ =
'(bitr (cong_of_equiv_mem @ cong_of_equiv_appCtx @ bicom lemma_62) @
bitr (cong_of_equiv_mem exists_appCtx) @
bitr (cong_of_equiv_mem @ cong_of_equiv_exists lemma_60_b) @
bitr (floor_imp membership_exists) @
bitr (cong_of_equiv_exists membership_and_bi)
(cong_of_equiv_exists @ cong_of_equiv_and_l lemma_in_in));
theorem membership_appCtx_forward {x y: EVar} {box: SVar} (ctx: Pattern box x) (phi: Pattern x):
$ (x in app[ phi / box ] ctx) -> exists y ((y in phi) /\ (x in app[ eVar y / box ] ctx)) $
= '(anl membership_appCtx);
theorem membership_appCtx_reverse {x y: EVar} {box: SVar} (ctx: Pattern box x) (phi: Pattern x):
$ exists y ((y in phi) /\ (x in app[ eVar y / box ] ctx)) -> (x in app[ phi / box ] ctx) $
= '(anr membership_appCtx);
theorem membership_app {x y: EVar} (phi psi: Pattern x):
$ (x in app phi psi) <-> exists y ((y in psi) /\ (x in app phi (eVar y))) $ =
(named '(norm (norm_equiv (norm_mem appCtxRVar) @ norm_exists @ norm_and_r @ norm_mem appCtxRVar) membership_appCtx));
theorem membership_app2 {x y z: EVar} (phi psi: Pattern x):
$ (x in app (app phi psi) rho) <-> exists y ((y in psi) /\ exists z ((z in rho) /\ (x in app (app phi (eVar y)) (eVar z)))) $ =
(named '(bitr (norm (norm_equiv (norm_mem appCtxLRVar) @ norm_exists @ norm_and_r @ norm_mem appCtxLRVar) membership_appCtx) @
cong_of_equiv_exists @ cong_of_equiv_and_r membership_app));
do {
(def (membership_appCtx_subst subst) '(norm (norm_equiv (norm_mem ,subst) @ norm_exists @ norm_and_r (norm_mem ,subst)) membership_appCtx))
};
theorem membership_expand {x y: EVar} (phi: Pattern x):
$ (x in phi) <-> exists y ((y in phi) /\ (eVar x == eVar y)) $ =
(named '(bitr ,(membership_appCtx_subst 'appCtxVar) @ cong_of_equiv_exists @ cong_of_equiv_and_r membership_var_bi));
--- lemma 59
-- theorem func_subst_explicit {x: EVar} {y: EVar} (phi1: Pattern x y) (phi2: Pattern x):
-- $ (forall x phi1) /\ (exists y phi2 == eVar y) -> e[ phi2 / x ] phi1 $ =
-- '();
theorem membership_forall_bi {x y: EVar} (phi: Pattern x y):
$ (x in (forall y phi)) <-> forall y (x in phi) $
= '(bitr membership_not_bi @ cong_of_equiv_not @ bitr membership_exists_bi @ cong_of_equiv_exists membership_not_bi);
theorem membership_forall {x y: EVar} (phi: Pattern x y):
$ (x in (forall y phi)) == forall y (x in phi) $
= '(equiv_to_eq membership_forall_bi);
theorem floor_imp_mem {x: EVar} (phi: Pattern x): $ |_ phi _| -> x in phi $ =