-
Notifications
You must be signed in to change notification settings - Fork 0
/
Frame.thy
2148 lines (1804 loc) · 97.2 KB
/
Frame.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 Frame
imports Agent
begin
lemma perm_length[simp]:
fixes p :: "name prm"
and xvec :: "'a::pt_name list"
shows "length(p \<bullet> xvec) = length xvec"
by(induct xvec) auto
nominal_datatype 'assertion frame =
F_assert "'assertion::fs_name"
| F_res "\<guillemotleft>name\<guillemotright> ('assertion frame)" ("\<lparr>\<nu>_\<rparr>_" [80, 80] 80)
fun frame_res_chain :: "name list \<Rightarrow> ('a::fs_name) frame \<Rightarrow> 'a frame"
where
frame_res_chainbase: "frame_res_chain [] F = F"
| frame_res_chainstep: "frame_res_chain (x#xs) F = \<lparr>\<nu>x\<rparr>(frame_res_chain xs F)"
notation frame_res_chain ("\<lparr>\<nu>*_\<rparr>_" [80, 80] 80)
notation F_assert ("\<langle>\<epsilon>, _\<rangle>" [80] 80)
abbreviation F_assert_judge ("\<langle>_, _\<rangle>" [80, 80] 80) where "\<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle> \<equiv> frame_res_chain A\<^sub>F (F_assert \<Psi>\<^sub>F)"
lemma frame_res_chain_eqvt[eqvt]:
fixes perm :: "name prm"
and lst :: "name list"
and F :: "'a::fs_name frame"
shows "perm \<bullet> (\<lparr>\<nu>*xvec\<rparr>F) = \<lparr>\<nu>*(perm \<bullet> xvec)\<rparr>(perm \<bullet> F)"
by(induct_tac xvec, auto)
lemma frame_res_chain_fresh:
fixes x :: name
and xvec :: "name list"
and F :: "'a::fs_name frame"
shows "x \<sharp> \<lparr>\<nu>*xvec\<rparr>F = (x \<in> set xvec \<or> x \<sharp> F)"
by (induct xvec) (simp_all add: abs_fresh)
lemma frame_res_chain_fresh_set:
fixes Xs :: "name set"
and xvec :: "name list"
and F :: "'a::fs_name frame"
shows "Xs \<sharp>* (\<lparr>\<nu>*xvec\<rparr>F) = (\<forall>x\<in>Xs. x \<in> set xvec \<or> x \<sharp> F)"
by (simp add: fresh_star_def frame_res_chain_fresh)
lemma frame_chain_alpha:
fixes p :: "name prm"
and xvec :: "name list"
and F :: "'a::fs_name frame"
assumes xvec_freshF: "(p \<bullet> xvec) \<sharp>* F"
and S: "set p \<subseteq> set xvec \<times> set (p \<bullet> xvec)"
shows "\<lparr>\<nu>*xvec\<rparr>F = \<lparr>\<nu>*(p \<bullet> xvec)\<rparr>(p \<bullet> F)"
proof -
note pt_name_inst at_name_inst S
moreover have "set xvec \<sharp>* (\<lparr>\<nu>*xvec\<rparr>F)"
by (simp add: frame_res_chain_fresh_set)
moreover from xvec_freshF have "set (p \<bullet> xvec) \<sharp>* (\<lparr>\<nu>*xvec\<rparr>F)"
by (simp add: frame_res_chain_fresh_set) (simp add: fresh_star_def)
ultimately have "\<lparr>\<nu>*xvec\<rparr>F = p \<bullet> (\<lparr>\<nu>*xvec\<rparr>F)"
by (rule_tac pt_freshs_freshs [symmetric])
then show ?thesis by(simp add: eqvts)
qed
lemma frame_chain_alpha':
fixes p :: "name prm"
and A\<^sub>P :: "name list"
and \<Psi>\<^sub>P :: "'a::fs_name"
assumes "(p \<bullet> A\<^sub>P) \<sharp>* \<Psi>\<^sub>P"
and S: "set p \<subseteq> set A\<^sub>P \<times> set (p \<bullet> A\<^sub>P)"
shows "\<langle>A\<^sub>P, \<Psi>\<^sub>P\<rangle> = \<langle>(p \<bullet> A\<^sub>P), p \<bullet> \<Psi>\<^sub>P\<rangle>"
using assms
by(subst frame_chain_alpha) (auto simp add: fresh_star_def)
lemma alpha_frame_res:
fixes x :: name
and F :: "'a::fs_name frame"
and y :: name
assumes "y \<sharp> F"
shows "\<lparr>\<nu>x\<rparr>F = \<lparr>\<nu>y\<rparr>([(x, y)] \<bullet> F)"
proof(cases "x = y")
assume "x=y"
thus ?thesis by simp
next
assume "x \<noteq> y"
with `y \<sharp> F` show ?thesis
by(perm_simp add: frame.inject alpha calc_atm fresh_left)
qed
lemma frame_chain_append:
fixes xvec :: "name list"
and yvec :: "name list"
and F :: "'a::fs_name frame"
shows "\<lparr>\<nu>*(xvec@yvec)\<rparr>F = \<lparr>\<nu>*xvec\<rparr>(\<lparr>\<nu>*yvec\<rparr>F)"
by(induct xvec) auto
lemma frame_chain_eq_length:
fixes xvec :: "name list"
and \<Psi> :: "'a::fs_name"
and yvec :: "name list"
and \<Psi>' :: "'a::fs_name"
assumes "\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>"
shows "length xvec = length yvec"
proof -
obtain n where "n = length xvec" by auto
with assms show ?thesis
proof(induct n arbitrary: xvec yvec \<Psi> \<Psi>')
case(0 xvec yvec \<Psi> \<Psi>')
from `0 = length xvec` have "xvec = []" by auto
moreover with `\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>` have "yvec = []"
by(case_tac yvec) auto
ultimately show ?case by simp
next
case(Suc n xvec yvec \<Psi> \<Psi>')
from `Suc n = length xvec`
obtain x xvec' where "xvec = x#xvec'" and "length xvec' = n"
by(case_tac xvec) auto
from `\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>` `xvec = x # xvec'`
obtain y yvec' where "\<langle>(x#xvec'), \<Psi>\<rangle> = \<langle>(y#yvec'), \<Psi>'\<rangle>"
and "yvec = y#yvec'"
by(case_tac yvec) auto
hence EQ: "\<lparr>\<nu>x\<rparr>\<lparr>\<nu>*xvec'\<rparr>(F_assert \<Psi>) = \<lparr>\<nu>y\<rparr>\<lparr>\<nu>*yvec'\<rparr>(F_assert \<Psi>')"
by simp
have IH: "\<And>xvec yvec \<Psi> \<Psi>'. \<lbrakk>\<langle>xvec, (\<Psi>::'a)\<rangle> = \<langle>yvec, (\<Psi>'::'a)\<rangle>; n = length xvec\<rbrakk> \<Longrightarrow> length xvec = length yvec"
by fact
show ?case
proof(case_tac "x = y")
assume "x = y"
with EQ have "\<langle>xvec', \<Psi>\<rangle> = \<langle>yvec', \<Psi>'\<rangle>"
by(simp add: alpha frame.inject)
with IH `length xvec' = n` have "length xvec' = length yvec'"
by blast
with `xvec = x#xvec'` `yvec=y#yvec'`
show ?case by simp
next
assume "x \<noteq> y"
with EQ have "\<langle>xvec', \<Psi>\<rangle> = [(x, y)] \<bullet> \<langle>yvec', \<Psi>'\<rangle>"
by(simp add: alpha frame.inject)
hence "\<langle>xvec', \<Psi>\<rangle> = \<langle>([(x, y)] \<bullet> yvec'), ([(x, y)] \<bullet> \<Psi>')\<rangle>"
by(simp add: eqvts)
with IH `length xvec' = n` have "length xvec' = length ([(x, y)] \<bullet> yvec')"
by blast
hence "length xvec' = length yvec'"
by simp
with `xvec = x#xvec'` `yvec=y#yvec'`
show ?case by simp
qed
qed
qed
lemma frame_eq_fresh:
fixes F :: "('a::fs_name) frame"
and G :: "'a frame"
and x :: name
and y :: name
assumes "\<lparr>\<nu>x\<rparr>F = \<lparr>\<nu>y\<rparr>G"
and "x \<sharp> F"
shows "y \<sharp> G"
using assms
by(auto simp add: frame.inject alpha fresh_left calc_atm)
lemma frame_eq_supp:
fixes F :: "('a::fs_name) frame"
and G :: "'a frame"
and x :: name
and y :: name
assumes "\<lparr>\<nu>x\<rparr>F = \<lparr>\<nu>y\<rparr>G"
and "x \<in> supp F"
shows "y \<in> supp G"
using assms
apply(auto simp add: frame.inject alpha fresh_left calc_atm)
apply(drule_tac pi="[(x, y)]" in pt_set_bij2[OF pt_name_inst, OF at_name_inst])
by(simp add: eqvts calc_atm)
lemma frame_chain_eq_supp_empty[dest]:
fixes xvec :: "name list"
and \<Psi> :: "'a::fs_name"
and yvec :: "name list"
and \<Psi>' :: "'a::fs_name"
assumes "\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>"
and "supp \<Psi> = ({}::name set)"
shows "\<Psi> = \<Psi>'"
proof -
obtain n where "n = length xvec" by auto
with assms show ?thesis
proof(induct n arbitrary: xvec yvec \<Psi> \<Psi>')
case(0 xvec yvec \<Psi> \<Psi>')
from `0 = length xvec` have "xvec = []" by auto
moreover with `\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>` have "yvec = []"
by(case_tac yvec) auto
ultimately show ?case using `\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>`
by(simp add: frame.inject)
next
case(Suc n xvec yvec \<Psi> \<Psi>')
from `Suc n = length xvec`
obtain x xvec' where "xvec = x#xvec'" and "length xvec' = n"
by(case_tac xvec) auto
from `\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>` `xvec = x # xvec'`
obtain y yvec' where "\<langle>(x#xvec'), \<Psi>\<rangle> = \<langle>(y#yvec'), \<Psi>'\<rangle>"
and "yvec = y#yvec'"
by(case_tac yvec) auto
hence EQ: "\<lparr>\<nu>x\<rparr>\<lparr>\<nu>*xvec'\<rparr>(F_assert \<Psi>) = \<lparr>\<nu>y\<rparr>\<lparr>\<nu>*yvec'\<rparr>(F_assert \<Psi>')"
by simp
have IH: "\<And>xvec yvec \<Psi> \<Psi>'. \<lbrakk>\<langle>xvec, (\<Psi>::'a)\<rangle> = \<langle>yvec, (\<Psi>'::'a)\<rangle>; supp \<Psi> = ({}::name set); n = length xvec\<rbrakk> \<Longrightarrow> \<Psi> = \<Psi>'"
by fact
show ?case
proof(case_tac "x = y")
assume "x = y"
with EQ have "\<langle>xvec', \<Psi>\<rangle> = \<langle>yvec', \<Psi>'\<rangle>"
by(simp add: alpha frame.inject)
with IH `length xvec' = n` `supp \<Psi> = {}` show ?case
by simp
next
assume "x \<noteq> y"
with EQ have "\<langle>xvec', \<Psi>\<rangle> = [(x, y)] \<bullet> \<langle>yvec', \<Psi>'\<rangle>"
by(simp add: alpha frame.inject)
hence "\<langle>xvec', \<Psi>\<rangle> = \<langle>([(x, y)] \<bullet> yvec'), ([(x, y)] \<bullet> \<Psi>')\<rangle>"
by(simp add: eqvts)
with IH `length xvec' = n` `supp \<Psi> = {}` have "\<Psi> = [(x, y)] \<bullet> \<Psi>'"
by(simp add: eqvts)
moreover with `supp \<Psi> = {}` have "supp([(x, y)] \<bullet> \<Psi>') = ({}::name set)"
by simp
hence "x \<sharp> ([(x, y)] \<bullet> \<Psi>')" and "y \<sharp> ([(x, y)] \<bullet> \<Psi>')"
by(simp add: fresh_def)+
with `x \<noteq> y` have "x \<sharp> \<Psi>'" and "y \<sharp> \<Psi>'"
by(simp add: fresh_left calc_atm)+
ultimately show ?case by simp
qed
qed
qed
lemma frame_chain_eq:
fixes xvec :: "name list"
and \<Psi> :: "'a::fs_name"
and yvec :: "name list"
and \<Psi>' :: "'a::fs_name"
assumes "\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>"
and "xvec \<sharp>* yvec"
obtains p where "(set p) \<subseteq> (set xvec) \<times> set (yvec)" and "distinct_perm p" and "\<Psi>' = p \<bullet> \<Psi>"
proof -
assume "\<And>p. \<lbrakk>set p \<subseteq> set xvec \<times> set yvec; distinct_perm p; \<Psi>' = p \<bullet> \<Psi>\<rbrakk> \<Longrightarrow> thesis"
moreover obtain n where "n = length xvec" by auto
with assms have "\<exists>p. (set p) \<subseteq> (set xvec) \<times> set (yvec) \<and> distinct_perm p \<and> \<Psi>' = p \<bullet> \<Psi>"
proof(induct n arbitrary: xvec yvec \<Psi> \<Psi>')
case(0 xvec yvec \<Psi> \<Psi>')
have Eq: "\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>" by fact
from `0 = length xvec` have "xvec = []" by auto
moreover with Eq have "yvec = []"
by(case_tac yvec) auto
ultimately show ?case using Eq
by(simp add: frame.inject)
next
case(Suc n xvec yvec \<Psi> \<Psi>')
from `Suc n = length xvec`
obtain x xvec' where "xvec = x#xvec'" and "length xvec' = n"
by(case_tac xvec) auto
from `\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>` `xvec = x # xvec'`
obtain y yvec' where "\<langle>(x#xvec'), \<Psi>\<rangle> = \<langle>(y#yvec'), \<Psi>'\<rangle>"
and "yvec = y#yvec'"
by(case_tac yvec) auto
hence EQ: "\<lparr>\<nu>x\<rparr>\<lparr>\<nu>*xvec'\<rparr>(F_assert \<Psi>) = \<lparr>\<nu>y\<rparr>\<lparr>\<nu>*yvec'\<rparr>(F_assert \<Psi>')"
by simp
from `xvec = x#xvec'` `yvec=y#yvec'` `xvec \<sharp>* yvec`
have "x \<noteq> y" and "xvec' \<sharp>* yvec'" and "x \<sharp> yvec'" and "y \<sharp> xvec'"
by auto
have IH: "\<And>xvec yvec \<Psi> \<Psi>'. \<lbrakk>\<langle>xvec, (\<Psi>::'a)\<rangle> = \<langle>yvec, (\<Psi>'::'a)\<rangle>; xvec \<sharp>* yvec; n = length xvec\<rbrakk> \<Longrightarrow>
\<exists>p. (set p) \<subseteq> (set xvec) \<times> (set yvec) \<and> distinct_perm p \<and> \<Psi>' = p \<bullet> \<Psi>"
by fact
from EQ `x \<noteq> y` have EQ': "\<langle>xvec', \<Psi>\<rangle> = ([(x, y)] \<bullet> \<langle>yvec', \<Psi>'\<rangle>)"
and x_fresh\<Psi>': "x \<sharp> \<lparr>\<nu>*yvec'\<rparr>(F_assert \<Psi>')"
by(simp add: frame.inject alpha)+
show ?case
proof(case_tac "x \<sharp> \<langle>xvec', \<Psi>\<rangle>")
assume "x \<sharp> \<langle>xvec', \<Psi>\<rangle>"
with EQ have "y \<sharp> \<langle>yvec', \<Psi>'\<rangle>"
by(rule frame_eq_fresh)
with x_fresh\<Psi>' EQ' have "\<langle>xvec', \<Psi>\<rangle> = \<langle>yvec', \<Psi>'\<rangle>"
by(simp)
with `xvec' \<sharp>* yvec'` `length xvec' = n` IH
obtain p where S: "(set p) \<subseteq> (set xvec') \<times> (set yvec')" and "distinct_perm p" and "\<Psi>' = p \<bullet> \<Psi>"
by blast
from S have "(set p) \<subseteq> set(x#xvec') \<times> set(y#yvec')" by auto
with `xvec = x#xvec'` `yvec=y#yvec'` `distinct_perm p` `\<Psi>' = p \<bullet> \<Psi>`
show ?case by blast
next
assume "\<not>(x \<sharp> \<lparr>\<nu>*xvec'\<rparr>(F_assert \<Psi>))"
hence x_supp\<Psi>: "x \<in> supp(\<langle>xvec', \<Psi>\<rangle>)"
by(simp add: fresh_def)
with EQ have "y \<in> supp (\<langle>yvec', \<Psi>'\<rangle>)"
by(rule frame_eq_supp)
hence "y \<sharp> yvec'"
by(induct yvec') (auto simp add: frame.supp abs_supp)
with `x \<sharp> yvec'` EQ' have "\<langle>xvec', \<Psi>\<rangle> = \<langle>yvec', ([(x, y)] \<bullet> \<Psi>')\<rangle>"
by(simp add: eqvts)
with `xvec' \<sharp>* yvec'` `length xvec' = n` IH
obtain p where S: "(set p) \<subseteq> (set xvec') \<times> (set yvec')" and "distinct_perm p" and "([(x, y)] \<bullet> \<Psi>') = p \<bullet> \<Psi>"
by blast
from x_supp\<Psi> have "x \<sharp> xvec'"
by(induct xvec') (auto simp add: frame.supp abs_supp)
with `x \<sharp> yvec'` `y \<sharp> xvec'` `y \<sharp> yvec'` S have "x \<sharp> p" and "y \<sharp> p"
apply(induct p)
by(auto simp add: name_list_supp) (auto simp add: fresh_def)
from S have "(set ((x, y)#p)) \<subseteq> (set(x#xvec')) \<times> (set(y#yvec'))"
by force
moreover from `x \<noteq> y` `x \<sharp> p` `y \<sharp> p` S `distinct_perm p`
have "distinct_perm((x,y)#p)" by simp
moreover from `x \<sharp> p` `y \<sharp> p` `x \<sharp> xvec'` `y \<sharp> xvec'` have "y#(p \<bullet> xvec') = ((x, y)#p) \<bullet> (x#xvec')"
by(simp add: eqvts calc_atm fresh_chain_simps)
moreover from `([(x, y)] \<bullet> \<Psi>') = p \<bullet> \<Psi>`
have "([(x, y)] \<bullet> [(x, y)] \<bullet> \<Psi>') = [(x, y)] \<bullet> p \<bullet> \<Psi>"
by(simp add: pt_bij)
hence "\<Psi>' = ((x, y)#p) \<bullet> \<Psi>" by simp
ultimately show ?case using `xvec=x#xvec'` `yvec=y#yvec'`
by blast
qed
qed
ultimately show ?thesis by blast
qed
(*
lemma frame_chain_eq'':
fixes xvec :: "name list"
and \<Psi> :: "'a::fs_name"
and yvec :: "name list"
and \<Psi>' :: "'a::fs_name"
assumes "\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>"
obtains p where "(set p) \<subseteq> (set xvec) \<times> set (yvec)" and "\<Psi>' = p \<bullet> \<Psi>"
proof -
assume "\<And>p. \<lbrakk>set p \<subseteq> set xvec \<times> set yvec; \<Psi>' = p \<bullet> \<Psi>\<rbrakk> \<Longrightarrow> thesis"
moreover obtain n where "n = length xvec" by auto
with assms have "\<exists>p. (set p) \<subseteq> (set xvec) \<times> set (yvec) \<and> \<Psi>' = p \<bullet> \<Psi>"
proof(induct n arbitrary: xvec yvec \<Psi> \<Psi>')
case(0 xvec yvec \<Psi> \<Psi>')
have Eq: "\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>" by fact
from `0 = length xvec` have "xvec = []" by auto
moreover with Eq have "yvec = []"
by(case_tac yvec) auto
ultimately show ?case using Eq
by(simp add: frame.inject)
next
case(Suc n xvec yvec \<Psi> \<Psi>')
from `Suc n = length xvec`
obtain x xvec' where "xvec = x#xvec'" and "length xvec' = n"
by(case_tac xvec) auto
from `\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>` `xvec = x # xvec'`
obtain y yvec' where "\<langle>(x#xvec'), \<Psi>\<rangle> = \<langle>(y#yvec'), \<Psi>'\<rangle>"
and "yvec = y#yvec'"
by(case_tac yvec) auto
hence EQ: "\<lparr>\<nu>x\<rparr>\<lparr>\<nu>*xvec'\<rparr>(F_assert \<Psi>) = \<lparr>\<nu>y\<rparr>\<lparr>\<nu>*yvec'\<rparr>(F_assert \<Psi>')"
by simp
have IH: "\<And>xvec yvec \<Psi> \<Psi>'. \<lbrakk>\<langle>xvec, (\<Psi>::'a)\<rangle> = \<langle>yvec, (\<Psi>'::'a)\<rangle>; n = length xvec\<rbrakk> \<Longrightarrow>
\<exists>p. (set p) \<subseteq> (set xvec) \<times> (set yvec) \<and> \<Psi>' = p \<bullet> \<Psi>"
by fact
show ?case
proof(cases "x=y")
case True
from EQ `x = y` have "\<langle>xvec', \<Psi>\<rangle> = \<langle>yvec', \<Psi>'\<rangle>" by(simp add: alpha frame.inject)
then obtain p where S: "set p \<subseteq> set xvec' \<times> set yvec'" and "\<Psi>' = p \<bullet> \<Psi>" using `length xvec' = n` IH
by blast
from S have "set((x, y)#p) \<subseteq> set(x#xvec') \<times> set (y#yvec')" by auto
moreover from `x = y` `\<Psi>' = p \<bullet> \<Psi>` have "\<Psi>' = ((x, y)#p) \<bullet> \<Psi>" by auto
ultimately show ?thesis using `xvec = x#xvec'` `yvec = y#yvec'` by blast
next
case False
thm
from EQ `x \<noteq> y` have EQ': "\<langle>xvec', \<Psi>\<rangle> = ([(x, y)] \<bullet> \<langle>yvec', \<Psi>'\<rangle>)"
and x_fresh\<Psi>': "x \<sharp> \<lparr>\<nu>*yvec'\<rparr>(F_assert \<Psi>')"
by(simp add: frame.inject alpha)+
show ?thesis
proof(cases "x \<sharp> \<langle>xvec', \<Psi>\<rangle>")
case True
from EQ `x \<sharp> \<langle>xvec', \<Psi>\<rangle>` have "y \<sharp> \<langle>yvec', \<Psi>'\<rangle>"
by(rule frame_eq_fresh)
with x_fresh\<Psi>' EQ' have "\<langle>xvec', \<Psi>\<rangle> = \<langle>yvec', \<Psi>'\<rangle>"
by(simp)
with `length xvec' = n` IH
obtain p where S: "(set p) \<subseteq> (set xvec') \<times> (set yvec')" and "\<Psi>' = p \<bullet> \<Psi>"
by blast
from S have "(set p) \<subseteq> set(x#xvec') \<times> set(y#yvec')" by auto
with `xvec = x#xvec'` `yvec=y#yvec'` `\<Psi>' = p \<bullet> \<Psi>`
show ?thesis by blast
next
case False
from `\<not>(x \<sharp> \<lparr>\<nu>*xvec'\<rparr>(F_assert \<Psi>))` have x_supp\<Psi>: "x \<in> supp(\<langle>xvec', \<Psi>\<rangle>)"
by(simp add: fresh_def)
with EQ have "y \<in> supp (\<langle>yvec', \<Psi>'\<rangle>)"
by(rule frame_eq_supp)
hence "y \<sharp> yvec'"
by(induct yvec') (auto simp add: frame.supp abs_supp)
with `x \<sharp> yvec'` EQ' have "\<langle>xvec', \<Psi>\<rangle> = \<langle>yvec', ([(x, y)] \<bullet> \<Psi>')\<rangle>"
by(simp add: eqvts)
with `xvec' \<sharp>* yvec'` `length xvec' = n` IH
obtain p where S: "(set p) \<subseteq> (set xvec') \<times> (set yvec')" and "distinct_perm p" and "([(x, y)] \<bullet> \<Psi>') = p \<bullet> \<Psi>"
by blast
from x_supp\<Psi> have "x \<sharp> xvec'"
by(induct xvec') (auto simp add: frame.supp abs_supp)
with `x \<sharp> yvec'` `y \<sharp> xvec'` `y \<sharp> yvec'` S have "x \<sharp> p" and "y \<sharp> p"
apply(induct p)
by(auto simp add: name_list_supp) (auto simp add: fresh_def)
from S have "(set ((x, y)#p)) \<subseteq> (set(x#xvec')) \<times> (set(y#yvec'))"
by force
moreover from `x \<noteq> y` `x \<sharp> p` `y \<sharp> p` S `distinct_perm p`
have "distinct_perm((x,y)#p)" by simp
moreover from `x \<sharp> p` `y \<sharp> p` `x \<sharp> xvec'` `y \<sharp> xvec'` have "y#(p \<bullet> xvec') = ((x, y)#p) \<bullet> (x#xvec')"
by(simp add: eqvts calc_atm fresh_chain_simps)
moreover from `([(x, y)] \<bullet> \<Psi>') = p \<bullet> \<Psi>`
have "([(x, y)] \<bullet> [(x, y)] \<bullet> \<Psi>') = [(x, y)] \<bullet> p \<bullet> \<Psi>"
by(simp add: pt_bij)
hence "\<Psi>' = ((x, y)#p) \<bullet> \<Psi>" by simp
ultimately show ?case using `xvec=x#xvec'` `yvec=y#yvec'`
by blast
qed
qed
ultimately show ?thesis by blast
qed
*)
lemma frame_chain_eq':
fixes xvec :: "name list"
and \<Psi> :: "'a::fs_name"
and yvec :: "name list"
and \<Psi>' :: "'a::fs_name"
assumes "\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>"
and "xvec \<sharp>* yvec"
and "distinct xvec"
and "distinct yvec"
obtains p where "(set p) \<subseteq> (set xvec) \<times> set (p \<bullet> xvec)" and "distinct_perm p" and "yvec = p \<bullet> xvec" and "\<Psi>' = p \<bullet> \<Psi>"
proof -
assume "\<And>p. \<lbrakk>set p \<subseteq> set xvec \<times> set (p \<bullet> xvec); distinct_perm p; yvec = p \<bullet> xvec; \<Psi>' = p \<bullet> \<Psi>\<rbrakk> \<Longrightarrow> thesis"
moreover obtain n where "n = length xvec" by auto
with assms have "\<exists>p. (set p) \<subseteq> (set xvec) \<times> set (yvec) \<and> distinct_perm p \<and> yvec = p \<bullet> xvec \<and> \<Psi>' = p \<bullet> \<Psi>"
proof(induct n arbitrary: xvec yvec \<Psi> \<Psi>')
case(0 xvec yvec \<Psi> \<Psi>')
have Eq: "\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>" by fact
from `0 = length xvec` have "xvec = []" by auto
moreover with Eq have "yvec = []"
by(case_tac yvec) auto
ultimately show ?case using Eq
by(simp add: frame.inject)
next
case(Suc n xvec yvec \<Psi> \<Psi>')
from `Suc n = length xvec`
obtain x xvec' where "xvec = x#xvec'" and "length xvec' = n"
by(case_tac xvec) auto
from `\<langle>xvec, \<Psi>\<rangle> = \<langle>yvec, \<Psi>'\<rangle>` `xvec = x # xvec'`
obtain y yvec' where "\<langle>(x#xvec'), \<Psi>\<rangle> = \<langle>(y#yvec'), \<Psi>'\<rangle>"
and "yvec = y#yvec'"
by(case_tac yvec) auto
hence EQ: "\<lparr>\<nu>x\<rparr>\<lparr>\<nu>*xvec'\<rparr>(F_assert \<Psi>) = \<lparr>\<nu>y\<rparr>\<lparr>\<nu>*yvec'\<rparr>(F_assert \<Psi>')"
by simp
from `xvec = x#xvec'` `yvec=y#yvec'` `xvec \<sharp>* yvec`
have "x \<noteq> y" and "xvec' \<sharp>* yvec'" and "x \<sharp> yvec'" and "y \<sharp> xvec'"
by auto
from `distinct xvec` `distinct yvec` `xvec=x#xvec'` `yvec=y#yvec'` have "x \<sharp> xvec'" and "y \<sharp> yvec'" and "distinct xvec'" and "distinct yvec'"
by simp+
have IH: "\<And>xvec yvec \<Psi> \<Psi>'. \<lbrakk>\<langle>xvec, (\<Psi>::'a)\<rangle> = \<langle>yvec, (\<Psi>'::'a)\<rangle>; xvec \<sharp>* yvec; distinct xvec; distinct yvec; n = length xvec\<rbrakk> \<Longrightarrow> \<exists>p. (set p) \<subseteq> (set xvec) \<times> (set yvec) \<and> distinct_perm p \<and> yvec = p \<bullet> xvec \<and> \<Psi>' = p \<bullet> \<Psi>"
by fact
from EQ `x \<noteq> y` `x \<sharp> yvec'` `y \<sharp> yvec'` have "\<langle>xvec', \<Psi>\<rangle> = \<langle>yvec', ([(x, y)] \<bullet> \<Psi>')\<rangle>"
by(simp add: frame.inject alpha eqvts)
with `xvec' \<sharp>* yvec'` `distinct xvec'` `distinct yvec'` `length xvec' = n` IH
obtain p where S: "(set p) \<subseteq> (set xvec') \<times> (set yvec')" and "distinct_perm p" and "yvec' = p \<bullet> xvec'" and "[(x, y)] \<bullet> \<Psi>' = p \<bullet> \<Psi>"
by metis
from S have "set((x, y)#p) \<subseteq> set(x#xvec') \<times> set(y#yvec')" by auto
moreover from `x \<sharp> xvec'` `x \<sharp> yvec'` `y \<sharp> xvec'` `y \<sharp> yvec'` S have "x \<sharp> p" and "y \<sharp> p"
apply(induct p)
by(auto simp add: name_list_supp) (auto simp add: fresh_def)
with S `distinct_perm p` `x \<noteq> y` have "distinct_perm((x, y)#p)" by auto
moreover from `yvec' = p \<bullet> xvec'` `x \<sharp> p` `y \<sharp> p` `x \<sharp> xvec'` `y \<sharp> xvec'` have "(y#yvec') = ((x, y)#p) \<bullet> (x#xvec')"
by(simp add: fresh_chain_simps calc_atm)
moreover from `([(x, y)] \<bullet> \<Psi>') = p \<bullet> \<Psi>`
have "([(x, y)] \<bullet> [(x, y)] \<bullet> \<Psi>') = [(x, y)] \<bullet> p \<bullet> \<Psi>"
by(simp add: pt_bij)
hence "\<Psi>' = ((x, y)#p) \<bullet> \<Psi>"
by simp
ultimately show ?case using `xvec=x#xvec'` `yvec=y#yvec'`
by blast
qed
ultimately show ?thesis by blast
qed
lemma frame_eq[simp]:
fixes A\<^sub>F :: "name list"
and \<Psi> :: "'a::fs_name"
and \<Psi>' :: 'a
shows "\<langle>A\<^sub>F, \<Psi>\<rangle> = \<langle>\<epsilon>, \<Psi>'\<rangle> = (A\<^sub>F = [] \<and> \<Psi> = \<Psi>')"
and "\<langle>\<epsilon>, \<Psi>'\<rangle> = \<langle>A\<^sub>F, \<Psi>\<rangle> = (A\<^sub>F = [] \<and> \<Psi> = \<Psi>')"
proof -
{
assume "\<langle>A\<^sub>F, \<Psi>\<rangle> = \<langle>\<epsilon>, \<Psi>'\<rangle>"
hence A: "\<langle>A\<^sub>F, \<Psi>\<rangle> = \<langle>[], \<Psi>'\<rangle>" by simp
hence "length A\<^sub>F = length ([]::name list)"
by(rule frame_chain_eq_length)
with A have "A\<^sub>F = []" and "\<Psi> = \<Psi>'" by(auto simp add: frame.inject)
}
thus "\<langle>A\<^sub>F, \<Psi>\<rangle> = \<langle>\<epsilon>, \<Psi>'\<rangle> = (A\<^sub>F = [] \<and> \<Psi> = \<Psi>')"
and "\<langle>\<epsilon>, \<Psi>'\<rangle> = \<langle>A\<^sub>F, \<Psi>\<rangle> = (A\<^sub>F = [] \<and> \<Psi> = \<Psi>')"
by auto
qed
lemma distinct_frame:
fixes A\<^sub>F :: "name list"
and \<Psi>\<^sub>F :: "'a::fs_name"
and C :: "'b::fs_name"
assumes "A\<^sub>F \<sharp>* C"
obtains A\<^sub>F' where "\<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle> = \<langle>A\<^sub>F', \<Psi>\<^sub>F\<rangle>" and "distinct A\<^sub>F'" and "A\<^sub>F' \<sharp>* C"
proof -
assume "\<And>A\<^sub>F'. \<lbrakk>\<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle> = \<langle>A\<^sub>F', \<Psi>\<^sub>F\<rangle>; distinct A\<^sub>F'; A\<^sub>F' \<sharp>* C\<rbrakk> \<Longrightarrow> thesis"
moreover from assms have "\<exists>A\<^sub>F'. \<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle> = \<langle>A\<^sub>F', \<Psi>\<^sub>F\<rangle> \<and> distinct A\<^sub>F' \<and> A\<^sub>F' \<sharp>* C"
proof(induct A\<^sub>F)
case Nil
thus ?case by simp
next
case(Cons a A\<^sub>F)
then obtain A\<^sub>F' where Eq: "\<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle> = \<langle>A\<^sub>F', \<Psi>\<^sub>F\<rangle>" and "distinct A\<^sub>F'" and "A\<^sub>F' \<sharp>* C" by force
from `(a#A\<^sub>F) \<sharp>* C` have "a \<sharp> C" and "A\<^sub>F \<sharp>* C" by simp+
show ?case
proof(case_tac "a \<sharp> \<langle>A\<^sub>F', \<Psi>\<^sub>F\<rangle>")
assume "a \<sharp> \<langle>A\<^sub>F', \<Psi>\<^sub>F\<rangle>"
obtain b::name where "b \<sharp> A\<^sub>F'" and "b \<sharp> \<Psi>\<^sub>F" and "b \<sharp> C" by(generate_fresh "name", auto)
have "\<langle>(a#A\<^sub>F), \<Psi>\<^sub>F\<rangle> = \<langle>(b#A\<^sub>F'), \<Psi>\<^sub>F\<rangle>"
proof -
from Eq have "\<langle>(a#A\<^sub>F), \<Psi>\<^sub>F\<rangle> = \<langle>(a#A\<^sub>F'), \<Psi>\<^sub>F\<rangle>" by(simp add: frame.inject)
moreover from `b \<sharp> \<Psi>\<^sub>F` have "\<dots> = \<lparr>\<nu>b\<rparr>([(a, b)] \<bullet> \<lparr>\<nu>*A\<^sub>F'\<rparr>(F_assert \<Psi>\<^sub>F))"
by(force intro: alpha_frame_res simp add: frame_res_chain_fresh)
ultimately show ?thesis using `a \<sharp> \<langle>A\<^sub>F', \<Psi>\<^sub>F\<rangle>` `b \<sharp> \<Psi>\<^sub>F`
by(simp add: frame_res_chain_fresh)
qed
moreover from `distinct A\<^sub>F'` `b \<sharp> A\<^sub>F'` have "distinct(b#A\<^sub>F')" by simp
moreover from `A\<^sub>F' \<sharp>* C` `b \<sharp> C` have "(b#A\<^sub>F') \<sharp>* C" by simp+
ultimately show ?case by blast
next
from Eq have "\<langle>(a#A\<^sub>F), \<Psi>\<^sub>F\<rangle> = \<langle>(a#A\<^sub>F'), \<Psi>\<^sub>F\<rangle>" by(simp add: frame.inject)
moreover assume "\<not>(a \<sharp> \<langle>A\<^sub>F', \<Psi>\<^sub>F\<rangle>)"
hence "a \<sharp> A\<^sub>F'" apply(simp add: fresh_def)
by(induct A\<^sub>F') (auto simp add: supp_list_nil supp_list_cons supp_atm frame.supp abs_supp)
with `distinct A\<^sub>F'` have "distinct(a#A\<^sub>F')" by simp
moreover from `A\<^sub>F' \<sharp>* C` `a \<sharp> C` have "(a#A\<^sub>F') \<sharp>* C" by simp+
ultimately show ?case by blast
qed
qed
ultimately show ?thesis using `A\<^sub>F \<sharp>* C`
by blast
qed
lemma fresh_frame:
fixes F :: "('a::fs_name) frame"
and C :: "'b ::fs_name"
obtains A\<^sub>F \<Psi>\<^sub>F where "F = \<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle>" and "distinct A\<^sub>F" and "A\<^sub>F \<sharp>* C"
proof -
assume "\<And>A\<^sub>F \<Psi>\<^sub>F. \<lbrakk>F = \<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle>; distinct A\<^sub>F; A\<^sub>F \<sharp>* C\<rbrakk> \<Longrightarrow> thesis"
moreover have "\<exists>A\<^sub>F \<Psi>\<^sub>F. F = \<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle> \<and> A\<^sub>F \<sharp>* C"
proof(nominal_induct F avoiding: C rule: frame.strong_induct)
case(F_assert \<Psi>\<^sub>F)
have "F_assert \<Psi>\<^sub>F = \<langle>[], \<Psi>\<^sub>F\<rangle>" by simp
moreover have "([]::name list) \<sharp>* C" by simp
ultimately show ?case by force
next
case(F_res a F)
from `\<And>C. \<exists>A\<^sub>F \<Psi>\<^sub>F. F = \<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle> \<and> A\<^sub>F \<sharp>* C`
obtain A\<^sub>F \<Psi>\<^sub>F where "F = \<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle>" and "A\<^sub>F \<sharp>* C"
by blast
with `a \<sharp> C` have "\<lparr>\<nu>a\<rparr>F = \<lparr>\<nu>*(a#A\<^sub>F)\<rparr>(F_assert \<Psi>\<^sub>F)" and "(a#A\<^sub>F) \<sharp>* C"
by simp+
thus ?case by blast
qed
ultimately show ?thesis
by(auto, rule_tac distinct_frame) auto
qed
locale assertion_aux =
fixes S_compose :: "'b::fs_name \<Rightarrow> 'b \<Rightarrow> 'b" (infixr "\<otimes>" 80)
and S_imp :: "'b \<Rightarrow> 'c::fs_name \<Rightarrow> bool" ("_ \<turnstile> _" [70, 70] 70)
and S_bottom :: 'b ("\<bottom>" 90)
and S_chan_eq :: "'a::fs_name \<Rightarrow> 'a \<Rightarrow> 'c" ("_ \<leftrightarrow> _" [80, 80] 80)
assumes stat_eqvt[eqvt]: "\<And>p::name prm. p \<bullet> (\<Psi> \<turnstile> \<Phi>) = (p \<bullet> \<Psi>) \<turnstile> (p \<bullet> \<Phi>)"
and stat_eqvt'[eqvt]: "\<And>p::name prm. p \<bullet> (\<Psi> \<otimes> \<Psi>') = (p \<bullet> \<Psi>) \<otimes> (p \<bullet> \<Psi>')"
and stat_eqvt''[eqvt]: "\<And>p::name prm. p \<bullet> (M \<leftrightarrow> N) = (p \<bullet> M) \<leftrightarrow> (p \<bullet> N)"
and perm_bottom[eqvt]: "\<And>p::name prm. (p \<bullet> S_bottom) = S_bottom"
begin
lemma stat_closed:
fixes \<Psi> :: 'b
and \<phi> :: 'c
and p :: "name prm"
assumes "\<Psi> \<turnstile> \<phi>"
shows "(p \<bullet> \<Psi>) \<turnstile> (p \<bullet> \<phi>)"
using assms stat_eqvt
by(simp add: perm_bool)
lemma comp_supp:
fixes \<Psi> :: 'b
and \<Psi>' :: 'b
shows "(supp(\<Psi> \<otimes> \<Psi>')::name set) \<subseteq> ((supp \<Psi>) \<union> (supp \<Psi>'))"
proof(auto simp add: eqvts supp_def)
fix x::name
let ?P = "\<lambda>y. ([(x, y)] \<bullet> \<Psi>) \<otimes> [(x, y)] \<bullet> \<Psi>' \<noteq> \<Psi> \<otimes> \<Psi>'"
let ?Q = "\<lambda>y \<Psi>. ([(x, y)] \<bullet> \<Psi>) \<noteq> \<Psi>"
assume "finite {y. ?Q y \<Psi>'}"
moreover assume "finite {y. ?Q y \<Psi>}" and "infinite {y. ?P(y)}"
hence "infinite({y. ?P(y)} - {y. ?Q y \<Psi>})" by(rule Diff_infinite_finite)
ultimately have "infinite(({y. ?P(y)} - {y. ?Q y \<Psi>}) - {y. ?Q y \<Psi>'})" by(rule Diff_infinite_finite)
hence "infinite({y. ?P(y) \<and> \<not>(?Q y \<Psi>) \<and> \<not> (?Q y \<Psi>')})" by(simp add: set_diff_eq)
moreover have "{y. ?P(y) \<and> \<not>(?Q y \<Psi>) \<and> \<not> (?Q y \<Psi>')} = {}" by auto
ultimately have "infinite {}" by(drule_tac Infinite_cong) auto
thus False by simp
qed
lemma chan_eq_supp:
fixes M :: 'a
and N :: 'a
shows "(supp(M \<leftrightarrow> N)::name set) \<subseteq> ((supp M) \<union> (supp N))"
proof(auto simp add: eqvts supp_def)
fix x::name
let ?P = "\<lambda>y. ([(x, y)] \<bullet> M) \<leftrightarrow> [(x, y)] \<bullet> N \<noteq> M \<leftrightarrow> N"
let ?Q = "\<lambda>y M. ([(x, y)] \<bullet> M) \<noteq> M"
assume "finite {y. ?Q y N}"
moreover assume "finite {y. ?Q y M}" and "infinite {y. ?P(y)}"
hence "infinite({y. ?P(y)} - {y. ?Q y M})" by(rule Diff_infinite_finite)
ultimately have "infinite(({y. ?P(y)} - {y. ?Q y M}) - {y. ?Q y N})" by(rule Diff_infinite_finite)
hence "infinite({y. ?P(y) \<and> \<not>(?Q y M) \<and> \<not> (?Q y N)})" by(simp add: set_diff_eq)
moreover have "{y. ?P(y) \<and> \<not>(?Q y M) \<and> \<not> (?Q y N)} = {}" by auto
ultimately have "infinite {}" by(drule_tac Infinite_cong) auto
thus False by simp
qed
lemma fresh_comp[intro]:
fixes x :: name
and \<Psi> :: 'b
and \<Psi>' :: 'b
assumes "x \<sharp> \<Psi>"
and "x \<sharp> \<Psi>'"
shows "x \<sharp> \<Psi> \<otimes> \<Psi>'"
using assms comp_supp
by(auto simp add: fresh_def)
lemma fresh_comp_chain[intro]:
fixes xvec :: "name list"
and Xs :: "name set"
and \<Psi> :: 'b
and \<Psi>' :: 'b
shows "\<lbrakk>xvec \<sharp>* \<Psi>; xvec \<sharp>* \<Psi>'\<rbrakk> \<Longrightarrow> xvec \<sharp>* (\<Psi> \<otimes> \<Psi>')"
and "\<lbrakk>Xs \<sharp>* \<Psi>; Xs \<sharp>* \<Psi>'\<rbrakk> \<Longrightarrow> Xs \<sharp>* (\<Psi> \<otimes> \<Psi>')"
by(auto simp add: fresh_star_def)
lemma fresh_chan_eq[intro]:
fixes x :: name
and M :: 'a
and N :: 'a
assumes "x \<sharp> M"
and "x \<sharp> N"
shows "x \<sharp> M \<leftrightarrow> N"
using assms chan_eq_supp
by(auto simp add: fresh_def)
lemma fresh_chan_eq_chain[intro]:
fixes xvec :: "name list"
and Xs :: "name set"
and M :: 'a
and N :: 'a
shows "\<lbrakk>xvec \<sharp>* M; xvec \<sharp>* N\<rbrakk> \<Longrightarrow> xvec \<sharp>* (M \<leftrightarrow> N)"
and "\<lbrakk>Xs \<sharp>* M; Xs \<sharp>* N\<rbrakk> \<Longrightarrow> Xs \<sharp>* (M \<leftrightarrow> N)"
by(auto simp add: fresh_star_def)
lemma supp_bottom[simp]:
shows "((supp S_bottom)::name set) = {}"
by(auto simp add: supp_def perm_bottom)
lemma fresh_bottom[simp]:
fixes x :: name
shows "x \<sharp> \<bottom>"
by(simp add: fresh_def)
lemma fresh_botto_chain[simp]:
fixes xvec :: "name list"
and Xs :: "name set"
shows "xvec \<sharp>* (\<bottom>)"
and "Xs \<sharp>* (\<bottom>)"
by(auto simp add: fresh_star_def)
lemma chan_eq_closed:
fixes \<Psi> :: 'b
and M :: 'a
and N :: 'a
and p :: "name prm"
assumes "\<Psi> \<turnstile> M \<leftrightarrow> N"
shows "(p \<bullet> \<Psi>) \<turnstile> (p \<bullet> M) \<leftrightarrow> (p \<bullet> N)"
proof -
from `\<Psi> \<turnstile> M \<leftrightarrow> N` have "(p \<bullet> \<Psi>) \<turnstile> p \<bullet> (M \<leftrightarrow> N)"
by(rule stat_closed)
thus ?thesis by(simp add: eqvts)
qed
definition
Assertion_stat_imp :: "'b \<Rightarrow> 'b \<Rightarrow> bool" (infix "\<hookrightarrow>" 70)
where "(\<Psi> \<hookrightarrow> \<Psi>') \<equiv> (\<forall>\<Phi>. \<Psi> \<turnstile> \<Phi> \<longrightarrow> \<Psi>' \<turnstile> \<Phi>)"
definition
Assertion_stat_eq :: "'b \<Rightarrow> 'b \<Rightarrow> bool" (infix "\<simeq>" 70)
where "(\<Psi> \<simeq> \<Psi>') \<equiv> \<Psi> \<hookrightarrow> \<Psi>' \<and> \<Psi>' \<hookrightarrow> \<Psi>"
lemma stat_imp_ent:
fixes \<Psi> :: 'b
and \<Psi>' :: 'b
and \<Phi> :: 'c
assumes "\<Psi> \<hookrightarrow> \<Psi>'"
and "\<Psi> \<turnstile> \<Phi>"
shows "\<Psi>' \<turnstile> \<Phi>"
using assms
by(simp add: Assertion_stat_imp_def)
lemma stat_eq_ent:
fixes \<Psi> :: 'b
and \<Psi>' :: 'b
and \<Phi> :: 'c
assumes "\<Psi> \<simeq> \<Psi>'"
and "\<Psi> \<turnstile> \<Phi>"
shows "\<Psi>' \<turnstile> \<Phi>"
using assms
by(auto simp add: Assertion_stat_eq_def intro: stat_imp_ent)
lemma Assertion_stat_imp_closed:
fixes \<Psi> :: 'b
and \<Psi>' :: 'b
and p :: "name prm"
assumes "\<Psi> \<hookrightarrow> \<Psi>'"
shows "(p \<bullet> \<Psi>) \<hookrightarrow> (p \<bullet> \<Psi>')"
proof(auto simp add: Assertion_stat_imp_def)
fix \<phi>
assume "(p \<bullet> \<Psi>) \<turnstile> \<phi>"
hence "\<Psi> \<turnstile> rev p \<bullet> \<phi>" by(drule_tac p="rev p" in stat_closed) auto
with `\<Psi> \<hookrightarrow> \<Psi>'` have "\<Psi>' \<turnstile> rev p \<bullet> \<phi>" by(simp add: Assertion_stat_imp_def)
thus "(p \<bullet> \<Psi>') \<turnstile> \<phi>" by(drule_tac p=p in stat_closed) auto
qed
lemma Assertion_stat_eq_closed:
fixes \<Psi> :: 'b
and \<Psi>' :: 'b
and p :: "name prm"
assumes "\<Psi> \<simeq> \<Psi>'"
shows "(p \<bullet> \<Psi>) \<simeq> (p \<bullet> \<Psi>')"
using assms
by(auto simp add: Assertion_stat_eq_def intro: Assertion_stat_imp_closed)
lemma Assertion_stat_imp_eqvt[eqvt]:
fixes \<Psi> :: 'b
and \<Psi>' :: 'b
and p :: "name prm"
shows "(p \<bullet> (\<Psi> \<hookrightarrow> \<Psi>')) = ((p \<bullet> \<Psi>) \<hookrightarrow> (p \<bullet> \<Psi>'))"
by(simp add: Assertion_stat_imp_def eqvts)
lemma Assertion_stat_eq_eqvt[eqvt]:
fixes \<Psi> :: 'b
and \<Psi>' :: 'b
and p :: "name prm"
shows "(p \<bullet> (\<Psi> \<simeq> \<Psi>')) = ((p \<bullet> \<Psi>) \<simeq> (p \<bullet> \<Psi>'))"
by(simp add: Assertion_stat_eq_def eqvts)
lemma Assertion_stat_imp_refl[simp]:
fixes \<Psi> :: 'b
shows "\<Psi> \<hookrightarrow> \<Psi>"
by(simp add: Assertion_stat_imp_def)
lemma Assertion_stat_eq_refl[simp]:
fixes \<Psi> :: 'b
shows "\<Psi> \<simeq> \<Psi>"
by(simp add: Assertion_stat_eq_def)
lemma Assertion_stat_eq_sym:
fixes \<Psi> :: 'b
and \<Psi>' :: 'b
assumes "\<Psi> \<simeq> \<Psi>'"
shows "\<Psi>' \<simeq> \<Psi>"
using assms
by(auto simp add: Assertion_stat_eq_def)
lemma Assertion_stat_imp_trans:
fixes \<Psi> :: 'b
and \<Psi>' :: 'b
and \<Psi>'' :: 'b
assumes "\<Psi> \<hookrightarrow> \<Psi>'"
and "\<Psi>' \<hookrightarrow> \<Psi>''"
shows "\<Psi> \<hookrightarrow> \<Psi>''"
using assms
by(simp add: Assertion_stat_imp_def)
lemma Assertion_stat_eq_trans:
fixes \<Psi> :: 'b
and \<Psi>' :: 'b
and \<Psi>'' :: 'b
assumes "\<Psi> \<simeq> \<Psi>'"
and "\<Psi>' \<simeq> \<Psi>''"
shows "\<Psi> \<simeq> \<Psi>''"
using assms
by(auto simp add: Assertion_stat_eq_def intro: Assertion_stat_imp_trans)
definition
Frame_imp :: "'b::fs_name frame \<Rightarrow> 'c \<Rightarrow> bool" (infixl "\<turnstile>\<^sub>F" 70)
where "(F \<turnstile>\<^sub>F \<Phi>) = (\<exists>A\<^sub>F \<Psi>\<^sub>F. F = \<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle> \<and> A\<^sub>F \<sharp>* \<Phi> \<and> (\<Psi>\<^sub>F \<turnstile> \<Phi>))"
lemma frame_impI:
fixes F :: "'b frame"
and \<phi> :: 'c
and A\<^sub>F :: "name list"
and \<Psi>\<^sub>F :: 'b
assumes "F = \<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle>"
and "A\<^sub>F \<sharp>* \<phi>"
and "\<Psi>\<^sub>F \<turnstile> \<phi>"
shows "F \<turnstile>\<^sub>F \<phi>"
using assms
by(force simp add: Frame_imp_def)
lemma frame_imp_alpha_ent:
fixes A\<^sub>F :: "name list"
and \<Psi>\<^sub>F :: 'b
and A\<^sub>F' :: "name list"
and \<Psi>\<^sub>F' :: 'b
and \<phi> :: 'c
assumes "\<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle> = \<langle>A\<^sub>F', \<Psi>\<^sub>F'\<rangle>"
and "A\<^sub>F \<sharp>* \<phi>"
and "A\<^sub>F' \<sharp>* \<phi>"
and "\<Psi>\<^sub>F' \<turnstile> \<phi>"
shows "\<Psi>\<^sub>F \<turnstile> \<phi>"
proof -
from `\<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle> = \<langle>A\<^sub>F', \<Psi>\<^sub>F'\<rangle>`
obtain n where "n = length A\<^sub>F" by blast
moreover from `\<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle> = \<langle>A\<^sub>F', \<Psi>\<^sub>F'\<rangle>`
have "length A\<^sub>F = length A\<^sub>F'"
by(rule frame_chain_eq_length)
ultimately show ?thesis using assms
proof(induct n arbitrary: A\<^sub>F A\<^sub>F' \<Psi>\<^sub>F' rule: nat.induct)
case(zero A\<^sub>F A\<^sub>F' \<Psi>\<^sub>F')
thus ?case by(auto simp add: frame.inject)
next
case(Suc n A\<^sub>F A\<^sub>F' \<Psi>\<^sub>F')
from `Suc n = length A\<^sub>F`
obtain x xs where "A\<^sub>F = x#xs" and "n = length xs"
by(case_tac A\<^sub>F) auto
from `\<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle> = \<langle>A\<^sub>F', \<Psi>\<^sub>F'\<rangle>` `A\<^sub>F = x # xs`
obtain y ys where "\<langle>(x#xs), \<Psi>\<^sub>F\<rangle> = \<langle>(y#ys), \<Psi>\<^sub>F'\<rangle>" and "A\<^sub>F' = y#ys"
by(case_tac A\<^sub>F') auto
hence EQ: "\<lparr>\<nu>x\<rparr>\<lparr>\<nu>*xs\<rparr>(F_assert \<Psi>\<^sub>F) = \<lparr>\<nu>y\<rparr>\<lparr>\<nu>*ys\<rparr>(F_assert \<Psi>\<^sub>F')"
by simp
from `A\<^sub>F = x # xs` `A\<^sub>F' = y # ys` `length A\<^sub>F = length A\<^sub>F'` `A\<^sub>F \<sharp>* \<phi>` `A\<^sub>F' \<sharp>* \<phi>`
have "length xs = length ys" and "xs \<sharp>* \<phi>" and "ys \<sharp>* \<phi>" and "x \<sharp> \<phi>" and "y \<sharp> \<phi>"
by auto
have IH: "\<And>xs ys \<Psi>\<^sub>F'. \<lbrakk>n = length xs; length xs = length ys; \<langle>xs, \<Psi>\<^sub>F\<rangle> = \<langle>ys, (\<Psi>\<^sub>F'::'b)\<rangle>; xs \<sharp>* \<phi>; ys \<sharp>* \<phi>; \<Psi>\<^sub>F' \<turnstile> \<phi>\<rbrakk> \<Longrightarrow> \<Psi>\<^sub>F \<turnstile> \<phi>"
by fact
show ?case
proof(case_tac "x = y")
assume "x = y"
with EQ have "\<langle>xs, \<Psi>\<^sub>F\<rangle> = \<langle>ys, \<Psi>\<^sub>F'\<rangle>" by(simp add: alpha frame.inject)
with IH `n = length xs` `length xs = length ys` `xs \<sharp>* \<phi>` `ys \<sharp>* \<phi>` `\<Psi>\<^sub>F' \<turnstile> \<phi>`
show ?case by blast
next
assume "x \<noteq> y"
with EQ have "\<langle>xs, \<Psi>\<^sub>F\<rangle> = [(x, y)] \<bullet> \<langle>ys, \<Psi>\<^sub>F'\<rangle>" by(simp add: alpha frame.inject)
hence "\<langle>xs, \<Psi>\<^sub>F\<rangle> = \<langle>([(x, y)] \<bullet> ys), ([(x, y)] \<bullet> \<Psi>\<^sub>F')\<rangle>" by(simp add: eqvts)
moreover from `length xs = length ys` have "length xs = length([(x, y)] \<bullet> ys)"
by auto
moreover from `ys \<sharp>* \<phi>` have "([(x, y)] \<bullet> ys) \<sharp>* ([(x, y)] \<bullet> \<phi>)"
by(simp add: fresh_star_bij)
with `x \<sharp> \<phi>` `y \<sharp> \<phi>` have "([(x, y)] \<bullet> ys) \<sharp>* \<phi>"
by simp
moreover with `\<Psi>\<^sub>F' \<turnstile> \<phi>` have "([(x, y)] \<bullet> \<Psi>\<^sub>F') \<turnstile> ([(x, y)] \<bullet> \<phi>)"
by(simp add: stat_closed)
with `x \<sharp> \<phi>` `y \<sharp> \<phi>` have "([(x, y)] \<bullet> \<Psi>\<^sub>F') \<turnstile> \<phi>"
by simp
ultimately show ?case using IH `n = length xs` `xs \<sharp>* \<phi>`
by blast
qed
qed
qed
lemma frame_imp_e_aux:
fixes F :: "'b frame"
and \<Phi> :: 'c
assumes "F \<turnstile>\<^sub>F \<Phi>"
and "F = \<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle>"
and "A\<^sub>F \<sharp>* \<Phi>"
shows "\<Psi>\<^sub>F \<turnstile> \<Phi>"
using assms
by(auto simp add: Frame_imp_def dest: frame_imp_alpha_ent)
lemma frame_impE:
fixes F :: "'b frame"
and \<Phi> :: 'c
assumes "\<langle>A\<^sub>F, \<Psi>\<^sub>F\<rangle> \<turnstile>\<^sub>F \<Phi>"
and "A\<^sub>F \<sharp>* \<Phi>"
shows "\<Psi>\<^sub>F \<turnstile> \<Phi>"
using assms
by(auto elim: frame_imp_e_aux)
lemma frame_imp_closed:
fixes F :: "'b frame"
and \<Phi> :: 'c
and p :: "name prm"
assumes "F \<turnstile>\<^sub>F \<Phi>"
shows "(p \<bullet> F) \<turnstile>\<^sub>F (p \<bullet> \<Phi>)"
using assms
by(force simp add: Frame_imp_def eqvts pt_fresh_star_bij[OF pt_name_inst, OF at_name_inst]
intro: stat_closed)
lemma frame_imp_eqvt[eqvt]:
fixes F :: "'b frame"
and \<Phi> :: 'c
and p :: "name prm"
shows "(p \<bullet> (F \<turnstile>\<^sub>F \<Phi>)) = (p \<bullet> F) \<turnstile>\<^sub>F (p \<bullet> \<Phi>)"
proof -
have "F \<turnstile>\<^sub>F \<Phi> \<Longrightarrow> (p \<bullet> F) \<turnstile>\<^sub>F (p \<bullet> \<Phi>)"
by(rule frame_imp_closed)
moreover have "(p \<bullet> F) \<turnstile>\<^sub>F (p \<bullet> \<Phi>) \<Longrightarrow> F \<turnstile>\<^sub>F \<Phi>"
by(drule_tac p = "rev p" in frame_imp_closed) simp
ultimately show ?thesis
by(auto simp add: perm_bool)
qed
lemma frame_imp_empty[simp]:
fixes \<Psi> :: 'b
and \<phi> :: 'c
shows "\<langle>\<epsilon>, \<Psi>\<rangle> \<turnstile>\<^sub>F \<phi> = \<Psi> \<turnstile> \<phi>"
by(auto simp add: Frame_imp_def)