Skip to content

Commit 265cb06

Browse files
committed
1 parent 68d5c75 commit 265cb06

18 files changed

+151
-108
lines changed

compiler/backend/proofs/bvi_tailrecProofScript.sml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,15 +1682,17 @@ Proof
16821682
\\ conj_asm1_tac
16831683
>- (
16841684
match_mp_tac code_rel_union
1685-
\\ fs[domain_fromAList,DISJOINT_SYM] )
1685+
\\ fs[domain_fromAList,DISJOINT_SYM]
1686+
\\ gvs[Abbr‘prog1’])
16861687
\\ `namespace_rel (fromAList prog1) (fromAList prog2)`
16871688
by (
16881689
match_mp_tac (GEN_ALL compile_prog_namespace_rel)
16891690
\\ asm_exists_tac \\ fs[input_condition_def])
16901691
\\ conj_asm1_tac
16911692
>- (
16921693
match_mp_tac namespace_rel_union
1693-
\\ fs[domain_fromAList,DISJOINT_SYM])
1694+
\\ fs[domain_fromAList,DISJOINT_SYM]
1695+
\\ gs[Abbr‘prog1’])
16941696
\\ simp[domain_union]
16951697
\\ imp_res_tac compile_prog_next_mono
16961698
\\ rveq \\ rw[]

compiler/backend/proofs/bvi_to_dataProofScript.sml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ open preamble
1212

1313
val _ = new_theory"bvi_to_dataProof";
1414

15-
val _ = set_grammar_ancestry["bvi_to_data", "bviSem", "bviProps", "dataSem", "dataProps"];
15+
val _ = set_grammar_ancestry["bvi_to_data", "bviSem", "bviProps", "dataSem",
16+
"dataProps"];
17+
val _ = temp_delsimps ["fromAList_def"]
1618
val _ = hide"tail";
1719

1820
(* value relation *)
@@ -935,7 +937,8 @@ Proof
935937
\\ full_simp_tac(srw_ss())[var_corr_def,get_var_def,lookup_map]
936938
\\ IMP_RES_TAC LIST_REL_MEM_IMP \\ full_simp_tac(srw_ss())[]
937939
\\ `lookup x t1.locals <> NONE` by METIS_TAC []
938-
\\ Cases_on `lookup x t1.locals` \\ full_simp_tac(srw_ss())[] \\ METIS_TAC [])
940+
\\ Cases_on `lookup x t1.locals` \\ full_simp_tac(srw_ss())[]
941+
\\ METIS_TAC [])
939942
\\ full_simp_tac(srw_ss())[]
940943
\\ Q.ABBREV_TAC `env1 = mk_wf (inter t2.locals (list_to_num_set (REVERSE vs++live++corr)))`
941944
\\ `var_corr (REVERSE a) (REVERSE vs) (map data_to_bvi_v env1)` by

compiler/backend/proofs/bvl_inlineProofScript.sml

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ open preamble backendPropsTheory
77
bvl_inlineTheory
88
local open bvl_handleProofTheory in end
99

10-
val _ = temp_delsimps ["lift_disj_eq", "lift_imp_disj"]
10+
val _ = temp_delsimps ["lift_disj_eq", "lift_imp_disj", "fromAList_def"]
1111

1212
val _ = new_theory"bvl_inlineProof";
1313

@@ -31,27 +31,27 @@ val state_rel_alt = state_rel_def
3131
val state_rel_def =
3232
state_rel_def |> SIMP_RULE (srw_ss()) [state_component_equality,GSYM CONJ_ASSOC];
3333

34-
val do_app_lemma = prove(
35-
``state_rel t' r ==>
34+
Theorem do_app_lemma[local]:
35+
state_rel t' r ==>
3636
case do_app op (REVERSE a) r of
3737
| 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
3941
Cases_on `op = Install` THEN1
4042
(rw [] \\ fs [do_app_def]
4143
\\ every_case_tac \\ fs []
4244
\\ fs [case_eq_thms,UNCURRY,do_install_def]
4345
\\ rveq \\ fs [PULL_EXISTS]
4446
\\ fs [SWAP_REVERSE_SYM] \\ rveq \\ fs []
4547
\\ fs [state_rel_def] \\ rveq \\ fs []
46-
\\ fs [domain_map]
4748
\\ fs [state_component_equality]
4849
THEN1
4950
(fs [shift_seq_def,o_DEF] \\ rfs []
5051
\\ Cases_on `t'.compile_oracle 0` \\ fs []
5152
\\ Cases_on `r'` \\ fs [] \\ Cases_on `h` \\ fs [] \\ rveq \\ fs []
52-
\\ fs [domain_map]
5353
\\ fs [map_union] \\ AP_TERM_TAC
54-
\\ fs [map_fromAList] \\ AP_TERM_TAC \\ fs []
54+
\\ simp [map_fromAList, map_insert] \\ AP_TERM_TAC \\ fs []
5555
\\ rpt (AP_THM_TAC ORELSE AP_TERM_TAC)
5656
\\ fs [FUN_EQ_THM,FORALL_PROD])
5757
\\ CCONTR_TAC \\ fs []
@@ -67,7 +67,6 @@ val do_app_lemma = prove(
6767
`r.compile`,`(I ## MAP (I ## I ## (λx. HD (remove_ticks [x])))) ∘
6868
t'.compile_oracle`] mp_tac)
6969
\\ qpat_x_assum `r = _` (assume_tac o GSYM) \\ fs []
70-
\\ impl_tac THEN1 fs [domain_map]
7170
\\ strip_tac \\ fs []
7271
\\ qpat_x_assum `_ = r` (assume_tac o GSYM) \\ fs []
7372
\\ rw [] \\ fs [state_component_equality]
@@ -78,7 +77,7 @@ val do_app_lemma = prove(
7877
`r.compile`,`(I ## MAP (I ## I ## (λx. HD (remove_ticks [x])))) ∘
7978
t'.compile_oracle`] mp_tac)
8079
\\ qpat_x_assum `r = _` (assume_tac o GSYM) \\ fs []
81-
\\ impl_tac THEN1 fs [domain_map] \\ fs []);
80+
QED
8281

