-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCapFlow.thy
More file actions
3787 lines (3616 loc) · 175 KB
/
CapFlow.thy
File metadata and controls
3787 lines (3616 loc) · 175 KB
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 CapFlow
imports Dynamic_model
begin
subsection {* Definitions *}
type_synonym max_buffer_size = nat
type_synonym buffer_size = nat
typedecl Message
typedecl Endpoint
typedecl Domain
type_synonym domain_id = nat
type_synonym domain_name = string
type_synonym endpoint_name = string
type_synonym endpoint_id = nat
datatype
right = SEND
|TAKE
|GRANT
|REMOVE
record cap = target :: domain_id
rights :: "right set"
record Endpoint_Concig =
e_max_buf_size :: "endpoint_id \<rightharpoonup> max_buffer_size"
e_name :: "endpoint_id \<rightharpoonup> endpoint_name"
e_listener :: "endpoint_id \<rightharpoonup> domain_id"
record Domain_Config =
d_name :: "domain_id \<rightharpoonup> domain_name"
d_ep_set :: "domain_id \<Rightarrow> endpoint_id set"
record Sys_Config =
domconf :: Domain_Config
commconf :: Endpoint_Concig
subsubsection {* System state *}
record State =
(*caps :: "domain_id \<Rightarrow> domain_id \<Rightarrow> right set"*)
caps :: "domain_id \<Rightarrow> cap set"
e_msgs :: "endpoint_id \<Rightarrow> Message set"
e_buf_size :: "endpoint_id \<rightharpoonup> buffer_size"
domain_endpoint :: "endpoint_id \<rightharpoonup> domain_id "
datatype Event = Client_Lookup_Endpoint_Name domain_id endpoint_name
| Send_Queuing_Message domain_id endpoint_id Message
| Receive_Queuing_Message domain_id endpoint_id
| Get_My_Endpoints_Set domain_id
| Get_Caps domain_id
| Grant_Endpoint_Cap domain_id cap cap
| Remove_Cap_Right domain_id cap right
subsubsection {* Utility Functions used for Event Specification *}
definition get_domain_name_from_domain_id :: "Sys_Config \<Rightarrow> domain_id \<Rightarrow> domain_name option"
where "get_domain_name_from_domain_id sc did \<equiv>
let
dm_conf = (domconf sc)
in
if((d_name dm_conf) did \<noteq> None )
then
((d_name dm_conf) did )
else
None"
definition get_endpoints_from_domain_id :: "Sys_Config \<Rightarrow> domain_id \<Rightarrow> endpoint_id set"
where "get_endpoints_from_domain_id sc did \<equiv>
let
dm_conf = (domconf sc)
in
if((d_name dm_conf) did \<noteq> None )
then
((d_ep_set dm_conf) did )
else
{}"
definition get_domain_id_from_domain_name :: "Sys_Config \<Rightarrow> domain_name \<Rightarrow> domain_id option"
where "get_domain_id_from_domain_name sc dname \<equiv>
let
dm_conf = (domconf sc)
in
if(\<exists>did. the((d_name dm_conf) did) = dname )
then
Some (SOME did. the((d_name dm_conf) did) = dname)
else
None"
definition get_listener_id_from_endpoint_id :: "Sys_Config \<Rightarrow> endpoint_id \<Rightarrow> domain_id option"
where "get_listener_id_from_endpoint_id sc eid \<equiv>
let
ep_conf = (commconf sc)
in
if((e_listener ep_conf) eid \<noteq> None )
then
((e_listener ep_conf) eid )
else
None"
definition get_endpoint_name_from_endpoint_id :: "Sys_Config \<Rightarrow> endpoint_id \<Rightarrow> endpoint_name option"
where "get_endpoint_name_from_endpoint_id sc eid \<equiv>
let
ep_conf = (commconf sc)
in
if((e_name ep_conf) eid \<noteq> None )
then
((e_name ep_conf) eid )
else
None"
definition get_endpoint_id_from_endpoint_name :: "Sys_Config \<Rightarrow> endpoint_name \<Rightarrow> endpoint_id option"
where "get_endpoint_id_from_endpoint_name sc ename \<equiv>
let
ep_conf = (commconf sc)
in
if(\<exists>eid. the((e_name ep_conf) eid) = ename )
then
Some (SOME eid. the((e_name ep_conf) eid) = ename )
else
None"
definition get_endpoint_max_bufsize_from_sc_by_id :: "Sys_Config \<Rightarrow> endpoint_id \<Rightarrow> max_buffer_size option"
where "get_endpoint_max_bufsize_from_sc_by_id sc eid \<equiv>
let
ep_conf = (commconf sc)
in
if((e_max_buf_size ep_conf) eid \<noteq> None )
then
((e_max_buf_size ep_conf) eid )
else
None"
definition is_a_domain :: "Sys_Config \<Rightarrow> domain_id \<Rightarrow> bool"
where "is_a_domain sc did \<equiv>
let
dm_conf = (domconf sc)
in
if((d_name dm_conf) did \<noteq> None )
then
True
else
False"
definition is_an_endpoint :: "Sys_Config \<Rightarrow> endpoint_id \<Rightarrow> bool"
where "is_an_endpoint sc eid \<equiv>
let
ep_conf = (commconf sc)
in
if((e_name ep_conf) eid \<noteq> None )
then
True
else
False"
definition is_an_endpoint_of_domain :: "Sys_Config \<Rightarrow> endpoint_id \<Rightarrow> domain_id \<Rightarrow> bool"
where "is_an_endpoint_of_domain sc eid did \<equiv>
let
dm_conf = (domconf sc)
in
if(eid \<in> ((d_ep_set dm_conf) did))
then
True
else
False"
definition is_an_endpoint_of_listener :: "Sys_Config \<Rightarrow> endpoint_id \<Rightarrow> domain_id \<Rightarrow> bool"
where "is_an_endpoint_of_listener sc eid did \<equiv>
let
ep_conf = (commconf sc)
in
if(the((e_listener ep_conf) eid) = did )
then
True
else
False"
definition get_domain_cap_set_from_domain_id :: "State \<Rightarrow> domain_id \<Rightarrow> cap set"
where "get_domain_cap_set_from_domain_id s did \<equiv>
let
cap_by_id = caps s
in
cap_by_id did
"
definition get_msg_set_from_endpoint_id :: "State \<Rightarrow> endpoint_id \<Rightarrow> Message set"
where "get_msg_set_from_endpoint_id s eid \<equiv>
let
msg_by_id = e_msgs s
in
msg_by_id eid
"
definition get_buf_size_from_endpoint_id :: "State \<Rightarrow> endpoint_id \<Rightarrow> buffer_size option"
where "get_buf_size_from_endpoint_id s eid \<equiv>
let
buf_size_by_id = e_buf_size s
in
buf_size_by_id eid
"
definition endpoint_is_full :: "Sys_Config \<Rightarrow> State \<Rightarrow> endpoint_id \<Rightarrow> bool"
where "endpoint_is_full sc s eid \<equiv>
get_buf_size_from_endpoint_id s eid
= get_endpoint_max_bufsize_from_sc_by_id sc eid"
definition get_endpoints_of_domain :: "State \<Rightarrow> domain_id \<Rightarrow> endpoint_id set"
where "get_endpoints_of_domain s did \<equiv>
let
dom_ep = domain_endpoint s
in
{x. dom_ep x = Some did}
"
definition get_domain_id_from_endpoint :: "State \<Rightarrow> endpoint_id \<Rightarrow> domain_id option"
where "get_domain_id_from_endpoint s eid \<equiv>
let
dom_ep = domain_endpoint s
in
dom_ep eid
"
definition get_endpoint_msg_set_of_domain :: "State \<Rightarrow> domain_id \<Rightarrow> Message set"
where "get_endpoint_msg_set_of_domain s did \<equiv>
let
dom_ep = domain_endpoint s;
eid_set = get_endpoints_of_domain s did;
msg_of_ep = e_msgs s
in
{x. \<exists>e. e\<in>eid_set \<and> x \<in> msg_of_ep e}
"
definition interferes :: "domain_id \<Rightarrow> State \<Rightarrow> domain_id \<Rightarrow> bool"
where "interferes w s v \<equiv>
if( w = v
\<or> (\<exists>c. c\<in>(get_domain_cap_set_from_domain_id s w) \<and> target c = v))
then
True
else
False
"
subsubsection{* Event specification *}
definition client_lookup_endpoint_name :: "Sys_Config \<Rightarrow> State
\<Rightarrow> domain_id \<Rightarrow> endpoint_name \<Rightarrow> (State \<times> endpoint_id option)"
where "client_lookup_endpoint_name sc s did ename \<equiv>
if(get_endpoint_id_from_endpoint_name sc ename \<noteq> None)
then
(s, get_endpoint_id_from_endpoint_name sc ename)
else
(s, None)"
definition send_queuing_message :: "State \<Rightarrow> domain_id \<Rightarrow> endpoint_id \<Rightarrow> Message \<Rightarrow> (State \<times> bool)"
where "send_queuing_message s did eid m \<equiv>
let
dom_ep = domain_endpoint s;
dst_dom = dom_ep eid;
emsgs = e_msgs s;
msg_set = get_msg_set_from_endpoint_id s eid;
new_msg_set = insert m msg_set
in
if(get_domain_id_from_endpoint s eid \<noteq> None
\<and> interferes did s (the (get_domain_id_from_endpoint s eid)))
then
(s\<lparr>
e_msgs := emsgs(eid := new_msg_set)
\<rparr>, False)
else
(s, False)"
definition receive_queuing_message :: "State \<Rightarrow> domain_id \<Rightarrow> endpoint_id \<Rightarrow> (State \<times> Message option)"
where "receive_queuing_message s did eid \<equiv>
if(get_domain_id_from_endpoint s eid = Some did)
then
let
emsgs = e_msgs s;
msg_set = get_msg_set_from_endpoint_id s eid;
m = SOME x. x\<in>msg_set;
new_msg_set = msg_set - {m}
in
(s\<lparr>
e_msgs := emsgs(eid := new_msg_set)
\<rparr>, Some m)
else
(s, None)
"
definition get_my_endpoints_set :: "State \<Rightarrow> domain_id \<Rightarrow> (State \<times> endpoint_id set)"
where "get_my_endpoints_set s did \<equiv>
if(get_endpoints_of_domain s did \<noteq> {})
then
(s, get_endpoints_of_domain s did)
else
(s, {})
"
definition get_caps :: "State \<Rightarrow> domain_id \<Rightarrow> (State \<times> cap set)"
where "get_caps s did \<equiv>
(s, get_domain_cap_set_from_domain_id s did)"
definition grant_endpoint_cap :: "State \<Rightarrow> domain_id \<Rightarrow> cap \<Rightarrow> cap \<Rightarrow> (State \<times> bool)"
where "grant_endpoint_cap s did grant_cap dst_cap \<equiv>
if(grant_cap\<in>get_domain_cap_set_from_domain_id s did
\<and> GRANT\<in>rights grant_cap
\<and> target grant_cap \<noteq> target dst_cap
\<and> dst_cap\<in>get_domain_cap_set_from_domain_id s did)
then
let
did_dst = target grant_cap;
caps0 = caps s;
cs_dst = get_domain_cap_set_from_domain_id s did_dst
in
(s\<lparr>
caps := caps0(did_dst := (insert dst_cap cs_dst))
\<rparr>, True)
else
(s, False)"
definition get_takable_caps :: "State \<Rightarrow> domain_id \<Rightarrow> cap \<Rightarrow> (State \<times> cap set)"
where "get_takable_caps s did take_cap \<equiv>
if(take_cap \<in> get_domain_cap_set_from_domain_id s did
\<and> TAKE \<in> rights take_cap)
then
let
did_dst = target take_cap
in
(s, get_domain_cap_set_from_domain_id s did_dst)
else
(s, {})"
definition take_endpoint_cap :: "State \<Rightarrow> domain_id \<Rightarrow> cap \<Rightarrow> cap \<Rightarrow> (State \<times> bool)"
where "take_endpoint_cap s did take_cap dst_cap \<equiv>
if(take_cap \<in> get_domain_cap_set_from_domain_id s did
\<and> TAKE \<in> rights take_cap
\<and> interferes did s (target dst_cap)
\<and> dst_cap \<in> get_domain_cap_set_from_domain_id s (target take_cap))
then
let
caps0 = caps s;
cs_dst = get_domain_cap_set_from_domain_id s did
in
(s\<lparr>
caps := caps0(did := (insert dst_cap cs_dst))
\<rparr>, True)
else
(s, False)"
definition remove_cap_right :: "State \<Rightarrow> domain_id \<Rightarrow> cap \<Rightarrow> right \<Rightarrow> (State \<times> bool)"
where "remove_cap_right s did rm_cap right_to_rm \<equiv>
let
caps0 = caps s;
cs_dst = get_domain_cap_set_from_domain_id s did;
cs_rest = {c. c\<in>cs_dst \<and> c\<noteq>rm_cap}
in
if(rm_cap \<in> get_domain_cap_set_from_domain_id s did
\<and> REMOVE \<in> rights rm_cap
\<and> right_to_rm \<in> rights rm_cap
\<and> REMOVE = right_to_rm
\<and> {REMOVE} = rights rm_cap)
then
(s\<lparr>
caps := caps0(did := (cs_rest))
\<rparr>, True)
else if(
rm_cap \<in> get_domain_cap_set_from_domain_id s did
\<and> REMOVE \<in> rights rm_cap
\<and> right_to_rm \<in> rights rm_cap
)
then
let
new_cap = \<lparr> target = target rm_cap,
rights = (rights rm_cap) - {right_to_rm}\<rparr>
in
(s\<lparr>
caps := caps0(did := (insert new_cap cs_rest))
\<rparr>, True)
else
(s, False)"
definition system_init :: "Sys_Config \<Rightarrow> State"
where "system_init sc \<equiv> \<lparr>
caps = (\<lambda> x. {}),
e_msgs = (\<lambda> x. {}),
e_buf_size = (\<lambda> x. None),
domain_endpoint = e_listener(commconf sc)
\<rparr>"
subsection{* Instantiation and Its Proofs of Security Model *}
consts sysconf :: "Sys_Config"
definition sys_config_witness :: Sys_Config
where
"sys_config_witness \<equiv> \<lparr>
domconf = \<lparr>
d_name = (\<lambda> x. None),
d_ep_set = (\<lambda> x. {})
\<rparr> ,
commconf = \<lparr>
e_max_buf_size = (\<lambda> x. None),
e_name = (\<lambda> x. None),
e_listener = (\<lambda> x. None)
\<rparr>
\<rparr>"
consts s0t :: State
definition s0t_witness :: State
where "s0t_witness \<equiv> system_init sysconf"
specification (s0t)
s0t_init: "s0t = system_init sysconf"
by simp
definition exec_event :: "State \<Rightarrow> Event \<Rightarrow> State"
where "exec_event s e \<equiv>
case e of Client_Lookup_Endpoint_Name did ename \<Rightarrow> fst (client_lookup_endpoint_name sysconf s did ename)
| Send_Queuing_Message did eid m \<Rightarrow> fst (send_queuing_message s did eid m)
| Receive_Queuing_Message did eid \<Rightarrow> fst (receive_queuing_message s did eid)
| Get_My_Endpoints_Set did \<Rightarrow> fst (get_my_endpoints_set s did)
| Get_Caps did \<Rightarrow>fst (get_caps s did)
| Grant_Endpoint_Cap did grant_cap dst_cap \<Rightarrow> fst (grant_endpoint_cap s did grant_cap dst_cap)
| Remove_Cap_Right did dst_cap right_to_rm \<Rightarrow> fst (remove_cap_right s did dst_cap right_to_rm)
"
definition domain_of_event :: "Event \<Rightarrow> domain_id option"
where "domain_of_event e \<equiv>
case e of Client_Lookup_Endpoint_Name did ename \<Rightarrow> Some did
| Send_Queuing_Message did eid m \<Rightarrow> Some did
| Receive_Queuing_Message did eid \<Rightarrow> Some did
| Get_My_Endpoints_Set did \<Rightarrow> Some did
| Get_Caps did \<Rightarrow> Some did
| Grant_Endpoint_Cap did grant_cap dst_cap \<Rightarrow> Some did
| Remove_Cap_Right did dst_cap right_to_rm \<Rightarrow> Some did
"
definition vpeq1 :: "State \<Rightarrow> domain_id \<Rightarrow> State \<Rightarrow> bool" ("(_ \<sim> _ \<sim> _)")
where
"vpeq1 s d t \<equiv>
let
cs1 = get_domain_cap_set_from_domain_id s d;
cs2 = get_domain_cap_set_from_domain_id t d;
dom_eps1 = get_endpoints_of_domain s d;
dom_eps2 = get_endpoints_of_domain t d
in
if(cs1 = cs2
\<and> (\<forall>v. interferes v s d \<longleftrightarrow> interferes v t d)
\<and> dom_eps1 = dom_eps2
\<and> (\<forall>ep. ep\<in>dom_eps1
\<longrightarrow> get_msg_set_from_endpoint_id s ep = get_msg_set_from_endpoint_id t ep )
)
then
True
else
False
"
declare vpeq1_def [cong]
lemma vpeq1_transitive_lemma : "\<forall> s t r d. (vpeq1 s d t) \<and> (vpeq1 t d r) \<longrightarrow> (vpeq1 s d r)"
using vpeq1_def by auto
lemma vpeq1_symmetric_lemma : "\<forall> s t d. (vpeq1 s d t) \<longrightarrow> (vpeq1 t d s)"
using vpeq1_def by auto
lemma vpeq1_reflexive_lemma : "\<forall> s d. (vpeq1 s d s)"
using vpeq1_def by auto
lemma interf_reflexive_lemma : "\<forall>d s. interferes d s d"
using interferes_def by auto
lemma policy_respect_lemma : "\<forall>v u s t. (s \<sim> u \<sim> t)
\<longrightarrow> (interferes v s u = interferes v t u)"
using vpeq1_def by auto
lemma reachable_top: "\<forall> s a. (SM.reachable0 s0t exec_event) s \<longrightarrow> (\<exists>s'. s' = exec_event s a)"
proof -
{
fix s a
assume p0: "(SM.reachable0 s0t exec_event) s"
have "(\<exists>s'. s' = exec_event s a)"
proof (induct a)
case (Client_Lookup_Endpoint_Name x) show ?case
apply (induct x)
by (simp add: exec_event_def) +
next
case (Send_Queuing_Message x1a x2 x3a) show ?case
apply (induct x1a)
by (simp add: exec_event_def) +
next
case (Receive_Queuing_Message x) show ?case
apply (induct x)
by (simp add: exec_event_def) +
next
case (Get_My_Endpoints_Set x) show ?case
apply (induct x)
by (simp add: exec_event_def) +
next
case (Get_Caps x ) show ?case
apply (induct x)
by (simp add: exec_event_def) +
case (Grant_Endpoint_Cap x1a x2 x3a ) show ?case
apply (induct x1a)
by (simp add: exec_event_def) +
case (Remove_Cap_Right x1a x2 ) show ?case
apply (induct x1a)
by (simp add: exec_event_def) +
qed
}
then show ?thesis by auto
qed
declare Let_def [cong] and vpeq1_def[cong]
interpretation SM_enabled
s0t exec_event domain_of_event vpeq1 interferes
using vpeq1_transitive_lemma vpeq1_symmetric_lemma vpeq1_reflexive_lemma
interf_reflexive_lemma policy_respect_lemma reachable_top
SM.intro[of vpeq1 interferes]
SM_enabled_axioms.intro[of s0t exec_event]
SM_enabled.intro[of vpeq1 interferes s0t exec_event] by blast
subsection{* Some lemmas of security proofs *}
subsection{* Concrete unwinding condition of "local respect" *}
subsubsection{*proving "client lookup endpoint name" satisfying the "local respect" property*}
lemma client_lookup_endpoint_name_lcl_resp:
assumes p0: "reachable0 s"
and p1: "\<not>(interferes did s d)"
and p2: "s' = fst (client_lookup_endpoint_name sysconf s did ename)"
shows "s \<sim> d \<sim> s'"
proof -
{
have a1: "s = s'"
by (simp add: p2 client_lookup_endpoint_name_def p1)
}
then show ?thesis by auto
qed
lemma client_lookup_endpoint_name_lcl_resp_e:
assumes p0: "reachable0 s"
and p1: "a = (Client_Lookup_Endpoint_Name did ename)"
and p2: "\<not>(interferes (the (domain_of_event a)) s d)"
and p3: "s' = exec_event s a"
shows "s \<sim> d \<sim> s'"
proof -
{
have a0: "(the (domain_of_event a)) = did"
using p1 domain_of_event_def by auto
have a1: "s' = fst (client_lookup_endpoint_name sysconf s did ename)"
using p1 p3 exec_event_def by auto
have a2: "\<not>(interferes did s d)"
using p2 a0 by auto
have a3: "s \<sim> d \<sim> s'"
using a1 a2 p0 client_lookup_endpoint_name_lcl_resp by blast
}
then show ?thesis by auto
qed
lemma client_lookup_endpoint_name_lcrsp_e: "dynamic_local_respect_e (Client_Lookup_Endpoint_Name did ename)"
proof -
{
have "\<forall>d s. reachable0 s
\<and> \<not>(interferes (the (domain_of_event (Client_Lookup_Endpoint_Name did ename))) s d)
\<longrightarrow> (s \<sim> d \<sim> (exec_event s (Client_Lookup_Endpoint_Name did ename)))"
proof -
{
fix d s
assume p1: "reachable0 s "
assume p2: " \<not>(interferes (the (domain_of_event (Client_Lookup_Endpoint_Name did ename))) s d)"
have "(s \<sim> d \<sim> (exec_event s (Client_Lookup_Endpoint_Name did ename)))"
using p1 p2 client_lookup_endpoint_name_lcl_resp_e by blast
}
then show ?thesis by blast
qed
}
then show ?thesis
using dynamic_local_respect_e_def by blast
qed
subsubsection{*proving "send queuing message" satisfying the "local respect" property*}
lemma send_queuing_message_notchg_domain_cap_set:
assumes p0: "reachable0 s"
and p1: "\<not>(interferes did s d)"
and p2: "s' = fst (send_queuing_message s did eid m)"
shows "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
proof (cases "(get_domain_id_from_endpoint s eid \<noteq> None
\<and> interferes did s (the (get_domain_id_from_endpoint s eid)))")
assume b0: "(get_domain_id_from_endpoint s eid \<noteq> None
\<and> interferes did s (the (get_domain_id_from_endpoint s eid)))"
have b1: "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
using b0 p2 send_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
then show ?thesis by auto
next
assume b0: "\<not> (get_domain_id_from_endpoint s eid \<noteq> None
\<and> interferes did s (the (get_domain_id_from_endpoint s eid)))"
have b1: "s = s'"
using b0 p2 send_queuing_message_def by auto
have b2: "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
using b1 get_domain_cap_set_from_domain_id_def by auto
then show ?thesis by auto
qed
lemma send_queuing_message_notchg_policy:
assumes p0: "reachable0 s"
and p2: "s' = fst (send_queuing_message s did eid m)"
shows "(\<forall>v. interferes v s d \<longleftrightarrow> interferes v s' d)"
proof (cases "(get_domain_id_from_endpoint s eid \<noteq> None
\<and> interferes did s (the (get_domain_id_from_endpoint s eid)))")
assume b0: "(get_domain_id_from_endpoint s eid \<noteq> None
\<and> interferes did s (the (get_domain_id_from_endpoint s eid)))"
have b1: "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
using b0 p2 send_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
have b2: "\<forall>v. get_domain_cap_set_from_domain_id s v
= get_domain_cap_set_from_domain_id s' v"
using b0 p2 send_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
have b3: "(\<forall>v. interferes v s d \<longleftrightarrow> interferes v s' d)"
using b1 b2 interferes_def by auto
then show ?thesis by auto
next
assume b0: "\<not> (get_domain_id_from_endpoint s eid \<noteq> None
\<and> interferes did s (the (get_domain_id_from_endpoint s eid)))"
have b1: "s = s'"
using b0 p2 send_queuing_message_def by auto
have b2: "(\<forall>v. interferes v s d \<longleftrightarrow> interferes v s' d)"
using b1 interferes_def by auto
then show ?thesis by auto
qed
lemma send_queuing_message_notchg_dom_eps:
assumes p0: "reachable0 s"
and p2: "s' = fst (send_queuing_message s did eid m)"
shows "get_endpoints_of_domain s d = get_endpoints_of_domain s' d"
proof (cases "(get_domain_id_from_endpoint s eid \<noteq> None
\<and> interferes did s (the (get_domain_id_from_endpoint s eid)))")
assume b0: "(get_domain_id_from_endpoint s eid \<noteq> None
\<and> interferes did s (the (get_domain_id_from_endpoint s eid)))"
have b1: "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
using b0 p2 send_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
have b2: "domain_endpoint s = domain_endpoint s'"
using b0 p2 send_queuing_message_def by auto
have b3: "get_endpoints_of_domain s d
= get_endpoints_of_domain s' d"
using b2 get_endpoints_of_domain_def by auto
then show ?thesis by auto
next
assume b0: "\<not> (get_domain_id_from_endpoint s eid \<noteq> None
\<and> interferes did s (the (get_domain_id_from_endpoint s eid)))"
have b1: "s = s'"
using b0 p2 send_queuing_message_def by auto
have b2: "get_endpoints_of_domain s d
= get_endpoints_of_domain s' d"
using b1 get_endpoints_of_domain_def by auto
then show ?thesis by auto
qed
lemma send_queuing_message_notchg_ep_msgs:
assumes p0: "reachable0 s"
and p1: "\<not>(interferes did s d)"
and p2: "s' = fst (send_queuing_message s did eid m)"
shows "(\<forall>ep. ep\<in>get_endpoints_of_domain s d
\<longrightarrow> get_msg_set_from_endpoint_id s ep = get_msg_set_from_endpoint_id s' ep )"
proof (cases "(get_domain_id_from_endpoint s eid \<noteq> None
\<and> interferes did s (the (get_domain_id_from_endpoint s eid)))")
assume b0: "(get_domain_id_from_endpoint s eid \<noteq> None
\<and> interferes did s (the (get_domain_id_from_endpoint s eid)))"
have b1: "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
using b0 p2 send_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
have b2: "domain_endpoint s = domain_endpoint s'"
using b0 p2 send_queuing_message_def by auto
have b3: "\<forall>e. e\<noteq>eid
\<longrightarrow> ((e_msgs s) e) = ((e_msgs s') e)"
using b0 p2 send_queuing_message_def by auto
have b4: "domain_endpoint s = domain_endpoint s'"
using b0 p2 send_queuing_message_def by auto
have b5: "get_endpoints_of_domain s d
= get_endpoints_of_domain s' d"
using b2 get_endpoints_of_domain_def by auto
have b6: "(the (get_domain_id_from_endpoint s eid)) \<noteq> d"
using b0 p1 by auto
have b7: "(the ((domain_endpoint s) eid)) \<noteq> d"
using b6 get_domain_id_from_endpoint_def by auto
have b8: "eid \<notin> get_endpoints_of_domain s d"
using b7 b6 get_endpoints_of_domain_def by auto
have b9: "\<forall>ep. ep\<in>get_endpoints_of_domain s d
\<longrightarrow> ((e_msgs s) ep) = ((e_msgs s') ep)"
using b8 b3 by auto
have b10: "\<forall>ep. ep\<in>get_endpoints_of_domain s d
\<longrightarrow> get_msg_set_from_endpoint_id s ep = get_msg_set_from_endpoint_id s' ep"
using b9 get_msg_set_from_endpoint_id_def by auto
then show ?thesis by auto
next
assume b0: "\<not> (get_domain_id_from_endpoint s eid \<noteq> None
\<and> interferes did s (the (get_domain_id_from_endpoint s eid)))"
have b1: "s = s'"
using b0 p2 send_queuing_message_def by auto
have b2: "(\<forall>ep. ep\<in>get_endpoints_of_domain s d
\<longrightarrow> get_msg_set_from_endpoint_id s ep = get_msg_set_from_endpoint_id s' ep )"
using b1 by auto
then show ?thesis by auto
qed
lemma send_queuing_message_lcl_resp:
assumes p0: "reachable0 s"
and p1: "\<not>(interferes did s d)"
and p2: "s' = fst (send_queuing_message s did eid m)"
shows "s \<sim> d \<sim> s'"
proof -
{
have a0: "did \<noteq> d"
using p1 interferes_def by auto
have a1: "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
using p0 p1 p2 send_queuing_message_notchg_domain_cap_set by auto
have a2: "(\<forall>v. interferes v s d \<longleftrightarrow> interferes v s' d)"
using p0 p1 p2 send_queuing_message_notchg_policy by auto
have a3: "get_endpoints_of_domain s d = get_endpoints_of_domain s' d"
using p0 p1 p2 send_queuing_message_notchg_dom_eps by auto
have a4: "(\<forall>ep. ep\<in>get_endpoints_of_domain s d
\<longrightarrow> get_msg_set_from_endpoint_id s ep = get_msg_set_from_endpoint_id s' ep )"
using p0 p1 p2 send_queuing_message_notchg_ep_msgs by auto
have a5: "s \<sim> d \<sim> s'"
using a1 a2 a3 a4 by auto
}
then show ?thesis by auto
qed
lemma send_queuing_message_lcl_resp_e:
assumes p0: "reachable0 s"
and p1: "a = Send_Queuing_Message did eid m"
and p2: "\<not>(interferes (the (domain_of_event a)) s d)"
and p3: "s' = exec_event s a"
shows "s \<sim> d \<sim> s'"
proof -
{
have a0: "(the (domain_of_event a)) = did"
using p1 domain_of_event_def by auto
have a1: "s' = fst (send_queuing_message s did eid m)"
using p1 p3 exec_event_def by auto
have a2: "\<not>(interferes did s d)"
using p2 a0 by auto
have a3: "s \<sim> d \<sim> s'"
using a1 a2 p0 send_queuing_message_lcl_resp by blast
}
then show ?thesis by auto
qed
lemma send_queuing_message_lcl_lcrsp_e: "dynamic_local_respect_e (Send_Queuing_Message did eid m)"
proof -
{
have "\<forall>d s. reachable0 s
\<and> \<not>(interferes (the (domain_of_event (Send_Queuing_Message did eid m))) s d)
\<longrightarrow> (s \<sim> d \<sim> (exec_event s (Send_Queuing_Message did eid m)))"
proof -
{
fix d s
assume p1: "reachable0 s "
assume p2: " \<not>(interferes (the (domain_of_event (Send_Queuing_Message did eid m))) s d)"
have "(s \<sim> d \<sim> (exec_event s (Send_Queuing_Message did eid m)))"
using p1 p2 send_queuing_message_lcl_resp_e by blast
}
then show ?thesis by blast
qed
}
then show ?thesis
using dynamic_local_respect_e_def by blast
qed
subsubsection{*proving "receive queuing message" satisfying the "local respect" property*}
lemma receive_queuing_message_notchg_domain_cap_set:
assumes p0: "reachable0 s"
and p1: "\<not>(interferes did s d)"
and p2: "s' = fst (receive_queuing_message s did eid)"
shows "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
proof (cases "the(get_domain_id_from_endpoint s eid) = did")
assume a0: "the(get_domain_id_from_endpoint s eid) = did"
have a1: "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
using a0 p2 receive_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
then show ?thesis by auto
next
assume a0: "the(get_domain_id_from_endpoint s eid) \<noteq> did"
have a1: "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
using a0 p2 receive_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
then show ?thesis by auto
qed
lemma receive_queuing_message_notchg_policy:
assumes p0: "reachable0 s"
and p1: "\<not>(interferes did s d)"
and p2: "s' = fst (receive_queuing_message s did eid)"
shows "(\<forall>v. interferes v s d \<longleftrightarrow> interferes v s' d)"
proof (cases "the(get_domain_id_from_endpoint s eid) = did")
assume a0: "the(get_domain_id_from_endpoint s eid) = did"
have a1: "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
using a0 p2 receive_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
have a2: "\<forall>v. get_domain_cap_set_from_domain_id s v
= get_domain_cap_set_from_domain_id s' v"
using a0 p2 receive_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
have a3: "(\<forall>v. interferes v s d \<longleftrightarrow> interferes v s' d)"
using a1 a2 interferes_def by auto
then show ?thesis by auto
next
assume a0: "the(get_domain_id_from_endpoint s eid) \<noteq> did"
have a1: "s = s'"
using a0 p2 receive_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
have a2: "(\<forall>v. interferes v s d \<longleftrightarrow> interferes v s' d)"
using a1 interferes_def by auto
then show ?thesis by auto
qed
lemma receive_queuing_message_notchg_dom_eps:
assumes p0: "reachable0 s"
and p2: "s' = fst (receive_queuing_message s did eid)"
shows "get_endpoints_of_domain s d = get_endpoints_of_domain s' d"
proof (cases "the(get_domain_id_from_endpoint s eid) = did")
assume a0: "the(get_domain_id_from_endpoint s eid) = did"
have a1: "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
using a0 p2 receive_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
have a2: "domain_endpoint s = domain_endpoint s'"
using a0 p2 receive_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
have a3: "get_endpoints_of_domain s d
= get_endpoints_of_domain s' d"
using a1 a2 get_endpoints_of_domain_def by auto
then show ?thesis by auto
next
assume a0: "the(get_domain_id_from_endpoint s eid) \<noteq> did"
have a1: "s = s'"
using a0 p2 receive_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
have a2: "get_endpoints_of_domain s d
= get_endpoints_of_domain s' d"
using a1 get_endpoints_of_domain_def by auto
then show ?thesis by auto
qed
lemma receive_queuing_message_notchg_ep_msgs:
assumes p0: "reachable0 s"
and p1: "\<not>(interferes did s d)"
and p2: "s' = fst (receive_queuing_message s did eid)"
shows "(\<forall>ep. ep\<in>get_endpoints_of_domain s d
\<longrightarrow> get_msg_set_from_endpoint_id s ep = get_msg_set_from_endpoint_id s' ep )"
proof (cases "the(get_domain_id_from_endpoint s eid) = did")
assume a0: "the(get_domain_id_from_endpoint s eid) = did"
have a1: "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
using a0 p2 receive_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
have a2: "domain_endpoint s = domain_endpoint s'"
using a0 p2 receive_queuing_message_def by auto
have a3: "get_endpoints_of_domain s d
= get_endpoints_of_domain s' d"
using a1 a2 get_endpoints_of_domain_def by auto
have a4: "\<forall>e. e\<noteq>eid
\<longrightarrow> ((e_msgs s) e) = ((e_msgs s') e)"
using a0 p2 receive_queuing_message_def by auto
have a5: "d \<noteq> did"
using p1 interferes_def by auto
have a6: "the(get_domain_id_from_endpoint s eid) \<noteq> d"
using a5 a0 by auto
have a7: "(the ((domain_endpoint s) eid)) \<noteq> d"
using a6 get_domain_id_from_endpoint_def by auto
have a8: "eid \<notin> get_endpoints_of_domain s d"
using a7 a6 get_endpoints_of_domain_def by auto
have a9: "\<forall>ep. ep\<in>get_endpoints_of_domain s d
\<longrightarrow> ((e_msgs s) ep) = ((e_msgs s') ep)"
using a8 a4 by auto
have a10: "\<forall>ep. ep\<in>get_endpoints_of_domain s d
\<longrightarrow> get_msg_set_from_endpoint_id s ep = get_msg_set_from_endpoint_id s' ep"
using a9 get_msg_set_from_endpoint_id_def by auto
then show ?thesis by auto
next
assume a0: "the(get_domain_id_from_endpoint s eid) \<noteq> did"
have a1: "s = s'"
using a0 p2 receive_queuing_message_def get_domain_cap_set_from_domain_id_def by auto
have a2: "(\<forall>ep. ep\<in>get_endpoints_of_domain s d
\<longrightarrow> get_msg_set_from_endpoint_id s ep = get_msg_set_from_endpoint_id s' ep )"
using a1 get_msg_set_from_endpoint_id_def by auto
then show ?thesis by auto
qed
lemma receive_queuing_message_lcl_resp:
assumes p0: "reachable0 s"
and p1: "\<not>(interferes did s d)"
and p2: "s' = fst (receive_queuing_message s did eid)"
shows "s \<sim> d \<sim> s'"
proof -
{
have a0: "did \<noteq> d"
using p1 interferes_def by auto
have a1: "get_domain_cap_set_from_domain_id s d
= get_domain_cap_set_from_domain_id s' d"
using p0 p1 p2 receive_queuing_message_notchg_domain_cap_set by auto
have a2: "(\<forall>v. interferes v s d \<longleftrightarrow> interferes v s' d)"
using p0 p1 p2 receive_queuing_message_notchg_policy by auto
have a3: "get_endpoints_of_domain s d = get_endpoints_of_domain s' d"
using p0 p1 p2 receive_queuing_message_notchg_dom_eps by auto
have a4: "(\<forall>ep. ep\<in>get_endpoints_of_domain s d
\<longrightarrow> get_msg_set_from_endpoint_id s ep = get_msg_set_from_endpoint_id s' ep )"
using p0 p1 p2 receive_queuing_message_notchg_ep_msgs by auto
have a5: "s \<sim> d \<sim> s'"
using a1 a2 a3 a4 by auto
}
then show ?thesis by auto
qed
lemma receive_queuing_message_lcl_resp_e:
assumes p0: "reachable0 s"
and p1: "a = (Receive_Queuing_Message did eid)"
and p2: "\<not>(interferes (the (domain_of_event a)) s d)"
and p3: "s' = exec_event s a"
shows "s \<sim> d \<sim> s'"
proof -
{
have a0: "(the (domain_of_event a)) = did"
using p1 domain_of_event_def by auto
have a1: "s' = fst (receive_queuing_message s did eid)"
using p1 p3 exec_event_def by auto
have a2: "\<not>(interferes did s d)"
using p2 a0 by auto
have a3: "s \<sim> d \<sim> s'"
using a1 a2 p0 receive_queuing_message_lcl_resp by blast
}
then show ?thesis by auto
qed
lemma receive_queuing_message_lcrsp_e: "dynamic_local_respect_e (Receive_Queuing_Message did eid)"
proof -
{
have "\<forall>d s. reachable0 s
\<and> \<not>(interferes (the (domain_of_event (Receive_Queuing_Message did eid))) s d)
\<longrightarrow> (s \<sim> d \<sim> (exec_event s (Receive_Queuing_Message did eid)))"
proof -
{
fix d s
assume p1: "reachable0 s "
assume p2: " \<not>(interferes (the (domain_of_event (Receive_Queuing_Message did eid))) s d)"
have "(s \<sim> d \<sim> (exec_event s (Receive_Queuing_Message did eid)))"
using p1 p2 receive_queuing_message_lcl_resp_e by blast
}
then show ?thesis by blast
qed
}
then show ?thesis
using dynamic_local_respect_e_def by blast
qed
subsubsection{*proving "get my endpoints set" satisfying the "local respect" property*}
lemma get_my_endpoints_set_lcl_resp:
assumes p0: "reachable0 s"
and p1: "\<not>(interferes did s d)"
and p2: "s' = fst (get_my_endpoints_set s did)"
shows "s \<sim> d \<sim> s'"
proof -
{
have a1: "s = s'"
by (simp add: p2 get_my_endpoints_set_def p1)
}
then show ?thesis by auto
qed
lemma get_my_endpoints_set_lcl_resp_e:
assumes p0: "reachable0 s"
and p1: "a = (Get_My_Endpoints_Set did)"
and p2: "\<not>(interferes (the (domain_of_event a)) s d)"
and p3: "s' = exec_event s a"
shows "s \<sim> d \<sim> s'"
proof -
{
have a0: "(the (domain_of_event a)) = did"
using p1 domain_of_event_def by auto
have a1: "s' = fst (get_my_endpoints_set s did)"
using p1 p3 exec_event_def by auto
have a2: "\<not>(interferes did s d)"
using p2 a0 by auto
have a3: "s \<sim> d \<sim> s'"
using a1 a2 p0 get_my_endpoints_set_lcl_resp by blast
}
then show ?thesis by auto
qed
lemma get_my_endpoints_set_lcrsp_e: "dynamic_local_respect_e (Get_My_Endpoints_Set did)"