-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmilCakeProofScript.sml
1144 lines (1046 loc) · 43.6 KB
/
milCakeProofScript.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 preamble ml_translatorLib ml_translatorTheory ml_progLib ml_progTheory mllistTheory mlmapTheory mlprettyprinterTheory comparisonTheory totoTheory milTheory milExecutableUtilityTheory milExecutableTransitionTheory milExecutableInitializationTheory milExecutableIOTheory milExecutableIOTraceTheory milExecutableExamplesTheory basisFunctionsLib Word64ProgTheory milCakeTheory;
(* ================================================= *)
(* Refinement proofs for CakeML executable functions *)
(* ================================================= *)
val _ = new_theory "milCakeProof";
(* --------------------- *)
(* Auxiliary definitions *)
(* --------------------- *)
Theorem str_may_list_find_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!l s t r ta. map_ok s ==>
str_may_list_find_cake f l s t r ta =
str_may_list_find f' l (to_fmap s) t r ta
Proof
strip_tac \\ strip_tac \\ strip_tac \\
Induct_on `l` \\ rw [str_may_list_find_cake,str_may_list_find] \\
fs [sem_expr_cake_ok] \\
Cases_on `h` \\ rename1 `i_assign t' c' mop` \\
Cases_on `mop` \\ rw [str_may_list_find_cake,str_may_list_find,lookup_thm]
QED
Theorem str_act_list_cond_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!l s t r ta ta'. map_ok s ==>
str_act_list_cond_cake f l s t r ta ta' =
str_act_list_cond f' l (to_fmap s) t r ta ta'
Proof
strip_tac \\ strip_tac \\ strip_tac \\
Induct_on `l` \\ rw [] \\
rw [str_act_list_cond_cake,str_act_list_cond] \\
fs [sem_expr_cake_ok] \\
Cases_on `h` \\ rename1 `i_assign t' c' mop` \\
Cases_on `mop` \\ rw [str_act_list_cond_cake,str_act_list_cond] \\
Cases_on `f c' s` \\ Cases_on `f' c' (to_fmap s)` \\ fs [] >-
(`f' c' (to_fmap s) = NONE` by METIS_TAC [] \\ fs []) \\
`SOME x = SOME x'` by METIS_TAC [] \\ rw [] \\
rw [lookup_thm]
QED
Theorem str_act_list_find_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!l s r ta l'. map_ok s ==>
str_act_list_find_cake f l s r ta l' =
str_act_list_find f' l (to_fmap s) r ta l'
Proof
strip_tac \\ strip_tac \\ strip_tac \\
Induct_on `l` \\ rw [str_act_list_find_cake,str_act_list_find] \\
Cases_on `h` \\ rename1 `i_assign t' c' mop` \\
Cases_on `mop` \\ rw [str_act_list_find_cake,str_act_list_find] \\
METIS_TAC [str_act_list_cond_eq_cake]
QED
Theorem str_may_list_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!stlc t. State_list_cake_ok stlc ==>
str_may_list_cake f stlc t =
str_may_list f' (state_list_cake_to_state_list stlc) t
Proof
strip_tac \\ strip_tac \\ strip_tac \\
Cases_on `stlc` \\ rename1 `State_st_list_cake l st cs fs` \\
rw [str_may_list_cake,str_may_list,state_list_cake_to_state_list,State_list_cake_ok] \\
METIS_TAC [str_may_list_find_eq_cake]
QED
Theorem str_act_list_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!stlc t. State_list_cake_ok stlc ==>
str_act_list_cake f stlc t =
str_act_list f' (state_list_cake_to_state_list stlc) t
Proof
strip_tac \\ strip_tac \\ strip_tac \\
Cases_on `stlc` \\ rename1 `State_st_list_cake l st cs fs` \\
rw [str_act_list_cake,str_act_list,state_list_cake_to_state_list] \\
METIS_TAC [
str_may_list_eq_cake,
str_act_list_find_eq_cake,
state_list_cake_to_state_list,
State_list_cake_ok
]
QED
Theorem sem_instr_exe_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!stlc. State_list_cake_ok stlc ==>
!i. sem_instr_exe_cake f i stlc = sem_instr_exe f' i (state_list_cake_to_state_list stlc)
Proof
strip_tac \\ strip_tac \\ strip_tac \\ strip_tac \\ strip_tac \\
Cases_on `i` \\ rename1 `i_assign t c mop` \\
Cases_on `mop` \\ rw [sem_instr_exe_cake,sem_instr_exe,lookup_thm] \\
`bound_names_program_list (str_act_list_cake f stlc t) =
bound_names_program_list (str_act_list f' (state_list_cake_to_state_list stlc) t)`
by METIS_TAC [str_act_list_eq_cake] \\
Cases_on `stlc` \\ rename1 `State_st_list_cake l st cs fs` \\
fs [sem_instr_exe_cake,sem_instr_exe,lookup_thm,state_list_cake_to_state_list,State_list_cake_ok,sem_expr_cake_ok] \\
Cases_on `r` \\
fs [
sem_instr_exe_cake,
sem_instr_exe,
lookup_thm,
str_act_list_eq_cake,
MEMBER_INTRO,
State_list_cake_ok
]
QED
Theorem Completed_list_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!stlc. State_list_cake_ok stlc ==>
!i. Completed_list_cake f stlc i = Completed_list f' (state_list_cake_to_state_list stlc) i
Proof
strip_tac \\ strip_tac \\ strip_tac \\
Cases_on `stlc` \\ rename1 `State_st_list_cake l st cs fs` \\
rw [State_list_cake_ok] \\ Cases_on `i` \\ rename1 `i_assign t c mop` \\
Cases_on `mop` \\
fs [Completed_list_cake,Completed_list,lookup_thm,MEMBER_INTRO,state_list_cake_to_state_list,sem_expr_cake_ok] \\
Cases_on `r` \\
rw [Completed_list_cake,Completed_list,lookup_thm,MEMBER_INTRO]
QED
(* ------------------------ *)
(* Initialization functions *)
(* ------------------------ *)
Theorem empty_state_list_eq_cake:
state_list_cake_to_state_list empty_state_list_cake = empty_state_list
Proof
rw [state_list_cake_to_state_list,empty_state_list_cake,empty_state_list] \\
`TotOrd num_cmp` suffices_by rw [mlmapTheory.empty_thm] \\
rw [num_cmp_numOrd,TO_numOrd]
QED
Theorem initialize_resource_at_list_eq_cake:
!stlc r a v t t' t''. State_list_cake_ok stlc ==>
state_list_cake_to_state_list (initialize_resource_at_list_cake stlc r a v t t' t'') =
initialize_resource_at_list (state_list_cake_to_state_list stlc) r a v t t' t''
Proof
Cases_on `stlc` \\ Cases_on `r` \\
rw [
State_list_cake_ok,
state_list_cake_to_state_list,
initialize_resource_at_list_cake,
initialize_resource_at_list,
insert_thm
]
QED
Theorem initialize_pc_without_fetch_at_list_eq_cake:
!stlc a v t t' t''. State_list_cake_ok stlc ==>
state_list_cake_to_state_list (initialize_pc_without_fetch_at_list_cake stlc a v t t' t'') =
initialize_pc_without_fetch_at_list (state_list_cake_to_state_list stlc) a v t t' t''
Proof
Cases_on `stlc` \\
rw [
State_list_cake_ok,
state_list_cake_to_state_list,
initialize_pc_without_fetch_at_list_cake,
initialize_pc_without_fetch_at_list,
insert_thm
]
QED
(* -------------------- *)
(* Transition functions *)
(* -------------------- *)
Theorem OoO_step_name_eq_cake:
!step_list step_list_cake stlc t.
(!i. option_ll_state_list_cake_to_ll_state_list (step_list_cake stlc i) =
step_list (state_list_cake_to_state_list stlc) i) ==>
option_ll_state_list_cake_to_ll_state_list (OoO_step_name_cake step_list_cake stlc t) =
OoO_step_name step_list (state_list_cake_to_state_list stlc) t
Proof
STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\
Cases_on `stlc` \\
rw [
OoO_step_name,
OoO_step_name_cake
] \\
Cases_on `FIND_instr t l` \\
rw [
option_ll_state_list_cake_to_ll_state_list,
OoO_step_name,
state_list_cake_to_state_list
]
QED
Theorem OoO_Exe_list_instr_not_stored_guard_true_sem_instr_eq_cake:
!stlc i v obs. State_list_cake_ok stlc ==>
ll_state_list_cake_to_ll_state_list (OoO_Exe_list_instr_not_stored_guard_true_sem_instr_cake stlc i v obs) =
OoO_Exe_list_instr_not_stored_guard_true_sem_instr (state_list_cake_to_state_list stlc) i v obs
Proof
Cases_on `stlc` \\ Cases_on `i` \\
rw [
State_list_cake_ok,
ll_state_list_cake_to_ll_state_list,
state_list_cake_to_state_list,
OoO_Exe_list_instr_not_stored_guard_true_sem_instr_cake,
OoO_Exe_list_instr_not_stored_guard_true_sem_instr,
insert_thm
]
QED
Theorem OoO_Exe_list_instr_not_stored_guard_true_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!stlc i. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_Exe_list_instr_not_stored_guard_true_cake f stlc i) =
OoO_Exe_list_instr_not_stored_guard_true f' (state_list_cake_to_state_list stlc) i
Proof
STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\
`sem_instr_exe_cake f i stlc = sem_instr_exe f' i (state_list_cake_to_state_list stlc)`
by rw [sem_instr_exe_eq_cake] \\
Cases_on `stlc` \\
rename1 `State_st_list_cake l st cs fs` \\
fs [
state_list_cake_to_state_list,
OoO_Exe_list_instr_not_stored_guard_true_cake,
OoO_Exe_list_instr_not_stored_guard_true,
sem_expr_cake_ok
] \\
Cases_on `sem_instr_exe f' i (State_st_list l (to_fmap st) cs fs)` \\
rw [option_ll_state_list_cake_to_ll_state_list] \\
Cases_on `x` \\
rw [
option_ll_state_list_cake_to_ll_state_list,
OoO_Exe_list_instr_not_stored_guard_true_sem_instr_eq_cake,
state_list_cake_to_state_list
]
QED
Theorem OoO_Exe_list_instr_not_stored_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!stlc i. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_Exe_list_instr_not_stored_cake f stlc i) =
OoO_Exe_list_instr_not_stored f' (state_list_cake_to_state_list stlc) i
Proof
STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\
`option_ll_state_list_cake_to_ll_state_list (OoO_Exe_list_instr_not_stored_guard_true_cake f stlc i) =
OoO_Exe_list_instr_not_stored_guard_true f' (state_list_cake_to_state_list stlc) i`
by rw [OoO_Exe_list_instr_not_stored_guard_true_eq_cake] \\
Cases_on `stlc` \\ Cases_on `i` \\
rename1 `State_st_list_cake l st cs fs` \\
rename1 `i_assign t c op` \\
fs [
sem_expr_cake_ok,
State_list_cake_ok,
state_list_cake_to_state_list,
OoO_Exe_list_instr_not_stored_cake,
OoO_Exe_list_instr_not_stored
] \\
Cases_on `f' c (to_fmap st)` \\
rw [option_ll_state_list_cake_to_ll_state_list]
QED
Theorem OoO_Exe_list_instr_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!stlc i. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_Exe_list_instr_cake f stlc i) =
OoO_Exe_list_instr f' (state_list_cake_to_state_list stlc) i
Proof
STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\
`option_ll_state_list_cake_to_ll_state_list (OoO_Exe_list_instr_not_stored_cake f stlc i) =
OoO_Exe_list_instr_not_stored f' (state_list_cake_to_state_list stlc) i`
by rw [OoO_Exe_list_instr_not_stored_eq_cake] \\
Cases_on `stlc` \\ Cases_on `i` \\
rename1 `State_st_list_cake l st cs fs` \\
rename1 `i_assign t c op` \\
fs [
sem_expr_cake_ok,
State_list_cake_ok,
OoO_Exe_list_instr_cake,
OoO_Exe_list_instr,
state_list_cake_to_state_list,
lookup_thm
] \\
Cases_on `FLOOKUP (to_fmap st) t` \\
rw [option_ll_state_list_cake_to_ll_state_list]
QED
Theorem OoO_Exe_list_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!stlc t. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_Exe_list_cake f stlc t) =
OoO_Exe_list f' (state_list_cake_to_state_list stlc) t
Proof
STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\
`!i. option_ll_state_list_cake_to_ll_state_list (OoO_Exe_list_instr_cake f stlc i) =
OoO_Exe_list_instr f' (state_list_cake_to_state_list stlc) i`
by rw [OoO_Exe_list_instr_eq_cake] \\
Cases_on `stlc` \\
rename1 `State_st_list_cake l st cs fs` \\
rw [OoO_Exe_list_cake,OoO_Exe_list,OoO_step_name_eq_cake]
QED
Theorem OoO_Cmt_list_stored_incomplete_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!stlc t ta tv. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_Cmt_list_stored_incomplete_cake f stlc t ta tv) =
OoO_Cmt_list_stored_incomplete f' (state_list_cake_to_state_list stlc) t ta tv
Proof
STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\
STRIP_TAC \\ STRIP_TAC \\
`!t. str_may_list_cake f stlc t = str_may_list f' (state_list_cake_to_state_list stlc) t`
by rw [str_may_list_eq_cake] \\
Cases_on `stlc` \\
rename1 `State_st_list_cake l st cs fs` \\
fs [
OoO_Cmt_list_stored_incomplete_cake,
OoO_Cmt_list_stored_incomplete,
State_list_cake_ok,
lookup_thm,
state_list_cake_to_state_list,
MEMBER_INTRO
] \\
Cases_on `FLOOKUP (to_fmap st) ta` \\
Cases_on `FLOOKUP (to_fmap st) tv` \\
Cases_on `str_may_list f' (State_st_list l (to_fmap st) cs fs) t` \\
rw [
option_ll_state_list_cake_to_ll_state_list,
ll_state_list_cake_to_ll_state_list,
state_list_cake_to_state_list
]
QED
Theorem OoO_Cmt_list_stored_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!stlc t ta tv. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_Cmt_list_stored_cake f stlc t ta tv) =
OoO_Cmt_list_stored f' (state_list_cake_to_state_list stlc) t ta tv
Proof
rw [] \\ Cases_on `stlc` \\
rw [
OoO_Cmt_list_stored_cake,
OoO_Cmt_list_stored,
option_ll_state_list_cake_to_ll_state_list,
state_list_cake_to_state_list,
MEMBER_INTRO
] \\
METIS_TAC [
OoO_Cmt_list_stored_incomplete_eq_cake,
state_list_cake_to_state_list
]
QED
Theorem OoO_Cmt_list_instr_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!stlc i. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_Cmt_list_instr_cake f stlc i) =
OoO_Cmt_list_instr f' (state_list_cake_to_state_list stlc) i
Proof
rw [] \\
`!t ta tv. option_ll_state_list_cake_to_ll_state_list (OoO_Cmt_list_stored_cake f stlc t ta tv) =
OoO_Cmt_list_stored f' (state_list_cake_to_state_list stlc) t ta tv`
by rw [OoO_Cmt_list_stored_eq_cake] \\
Cases_on `stlc` \\ Cases_on `i` \\
rename1 `State_st_list_cake l st cs fs` \\
rename1 `i_assign t c op` \\
Cases_on `op` \\
rw [
OoO_Cmt_list_instr_cake,
OoO_Cmt_list_instr,
option_ll_state_list_cake_to_ll_state_list,
state_list_cake_to_state_list
] \\
Cases_on `r` \\
fs [
State_list_cake_ok,
OoO_Cmt_list_instr_cake,
OoO_Cmt_list_instr,
option_ll_state_list_cake_to_ll_state_list,
state_list_cake_to_state_list,
lookup_thm
] \\
Cases_on `FLOOKUP (to_fmap st) t` \\
rw [option_ll_state_list_cake_to_ll_state_list]
QED
Theorem OoO_Cmt_list_eq_cake:
!f f'. sem_expr_cake_ok f f' ==>
!stlc t. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_Cmt_list_cake f stlc t) =
OoO_Cmt_list f' (state_list_cake_to_state_list stlc) t
Proof
STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\
`!i. option_ll_state_list_cake_to_ll_state_list (OoO_Cmt_list_instr_cake f stlc i) =
OoO_Cmt_list_instr f' (state_list_cake_to_state_list stlc) i`
by rw [OoO_Cmt_list_instr_eq_cake] \\
Cases_on `stlc` \\
rename1 `State_st_list_cake l st cs fs` \\
rw [OoO_Cmt_list_cake,OoO_Cmt_list,OoO_step_name_eq_cake]
QED
Theorem OoO_Ftc_list_stored_incomplete_eq_cake:
!g f f'. sem_expr_cake_ok f f' ==>
!stlc t v. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_Ftc_list_stored_incomplete_cake g f stlc t v) =
OoO_Ftc_list_stored_incomplete g f' (state_list_cake_to_state_list stlc) t v
Proof
STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\
STRIP_TAC \\ STRIP_TAC \\
`!t. str_may_list_cake f stlc t = str_may_list f' (state_list_cake_to_state_list stlc) t`
by rw [str_may_list_eq_cake] \\
Cases_on `stlc` \\
rename1 `State_st_list_cake l st cs fs` \\
fs [
OoO_Ftc_list_stored_incomplete_cake,
OoO_Ftc_list_stored_incomplete,
State_list_cake_ok,
state_list_cake_to_state_list,
MEMBER_INTRO
] \\
Cases_on `str_may_list f' (State_st_list l (to_fmap st) cs fs) t` \\
rw [
option_ll_state_list_cake_to_ll_state_list,
ll_state_list_cake_to_ll_state_list,
state_list_cake_to_state_list
]
QED
Theorem OoO_Ftc_list_stored_eq_cake:
!g f f'. sem_expr_cake_ok f f' ==>
!stlc t v. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_Ftc_list_stored_cake g f stlc t v) =
OoO_Ftc_list_stored g f' (state_list_cake_to_state_list stlc) t v
Proof
rw [] \\
`option_ll_state_list_cake_to_ll_state_list (OoO_Ftc_list_stored_incomplete_cake g f stlc t v) =
OoO_Ftc_list_stored_incomplete g f' (state_list_cake_to_state_list stlc) t v`
by rw [OoO_Ftc_list_stored_incomplete_eq_cake] \\
Cases_on `stlc` \\
rename1 `State_st_list_cake l st cs fs` \\
fs [
option_ll_state_list_cake_to_ll_state_list,
OoO_Ftc_list_stored_cake,
OoO_Ftc_list_stored,
state_list_cake_to_state_list,
MEMBER_INTRO
] \\
Cases_on `MEMBER t fs` \\
rw [option_ll_state_list_cake_to_ll_state_list]
QED
Theorem OoO_Ftc_list_instr_eq_cake:
!g f f'. sem_expr_cake_ok f f' ==>
!stlc i. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_Ftc_list_instr_cake g f stlc i) =
OoO_Ftc_list_instr g f' (state_list_cake_to_state_list stlc) i
Proof
rw [] \\
`!t v. option_ll_state_list_cake_to_ll_state_list (OoO_Ftc_list_stored_cake g f stlc t v) =
OoO_Ftc_list_stored g f' (state_list_cake_to_state_list stlc) t v`
by rw [OoO_Ftc_list_stored_eq_cake] \\
Cases_on `stlc` \\ Cases_on `i` \\
rename1 `State_st_list_cake l st cs fs` \\
rename1 `i_assign t c op` \\
Cases_on `op` \\
rw [
OoO_Ftc_list_instr_cake,
OoO_Ftc_list_instr,
option_ll_state_list_cake_to_ll_state_list,
state_list_cake_to_state_list
] \\
Cases_on `r` \\
fs [
State_list_cake_ok,
OoO_Ftc_list_instr_cake,
OoO_Ftc_list_instr,
option_ll_state_list_cake_to_ll_state_list,
state_list_cake_to_state_list,
lookup_thm
] \\
Cases_on `FLOOKUP (to_fmap st) t` \\
rw [option_ll_state_list_cake_to_ll_state_list]
QED
Theorem OoO_Ftc_list_eq_cake:
!g f f'. sem_expr_cake_ok f f' ==>
!stlc i. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_Ftc_list_cake g f stlc i) =
OoO_Ftc_list g f' (state_list_cake_to_state_list stlc) i
Proof
STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\
`!i. option_ll_state_list_cake_to_ll_state_list (OoO_Ftc_list_instr_cake g f stlc i) =
OoO_Ftc_list_instr g f' (state_list_cake_to_state_list stlc) i`
by rw [OoO_Ftc_list_instr_eq_cake] \\
Cases_on `stlc` \\
rename1 `State_st_list_cake l st cs fs` \\
rw [OoO_Ftc_list_cake,OoO_Ftc_list,OoO_step_name_eq_cake]
QED
Theorem OoO_step_list_instr_eq_cake:
!g f f'. sem_expr_cake_ok f f' ==>
!stlc i. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_step_list_instr_cake g f stlc i) =
OoO_step_list_instr g f' (state_list_cake_to_state_list stlc) i
Proof
rw [] \\
Cases_on `stlc` \\ Cases_on `i` \\
rename1 `State_st_list_cake l st cs fs` \\
rename1 `i_assign t c mop` \\
Cases_on `mop` \\
fs [
OoO_step_list_instr_cake,
OoO_step_list_instr,
State_list_cake_ok,
lookup_thm,
state_list_cake_to_state_list
] \\
Cases_on `FLOOKUP (to_fmap st) t` \\
rw [option_ll_state_list_cake_to_ll_state_list] >| [
METIS_TAC [OoO_Exe_list_instr_not_stored_eq_cake,State_list_cake_ok,state_list_cake_to_state_list],
METIS_TAC [OoO_Exe_list_instr_not_stored_eq_cake,State_list_cake_ok,state_list_cake_to_state_list],
METIS_TAC [OoO_Exe_list_instr_not_stored_eq_cake,State_list_cake_ok,state_list_cake_to_state_list],
Cases_on `r` \\ rw [option_ll_state_list_cake_to_ll_state_list] >-
METIS_TAC [OoO_Ftc_list_stored_eq_cake,State_list_cake_ok,state_list_cake_to_state_list] \\
METIS_TAC [OoO_Cmt_list_stored_eq_cake,State_list_cake_ok,state_list_cake_to_state_list]
]
QED
Theorem OoO_step_list_eq_cake:
!g f f'. sem_expr_cake_ok f f' ==>
!stlc t. State_list_cake_ok stlc ==>
option_ll_state_list_cake_to_ll_state_list (OoO_step_list_cake g f stlc t) =
OoO_step_list g f' (state_list_cake_to_state_list stlc) t
Proof
STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\ STRIP_TAC \\
`!i. option_ll_state_list_cake_to_ll_state_list (OoO_step_list_instr_cake g f stlc i) =
OoO_step_list_instr g f' (state_list_cake_to_state_list stlc) i`
by rw [OoO_step_list_instr_eq_cake] \\
Cases_on `stlc` \\
rename1 `State_st_list_cake l st cs fs` \\
rw [OoO_step_list_cake,OoO_step_list,OoO_step_name_eq_cake]
QED
Theorem State_list_cake_ok_OoO_Exe_list_instr_not_stored_guard_true_sem_instr_cake:
!stlc i v obs ll stlc'. State_list_cake_ok stlc ==>
OoO_Exe_list_instr_not_stored_guard_true_sem_instr_cake stlc i v obs = (ll,stlc') ==>
State_list_cake_ok stlc'
Proof
Cases_on `stlc` \\ Cases_on `i` \\
fs [OoO_Exe_list_instr_not_stored_guard_true_sem_instr_cake,State_list_cake_ok] \\
rw [insert_thm]
QED
Theorem State_list_cake_ok_OoO_Cmt_list_stored_incomplete_cake:
!f stlc t ta tv ll stlc'. State_list_cake_ok stlc ==>
OoO_Cmt_list_stored_incomplete_cake f stlc t ta tv = SOME (ll,stlc') ==>
State_list_cake_ok stlc'
Proof
strip_tac \\ Cases_on `stlc` \\
fs [OoO_Cmt_list_stored_incomplete_cake,State_list_cake_ok] \\
rw [] \\
Cases_on `lookup m ta` \\
Cases_on `lookup m tv` \\
Cases_on `str_may_list_cake f (State_st_list_cake l m l0 l1) t` \\
fs [] \\ rw [State_list_cake_ok]
QED
Theorem State_list_cake_ok_OoO_Cmt_list_stored_cake:
!f stlc t ta tv ll stlc'. State_list_cake_ok stlc ==>
OoO_Cmt_list_stored_cake f stlc t ta tv = SOME (ll,stlc') ==>
State_list_cake_ok stlc'
Proof
strip_tac \\ Cases_on `stlc` \\
fs [OoO_Cmt_list_stored_cake] \\
METIS_TAC [State_list_cake_ok_OoO_Cmt_list_stored_incomplete_cake]
QED
Theorem State_list_cake_ok_OoO_Ftc_list_stored_incomplete_cake:
!g f stlc t v ll stlc'. State_list_cake_ok stlc ==>
OoO_Ftc_list_stored_incomplete_cake g f stlc t v = SOME (ll,stlc') ==>
State_list_cake_ok stlc'
Proof
strip_tac \\ strip_tac \\ Cases_on `stlc` \\
fs [OoO_Ftc_list_stored_incomplete_cake,State_list_cake_ok] \\
rw [] \\
Cases_on `str_may_list_cake f (State_st_list_cake l m l0 l1) t` \\
fs [] \\ rw [State_list_cake_ok]
QED
Theorem State_list_cake_ok_OoO_Ftc_list_stored_cake:
!g f stlc t v ll stlc'. State_list_cake_ok stlc ==>
OoO_Ftc_list_stored_cake g f stlc t v = SOME (ll,stlc') ==>
State_list_cake_ok stlc'
Proof
strip_tac \\ Cases_on `stlc` \\
fs [OoO_Ftc_list_stored_cake] \\
METIS_TAC [State_list_cake_ok_OoO_Ftc_list_stored_incomplete_cake]
QED
Theorem IO_bounded_execution_acc_eq_cake:
!g f f'. sem_expr_cake_ok f f' ==>
!n stlc pos exec. State_list_cake_ok stlc ==>
option_map_step_list_cake_to_step_list (IO_bounded_execution_acc_cake g f stlc pos n exec) =
IO_bounded_execution_acc g f' (state_list_cake_to_state_list stlc) pos n (MAP step_list_cake_to_step_list exec)
Proof
strip_tac \\ strip_tac \\ strip_tac \\ strip_tac \\
Induct_on `n` \\ rw [] \\ Cases_on `stlc` \\
rename1 `State_st_list_cake l st cs fs` >-
rw [
state_list_cake_to_state_list,
IO_bounded_execution_acc_cake,
IO_bounded_execution_acc,
option_map_step_list_cake_to_step_list
] \\
rw [state_list_cake_to_state_list] \\
once_rewrite_tac [IO_bounded_execution_acc] \\
once_rewrite_tac [IO_bounded_execution_acc_cake] \\
fs [] >> rw [drop_def] >>
Cases_on `DROP pos l` >> fs [] >-
rw [option_map_step_list_cake_to_step_list] \\
Cases_on `h` >>
rename1 `i_assign t' c mop::l'` >> rename1 `i_assign t c mop` >>
fs [] >>
`map_ok st` by fs [State_list_cake_ok] \\
fs [lookup_thm,sem_expr_cake_ok] \\
Cases_on `FLOOKUP (to_fmap st) t` >> fs [] >-
(Cases_on `f' c (to_fmap st)` \\ fs [] >-
rw [option_map_step_list_cake_to_step_list] \\
rename1 `SOME v` \\
Cases_on `v = val_false` >> fs [] >-
rw [state_list_cake_to_state_list] \\
`sem_expr_cake_ok f f'` by rw [sem_expr_cake_ok] \\
`sem_instr_exe_cake f (i_assign t c mop) (State_st_list_cake l st cs fs) =
sem_instr_exe f' (i_assign t c mop) (State_st_list l (to_fmap st) cs fs)`
by METIS_TAC [sem_instr_exe_eq_cake,state_list_cake_to_state_list] \\
rw [] \\
Cases_on `sem_instr_exe f' (i_assign t c mop) (State_st_list l (to_fmap st) cs fs)` \\
rw [option_map_step_list_cake_to_step_list] \\
Cases_on `x` \\ rename1 `(v',obs)` \\ fs [] \\
`ll_state_list_cake_to_ll_state_list (OoO_Exe_list_instr_not_stored_guard_true_sem_instr_cake
(State_st_list_cake l st cs fs) (i_assign t c mop) v' obs) =
OoO_Exe_list_instr_not_stored_guard_true_sem_instr
(State_st_list l (to_fmap st) cs fs) (i_assign t c mop) v' obs`
by rw [OoO_Exe_list_instr_not_stored_guard_true_sem_instr_eq_cake,state_list_cake_to_state_list] \\
Cases_on `OoO_Exe_list_instr_not_stored_guard_true_sem_instr
(State_st_list l (to_fmap st) cs fs) (i_assign t c mop) v' obs` \\
fs [] \\
rename1 `OoO_Exe_list_instr_not_stored_guard_true_sem_instr
(State_st_list l (to_fmap st) cs fs) (i_assign t c mop) v' obs = (ll,stl)` \\
Cases_on `OoO_Exe_list_instr_not_stored_guard_true_sem_instr_cake
(State_st_list_cake l st cs fs) (i_assign t c mop) v' obs` \\
fs [] \\
rename1 `OoO_Exe_list_instr_not_stored_guard_true_sem_instr_cake
(State_st_list_cake l st cs fs) (i_assign t c mop) v' obs = (ll',stlc)` \\
`State_list_cake_ok stlc`
by METIS_TAC [State_list_cake_ok_OoO_Exe_list_instr_not_stored_guard_true_sem_instr_cake] \\
Cases_on `stlc` \\ fs [ll_state_list_cake_to_ll_state_list,state_list_cake_to_state_list] \\
rw [] \\
rename1 `(ll,State_st_list_cake ls' st' cs' fs')` \\
Cases_on `mop` \\ fs [] \\
rw [state_list_cake_to_state_list,step_list_cake_to_step_list] \\
Cases_on `r` \\ fs [] \\ rw [] >| [
`OoO_Ftc_list_stored g f' (State_st_list ls' (to_fmap st') cs' fs') t v' =
option_ll_state_list_cake_to_ll_state_list
(OoO_Ftc_list_stored_cake g f (State_st_list_cake ls' st' cs' fs') t v')`
by METIS_TAC [OoO_Ftc_list_stored_eq_cake,state_list_cake_to_state_list,
option_ll_state_list_cake_to_ll_state_list] \\
rw [] \\
Cases_on `OoO_Ftc_list_stored_cake g f (State_st_list_cake ls' st' cs' fs') t v'` \\
fs [option_ll_state_list_cake_to_ll_state_list,option_map_step_list_cake_to_step_list] \\
Cases_on `x` \\ rename1 `(ll',stlc')` \\
fs [ll_state_list_cake_to_ll_state_list] \\
`State_list_cake_ok stlc'`
by METIS_TAC [State_list_cake_ok_OoO_Ftc_list_stored_cake] \\
rw [step_list_cake_to_step_list,state_list_cake_to_state_list],
rw [step_list_cake_to_step_list,state_list_cake_to_state_list],
`OoO_Cmt_list_stored f' (State_st_list ls' (to_fmap st') cs' fs') t n' n0 =
option_ll_state_list_cake_to_ll_state_list
(OoO_Cmt_list_stored_cake f (State_st_list_cake ls' st' cs' fs') t n' n0)`
by METIS_TAC [OoO_Cmt_list_stored_eq_cake,state_list_cake_to_state_list,
option_ll_state_list_cake_to_ll_state_list] \\
rw [] \\
Cases_on `OoO_Cmt_list_stored_cake f (State_st_list_cake ls' st' cs' fs') t n' n0` \\
fs [option_ll_state_list_cake_to_ll_state_list,option_map_step_list_cake_to_step_list] \\
Cases_on `x` \\ rename1 `(ll',stlc')` \\
fs [ll_state_list_cake_to_ll_state_list] \\
`State_list_cake_ok stlc'`
by METIS_TAC [State_list_cake_ok_OoO_Cmt_list_stored_cake] \\
rw [step_list_cake_to_step_list,state_list_cake_to_state_list]
]) \\
rename1 `SOME v` \\
Cases_on `mop` \\ fs [state_list_cake_to_state_list] \\
rename1 `o_store r ta tv` \\
Cases_on `r` \\ fs [state_list_cake_to_state_list] \\
rw [MEMBER_INTRO,state_list_cake_to_state_list] >-
(`OoO_Ftc_list_stored_incomplete g f' (State_st_list l (to_fmap st) cs fs) t v =
option_ll_state_list_cake_to_ll_state_list
(OoO_Ftc_list_stored_incomplete_cake g f (State_st_list_cake l st cs fs) t v)`
by METIS_TAC [OoO_Ftc_list_stored_incomplete_eq_cake,state_list_cake_to_state_list,
option_ll_state_list_cake_to_ll_state_list,sem_expr_cake_ok] \\
rw [] \\
Cases_on `OoO_Ftc_list_stored_incomplete_cake g f (State_st_list_cake l st cs fs) t v` \\
fs [option_ll_state_list_cake_to_ll_state_list,option_map_step_list_cake_to_step_list] \\
Cases_on `x` \\ rename1 `(ll,stlc)` \\
fs [ll_state_list_cake_to_ll_state_list] \\
`State_list_cake_ok stlc`
by METIS_TAC [State_list_cake_ok_OoO_Ftc_list_stored_incomplete_cake] \\
rw [step_list_cake_to_step_list,state_list_cake_to_state_list]) \\
`OoO_Cmt_list_stored_incomplete f' (State_st_list l (to_fmap st) cs fs) t ta tv =
option_ll_state_list_cake_to_ll_state_list
(OoO_Cmt_list_stored_incomplete_cake f (State_st_list_cake l st cs fs) t ta tv)`
by METIS_TAC [OoO_Cmt_list_stored_incomplete_eq_cake,state_list_cake_to_state_list,
option_ll_state_list_cake_to_ll_state_list,sem_expr_cake_ok] \\
rw [] \\
Cases_on `OoO_Cmt_list_stored_incomplete_cake f (State_st_list_cake l st cs fs) t ta tv` \\
fs [option_ll_state_list_cake_to_ll_state_list,option_map_step_list_cake_to_step_list] \\
Cases_on `x` \\ rename1 `(ll,stlc)` \\
fs [ll_state_list_cake_to_ll_state_list] \\
`State_list_cake_ok stlc`
by METIS_TAC [State_list_cake_ok_OoO_Cmt_list_stored_incomplete_cake] \\
rw [step_list_cake_to_step_list,state_list_cake_to_state_list]
QED
Theorem IO_bounded_execution_eq_cake:
!g f f'. sem_expr_cake_ok f f' ==>
!n stlc pos. State_list_cake_ok stlc ==>
option_map_step_list_cake_to_step_list (IO_bounded_execution_cake g f stlc pos n) =
IO_bounded_execution g f' (state_list_cake_to_state_list stlc) pos n
Proof
rw [IO_bounded_execution,IO_bounded_execution_cake] \\
`MAP step_list_cake_to_step_list [] = []` by rw [] \\
METIS_TAC [IO_bounded_execution_acc_eq_cake]
QED
Theorem IO_bounded_trace_acc_eq_cake:
!g f f'. sem_expr_cake_ok f f' ==>
!n stlc pos tr. State_list_cake_ok stlc ==>
option_state_list_cake_obs_list_to_state_list_obs_list (IO_bounded_trace_acc_cake g f stlc pos n tr) =
IO_bounded_trace_acc g f' (state_list_cake_to_state_list stlc) pos n tr
Proof
strip_tac \\ strip_tac \\ strip_tac \\ strip_tac \\
Induct_on `n` \\ rw [] \\ Cases_on `stlc` \\
rename1 `State_st_list_cake l st cs fs` >-
rw [
state_list_cake_to_state_list,
IO_bounded_trace_acc_cake,
IO_bounded_trace_acc,
option_state_list_cake_obs_list_to_state_list_obs_list
] \\
rw [state_list_cake_to_state_list] \\
once_rewrite_tac [IO_bounded_trace_acc] \\
once_rewrite_tac [IO_bounded_trace_acc_cake] \\
fs [] \\ rw [drop_def] \\
Cases_on `DROP pos l` \\ fs [] >-
rw [option_state_list_cake_obs_list_to_state_list_obs_list,state_list_cake_to_state_list] \\
Cases_on `h` \\
rename1 `i_assign t' c mop::l'` \\ rename1 `i_assign t c mop` \\
fs [] \\
`map_ok st` by fs [State_list_cake_ok] \\
fs [lookup_thm,sem_expr_cake_ok] \\
Cases_on `FLOOKUP (to_fmap st) t` >> fs [] >-
(Cases_on `f' c (to_fmap st)` \\ fs [] >-
rw [option_state_list_cake_obs_list_to_state_list_obs_list,state_list_cake_to_state_list] \\
rename1 `SOME v` \\
Cases_on `v = val_false` >> fs [] >-
rw [state_list_cake_to_state_list] \\
`sem_expr_cake_ok f f'` by rw [sem_expr_cake_ok] \\
`sem_instr_exe_cake f (i_assign t c mop) (State_st_list_cake l st cs fs) =
sem_instr_exe f' (i_assign t c mop) (State_st_list l (to_fmap st) cs fs)`
by METIS_TAC [sem_instr_exe_eq_cake,state_list_cake_to_state_list] \\
rw [] \\
Cases_on `sem_instr_exe f' (i_assign t c mop) (State_st_list l (to_fmap st) cs fs)` >-
rw [option_state_list_cake_obs_list_to_state_list_obs_list] \\
Cases_on `x` \\ rename1 `(v',obs)` \\ fs [] \\
`ll_state_list_cake_to_ll_state_list (OoO_Exe_list_instr_not_stored_guard_true_sem_instr_cake
(State_st_list_cake l st cs fs) (i_assign t c mop) v' obs) =
OoO_Exe_list_instr_not_stored_guard_true_sem_instr
(State_st_list l (to_fmap st) cs fs) (i_assign t c mop) v' obs`
by rw [OoO_Exe_list_instr_not_stored_guard_true_sem_instr_eq_cake,state_list_cake_to_state_list] \\
Cases_on `OoO_Exe_list_instr_not_stored_guard_true_sem_instr
(State_st_list l (to_fmap st) cs fs) (i_assign t c mop) v' obs` \\
fs [] \\
rename1 `OoO_Exe_list_instr_not_stored_guard_true_sem_instr
(State_st_list l (to_fmap st) cs fs) (i_assign t c mop) v' obs = (ll,stl)` \\
Cases_on `OoO_Exe_list_instr_not_stored_guard_true_sem_instr_cake
(State_st_list_cake l st cs fs) (i_assign t c mop) v' obs` \\
fs [] \\
rename1 `OoO_Exe_list_instr_not_stored_guard_true_sem_instr_cake
(State_st_list_cake l st cs fs) (i_assign t c mop) v' obs = (ll',stlc)` \\
`State_list_cake_ok stlc`
by METIS_TAC [State_list_cake_ok_OoO_Exe_list_instr_not_stored_guard_true_sem_instr_cake] \\
Cases_on `stlc` \\ fs [ll_state_list_cake_to_ll_state_list,state_list_cake_to_state_list] \\
rw [] \\
rename1 `(ll,State_st_list_cake ls' st' cs' fs')` \\
Cases_on `mop` \\ fs [] \\
rw [state_list_cake_to_state_list,step_list_cake_to_step_list] \\
Cases_on `r` \\ fs [] \\ rw [] >| [
`OoO_Ftc_list_stored g f' (State_st_list ls' (to_fmap st') cs' fs') t v' =
option_ll_state_list_cake_to_ll_state_list
(OoO_Ftc_list_stored_cake g f (State_st_list_cake ls' st' cs' fs') t v')`
by METIS_TAC [OoO_Ftc_list_stored_eq_cake,state_list_cake_to_state_list,
option_ll_state_list_cake_to_ll_state_list] \\
rw [] \\
Cases_on `OoO_Ftc_list_stored_cake g f (State_st_list_cake ls' st' cs' fs') t v'` \\
fs [option_state_list_cake_obs_list_to_state_list_obs_list,option_ll_state_list_cake_to_ll_state_list] \\
Cases_on `x` \\ rename1 `(ll',stlc')` \\
fs [ll_state_list_cake_to_ll_state_list] \\
`State_list_cake_ok stlc'`
by METIS_TAC [State_list_cake_ok_OoO_Ftc_list_stored_cake] \\
rw [option_state_list_cake_obs_list_to_state_list_obs_list],
rw [state_list_cake_to_state_list],
`OoO_Cmt_list_stored f' (State_st_list ls' (to_fmap st') cs' fs') t n' n0 =
option_ll_state_list_cake_to_ll_state_list
(OoO_Cmt_list_stored_cake f (State_st_list_cake ls' st' cs' fs') t n' n0)`
by METIS_TAC [OoO_Cmt_list_stored_eq_cake,state_list_cake_to_state_list,
option_ll_state_list_cake_to_ll_state_list] \\
rw [] \\
Cases_on `OoO_Cmt_list_stored_cake f (State_st_list_cake ls' st' cs' fs') t n' n0` \\
fs [option_state_list_cake_obs_list_to_state_list_obs_list,option_ll_state_list_cake_to_ll_state_list] \\
Cases_on `x` \\ rename1 `(ll',stlc')` \\
fs [ll_state_list_cake_to_ll_state_list] \\
`State_list_cake_ok stlc'`
by METIS_TAC [State_list_cake_ok_OoO_Cmt_list_stored_cake] \\
rw [option_state_list_cake_obs_list_to_state_list_obs_list],
`OoO_Ftc_list_stored g f' (State_st_list ls' (to_fmap st') cs' fs') t v' =
option_ll_state_list_cake_to_ll_state_list
(OoO_Ftc_list_stored_cake g f (State_st_list_cake ls' st' cs' fs') t v')`
by METIS_TAC [OoO_Ftc_list_stored_eq_cake,state_list_cake_to_state_list,
option_ll_state_list_cake_to_ll_state_list] \\
rw [] \\
Cases_on `OoO_Ftc_list_stored_cake g f (State_st_list_cake ls' st' cs' fs') t v'` \\
fs [option_state_list_cake_obs_list_to_state_list_obs_list,option_ll_state_list_cake_to_ll_state_list] \\
Cases_on `x` \\ rename1 `(ll',stlc')` \\
fs [ll_state_list_cake_to_ll_state_list] \\
`State_list_cake_ok stlc'`
by METIS_TAC [State_list_cake_ok_OoO_Ftc_list_stored_cake] \\
rw [option_state_list_cake_obs_list_to_state_list_obs_list],
rw [state_list_cake_to_state_list],
`OoO_Cmt_list_stored f' (State_st_list ls' (to_fmap st') cs' fs') t n' n0 =
option_ll_state_list_cake_to_ll_state_list
(OoO_Cmt_list_stored_cake f (State_st_list_cake ls' st' cs' fs') t n' n0)`
by METIS_TAC [OoO_Cmt_list_stored_eq_cake,state_list_cake_to_state_list,
option_ll_state_list_cake_to_ll_state_list] \\
rw [] \\
Cases_on `OoO_Cmt_list_stored_cake f (State_st_list_cake ls' st' cs' fs') t n' n0` \\
fs [option_state_list_cake_obs_list_to_state_list_obs_list,option_ll_state_list_cake_to_ll_state_list] \\
Cases_on `x` \\ rename1 `(ll',stlc')` \\
fs [ll_state_list_cake_to_ll_state_list] \\
`State_list_cake_ok stlc'`
by METIS_TAC [State_list_cake_ok_OoO_Cmt_list_stored_cake] \\
rw [option_state_list_cake_obs_list_to_state_list_obs_list]
]) \\
rename1 `SOME v` \\
Cases_on `mop` \\ fs [state_list_cake_to_state_list] \\
rename1 `o_store r ta tv` \\
Cases_on `r` \\ fs [state_list_cake_to_state_list] \\
rw [MEMBER_INTRO,state_list_cake_to_state_list] >-
(`OoO_Ftc_list_stored_incomplete g f' (State_st_list l (to_fmap st) cs fs) t v =
option_ll_state_list_cake_to_ll_state_list
(OoO_Ftc_list_stored_incomplete_cake g f (State_st_list_cake l st cs fs) t v)`
by METIS_TAC [OoO_Ftc_list_stored_incomplete_eq_cake,state_list_cake_to_state_list,
option_ll_state_list_cake_to_ll_state_list,sem_expr_cake_ok] \\
rw [] \\
Cases_on `OoO_Ftc_list_stored_incomplete_cake g f (State_st_list_cake l st cs fs) t v` \\
fs [option_state_list_cake_obs_list_to_state_list_obs_list,option_ll_state_list_cake_to_ll_state_list] \\
Cases_on `x` \\ rename1 `(ll,stlc)` \\
fs [ll_state_list_cake_to_ll_state_list] \\
`State_list_cake_ok stlc`
by METIS_TAC [State_list_cake_ok_OoO_Ftc_list_stored_incomplete_cake] \\
rw [step_list_cake_to_step_list,state_list_cake_to_state_list]) \\
`OoO_Cmt_list_stored_incomplete f' (State_st_list l (to_fmap st) cs fs) t ta tv =
option_ll_state_list_cake_to_ll_state_list
(OoO_Cmt_list_stored_incomplete_cake f (State_st_list_cake l st cs fs) t ta tv)`
by METIS_TAC [OoO_Cmt_list_stored_incomplete_eq_cake,state_list_cake_to_state_list,
option_ll_state_list_cake_to_ll_state_list,sem_expr_cake_ok] \\
rw [] \\
Cases_on `OoO_Cmt_list_stored_incomplete_cake f (State_st_list_cake l st cs fs) t ta tv` \\
fs [option_ll_state_list_cake_to_ll_state_list,option_state_list_cake_obs_list_to_state_list_obs_list] \\
Cases_on `x` \\ rename1 `(ll,stlc)` \\
fs [ll_state_list_cake_to_ll_state_list] \\
`State_list_cake_ok stlc`
by METIS_TAC [State_list_cake_ok_OoO_Cmt_list_stored_incomplete_cake] \\
rw [step_list_cake_to_step_list,state_list_cake_to_state_list]
QED
Theorem IO_bounded_trace_eq_cake:
!g f f'. sem_expr_cake_ok f f' ==>
!n stlc pos. State_list_cake_ok stlc ==>
IO_bounded_trace_cake g f stlc pos n =
IO_bounded_trace g f' (state_list_cake_to_state_list stlc) pos n
Proof
rw [IO_bounded_trace,IO_bounded_trace_cake,IO_bounded_trace_aux,IO_bounded_trace_aux_cake] \\
`IO_bounded_trace_acc g f' (state_list_cake_to_state_list stlc) (PRE pos) n [] =
option_state_list_cake_obs_list_to_state_list_obs_list
(IO_bounded_trace_acc_cake g f stlc (PRE pos) n [])`
by METIS_TAC [IO_bounded_trace_acc_eq_cake] \\
rw [] \\
Cases_on `IO_bounded_trace_acc_cake g f stlc (PRE pos) n []` \\
fs [option_state_list_cake_obs_list_to_state_list_obs_list] \\
Cases_on `x` \\ fs [option_state_list_cake_obs_list_to_state_list_obs_list]
QED
(* ------------------------------- *)
(* Expression evaluation functions *)
(* ------------------------------- *)
Theorem word_2comp_cake_word_2comp:
!(v:mil$v). word_2comp_cake v = word_2comp v
Proof
rw [word_2comp_cake,word_2comp_def]
QED
Theorem i2w_cake_i2w:
!(i:int). i2w_cake i = i2w i
Proof
rw [i2w_cake,integer_wordTheory.i2w_def,word_2comp_cake_word_2comp]
QED
Theorem word_msb_cake_word_msb:
!(v:mil$v). word_msb_cake v = word_msb v
Proof
rw [word_msb_cake,word_msb] \\
blastLib.BBLAST_TAC
QED
Theorem w2i_cake_w2i:
!(v:mil$v). w2i_cake v = w2i v
Proof
once_rewrite_tac [w2i_cake,integer_wordTheory.w2i_def] \\
rw [word_2comp_cake_word_2comp,word_msb_cake_word_msb]
QED
Theorem nzcv_cake_nzcv:
!(a:mil$v) (b:mil$v). nzcv_cake a b = nzcv a b
Proof
once_rewrite_tac [nzcv_cake,nzcv_def] \\
rw [word_2comp_cake_word_2comp,word_msb_cake_word_msb]
QED
Theorem v_and_cake_v_and:
!(v1:mil$v) (v2:mil$v). v_and_cake v1 v2 = v_and v1 v2
Proof
rw [v_and_cake,v_and]
QED
Theorem v_or_cake_v_or:
!(v1:mil$v) (v2:mil$v). v_or_cake v1 v2 = v_or v1 v2
Proof
rw [v_or_cake,v_or]
QED
Theorem v_xor_cake_v_xor:
!(v1:mil$v) (v2:mil$v). v_xor_cake v1 v2 = v_xor v1 v2
Proof
rw [v_xor_cake,v_xor]
QED
Theorem v_add_cake_v_add:
!(v1:mil$v) (v2:mil$v). v_add_cake v1 v2 = v_add v1 v2
Proof
rw [v_add_cake,v_add]
QED
Theorem v_sub_cake_v_sub:
!(v1:mil$v) (v2:mil$v). v_sub_cake v1 v2 = v_sub v1 v2
Proof
rw [v_sub_cake,v_sub]
QED
Theorem v_mul_cake_v_mul:
!(v1:mil$v) (v2:mil$v). v_mul_cake v1 v2 = v_mul v1 v2
Proof
rw [v_mul_cake,v_mul,word_mul_def]
QED
Theorem v_div_cake_v_div:
!(v1:mil$v) (v2:mil$v). v_div_cake v1 v2 = v_div v1 v2
Proof
rw [v_div_cake,v_div,word_div_def]
QED
Theorem v_sdiv_cake_v_sdiv:
!(v1:mil$v) (v2:mil$v). v_sdiv_cake v1 v2 = v_sdiv v1 v2
Proof
rw [v_sdiv_cake,v_sdiv,integer_wordTheory.word_sdiv_def,i2w_cake_i2w,w2i_cake_w2i]
QED
Theorem v_mod_cake_v_mod:
!(v1:mil$v) (v2:mil$v). v_mod_cake v1 v2 = v_mod v1 v2
Proof
rw [v_mod_cake,v_mod,word_mod_def]
QED
Theorem v_smod_cake_v_smod:
!(v1:mil$v) (v2:mil$v). v_smod_cake v1 v2 = v_smod v1 v2
Proof
rw [v_smod_cake,v_smod,integer_wordTheory.word_smod_def,i2w_cake_i2w,w2i_cake_w2i]
QED