-
Notifications
You must be signed in to change notification settings - Fork 0
/
milTracesScript.sml
521 lines (474 loc) · 16.6 KB
/
milTracesScript.sml
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
open HolKernel boolLib Parse bossLib wordsTheory finite_mapTheory pred_setTheory relationTheory listTheory pairTheory milUtilityTheory milTheory;
(* ==================================================== *)
(* MIL executions, interference, and memory consistency *)
(* ==================================================== *)
val _ = new_theory "milTraces";
(* ------------------------------------------- *)
(* Execution following a labeled step relation *)
(* ------------------------------------------- *)
(* - an "execution" is a list of tuples of states and labels: ('state # 'label # 'state) list
- a "step relation" is a relation: 'state -> 'label -> 'state -> bool
- a "step execution" for a step relation is
* an singleton execution which is a valid step
* a step execution with a last element, where the last element can be
removed to form a step execution, and a valid step can be formed from the elements
- drawback: duplication of states in tuples
*)
Inductive step_execution:
(!s l s'. R s l s' ==> step_execution R [(s,l,s')])
/\
(!(e:('state # 'label # 'state) list) s1 l1 s2 l2 s3.
(step_execution R (e ++ [(s1,l1,s2)]) /\ R s2 l2 s3) ==>
(step_execution R (e ++ [(s1,l1,s2);(s2,l2,s3)])))
End
Definition in_order_step_execution:
in_order_step_execution = step_execution in_order_step
End
Definition out_of_order_step_execution:
out_of_order_step_execution = step_execution out_of_order_step
End
Definition trace:
trace (obs_of_label:'label -> obs) (visible:obs -> bool) (exec:('state # 'label # 'state) list) =
FILTER visible (MAP (obs_of_label o FST o SND) exec)
End
(* ------------------------- *)
(* Execution utility results *)
(* ------------------------- *)
(* sanity checking *)
Theorem step_execution_singleton:
!R s l s'. step_execution R [(s,l,s')] ==> R s l s'
Proof
rw [] >>
`(?s1 l1 s2. [(s,l,s')] = [(s1,l1,s2)] /\ R s1 l1 s2) \/
?e s1 l1 s2 l2 s3. [(s,l,s')] = e ++ [(s1,l1,s2); (s2,l2,s3)] /\
step_execution R (e ++ [(s1,l1,s2)]) /\ R s2 l2 s3`
by METIS_TAC [step_execution_cases] >> fs []
QED
(* sanity checking *)
Theorem step_execution_not_empty_list:
!R e. step_execution R e ==> e <> []
Proof
STRIP_TAC >>
Cases >| [
STRIP_TAC >>
`(?s' l s. [] = [(s,l,s')] /\ R s l s') \/
?e s1 l1 s2 l2 s3. [] = e ++ [(s1,l1,s2); (s2,l2,s3)] /\
step_execution R (e ++ [(s1,l1,s2)]) /\ R s2 l2 s3`
by METIS_TAC [step_execution_cases] >>
fs [],
fs []
]
QED
Theorem step_execution_append_eq_state_base:
!R s1 l1 s2 s3 l2 s4 e.
step_execution R (e ++ [(s1,l1,s2); (s3,l2,s4)]) ==>
s2 = s3
Proof
rw [] >>
`(?s' l s. (e ++ [(s1,l1,s2); (s3,l2,s4)]) = [(s,l,s')] /\ R s l s') \/
?e' s1' l1' s2' l2' s3'. (e ++ [(s1,l1,s2); (s3,l2,s4)]) = e' ++ [(s1',l1',s2'); (s2',l2',s3')]`
by METIS_TAC [step_execution_cases] >>
fs []
QED
Theorem step_execution_reduce_one:
!R e s l s'.
e <> [] ==>
step_execution R (e ++ [(s,l,s')]) ==>
step_execution R e /\ R s l s'
Proof
STRIP_TAC >> STRIP_TAC >>
`e = [] \/ ?x e'. e = SNOC x e'`
by METIS_TAC [SNOC_CASES] >>
rw [] >>
fs [SNOC_APPEND] >>
Cases_on `x` >> Cases_on `r` >>
fs [APPEND_CONS] >>
`(?s'0 l0 s0. e' ++ [(q,q',r'); (s,l,s')] = [(s0,l0,s'0)] /\ R s0 l0 s'0) \/
?e s1 l1 s2 l2 s3.
e' ++ [(q,q',r'); (s,l,s')] = e ++ [(s1,l1,s2); (s2,l2,s3)] /\
step_execution R (e ++ [(s1,l1,s2)]) /\ R s2 l2 s3`
by METIS_TAC [step_execution_cases] >>
fs []
QED
Theorem step_execution_append_eq_state:
!R e1 e2 s1 l1 s2 s3 l2 s4.
step_execution R (e1 ++ [(s1,l1,s2); (s3,l2,s4)] ++ e2) ==>
s2 = s3
Proof
STRIP_TAC >> STRIP_TAC >>
ho_match_mp_tac SNOC_INDUCT >>
rw [] >- METIS_TAC [step_execution_append_eq_state_base] >>
fs [SNOC_APPEND] >>
`step_execution R (e1 ++ [(s1,l1,s2); (s3,l2,s4)] ++ e2)` suffices_by METIS_TAC [] >>
Cases_on `x` >> Cases_on `r` >>
`e1 ++ [(s1,l1,s2); (s3,l2,s4)] ++ e2 <> []` suffices_by METIS_TAC [step_execution_reduce_one] >>
METIS_TAC [APPEND_mid_not_empty]
QED
(* custom transitive closure relation for labeled relations *)
Inductive LTC:
(!s l s'. R s l s' ==> LTC R s s') /\
(!x y z. LTC R x y /\ LTC R y z ==> LTC R x z)
End
Theorem singleton_neq_doubleton[local]:
!e a b c. [a] <> e ++ [b; c]
Proof
Induct >> rw []
QED
Theorem cons_append_eq[local]:
!e e' a. a::(e ++ e') = a::e ++ e'
Proof
Induct >> rw []
QED
Theorem step_execution_rest:
!R e s1 l1 s2 s3 l2 s4.
step_execution R (e ++ [(s1,l1,s2); (s3,l2,s4)]) ==>
step_execution R (e ++ [(s1,l1,s2)]) /\ R s3 l2 s4
Proof
STRIP_TAC >> STRIP_TAC >> STRIP_TAC >> STRIP_TAC >>
STRIP_TAC >> STRIP_TAC >> STRIP_TAC >> STRIP_TAC >>
`e ++ [(s1,l1,s2)] <> []` by (Induct_on `e` >> rw []) >>
`e ++ [(s1,l1,s2); (s3,l2,s4)] = (e ++ [(s1,l1,s2)]) ++ [(s3,l2,s4)]` by fs [] >>
METIS_TAC [step_execution_reduce_one]
QED
Theorem step_execution_mid:
!R e e' s1 l1 s2.
step_execution R (e' ++ (s1,l1,s2)::e) ==>
R s1 l1 s2
Proof
STRIP_TAC >>
ho_match_mp_tac SNOC_INDUCT >> rw [] >-
(Cases_on `e'` >-
(fs [] >>
`(?s l s'. [(s1,l1,s2)] = [(s,l,s')] /\ R s l s') \/
?e s1' l1' s2' l2' s3'.
[(s1,l1,s2)] = e ++ [(s1',l1',s2'); (s2',l2',s3')]`
by METIS_TAC [step_execution_cases] >> fs []) >>
`h :: t <> []` by fs [] >>
METIS_TAC [step_execution_reduce_one]) >>
fs [SNOC_APPEND] >>
Cases_on `x` >> Cases_on `r` >>
`e' ++ (s1,l1,s2)::(e ++ [(q,q',r')]) = e' ++ (s1,l1,s2)::e ++ [(q,q',r')]`
by fs [] >>
`e' ++ (s1,l1,s2)::e <> []` by fs [] >>
METIS_TAC [step_execution_reduce_one]
QED
Theorem step_execution_remove_head:
!R e s1 l1 s2.
e <> [] ==>
step_execution R ((s1,l1,s2)::e) ==>
step_execution R e
Proof
STRIP_TAC >>
ho_match_mp_tac SNOC_INDUCT >> rw [] >>
Cases_on `x` >> Cases_on `r` >>
fs [SNOC_APPEND] >>
`(s1,l1,s2)::(e ++ [(q,q',r')]) = (s1,l1,s2)::e ++ [(q,q',r')]` by fs [] >>
`step_execution R ((s1,l1,s2)::e ++ [(q,q',r')])` by METIS_TAC [] >>
`(s1,l1,s2)::e <> []` by fs [] >>
`step_execution R ((s1,l1,s2)::e) /\ R q q' r'` by METIS_TAC [step_execution_reduce_one] >>
`e = [] \/ ?x l. e = SNOC x l` by METIS_TAC [SNOC_CASES] >-
(fs [] >> METIS_TAC [step_execution_rules]) >>
fs [SNOC_APPEND] >> rw [] >>
Cases_on `x` >> Cases_on `r` >>
`(s1,l1,s2)::(l ++ [(q'',q''',r'')] ++ [(q,q',r')]) =
(s1,l1,s2)::l ++ [(q'',q''',r'');(q,q',r')]` by fs [] >>
`step_execution R ((s1,l1,s2)::l ++ [(q'',q''',r'');(q,q',r')])`
by METIS_TAC [] >>
`r'' = q` by METIS_TAC [step_execution_append_eq_state_base] >> rw [] >>
`l ++ [(q'',q''',q)] ++ [(q,q',r')] = l ++ [(q'',q''',q);(q,q',r')]`
by fs [] >> rw [] >>
METIS_TAC [step_execution_rules]
QED
Theorem step_execution_mid_execution:
!R e' e s1 l1 s2.
step_execution R (e' ++ (s1,l1,s2)::e) ==>
step_execution R ((s1,l1,s2)::e)
Proof
STRIP_TAC >>
Induct_on `e'` >> fs [] >> rw [] >>
`e' ++ (s1,l1,s2)::e <> []` by (Cases_on `e'` >> fs []) >>
Cases_on `h` >> Cases_on `r` >>
`step_execution R (e' ++ (s1,l1,s2)::e)`
by METIS_TAC [step_execution_remove_head] >>
METIS_TAC []
QED
(* FIXME: add summarizing lemma saying MEM implies R x l y *)
Theorem step_execution_LTC:
!R e s1 l1 s2 s3 l2 s4.
LAST ((s1,l1,s2)::e) = (s3,l2,s4) ==>
step_execution R ((s1,l1,s2)::e) ==>
LTC R s1 s4
Proof
STRIP_TAC >>
ho_match_mp_tac SNOC_INDUCT >> rw [] >-
(`?l. R s1 l s2` suffices_by METIS_TAC [LTC_rules] >>
Q.EXISTS_TAC `l1` >>
`(?s l s'. [(s1,l1,s2)] = [(s,l,s')] /\ R s l s') \/
?e s1' l1' s2' l2 s3.
[(s1,l1,s2)] = e ++ [(s1',l1',s2'); (s2',l2,s3)] /\
step_execution R (e ++ [(s1',l1',s2')]) /\ R s2' l2 s3`
by METIS_TAC [step_execution_cases] >- fs [] >>
METIS_TAC [singleton_neq_doubleton]) >>
fs [LAST_DEF] >> fs [SNOC_APPEND] >>
rw [] >>
`e = [] \/ ?x e'. e = SNOC x e'` by rw [SNOC_CASES] >-
(fs [] >>
`[(s1,l1,s2); (s3,l2,s4)] = [] ++ [(s1,l1,s2); (s3,l2,s4)]` by fs [] >>
`s2 = s3` by METIS_TAC [step_execution_append_eq_state_base] >>
rw [] >>
`step_execution R ([] ++ [(s1,l1,s2); (s2,l2,s4)])`
by METIS_TAC [] >>
`step_execution R ([] ++ [(s1,l1,s2)]) /\ R s2 l2 s4`
by METIS_TAC [step_execution_rest] >>
fs [] >>
`LTC R s1 s2` by METIS_TAC [] >>
`LTC R s2 s4` by METIS_TAC [LTC_rules] >>
METIS_TAC [LTC_rules]) >>
fs [] >>
Cases_on `x` >> Cases_on `r` >>
`(s1,l1,s2)::(e' ++ [(q,q',r')] ++ [(s3,l2,s4)]) =
(s1,l1,s2)::e' ++ [(q,q',r');(s3,l2,s4)]` by fs [] >>
`step_execution R ((s1,l1,s2)::e' ++ [(q,q',r');(s3,l2,s4)])`
by METIS_TAC [] >>
`(s1,l1,s2)::e' <> []` by rw [] >>
`step_execution R (((s1,l1,s2)::e') ++ [(q,q',r')]) /\ R s3 l2 s4`
by METIS_TAC [step_execution_rest] >>
`(s1,l1,s2)::e' ++ [(q,q',r')] = (s1,l1,s2)::(e' ++ [(q,q',r')])`
by fs [] >>
`LTC R s1 r'` by METIS_TAC [] >>
`LTC R s3 s4` by METIS_TAC [LTC_rules] >>
`r' = s3` suffices_by METIS_TAC [LTC_rules] >>
METIS_TAC [step_execution_append_eq_state_base]
QED
(* straightforward corollary *)
Theorem step_execution_LTC_end[local]:
!R e s1 l1 s2 s3 l2 s4.
step_execution R ((s1,l1,s2)::e ++ [(s3,l2,s4)]) ==>
LTC R s1 s4
Proof
rw [] >>
`LAST ((s1,l1,s2)::(e ++ [(s3,l2,s4)])) = (s3,l2,s4)`
suffices_by METIS_TAC [step_execution_LTC] >>
fs [LAST_DEF]
QED
Theorem step_execution_mid_LTC[local]:
!R e e' s1 l1 s2 s3 l2 s4.
step_execution R ((s1,l1,s2)::e' ++ (s3,l2,s4)::e) ==>
LTC R s1 s4
Proof
STRIP_TAC >>
HO_MATCH_MP_TAC SNOC_INDUCT >> rw [] >-
METIS_TAC [cons_append_eq,step_execution_LTC_end] >>
fs [SNOC_APPEND] >>
Cases_on `x` >> Cases_on `r` >>
`(s1,l1,s2)::(e' ++ (s3,l2,s4)::(e ++ [(q,q',r')])) =
(s1,l1,s2)::e' ++ (s3,l2,s4)::e ++ [(q,q',r')]` by fs [] >>
`(s1,l1,s2)::e' ++ (s3,l2,s4)::e <> []` by fs [] >>
`step_execution R ((s1,l1,s2)::e' ++ (s3,l2,s4)::e) /\ R q q' r'`
by METIS_TAC [step_execution_reduce_one] >>
`(s1,l1,s2)::e' ++ (s3,l2,s4)::e = (s1,l1,s2)::(e' ++ (s3,l2,s4)::e)`
by fs [] >>
METIS_TAC []
QED
Theorem step_execution_mid_FST_LTC[local]:
!R e e' s1 l1 s2 s3 l2 s4.
step_execution R ((s1,l1,s2)::e ++ (s3,l2,s4)::e') ==>
LTC R s1 s3
Proof
STRIP_TAC >> STRIP_TAC >>
`e = [] \/ ?x e'. e = SNOC x e'`
by METIS_TAC [SNOC_CASES] >> rw [] >-
(`(s1,l1,s2)::(s3,l2,s4)::e' = [] ++ [(s1,l1,s2);(s3,l2,s4)] ++ e'`
by fs [] >>
`s2 = s3` by METIS_TAC [step_execution_append_eq_state] >>
rw [] >>
`(s1,l1,s2)::(s2,l2,s4)::e' = [] ++ (s1,l1,s2)::((s2,l2,s4)::e')` by fs [] >>
METIS_TAC [step_execution_mid,LTC_rules]) >>
fs [SNOC_APPEND] >>
Cases_on `x` >> Cases_on `r` >>
`(s1,l1,s2)::(e' ++ [(q,q',r')] ++ (s3,l2,s4)::e'') =
(s1,l1,s2)::e' ++ [(q,q',r');(s3,l2,s4)] ++ e''`
by fs [] >>
`r' = s3` by METIS_TAC [step_execution_append_eq_state] >>
rw [] >>
`(s1,l1,s2)::(e' ++ [(q,q',r')] ++ (r',l2,s4)::e'') =
(s1,l1,s2)::e' ++ (q,q',r')::((r',l2,s4)::e'')`
by fs [] >>
METIS_TAC [step_execution_mid_LTC]
QED
Theorem LTC_truncate_TC[local]:
!R x y. LTC R x y <=> TC (\a b. ?l. R a l b) x y
Proof
STRIP_TAC >> STRIP_TAC >> STRIP_TAC >> EQ_TAC >-
(match_mp_tac LTC_ind >> rw [] >-
(rw [TC_DEF] >> METIS_TAC []) >>
METIS_TAC [TC_TRANSITIVE,transitive_def]) >>
once_rewrite_tac [TC_DEF] >>
`(!x y. (\a b. ?l. R a l b) x y ==> LTC R x y) /\
(!x y z. LTC R x y /\ LTC R y z ==> LTC R x z)`
suffices_by METIS_TAC [] >>
rw [] >> METIS_TAC [LTC_rules]
QED
Definition step_invariant:
step_invariant
(R: 'state -> 'label -> 'state -> bool)
(P: 'state -> bool) =
!s l s'. P s ==> R s l s' ==> P s'
End
Definition LTC_invariant:
LTC_invariant
(R: 'state -> 'label -> 'state -> bool)
(P: 'state -> bool) =
!s s'. P s ==> LTC R s s' ==> P s'
End
Theorem step_invariant_LTC[local]:
!R P s s'. LTC R s s' ==> P s ==> step_invariant R P ==> P s'
Proof
STRIP_TAC >> STRIP_TAC >> ho_match_mp_tac LTC_ind >> rw [] >>
METIS_TAC [step_invariant]
QED
Theorem step_invariant_LTC_invariant:
!R P. step_invariant R P ==> LTC_invariant R P
Proof
METIS_TAC [LTC_invariant,step_invariant_LTC]
QED
Theorem step_execution_mid_LTC_invariant:
!R P. LTC_invariant R P ==>
!e e' s1 l1 s2 s3 l2 s4. P s1 ==>
step_execution R ((s1,l1,s2)::e' ++ (s3,l2,s4)::e) ==>
P s4
Proof
STRIP_TAC >> STRIP_TAC >> STRIP_TAC >>
STRIP_TAC >> STRIP_TAC >> STRIP_TAC >>
STRIP_TAC >> STRIP_TAC >> STRIP_TAC >>
STRIP_TAC >> STRIP_TAC >> STRIP_TAC >> STRIP_TAC >>
`LTC R s1 s4` by METIS_TAC [step_execution_mid_LTC] >>
METIS_TAC [LTC_invariant]
QED
Theorem step_execution_mid_FST_LTC_invariant:
!R P. LTC_invariant R P ==>
!e e' s1 l1 s2 s3 l2 s4. P s1 ==>
step_execution R ((s1,l1,s2)::e' ++ (s3,l2,s4)::e) ==>
P s3
Proof
STRIP_TAC >> STRIP_TAC >> STRIP_TAC >>
STRIP_TAC >> STRIP_TAC >> STRIP_TAC >>
STRIP_TAC >> STRIP_TAC >> STRIP_TAC >>
STRIP_TAC >> STRIP_TAC >> STRIP_TAC >> STRIP_TAC >>
`LTC R s1 s3` by METIS_TAC [step_execution_mid_FST_LTC] >>
METIS_TAC [LTC_invariant]
QED
Theorem step_execution_single:
!R s l s' . step_execution R [(s, l, s')] ==> R s l s'
Proof
once_rewrite_tac [step_execution_cases] >> rw []
QED
Theorem step_execution_append_one:
!R e s l s'.
step_execution R e /\ SND (SND (LAST e)) = s /\ R s l s' ==>
step_execution R (e ++ [(s,l,s')])
Proof
STRIP_TAC >>
ho_match_mp_tac SNOC_INDUCT >>
rw [] >| [
METIS_TAC [step_execution_not_empty_list],
fs [SNOC_APPEND] >>
Cases_on `x` >> Cases_on `r` >>
fs [SND] >>
`step_execution R (e ++ [(q,q',r'); (r',l,s')])`
by METIS_TAC [step_execution_cases] >>
rw [APPEND_CONS]
]
QED
Theorem trace_append_eq_label:
!obs_of_label observable e1 e2 s1 s1' s2 s2' lb.
trace obs_of_label observable e1 = trace obs_of_label observable e2 ==>
trace obs_of_label observable (e1 ++ [(s1, lb, s1')]) = trace obs_of_label observable (e2 ++ [(s2, lb, s2')])
Proof
rw [trace,FILTER_APPEND_DISTRIB]
QED
(* ---------------------------------------- *)
(* Interference and consistency definitions *)
(* ---------------------------------------- *)
Definition cond_noninterference:
cond_noninterference
(Indist : 'state -> 'state -> bool)
(step_t : 'state -> 'label -> 'state -> bool)
(step_r : 'state -> 'label -> 'state -> bool)
(obs_of_label : 'label -> obs)
(observable : obs -> bool) =
(equivalence Indist /\
(!s1 s2. Indist s1 s2 ==>
(!pi1. step_execution step_r pi1 ==> FST (HD pi1) = s1 ==>
?pi2. FST (HD pi2) = s2 /\ step_execution step_r pi2 /\
trace obs_of_label observable pi1 = trace obs_of_label observable pi2) ==>
(!rho1. step_execution step_t rho1 ==> FST (HD rho1) = s1 ==>
?rho2. FST (HD rho2) = s2 /\ step_execution step_t rho2 /\
trace obs_of_label observable rho1 = trace obs_of_label observable rho2)))
End
Definition noninterference:
noninterference
(Indist : 'state -> 'state -> bool)
(step_p : 'state -> 'label -> 'state -> bool)
(obs_of_label : 'label -> obs)
(observable : obs -> bool) =
(equivalence Indist /\
(!s1 s2. Indist s1 s2 ==>
(!pi1. step_execution step_p pi1 ==> FST (HD pi1) = s1 ==>
?pi2. FST (HD pi2) = s2 /\ step_execution step_p pi2 /\
trace obs_of_label observable pi1 = trace obs_of_label observable pi2)))
End
Theorem noninterference_implies_cond_noninterference:
!Indist step_t step_r obs_of_label observable.
noninterference Indist step_t obs_of_label observable ==>
cond_noninterference Indist step_t step_r obs_of_label observable
Proof
rw [cond_noninterference,noninterference]
QED
Theorem cond_noninterference_and_reference_noninterference_imply_target_noninterference:
!Indist step_t step_r obs_of_label observable.
cond_noninterference Indist step_t step_r obs_of_label observable ==>
noninterference Indist step_r obs_of_label observable ==>
noninterference Indist step_t obs_of_label observable
Proof
rw [cond_noninterference,noninterference]
QED
Definition commits:
(commits [] a = []) /\
(commits (((s:'state),l_lb ob (act_cmt a' v) t,(s':'state))::pi) a =
if a' = a then v :: commits pi a else commits pi a) /\
(commits ((s,l,s')::pi) a = commits pi a)
End
Definition commits_fold:
(commits_fold a ((s:'state),l_lb ob (act_cmt a' v) t,(s':'state)) pi =
if a' = a then v :: pi else pi) /\
(commits_fold a (s,l,s') pi = pi)
End
Theorem commits_filter[local]:
!pi a. commits pi a = FOLDR (commits_fold a) [] pi
Proof
Induct >> rw [commits] >>
Cases_on `h` >> Cases_on `r` >> Cases_on `q'` >>
Cases_on `a'` >> once_rewrite_tac [commits,commits_fold] >| [
METIS_TAC [],
Cases_on `c = a` >> rw [],
METIS_TAC []
]
QED
Theorem commits_app:
!pi pi' a. commits (pi ++ pi') a = commits pi a ++ commits pi' a
Proof
Induct_on `pi` >> rw [commits] >>
Cases_on `h` >> Cases_on `r` >> Cases_on `q'` >>
Cases_on `a'` >> rw [commits]
QED
Definition memory_consistent:
memory_consistent
(step_1 : 'state -> l -> 'state -> bool)
(step_2 : 'state -> l -> 'state -> bool)
(initial : 'state) =
(!pi. step_execution step_1 pi ==> FST (HD pi) = initial ==>
?pi'. step_execution step_2 pi' /\ FST (HD pi') = initial /\
!a. commits pi a <<= commits pi' a)
End
val _ = export_theory ();