@@ -7,7 +7,7 @@ open preamble backendPropsTheory
7
7
bvl_inlineTheory
8
8
local open bvl_handleProofTheory in end
9
9
10
- val _ = temp_delsimps [" lift_disj_eq" , " lift_imp_disj" ]
10
+ val _ = temp_delsimps [" lift_disj_eq" , " lift_imp_disj" , " fromAList_def " ]
11
11
12
12
val _ = new_theory" bvl_inlineProof" ;
13
13
@@ -31,27 +31,27 @@ val state_rel_alt = state_rel_def
31
31
val state_rel_def =
32
32
state_rel_def |> SIMP_RULE (srw_ss()) [state_component_equality,GSYM CONJ_ASSOC];
33
33
34
- val do_app_lemma = prove(
35
- `` state_rel t' r ==>
34
+ Theorem do_app_lemma[ local ]:
35
+ state_rel t' r ==>
36
36
case do_app op (REVERSE a) r of
37
37
| Rerr err => do_app op (REVERSE a) t' = Rerr err
38
- | Rval (v,r2) => ?t2. state_rel t2 r2 /\ do_app op (REVERSE a) t' = Rval (v,t2)``,
38
+ | Rval (v,r2) => ?t2. state_rel t2 r2 /\
39
+ do_app op (REVERSE a) t' = Rval (v,t2)
40
+ Proof
39
41
Cases_on `op = Install` THEN1
40
42
(rw [] \\ fs [do_app_def]
41
43
\\ every_case_tac \\ fs []
42
44
\\ fs [case_eq_thms,UNCURRY,do_install_def]
43
45
\\ rveq \\ fs [PULL_EXISTS]
44
46
\\ fs [SWAP_REVERSE_SYM] \\ rveq \\ fs []
45
47
\\ fs [state_rel_def] \\ rveq \\ fs []
46
- \\ fs [domain_map]
47
48
\\ fs [state_component_equality]
48
49
THEN1
49
50
(fs [shift_seq_def,o_DEF] \\ rfs []
50
51
\\ Cases_on `t'.compile_oracle 0 ` \\ fs []
51
52
\\ Cases_on `r'` \\ fs [] \\ Cases_on `h` \\ fs [] \\ rveq \\ fs []
52
- \\ fs [domain_map]
53
53
\\ fs [map_union] \\ AP_TERM_TAC
54
- \\ fs [map_fromAList] \\ AP_TERM_TAC \\ fs []
54
+ \\ simp [map_fromAList, map_insert ] \\ AP_TERM_TAC \\ fs []
55
55
\\ rpt (AP_THM_TAC ORELSE AP_TERM_TAC)
56
56
\\ fs [FUN_EQ_THM,FORALL_PROD])
57
57
\\ CCONTR_TAC \\ fs []
@@ -67,7 +67,6 @@ val do_app_lemma = prove(
67
67
`r.compile`,`(I ## MAP (I ## I ## (λx. HD (remove_ticks [x])))) ∘
68
68
t'.compile_oracle`] mp_tac)
69
69
\\ qpat_x_assum `r = _` (assume_tac o GSYM) \\ fs []
70
- \\ impl_tac THEN1 fs [domain_map]
71
70
\\ strip_tac \\ fs []
72
71
\\ qpat_x_assum `_ = r` (assume_tac o GSYM) \\ fs []
73
72
\\ rw [] \\ fs [state_component_equality]
@@ -78,7 +77,7 @@ val do_app_lemma = prove(
78
77
`r.compile`,`(I ## MAP (I ## I ## (λx. HD (remove_ticks [x])))) ∘
79
78
t'.compile_oracle`] mp_tac)
80
79
\\ qpat_x_assum `r = _` (assume_tac o GSYM) \\ fs []
81
- \\ impl_tac THEN1 fs [domain_map] \\ fs []);
80
+ QED
82
81
83
82
Theorem evaluate_remove_ticks:
84
83
!k xs env s (t:('c,'ffi) bvlSem$state) res s'.
@@ -767,8 +766,8 @@ Proof
767
766
\\ qexists_tac `aa1` \\ fs []
768
767
QED
769
768
770
- val tick_compile_prog_IMP_exp_rel = prove(
771
- `` !limit cs0 in1 cs1 in2 k arity exp src_code.
769
+ Theorem tick_compile_prog_IMP_exp_rel[ local ]:
770
+ !limit cs0 in1 cs1 in2 k arity exp src_code.
772
771
tick_compile_prog limit cs0 in1 = (cs1,in2) /\
773
772
ALOOKUP in1 k = SOME (arity,exp) /\
774
773
ALL_DISTINCT (MAP FST in1) /\
@@ -780,7 +779,8 @@ val tick_compile_prog_IMP_exp_rel = prove(
780
779
DISJOINT (domain cs0) (set (MAP FST in1)) ==>
781
780
∃exp2.
782
781
ALOOKUP in2 k = SOME (arity,exp2) /\
783
- exp_rel (union src_code (fromAList in1)) [exp] [exp2]``,
782
+ exp_rel (union src_code (fromAList in1)) [exp] [exp2]
783
+ Proof
784
784
Induct_on `in1`
785
785
\\ fs [FORALL_PROD,tick_compile_prog_def,tick_inline_all_def]
786
786
\\ once_rewrite_tac [tick_inline_all_acc]
@@ -794,7 +794,7 @@ val tick_compile_prog_IMP_exp_rel = prove(
794
794
\\ match_mp_tac exp_rel_tick_inline \\ metis_tac [])
795
795
\\ first_x_assum drule
796
796
\\ disch_then (qspec_then `k` mp_tac) \\ fs []
797
- \\ qmatch_goalsub_rename_tac `(p1,p2,p3):: in1`
797
+ \\ qmatch_goalsub_rename_tac `(p1,p2,p3) :: in1`
798
798
\\ disch_then (qspec_then `union src_code (insert p1 (p2,p3) LN)` mp_tac)
799
799
\\ fs [exp_rel_rw] \\ disch_then match_mp_tac
800
800
\\ reverse (IF_CASES_TAC \\ fs [])
@@ -808,7 +808,6 @@ val tick_compile_prog_IMP_exp_rel = prove(
808
808
\\ fs [subspt_lookup,lookup_union])
809
809
\\ CCONTR_TAC \\ fs [] \\ metis_tac [])
810
810
\\ reverse (rw [])
811
- THEN1 (fs [DISJOINT_DEF,domain_union,EXTENSION] \\ metis_tac [])
812
811
\\ fs [lookup_insert,case_eq_thms] \\ rveq
813
812
THEN1
814
813
(rename1 `must_inline k2 _ _`
@@ -817,19 +816,22 @@ val tick_compile_prog_IMP_exp_rel = prove(
817
816
\\ qexists_tac `src_code`
818
817
\\ conj_tac THEN1 fs [subspt_lookup,lookup_union]
819
818
\\ match_mp_tac exp_rel_tick_inline \\ metis_tac [])
820
- \\ fs [lookup_union,case_eq_thms,GSYM lookup_NONE_domain,lookup_insert,lookup_def]
819
+ \\ fs [lookup_union,case_eq_thms,GSYM lookup_NONE_domain,lookup_insert,
820
+ lookup_def]
821
821
\\ pop_assum (assume_tac o GSYM)
822
822
\\ first_x_assum drule \\ strip_tac \\ fs []
823
823
\\ match_mp_tac (subspt_exp_rel |> ONCE_REWRITE_RULE [CONJ_COMM])
824
824
\\ asm_exists_tac \\ fs []
825
- \\ fs [subspt_lookup,lookup_union]);
825
+ \\ fs [subspt_lookup,lookup_union]
826
+ QED
826
827
827
- val in_do_app_lemma = prove(
828
- `` in_state_rel limit s1 t1 ==>
828
+ Theorem in_do_app_lemma[ local ]:
829
+ in_state_rel limit s1 t1 ==>
829
830
case do_app op a s1 of
830
831
| Rerr err => (err <> Rabort Rtype_error ==> do_app op a t1 = Rerr err)
831
832
| Rval (v,s2) => ?t2. in_state_rel limit s2 t2 /\
832
- do_app op a t1 = Rval (v,t2)``,
833
+ do_app op a t1 = Rval (v,t2)
834
+ Proof
833
835
Cases_on `op = Install`
834
836
THEN1
835
837
(rw [] \\ fs [do_app_def]
@@ -898,7 +900,8 @@ val in_do_app_lemma = prove(
898
900
\\ impl_tac THEN1 fs [in_state_rel_def]
899
901
\\ fs [] \\ disch_then kall_tac
900
902
\\ fs [in_state_rel_def]
901
- \\ imp_res_tac do_app_const \\ fs []);
903
+ \\ imp_res_tac do_app_const \\ fs []
904
+ QED
902
905
903
906
Theorem evaluate_inline:
904
907
!es env s1 res t1 s2 es2.
@@ -1447,11 +1450,13 @@ Proof
1447
1450
\\ CASE_TAC \\ fs []
1448
1451
QED
1449
1452
1450
- val do_app_lemma = prove(
1451
- `` let_state_rel q4 l4 s1 t1 ==>
1453
+ Theorem do_app_lemma[ local ]:
1454
+ let_state_rel q4 l4 s1 t1 ==>
1452
1455
case do_app op a s1 of
1453
1456
| Rerr err => do_app op a t1 = Rerr err
1454
- | Rval (v,s2) => ?t2. let_state_rel q4 l4 s2 t2 /\ do_app op a t1 = Rval (v,t2)``,
1457
+ | Rval (v,s2) => ?t2. let_state_rel q4 l4 s2 t2 /\
1458
+ do_app op a t1 = Rval (v,t2)
1459
+ Proof
1455
1460
Cases_on `op = Install` THEN1
1456
1461
(rw [] \\ fs [do_app_def]
1457
1462
\\ every_case_tac \\ fs []
@@ -1479,7 +1484,6 @@ val do_app_lemma = prove(
1479
1484
`t1.compile`,`(I ## MAP (I ## let_opt q4 l4)) ∘
1480
1485
s1.compile_oracle`] mp_tac)
1481
1486
\\ qpat_x_assum `t1 = _` (assume_tac o GSYM) \\ fs []
1482
- \\ impl_tac THEN1 fs [domain_map]
1483
1487
\\ strip_tac \\ fs []
1484
1488
\\ qpat_x_assum `_ = t1` (assume_tac o GSYM) \\ fs []
1485
1489
\\ rw [] \\ fs [state_component_equality]
@@ -1490,7 +1494,7 @@ val do_app_lemma = prove(
1490
1494
`t1.compile`,`(I ## MAP (I ## let_opt q4 l4)) ∘
1491
1495
s1.compile_oracle`] mp_tac)
1492
1496
\\ qpat_x_assum `t1 = _` (assume_tac o GSYM) \\ fs []
1493
- \\ impl_tac THEN1 fs [domain_map] \\ fs []);
1497
+ QED
1494
1498
1495
1499
Theorem evaluate_let_op:
1496
1500
!es env s1 res t1 s2.
0 commit comments