8382
Theorem evaluate_remove_ticks:
8483
!k xs env s (t:('c,'ffi) bvlSem$state) res s'.
@@ -767,8 +766,8 @@ Proof
767766
\\ qexists_tac `aa1` \\ fs []
768767
QED
769768

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.
772771
tick_compile_prog limit cs0 in1 = (cs1,in2) /\
773772
ALOOKUP in1 k = SOME (arity,exp) /\
774773
ALL_DISTINCT (MAP FST in1) /\
@@ -780,7 +779,8 @@ val tick_compile_prog_IMP_exp_rel = prove(
780779
DISJOINT (domain cs0) (set (MAP FST in1)) ==>
781780
∃exp2.
782781
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
784784
Induct_on `in1`
785785
\\ fs [FORALL_PROD,tick_compile_prog_def,tick_inline_all_def]
786786
\\ once_rewrite_tac [tick_inline_all_acc]
@@ -794,7 +794,7 @@ val tick_compile_prog_IMP_exp_rel = prove(
794794
\\ match_mp_tac exp_rel_tick_inline \\ metis_tac [])
795795
\\ first_x_assum drule
796796
\\ 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`
798798
\\ disch_then (qspec_then `union src_code (insert p1 (p2,p3) LN)` mp_tac)
799799
\\ fs [exp_rel_rw] \\ disch_then match_mp_tac
800800
\\ reverse (IF_CASES_TAC \\ fs [])
@@ -808,7 +808,6 @@ val tick_compile_prog_IMP_exp_rel = prove(
808808
\\ fs [subspt_lookup,lookup_union])
809809
\\ CCONTR_TAC \\ fs [] \\ metis_tac [])
810810
\\ reverse (rw [])
811-
THEN1 (fs [DISJOINT_DEF,domain_union,EXTENSION] \\ metis_tac [])
812811
\\ fs [lookup_insert,case_eq_thms] \\ rveq
813812
THEN1
814813
(rename1 `must_inline k2 _ _`
@@ -817,19 +816,22 @@ val tick_compile_prog_IMP_exp_rel = prove(
817816
\\ qexists_tac `src_code`
818817
\\ conj_tac THEN1 fs [subspt_lookup,lookup_union]
819818
\\ 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]
821821
\\ pop_assum (assume_tac o GSYM)
822822
\\ first_x_assum drule \\ strip_tac \\ fs []
823823
\\ match_mp_tac (subspt_exp_rel |> ONCE_REWRITE_RULE [CONJ_COMM])
824824
\\ asm_exists_tac \\ fs []
825-
\\ fs [subspt_lookup,lookup_union]);
825+
\\ fs [subspt_lookup,lookup_union]
826+
QED
826827

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 ==>
829830
case do_app op a s1 of
830831
| Rerr err => (err <> Rabort Rtype_error ==> do_app op a t1 = Rerr err)
831832
| 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
833835
Cases_on `op = Install`
834836
THEN1
835837
(rw [] \\ fs [do_app_def]
@@ -898,7 +900,8 @@ val in_do_app_lemma = prove(
898900
\\ impl_tac THEN1 fs [in_state_rel_def]
899901
\\ fs [] \\ disch_then kall_tac
900902
\\ fs [in_state_rel_def]
901-
\\ imp_res_tac do_app_const \\ fs []);
903+
\\ imp_res_tac do_app_const \\ fs []
904+
QED
902905

903906
Theorem evaluate_inline:
904907
!es env s1 res t1 s2 es2.
@@ -1447,11 +1450,13 @@ Proof
14471450
\\ CASE_TAC \\ fs []
14481451
QED
14491452

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 ==>
14521455
case do_app op a s1 of
14531456
| 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
14551460
Cases_on `op = Install` THEN1
14561461
(rw [] \\ fs [do_app_def]
14571462
\\ every_case_tac \\ fs []
@@ -1479,7 +1484,6 @@ val do_app_lemma = prove(
14791484
`t1.compile`,`(I ## MAP (I ## let_opt q4 l4)) ∘
14801485
s1.compile_oracle`] mp_tac)
14811486
\\ qpat_x_assum `t1 = _` (assume_tac o GSYM) \\ fs []
1482-
\\ impl_tac THEN1 fs [domain_map]
14831487
\\ strip_tac \\ fs []
14841488
\\ qpat_x_assum `_ = t1` (assume_tac o GSYM) \\ fs []
14851489
\\ rw [] \\ fs [state_component_equality]
@@ -1490,7 +1494,7 @@ val do_app_lemma = prove(
14901494
`t1.compile`,`(I ## MAP (I ## let_opt q4 l4)) ∘
14911495
s1.compile_oracle`] mp_tac)
14921496
\\ qpat_x_assum `t1 = _` (assume_tac o GSYM) \\ fs []
1493-
\\ impl_tac THEN1 fs [domain_map] \\ fs []);
1497+
QED
14941498

14951499
Theorem evaluate_let_op:
14961500
!es env s1 res t1 s2.

compiler/backend/proofs/bvl_to_bviProofScript.sml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ local open
1313
bvi_tailrecProofTheory
1414
in end;
1515

16-
val _ = temp_delsimps ["NORMEQ_CONV", "lift_disj_eq", "lift_imp_disj"]
16+
val _ = temp_delsimps ["NORMEQ_CONV", "lift_disj_eq", "lift_imp_disj",
17+
"fromAList_def", "domain_union", "domain_insert",
18+
"domain_inter"]
1719

1820
val _ = new_theory"bvl_to_bviProof";
1921

@@ -1642,7 +1644,7 @@ Proof
16421644
Induct >> simp[aux_code_installed_def] >>
16431645
qx_gen_tac`p`>>PairCases_on`p`>>
16441646
Cases >> simp[IS_SUBLIST] >> strip_tac >- (
1645-
simp[aux_code_installed_def,lookup_fromAList] >>
1647+
simp[aux_code_installed_def,lookup_fromAList, Excl "fromAList_def"] >>
16461648
first_x_assum match_mp_tac >>
16471649
var_eq_tac >> full_simp_tac(srw_ss())[] >>
16481650
full_simp_tac(srw_ss())[IS_SUBLIST_APPEND,IS_PREFIX_APPEND] >>
@@ -2437,7 +2439,7 @@ Proof
24372439
\\ fs [domain_fromAList]
24382440
\\ drule (GEN_ALL compile_inc_next_range) \\ fs []
24392441
\\ disch_then drule \\ fs []
2440-
\\ rw [] \\ fs [])
2442+
\\ rw [] \\ fs [] \\ gvs[Abbr‘prog1’])
24412443
\\ reverse (rpt strip_tac) \\ rveq \\ fs []
24422444
THEN1
24432445
(first_x_assum drule \\ strip_tac

compiler/backend/proofs/clos_to_bvlProofScript.sml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ val _ = new_theory"clos_to_bvlProof";
2323

2424
val _ = temp_delsimps ["NORMEQ_CONV"]
2525
val _ = diminish_srw_ss ["ABBREV"]
26-
val _ = temp_delsimps ["lift_disj_eq", "lift_imp_disj"]
26+
val _ = temp_delsimps ["lift_disj_eq", "lift_imp_disj", "fromAList_def",
27+
"domain_union", "domain_insert"]
2728
val _ = set_trace "BasicProvers.var_eq_old" 1
2829

2930
val _ = set_grammar_ancestry

compiler/backend/proofs/data_to_word_assignProofScript.sml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ val _ = new_theory "data_to_word_assignProof";
1515
val _ = temp_delsimps ["NORMEQ_CONV"]
1616
val _ = temp_delsimps ["lift_disj_eq", "lift_imp_disj"]
1717
val _ = temp_delsimps ["DIV_NUMERAL_THM"]
18+
val _ = temp_delsimps ["fromAList_def", "domain_union",
19+
"domain_inter", "domain_difference",
20+
"domain_map", "sptree.map_def", "sptree.lookup_rwts",
21+
"sptree.insert_notEmpty", "sptree.isEmpty_union"]
1822
val _ = diminish_srw_ss ["ABBREV"]
1923
val _ = set_trace "BasicProvers.var_eq_old" 1
2024

compiler/backend/proofs/data_to_word_bignumProofScript.sml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ local open gen_gcTheory in end
1313

1414
val _ = new_theory "data_to_word_bignumProof";
1515

16-
val _ = temp_delsimps ["NORMEQ_CONV"]
16+
val _ = temp_delsimps ["NORMEQ_CONV", "fromAList_def", "domain_union",
17+
"domain_inter", "domain_difference",
18+
"domain_map", "sptree.map_def", "sptree.lookup_rwts",
19+
"sptree.insert_notEmpty", "sptree.isEmpty_union"]
1720
val _ = diminish_srw_ss ["ABBREV"]
1821
val _ = set_trace "BasicProvers.var_eq_old" 1
1922

0 commit comments

Comments
 (0)