-
Notifications
You must be signed in to change notification settings - Fork 0
/
milExampleSpectreOOOScript.sml
2507 lines (2323 loc) · 123 KB
/
milExampleSpectreOOOScript.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
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
open HolKernel boolLib Parse bossLib boolSimps wordsLib wordsTheory pred_setTheory finite_mapTheory relationTheory bisimulationTheory milUtilityTheory milTheory milSemanticsUtilityTheory milMetaTheory milExampleUtilityTheory milStoreTheory milExampleBisimulationTheory milNoninterferenceTheory milExecutableExamplesTheory milExecutableUtilityTheory milMaxExeTraceExampleSpectreOOOTheory milLib;
(* =================================== *)
(* Example MIL program for Spectre OoO *)
(* =================================== *)
val _ = new_theory "milExampleSpectreOOO";
(* --------------------- *)
(* Definition of program *)
(* --------------------- *)
(* Translation of the program that demonstrates the Spectre-OoO vulnerability *)
Definition example_spectre_OoO_1:
example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2 : I =
{ (* register names and memory addresses *)
i_assign t00 (e_val val_true) (o_internal (e_val val_zero));
i_assign t01 (e_val val_true) (o_internal (e_val r1));
i_assign t02 (e_val val_true) (o_internal (e_val r2));
i_assign t03 (e_val val_true) (o_internal (e_val z));
i_assign t04 (e_val val_true) (o_internal (e_val b1));
i_assign t05 (e_val val_true) (o_internal (e_val b2));
(* r1 := *b1 *)
i_assign t11 (e_val val_true) (o_load res_MEM t04);
i_assign t12 (e_val val_true) (o_store res_REG t01 t11);
(* cmov z, r2, r1 *)
i_assign t21 (e_val val_true) (o_load res_REG t03);
i_assign t22 (e_eq (e_name t21) (e_val val_one)) (o_load res_REG t01);
i_assign t23 (e_eq (e_name t21) (e_val val_one)) (o_store res_REG t02 t22);
(* *b2 := r2 *)
i_assign t31 (e_val val_true) (o_load res_REG t02);
i_assign t32 (e_val val_true) (o_store res_MEM t05 t31);
(* pc := pc + 4w *)
i_assign t41 (e_val val_true) (o_load res_PC t00);
i_assign t42 (e_val val_true) (o_internal (e_add (e_name t41) (e_val 4w)));
i_assign t43 (e_val val_true) (o_store res_PC t00 t42)
}
End
(* --------------------- *)
(* Bisimulation relation *)
(* --------------------- *)
Definition example_spectre_OoO_1_rel:
example_spectre_OoO_1_rel t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z
b1 b1' b2 b2' ts_pc (** ts_r1 ts_r2 **) ts_z (** ts_b1 ts_b2 **)
(State_st I1 s1 C1 F1) (State_st I2 s2 C2 F2) =
(? I0 I0' .
t00 < t01 /\ t01 < t02 /\ t02 < t03 /\ t03 < t04 /\ t04 < t05 /\ t05 < t11 /\ t11 < t12 /\ t12 < t21 /\
t21 < t22 /\ t22 < t23 /\ t23 < t31 /\ t31 < t32 /\ t32 < t41 /\ t41 < t42 /\ t42 < t43 /\
r1 <> z /\
well_formed_state (State_st I1 s1 C1 F1) /\
well_formed_state (State_st I2 s2 C2 F2) /\
I1 = I0 UNION example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2 /\
I2 = I0' UNION example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1' b2' /\
FDOM s1 = FDOM s2 /\ C1 = C2 /\ F1 = F2 /\
b1 = b1' /\ b2 = b2' /\ (* the reason that this relation can be symmetric is this *)
bound_names_program I0 <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) /\
bound_names_program I0' <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1' b2') /\
(!i. i IN I0 ==> Completed (State_st I1 s1 C1 F1) i) /\
(!i. i IN I0' ==> Completed (State_st I2 s2 C2 F2) i) /\
str_act_addr (State_st I1 s1 C1 F1) t41 res_PC val_zero =
str_act_addr (State_st I2 s2 C2 F2) t41 res_PC val_zero /\
ts_pc IN bound_names_program I0 /\
ts_pc IN bound_names_program I0' /\
ts_pc IN bound_names_program (str_act_addr (State_st I1 s1 C1 F1) t41 res_PC val_zero) /\
FLOOKUP s1 ts_pc = FLOOKUP s2 ts_pc /\
FLOOKUP s1 t41 = FLOOKUP s2 t41 /\
FLOOKUP s1 t42 = FLOOKUP s2 t42 /\
FLOOKUP s1 t43 = FLOOKUP s2 t43 /\
str_act_addr (State_st I1 s1 C1 F1) t22 res_REG r1 =
str_act_addr (State_st I2 s2 C2 F2) t22 res_REG r1 /\
(** ts_r1 IN bound_names_program I0 /\ **)
str_act_addr (State_st I1 s1 C1 F1) t31 res_REG r2 =
str_act_addr (State_st I2 s2 C2 F2) t31 res_REG r2 /\
(** ts_r2 IN bound_names_program I0 /\ **)
str_act_addr (State_st I1 s1 C1 F1) t21 res_REG z =
str_act_addr (State_st I2 s2 C2 F2) t21 res_REG z /\
ts_z IN bound_names_program I0 /\
ts_z IN bound_names_program I0' /\
ts_z IN bound_names_program (str_act_addr (State_st I1 s1 C1 F1) t21 res_REG z) /\
FLOOKUP s1 ts_z = FLOOKUP s2 ts_z /\ (* TODO: show counterexample if this is removed *)
FLOOKUP s1 t21 = FLOOKUP s2 t21 /\
str_act_addr (State_st I1 s1 C1 F1) t11 res_MEM b1 =
str_act_addr (State_st I2 s2 C2 F2) t11 res_MEM b1' /\
FLOOKUP s1 t04 = FLOOKUP s2 t04 /\
(** ts_b1 IN bound_names_program I0 /\ **)
str_act_addr (State_st I1 s1 C1 F1) t32 res_MEM b2 =
str_act_addr (State_st I2 s2 C2 F2) t32 res_MEM b2' /\
FLOOKUP s1 t05 = FLOOKUP s2 t05
(** ts_b2 IN bound_names_program I0 /\ **)
(**
((FLOOKUP s1 ts_z = SOME val_one /\
(map_down s1 t21 ==> FLOOKUP s1 t21 = SOME val_one) /\
(map_down s1 t21 ==> bound_names_program (str_act (State_st I1 s1 C1 F1) t31) = { t23 })) \/
(FLOOKUP s1 ts_z <> SOME val_one /\
(map_down s1 t21 ==> FLOOKUP s1 t21 <> SOME val_one) /\
(map_down s1 t21 ==> bound_names_program (str_act (State_st I1 s1 C1 F1) t31) = { ts_r2 })))
**)
)
End
Theorem example_spectre_OoO_1_rel_symmetric[local]:
! t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b1' b2 b2' ts_pc ts_z .
symmetric
(example_spectre_OoO_1_rel t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b1' b2 b2' ts_pc ts_z)
Proof
rw [symmetric_def] >>
Cases_on `x` >> Cases_on `y` >>
rw [example_spectre_OoO_1_rel] >>
METIS_TAC []
QED
Theorem example_spectre_OoO_1_rel_transitive[local]:
! t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b1' b2 b2' ts_pc ts_z .
transitive
(example_spectre_OoO_1_rel t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b1' b2 b2' ts_pc ts_z)
Proof
rw [transitive_def] >>
Cases_on `x` >> Cases_on `y` >> Cases_on `z'` >>
fs [example_spectre_OoO_1_rel] >>
METIS_TAC []
QED
(* ------------- *)
(* Common lemmas *)
(* ------------- *)
Theorem example_spectre_OoO_1_bn[local]:
! t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2 .
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
= { t00; t01; t02; t03; t04; t05; t11; t12; t21; t22; t23; t31; t32; t41; t42; t43 }
Proof
fs [bound_names_program, example_spectre_OoO_1] >>
dsimp [EXTENSION, bound_name_instr]
QED
(* -------------------------------------- *)
(* Lemmas for str_may_act_addr_preserving *)
(* -------------------------------------- *)
val example_spectre_OoO_1_str_may_act_addr_preserving_PC_tac1 = (
(* when [c']s1↑ *)
PAT_ASSUM ``i_assign t' c' (o_store res_PC ta' tv') IN _``
(fn thm => ASSUME_TAC (MATCH_MP str_may_addr_in_I thm)) >>
`i_assign t' c' (o_store res_PC ta' tv') IN I0 \/
i_assign t' c' (o_store res_PC ta' tv') IN
example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* when t' is in I0, it is completed, [c']s1↓ *)
`Completed (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) (i_assign t' c' (o_store res_PC ta' tv'))`
by fs [] >>
`sem_expr c' s1 = SOME val_false \/ t' IN F1` by fs [Completed] >- fs [] >>
`t' IN FDOM s1` by METIS_TAC [well_formed_in_F_in_s] >>
`?v. FLOOKUP s1 t' = SOME v` by fs [flookup_thm] >>
`?v'. sem_expr c' s1 = SOME v' /\ v' <> val_false` by METIS_TAC [wfs_flookup_condition_not_false] >>
fs [],
(* when t' is in the program, c' is constantly true *)
`t IN names_e c'` by METIS_TAC [sem_expr_name_resolved] >>
`c' = e_val val_true` by fs [example_spectre_OoO_1] >>
fs [names_e]
]
)
val example_spectre_OoO_1_str_may_act_addr_preserving_PC_tac2 = (
(* when [c']s2↑ *)
PAT_ASSUM ``i_assign t' c' (o_store res_PC ta' tv') IN _``
(fn thm => ASSUME_TAC (MATCH_MP str_may_addr_in_I thm)) >>
`i_assign t' c' (o_store res_PC ta' tv') IN I0' \/
i_assign t' c' (o_store res_PC ta' tv') IN
example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* when t' is in I0', it is completed, [c']s2↓ *)
`Completed (State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s2 C2 F2) (i_assign t' c' (o_store res_PC ta' tv'))`
by fs [] >>
`sem_expr c' s2 = SOME val_false \/ t' IN F2` by fs [Completed] >- fs [] >>
`t' IN FDOM s2` by METIS_TAC [well_formed_in_F_in_s] >>
`?v. FLOOKUP s2 t' = SOME v` by fs [flookup_thm] >>
`?v'. sem_expr c' s2 = SOME v' /\ v' <> val_false` by METIS_TAC [wfs_flookup_condition_not_false] >>
fs [],
(* when t' is in the program, c' is constantly true *)
`t IN names_e c'` by METIS_TAC [sem_expr_name_resolved] >>
`c' = e_val val_true` by fs [example_spectre_OoO_1] >>
fs [names_e]
]
)
val example_spectre_OoO_1_str_may_act_addr_preserving_PC_tac3 = (
(* when t = ta' *)
PAT_ASSUM ``i_assign t' c' (o_store res_PC ta' tv') IN _``
(fn thm => ASSUME_TAC (MATCH_MP str_may_addr_in_I thm)) >>
`i_assign t' c' (o_store res_PC ta' tv') IN I0 \/
i_assign t' c' (o_store res_PC ta' tv') IN
example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* it is impossible that t' is in I0, because t = ta' < t' would not be in the program then *)
`t' IN bound_names_program I0` by METIS_TAC [instr_in_bound_names_program] >>
`t < t'` by METIS_TAC [well_formed_store_lt] >>
`t IN bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)`
by fs [example_spectre_OoO_1_bn] >>
`t' < t` by METIS_TAC [names_lt] >>
fs [],
(* when t' is in the program *)
FIRST_PROVE [
(* show v1 = v2 *)
fs [sem_expr_correct],
(* there is no such t' in the program *)
fs [example_spectre_OoO_1]
]
]
)
val example_spectre_OoO_1_str_may_act_addr_preserving_PC_tac4 = (
(* when t = ta' *)
PAT_ASSUM ``i_assign t' c' (o_store res_PC ta' tv') IN _``
(fn thm => ASSUME_TAC (MATCH_MP str_may_addr_in_I thm)) >>
`i_assign t' c' (o_store res_PC ta' tv') IN I0' \/
i_assign t' c' (o_store res_PC ta' tv') IN
example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* it is impossible that t' is in I0', because t = ta' < t' would not be in the program then *)
`t' IN bound_names_program I0'` by METIS_TAC [instr_in_bound_names_program] >>
`t < t'` by METIS_TAC [well_formed_store_lt] >>
`t IN bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)`
by fs [example_spectre_OoO_1_bn] >>
`t' < t` by METIS_TAC [names_lt] >>
fs [],
(* when t' is in the program *)
FIRST_PROVE [
(* show v1 = v2 *)
fs [sem_expr_correct],
(* there is no such t' in the program *)
fs [example_spectre_OoO_1]
]
]
)
val example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac1 = (
(* when [c']s1↑ *)
PAT_ASSUM ``i_assign t' c' (o_store res_REG ta' tv') IN _``
(fn thm => ASSUME_TAC (MATCH_MP str_may_addr_in_I thm)) >>
`i_assign t' c' (o_store res_REG ta' tv') IN I0 \/
i_assign t' c' (o_store res_REG ta' tv') IN
example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* when t' is in I0, it is completed, [c']s1↓ *)
`Completed (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) (i_assign t' c' (o_store res_REG ta' tv'))`
by fs [] >>
`sem_expr c' s1 = SOME val_false \/ t' IN FDOM s1` by fs [Completed] >- fs [] >>
`t' IN FDOM s1` by METIS_TAC [well_formed_in_F_in_s] >>
`?v. FLOOKUP s1 t' = SOME v` by fs [flookup_thm] >>
`?v'. sem_expr c' s1 = SOME v' /\ v' <> val_false` by METIS_TAC [wfs_flookup_condition_not_false] >>
fs [],
(* when t' is in the program, c' is constantly true *)
`t IN names_e c'` by METIS_TAC [sem_expr_name_resolved] >>
`c' = e_val val_true \/ c' = e_eq (e_name t21) (e_val val_one)` by fs [example_spectre_OoO_1] >>
fs [names_e]
]
)
val example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac2 = (
(* when [c']s2↑ *)
PAT_ASSUM ``i_assign t' c' (o_store res_REG ta' tv') IN _``
(fn thm => ASSUME_TAC (MATCH_MP str_may_addr_in_I thm)) >>
`i_assign t' c' (o_store res_REG ta' tv') IN I0' \/
i_assign t' c' (o_store res_REG ta' tv') IN
example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* when t' is in I0', it is completed, [c']s2↓ *)
`Completed (State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s2 C2 F2) (i_assign t' c' (o_store res_REG ta' tv'))`
by fs [] >>
`sem_expr c' s2 = SOME val_false \/ t' IN FDOM s2` by fs [Completed] >- fs [] >>
`t' IN FDOM s2` by METIS_TAC [well_formed_in_F_in_s] >>
`?v. FLOOKUP s2 t' = SOME v` by fs [flookup_thm] >>
`?v'. sem_expr c' s2 = SOME v' /\ v' <> val_false` by METIS_TAC [wfs_flookup_condition_not_false] >>
fs [],
(* when t' is in the program, c' is constantly true *)
`t IN names_e c'` by METIS_TAC [sem_expr_name_resolved] >>
`c' = e_val val_true \/ c' = e_eq (e_name t21) (e_val val_one)` by fs [example_spectre_OoO_1] >>
fs [names_e]
]
)
val example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac3 = (
(* when t = ta' *)
PAT_ASSUM ``i_assign t' c' (o_store res_REG ta' tv') IN _``
(fn thm => ASSUME_TAC (MATCH_MP str_may_addr_in_I thm)) >>
`i_assign t' c' (o_store res_REG ta' tv') IN I0 \/
i_assign t' c' (o_store res_REG ta' tv') IN
example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* it is impossible that t' is in I0, because t = ta' < t' would not be in the program then *)
`t' IN bound_names_program I0` by METIS_TAC [instr_in_bound_names_program] >>
`t < t'` by METIS_TAC [well_formed_store_lt] >>
`t IN bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)`
by fs [example_spectre_OoO_1_bn] >>
`t' < t` by METIS_TAC [names_lt] >>
fs [],
(* when t' is in the program *)
FIRST_PROVE [
(* show v1 = v2 *)
fs [sem_expr_correct],
(* there is no such t' in the program *)
fs [example_spectre_OoO_1] >> fs [],
(* there is no such t' in str-may-addr *)
fs [example_spectre_OoO_1] >> fs [str_may_addr]
]
]
)
val example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac4 = (
(* when t = ta' *)
PAT_ASSUM ``i_assign t' c' (o_store res_REG ta' tv') IN _``
(fn thm => ASSUME_TAC (MATCH_MP str_may_addr_in_I thm)) >>
`i_assign t' c' (o_store res_REG ta' tv') IN I0' \/
i_assign t' c' (o_store res_REG ta' tv') IN
example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* it is impossible that t' is in I0', because t = ta' < t' would not be in the program then *)
`t' IN bound_names_program I0'` by METIS_TAC [instr_in_bound_names_program] >>
`t < t'` by METIS_TAC [well_formed_store_lt] >>
`t IN bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)`
by fs [example_spectre_OoO_1_bn] >>
`t' < t` by METIS_TAC [names_lt] >>
fs [],
(* when t' is in the program *)
FIRST_PROVE [
(* show v1 = v2 *)
fs [sem_expr_correct],
(* there is no such t' in the program *)
fs [example_spectre_OoO_1] >> fs [],
(* there is no such t' in str-may-addr *)
fs [example_spectre_OoO_1] >> fs [str_may_addr]
]
]
)
val example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac1 = (
(* when [c']s1↑ *)
PAT_ASSUM ``i_assign t' c' (o_store res_MEM ta' tv') IN _``
(fn thm => ASSUME_TAC (MATCH_MP str_may_addr_in_I thm)) >>
`i_assign t' c' (o_store res_MEM ta' tv') IN I0 \/
i_assign t' c' (o_store res_MEM ta' tv') IN
example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* when t' is in I0, it is completed, [c']s1↓ *)
`Completed (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) (i_assign t' c' (o_store res_MEM ta' tv'))`
by fs [] >>
`sem_expr c' s1 = SOME val_false \/ t' IN C1` by fs [Completed] >- fs [] >>
`t' IN FDOM s1` by METIS_TAC [well_formed_in_C_in_s] >>
`?v. FLOOKUP s1 t' = SOME v` by fs [flookup_thm] >>
`?v'. sem_expr c' s1 = SOME v' /\ v' <> val_false` by METIS_TAC [wfs_flookup_condition_not_false] >>
fs [],
(* when t' is in the program, c' is constantly true or (t21 = 1) *)
`t IN names_e c'` by METIS_TAC [sem_expr_name_resolved] >>
`c' = e_val val_true \/ c' = e_eq (e_name t21) (e_val val_one)` by fs [example_spectre_OoO_1] >>
fs [names_e] >>
(* when t = t21, there is no such t' in str-may-addr *)
fs [example_spectre_OoO_1] >> fs [str_may_addr]
]
)
val example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac2 = (
(* when [c']s2↑ *)
PAT_ASSUM ``i_assign t' c' (o_store res_MEM ta' tv') IN _``
(fn thm => ASSUME_TAC (MATCH_MP str_may_addr_in_I thm)) >>
`i_assign t' c' (o_store res_MEM ta' tv') IN I0' \/
i_assign t' c' (o_store res_MEM ta' tv') IN
example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* when t' is in I0', it is completed, [c']s2↓ *)
`Completed (State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s2 C2 F2) (i_assign t' c' (o_store res_MEM ta' tv'))`
by fs [] >>
`sem_expr c' s2 = SOME val_false \/ t' IN C2` by fs [Completed] >- fs [] >>
`t' IN FDOM s2` by METIS_TAC [well_formed_in_C_in_s] >>
`?v. FLOOKUP s2 t' = SOME v` by fs [flookup_thm] >>
`?v'. sem_expr c' s2 = SOME v' /\ v' <> val_false` by METIS_TAC [wfs_flookup_condition_not_false] >>
fs [],
(* when t' is in the program, c' is constantly true or (t21 = 1) *)
`t IN names_e c'` by METIS_TAC [sem_expr_name_resolved] >>
`c' = e_val val_true \/ c' = e_eq (e_name t21) (e_val val_one)` by fs [example_spectre_OoO_1] >>
fs [names_e] >>
(* when t = t21, there is no such t' in str-may-addr *)
fs [example_spectre_OoO_1] >> fs [str_may_addr]
]
)
val example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac3 = (
(* when t = ta' *)
PAT_ASSUM ``i_assign t' c' (o_store res_MEM ta' tv') IN _``
(fn thm => ASSUME_TAC (MATCH_MP str_may_addr_in_I thm)) >>
`i_assign t' c' (o_store res_MEM ta' tv') IN I0 \/
i_assign t' c' (o_store res_MEM ta' tv') IN
example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* it is impossible that t' is in I0, because t = ta' < t' would not be in the program then *)
`t' IN bound_names_program I0` by METIS_TAC [instr_in_bound_names_program] >>
`t < t'` by METIS_TAC [well_formed_store_lt] >>
`t IN bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)`
by fs [example_spectre_OoO_1_bn] >>
`t' < t` by METIS_TAC [names_lt] >>
fs [],
(* when t' is in the program *)
FIRST_PROVE [
(* show v1 = v2 *)
fs [sem_expr_correct],
(* there is no such t' in the program *)
fs [example_spectre_OoO_1] >> fs [],
(* there is no such t' in str-may-addr *)
fs [example_spectre_OoO_1] >> fs [str_may_addr]
]
]
)
val example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac4 = (
(* when t = ta' *)
PAT_ASSUM ``i_assign t' c' (o_store res_MEM ta' tv') IN _``
(fn thm => ASSUME_TAC (MATCH_MP str_may_addr_in_I thm)) >>
`i_assign t' c' (o_store res_MEM ta' tv') IN I0' \/
i_assign t' c' (o_store res_MEM ta' tv') IN
example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* it is impossible that t' is in I0', because t = ta' < t' would not be in the program then *)
`t' IN bound_names_program I0'` by METIS_TAC [instr_in_bound_names_program] >>
`t < t'` by METIS_TAC [well_formed_store_lt] >>
`t IN bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)`
by fs [example_spectre_OoO_1_bn] >>
`t' < t` by METIS_TAC [names_lt] >>
fs [],
(* when t' is in the program *)
FIRST_PROVE [
(* show v1 = v2 *)
fs [sem_expr_correct],
(* there is no such t' in the program *)
fs [example_spectre_OoO_1] >> fs [],
(* there is no such t' in str-may-addr *)
fs [example_spectre_OoO_1] >> fs [str_may_addr]
]
]
)
Theorem example_spectre_OoO_1_str_may_act_addr_preserving_t41[local]:
! t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2 I0 I0' s1 s2 C1 C2 F1 F2 t v1 v2 .
(t = t00 /\ sem_expr (e_val val_zero) s1 = SOME v1 /\ sem_expr (e_val val_zero) s2 = SOME v2) \/
t = t01 \/ t = t02 \/ t = t03 \/ t = t04 \/ t = t05 \/ t = t11 \/ t = t12 \/
t = t21 \/ t = t22 \/ t = t23 \/ t = t31 \/ t = t32 \/ t = t41 \/ t = t42 \/ t = t43 ==>
t00 < t01 /\ t01 < t02 /\ t02 < t03 /\ t03 < t04 /\ t04 < t05 /\ t05 < t11 /\ t11 < t12 /\ t12 < t21 /\
t21 < t22 /\ t22 < t23 /\ t23 < t31 /\ t31 < t32 /\ t32 < t41 /\ t41 < t42 /\ t42 < t43 ==>
well_formed_state
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1) ==>
well_formed_state
(State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s2 C2 F2) ==>
bound_names_program I0 <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
bound_names_program I0' <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
(!i. i IN I0 ==>
Completed (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) i) ==>
(!i. i IN I0' ==>
Completed (State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s2 C2 F2) i) ==>
str_may_act_addr_preserving
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1)
(State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s2 C2 F2)
t41 res_PC val_zero t v1 v2
Proof
REPEAT STRIP_TAC >>
REWRITE_TAC [str_may_act_addr_preserving] >> (
REPEAT STRIP_TAC >| [
example_spectre_OoO_1_str_may_act_addr_preserving_PC_tac1,
example_spectre_OoO_1_str_may_act_addr_preserving_PC_tac1,
example_spectre_OoO_1_str_may_act_addr_preserving_PC_tac3,
example_spectre_OoO_1_str_may_act_addr_preserving_PC_tac2,
example_spectre_OoO_1_str_may_act_addr_preserving_PC_tac2,
example_spectre_OoO_1_str_may_act_addr_preserving_PC_tac4
])
QED
Theorem example_spectre_OoO_1_str_may_act_addr_preserving_t22[local]:
! t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2 I0 I0' s1 s2 C1 C2 F1 F2 t v1 v2 ts_z .
(t = t01 /\ sem_expr (e_val r1) s1 = SOME v1 /\ sem_expr (e_val r1) s2 = SOME v2) \/
t = t00 \/ t = t02 \/ t = t03 \/ t = t04 \/ t = t05 \/ t = t11 \/ t = t12 \/
(t = t21 /\ FLOOKUP s1 ts_z = SOME v1 /\ FLOOKUP s2 ts_z = SOME v2) \/
t = t22 \/ t = t23 \/ t = t31 \/ t = t32 \/ t = t41 \/ t = t42 \/ t = t43 ==>
t00 < t01 /\ t01 < t02 /\ t02 < t03 /\ t03 < t04 /\ t04 < t05 /\ t05 < t11 /\ t11 < t12 /\ t12 < t21 /\
t21 < t22 /\ t22 < t23 /\ t23 < t31 /\ t31 < t32 /\ t32 < t41 /\ t41 < t42 /\ t42 < t43 ==>
well_formed_state
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1) ==>
well_formed_state
(State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s2 C2 F2) ==>
bound_names_program I0 <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
bound_names_program I0' <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
(!i. i IN I0 ==>
Completed (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) i) /\
(!i. i IN I0' ==>
Completed (State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s2 C2 F2) i) ==>
FLOOKUP s1 ts_z = FLOOKUP s2 ts_z ==>
str_may_act_addr_preserving
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1)
(State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s2 C2 F2)
t22 res_REG r1 t v1 v2
Proof
REPEAT STRIP_TAC >>
REWRITE_TAC [str_may_act_addr_preserving] >> (
REPEAT STRIP_TAC >| [
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac1,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac1,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac3,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac2,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac2,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac4
] >>
(* when t = ta' = t21, there is no such t' in str-may-addr *)
fs [example_spectre_OoO_1] >> fs [str_may_addr])
QED
Theorem example_spectre_OoO_1_str_may_act_addr_preserving_t31[local]:
! t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2 I0 I0' s1 s2 C1 C2 F1 F2 t v1 v2 ts_z .
(t = t02 /\ sem_expr (e_val r2) s1 = SOME v1 /\ sem_expr (e_val r2) s2 = SOME v2) \/
t = t00 \/
(t = t01 /\ sem_expr (e_val r1) s1 = SOME v1 /\ sem_expr (e_val r1) s2 = SOME v2) \/
t = t03 \/ t = t04 \/ t = t05 \/ t = t11 \/ t = t12 \/
(t = t21 /\ FLOOKUP s1 ts_z = SOME v1 /\ FLOOKUP s2 ts_z = SOME v2) \/
t = t22 \/ t = t23 \/ t = t31 \/ t = t32 \/ t = t41 \/ t = t42 \/ t = t43 ==>
t00 < t01 /\ t01 < t02 /\ t02 < t03 /\ t03 < t04 /\ t04 < t05 /\ t05 < t11 /\ t11 < t12 /\ t12 < t21 /\
t21 < t22 /\ t22 < t23 /\ t23 < t31 /\ t31 < t32 /\ t32 < t41 /\ t41 < t42 /\ t42 < t43 ==>
well_formed_state
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1) ==>
well_formed_state
(State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s2 C2 F2) ==>
bound_names_program I0 <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
bound_names_program I0' <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
(!i. i IN I0 ==>
Completed (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) i) /\
(!i. i IN I0' ==>
Completed (State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s2 C2 F2) i) ==>
FLOOKUP s1 ts_z = FLOOKUP s2 ts_z ==>
FLOOKUP s1 t21 = FLOOKUP s2 t21 ==>
str_may_act_addr_preserving
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1)
(State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s2 C2 F2)
t31 res_REG r2 t v1 v2
Proof
REPEAT STRIP_TAC >>
REWRITE_TAC [str_may_act_addr_preserving] >> (
REPEAT STRIP_TAC >| [
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac1,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac1,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac3,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac2,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac2,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac4
])
QED
Theorem example_spectre_OoO_1_str_may_act_addr_preserving_t21[local]:
! t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2 I0 I0' s1 s2 C1 C2 F1 F2 t v1 v2 .
t = t00 \/
(t = t01 /\ sem_expr (e_val r1) s1 = SOME v1 /\ sem_expr (e_val r1) s2 = SOME v2) \/
t = t02 \/ t = t03 \/ t = t04 \/ t = t05 \/ t = t11 \/ t = t12 \/ t = t21 \/
t = t22 \/ t = t23 \/ t = t31 \/ t = t32 \/ t = t41 \/ t = t42 \/ t = t43 ==>
t00 < t01 /\ t01 < t02 /\ t02 < t03 /\ t03 < t04 /\ t04 < t05 /\ t05 < t11 /\ t11 < t12 /\ t12 < t21 /\
t21 < t22 /\ t22 < t23 /\ t23 < t31 /\ t31 < t32 /\ t32 < t41 /\ t41 < t42 /\ t42 < t43 ==>
well_formed_state
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1) ==>
well_formed_state
(State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s2 C2 F2) ==>
bound_names_program I0 <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
bound_names_program I0' <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
(!i. i IN I0 ==>
Completed (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) i) /\
(!i. i IN I0' ==>
Completed (State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s2 C2 F2) i) ==>
str_may_act_addr_preserving
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1)
(State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s2 C2 F2)
t21 res_REG z t v1 v2
Proof
REPEAT STRIP_TAC >>
REWRITE_TAC [str_may_act_addr_preserving] >> (
REPEAT STRIP_TAC >| [
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac1,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac1,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac3,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac2,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac2,
example_spectre_OoO_1_str_may_act_addr_preserving_REG_tac4
] >>
fs [example_spectre_OoO_1] >> fs [str_may_addr])
QED
Theorem example_spectre_OoO_1_str_may_act_addr_preserving_t11[local]:
! t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2 I0 I0' s1 s2 C1 C2 F1 F2 t v1 v2 .
t = t00 \/ t = t01 \/ t = t02 \/ t = t03 \/ t = t04 \/ t = t05 \/ t = t11 \/ t = t12 \/
t = t21 \/ t = t22 \/ t = t23 \/ t = t31 \/ t = t32 \/ t = t41 \/ t = t42 \/ t = t43 ==>
t00 < t01 /\ t01 < t02 /\ t02 < t03 /\ t03 < t04 /\ t04 < t05 /\ t05 < t11 /\ t11 < t12 /\ t12 < t21 /\
t21 < t22 /\ t22 < t23 /\ t23 < t31 /\ t31 < t32 /\ t32 < t41 /\ t41 < t42 /\ t42 < t43 ==>
well_formed_state
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1) ==>
well_formed_state
(State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s2 C2 F2) ==>
bound_names_program I0 <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
bound_names_program I0' <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
(!i. i IN I0 ==>
Completed (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) i) /\
(!i. i IN I0' ==>
Completed (State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s2 C2 F2) i) ==>
str_may_act_addr_preserving
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1)
(State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s2 C2 F2)
t11 res_MEM b1 t v1 v2
Proof
REPEAT STRIP_TAC >>
REWRITE_TAC [str_may_act_addr_preserving] >> (
REPEAT STRIP_TAC >| [
example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac1,
example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac1,
example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac3,
example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac2,
example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac2,
example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac4
])
QED
Theorem example_spectre_OoO_1_str_may_act_addr_preserving_t32[local]:
! t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2 I0 I0' s1 s2 C1 C2 F1 F2 t v1 v2 .
t = t00 \/ t = t01 \/ t = t02 \/ t = t03 \/ t = t04 \/ t = t05 \/ t = t11 \/ t = t12 \/
t = t21 \/ t = t22 \/ t = t23 \/ t = t31 \/ t = t32 \/ t = t41 \/ t = t42 \/ t = t43 ==>
t00 < t01 /\ t01 < t02 /\ t02 < t03 /\ t03 < t04 /\ t04 < t05 /\ t05 < t11 /\ t11 < t12 /\ t12 < t21 /\
t21 < t22 /\ t22 < t23 /\ t23 < t31 /\ t31 < t32 /\ t32 < t41 /\ t41 < t42 /\ t42 < t43 ==>
well_formed_state
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1) ==>
well_formed_state
(State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s2 C2 F2) ==>
bound_names_program I0 <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
bound_names_program I0' <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
(!i. i IN I0 ==>
Completed (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) i) /\
(!i. i IN I0' ==>
Completed (State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s2 C2 F2) i) ==>
str_may_act_addr_preserving
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1)
(State_st (I0' UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s2 C2 F2)
t32 res_MEM b2 t v1 v2
Proof
REPEAT STRIP_TAC >>
REWRITE_TAC [str_may_act_addr_preserving] >> (
REPEAT STRIP_TAC >| [
example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac1,
example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac1,
example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac3,
example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac2,
example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac2,
example_spectre_OoO_1_str_may_act_addr_preserving_MEM_tac4
])
QED
(* ------------------- *)
(* Lemmas for executes *)
(* ------------------- *)
(* TODO: use REPEAT STRIP_TAC *)
Theorem example_spectre_OoO_1_ts_in_str_act_addr_t41_update[local]:
! t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2 I0 ts_pc s1 C1 F1 t v1 .
t = t00 \/ t = t01 \/ t = t02 \/ t = t03 \/ t = t04 \/ t = t05 \/ t = t11 \/ t = t12 \/
t = t21 \/ t = t22 \/ t = t23 \/ t = t31 \/ t = t32 \/ t = t41 \/ t = t42 \/ t = t43 ==>
t00 < t01 /\ t01 < t02 /\ t02 < t03 /\ t03 < t04 /\ t04 < t05 /\ t05 < t11 /\ t11 < t12 /\ t12 < t21 /\
t21 < t22 /\ t22 < t23 /\ t23 < t31 /\ t31 < t32 /\ t32 < t41 /\ t41 < t42 /\ t42 < t43 ==>
well_formed_state
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1) ==>
bound_names_program I0 <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
(!i. i IN I0 ==>
Completed (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) i) ==>
ts_pc IN bound_names_program I0 ==>
ts_pc IN bound_names_program
(str_act_addr (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) t41 res_PC val_zero) ==>
t NOTIN FDOM s1 ==>
ts_pc IN bound_names_program
(str_act_addr (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
(s1 |+ (t, v1)) C1 F1) t41 res_PC val_zero)
Proof
rw [] >>>
TACS_TO_LT [
Q.ABBREV_TAC `t00 = t`,
Q.ABBREV_TAC `t01 = t`,
Q.ABBREV_TAC `t02 = t`,
Q.ABBREV_TAC `t03 = t`,
Q.ABBREV_TAC `t04 = t`,
Q.ABBREV_TAC `t05 = t`,
Q.ABBREV_TAC `t11 = t`,
Q.ABBREV_TAC `t12 = t`,
Q.ABBREV_TAC `t21 = t`,
Q.ABBREV_TAC `t22 = t`,
Q.ABBREV_TAC `t23 = t`,
Q.ABBREV_TAC `t31 = t`,
Q.ABBREV_TAC `t32 = t`,
Q.ABBREV_TAC `t41 = t`,
Q.ABBREV_TAC `t42 = t`,
Q.ABBREV_TAC `t43 = t`] >>
`Completed_t (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) ts_pc`
by (
(* we know that ts_pc is IN I0 *)
`?c mop. i_assign ts_pc c mop IN I0` by fs [bound_names_program_in_instr] >>
(* so ts_pc is completed *)
`Completed (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) (i_assign ts_pc c mop)`
by fs [] >>
`bound_name_instr (i_assign ts_pc c mop) = ts_pc` by fs [bound_name_instr] >>
`i_assign ts_pc c mop IN I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [] >>
METIS_TAC [Completed_t]) >> (
(* it is sufficient to show that there exists no overwriting store t'' *)
`~(? t'' c'' ta'' tv'' .
i_assign t'' c'' (o_store res_PC ta'' tv'') IN
str_may_addr (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
(s1 |+ (t, v1)) C1 F1) t41 res_PC val_zero /\
t'' > ts_pc /\
(?v. sem_expr c'' (s1 |+ (t, v1)) = SOME v /\ v <> val_false) /\
FLOOKUP (s1 |+ (t, v1)) ta'' = SOME val_zero)`
suffices_by METIS_TAC [wfs_completed_t_in_bn_str_act_addr_fupdate] >>
rw [] >>
Cases_on `i_assign t'' c'' (o_store res_PC ta'' tv'') NOTIN
str_may_addr (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
(s1 |+ (t,v1)) C1 F1) t41 res_PC val_zero` >- METIS_TAC [] >>
rw [] >>
`i_assign t'' c'' (o_store res_PC ta'' tv'') IN
I0 UNION example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by METIS_TAC [str_may_addr_in_I] >>
`i_assign t'' c'' (o_store res_PC ta'' tv'') IN I0 \/
i_assign t'' c'' (o_store res_PC ta'' tv'') IN example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* when t'' is in I0 *)
Cases_on `~(t'' > ts_pc)` >- fs [] >>
Cases_on `!v. sem_expr c'' (s1 |+ (t,v1)) = SOME v ==> v = val_false` >- fs [] >>
rw [] >>
(* show contradiction *)
`?c mop. i_assign ts_pc c mop IN
str_act_addr (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) t41 res_PC val_zero`
by fs [bound_names_program_in_instr] >>
`i_assign ts_pc c mop IN
str_may_addr (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) t41 res_PC val_zero`
by fs [str_act_addr] >>
`? ta tv . mop = o_store res_PC ta tv` by fs [str_may_addr] >>
`i_assign ts_pc c (o_store res_PC ta tv) IN
str_act_addr (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) t41 res_PC val_zero`
by rw [] >>
`i_assign ts_pc c (o_store res_PC ta tv) IN
str_may_addr (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) t41 res_PC val_zero`
by fs [str_act_addr] >>
`i_assign t'' c'' (o_store res_PC ta'' tv'') IN
str_may_addr (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) t41 res_PC val_zero`
by METIS_TAC [str_may_addr_monotonicity_s, SUBSET_DEF] >>
`t'' IN bound_names_program I0` by METIS_TAC [instr_in_bound_names_program] >>
`t'' < t`
by (
`t IN bound_names_program (example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)`
by fs [example_spectre_OoO_1_bn] >>
METIS_TAC [names_lt]) >>
(* show [c'']s1 *)
`?v. sem_expr c'' (s1 |+ (t,v1)) = SOME v /\ v <> val_false` by fs [] >>
`t > t''` by fs [] >>
`t NOTIN names_e c''` by METIS_TAC [well_formed_greater_name_notin_names_e] >>
`?v. sem_expr c'' s1 = SOME v /\ v <> val_false` by fs [sem_expr_notin_names_fupdate_eq] >>
(* show [ta'']s1 = val_zero *)
`ta'' < t''` by METIS_TAC [well_formed_store_lt] >>
`ta'' <> t` by fs [] >>
`FLOOKUP s1 ta'' = SOME val_zero` by METIS_TAC [FLOOKUP_UPDATE] >>
(* but then ts_pc could not be in str-act-addr, contradiction *)
METIS_TAC [str_act_addr_successor],
(* the only possible PC store is t43 *)
`t'' = t43` by fs [example_spectre_OoO_1] >>
(* but it cannot be in str-may-addr *)
`t'' < t41` by fs [str_may_addr] >>
fs []
]
)
QED
Theorem example_spectre_OoO_1_ts_in_str_act_addr_t21_update[local]:
! t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2 I0 ts_z s1 C1 F1 t v1 .
t = t00 \/ (t = t01 /\ v1 = r1) \/ t = t02 \/ t = t03 \/ t = t04 \/ t = t05 \/ t = t11 \/ t = t12 \/
t = t21 \/ t = t22 \/ t = t23 \/ t = t31 \/ t = t32 \/ t = t41 \/ t = t42 \/ t = t43 ==>
t00 < t01 /\ t01 < t02 /\ t02 < t03 /\ t03 < t04 /\ t04 < t05 /\ t05 < t11 /\ t11 < t12 /\ t12 < t21 /\
t21 < t22 /\ t22 < t23 /\ t23 < t31 /\ t31 < t32 /\ t32 < t41 /\ t41 < t42 /\ t42 < t43 ==>
r1 <> z ==>
well_formed_state
(State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) s1 C1 F1) ==>
bound_names_program I0 <
bound_names_program
(example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2) ==>
(!i. i IN I0 ==>
Completed (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) i) ==>
ts_z IN bound_names_program I0 ==>
ts_z IN bound_names_program
(str_act_addr (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) t21 res_REG z) ==>
t NOTIN FDOM s1 ==>
ts_z IN bound_names_program
(str_act_addr (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
(s1 |+ (t, v1)) C1 F1) t21 res_REG z)
Proof
rw [] >>>
TACS_TO_LT [
Q.ABBREV_TAC `t00 = t`,
Q.ABBREV_TAC `t01 = t` >> Q.ABBREV_TAC `v1 = r1`,
Q.ABBREV_TAC `t02 = t`,
Q.ABBREV_TAC `t03 = t`,
Q.ABBREV_TAC `t04 = t`,
Q.ABBREV_TAC `t05 = t`,
Q.ABBREV_TAC `t11 = t`,
Q.ABBREV_TAC `t12 = t`,
Q.ABBREV_TAC `t21 = t`,
Q.ABBREV_TAC `t22 = t`,
Q.ABBREV_TAC `t23 = t`,
Q.ABBREV_TAC `t31 = t`,
Q.ABBREV_TAC `t32 = t`,
Q.ABBREV_TAC `t41 = t`,
Q.ABBREV_TAC `t42 = t`,
Q.ABBREV_TAC `t43 = t`] >>
`Completed_t (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) ts_z`
by (
(* we know that ts_z is IN I0 *)
`?c mop. i_assign ts_z c mop IN I0` by fs [bound_names_program_in_instr] >>
(* so ts_z is completed *)
`Completed (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
s1 C1 F1) (i_assign ts_z c mop)`
by fs [] >>
`bound_name_instr (i_assign ts_z c mop) = ts_z` by fs [bound_name_instr] >>
`i_assign ts_z c mop IN I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [] >>
METIS_TAC [Completed_t]) >> (
(* it is sufficient to show that there exists no overwriting store t'' *)
`~(? t'' c'' ta'' tv'' .
i_assign t'' c'' (o_store res_REG ta'' tv'') IN
str_may_addr (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
(s1 |+ (t, v1)) C1 F1) t21 res_REG z /\
t'' > ts_z /\
(?v. sem_expr c'' (s1 |+ (t, v1)) = SOME v /\ v <> val_false) /\
FLOOKUP (s1 |+ (t, v1)) ta'' = SOME z)`
suffices_by METIS_TAC [wfs_completed_t_in_bn_str_act_addr_fupdate] >>
rw [] >>
Cases_on `i_assign t'' c'' (o_store res_REG ta'' tv'') NOTIN
str_may_addr (State_st (I0 UNION example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2)
(s1 |+ (t,v1)) C1 F1) t21 res_REG z` >- METIS_TAC [] >>
rw [] >>
`i_assign t'' c'' (o_store res_REG ta'' tv'') IN
I0 UNION example_spectre_OoO_1 t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by METIS_TAC [str_may_addr_in_I] >>
`i_assign t'' c'' (o_store res_REG ta'' tv'') IN I0 \/
i_assign t'' c'' (o_store res_REG ta'' tv'') IN example_spectre_OoO_1
t00 t01 t02 t03 t04 t05 t11 t12 t21 t22 t23 t31 t32 t41 t42 t43 r1 r2 z b1 b2`
by fs [UNION_DEF] >| [
(* when t'' is in I0 *)
Cases_on `~(t'' > ts_z)` >- fs [] >>