Skip to content

Commit e5d45f1

Browse files
some trials to make fwd proof stage 2 faster
1 parent f981e1e commit e5d45f1

File tree

1 file changed

+55
-3
lines changed

1 file changed

+55
-3
lines changed

hol/policy_to_table/fwd_proofLib.sml

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ open alistTheory;
1818
open numeralTheory;
1919
open alistTheory;
2020

21+
open optionSimps boolSimps;
2122

2223
open p4Lib;
2324
open blastLib bitstringLib;
@@ -130,11 +131,11 @@ open bdd_utilsLib;
130131

131132
(* get I (pairs isomorphic in the graph), and check if isisIsomorph *)
132133
val get_i_policy = bdd_utilsLib.pairBDDs (eval_policy_full_opt_rhs, eval_table_full_opt_auto_rhs);
134+
135+
133136
(*val is_tbl_policy1_iso = EVAL “isIsomorph_exec ^get_i_policy ^eval_policy_full_opt_rhs
134137
^eval_table_full_opt_auto_rhs”;
135138
*)
136-
137-
138139

139140
(* Theorem of correctness for conversion from var policy to var table *)
140141
(*)
@@ -153,7 +154,7 @@ open bdd_utilsLib;
153154
val assumption5 = EVAL “prop_in_BDD 0 ^eval_table_full_opt_auto_rhs = SOME ^gen_var_table_auto”;
154155
val assumption6 = EVAL “fv_in_vars_exec table_structure ^gen_var_table_auto ^policy_order”;
155156
val assumption7 = EVAL “fv_in_vars_exec policy_structure ^var_policy ^policy_order”;
156-
val assumption8 = EVAL “ALL_DISTINCT ^var_policy”;
157+
val assumption8 = EVAL “ALL_DISTINCT ^policy_order;
157158
val assumption9 = EVAL “^var_policy ≠ []”;
158159
159160
@@ -174,6 +175,57 @@ open bdd_utilsLib;
174175
val var_eq_thm_extract_red = computeLib.RESTR_EVAL_RULE [“correct_var_policy_var_tables_exec”, “sem_tables”,“sem_policy”, “mv_dom_vars”] var_eq_thm_extract;
175176
val var_policy_var_table_thm = SIMP_RULE bool_ss [correct_var_policy_var_tables_exec_thm1] var_eq_thm_extract_red;
176177

178+
(*
179+
180+
val cpu_stage2_proof_step1 = Timer.startCPUTimer ();
181+
val real_stage2_proof_step1 = Timer.startRealTimer ();
182+
183+
val var_eq_thm_extract = REWRITE_CONV [correct_var_policy_var_tables_exec_def, eval_policy_full_opt , eval_table_full_opt_auto] “correct_var_policy_var_tables_exec ^var_policy ^gen_var_table_auto ^policy_order ^get_i_policy”;
184+
185+
val _ = time_stage ("Stage 2 proof: step 1 : ", cpu_stage2_proof_step1, real_stage2_proof_step1);
186+
val cpu_stage2_proof_step2 = Timer.startCPUTimer ();
187+
val real_stage2_proof_step2 = Timer.startRealTimer ();
188+
189+
190+
val isIsomorph_exec_thm = EVAL “isIsomorph_exec ^get_i_policy ^eval_policy_full_opt_rhs
191+
^eval_table_full_opt_auto_rhs”;
192+
193+
val _ = time_stage ("Stage 2 proof: step 2 :", cpu_stage2_proof_step2, real_stage2_proof_step2);
194+
val cpu_stage2_proof_step3 = Timer.startCPUTimer ();
195+
val real_stage2_proof_step3 = Timer.startRealTimer ();
196+
197+
198+
199+
val assumption1 = EVAL “ALOOKUP ^get_i_policy 0 = SOME 0”;
200+
val assumption2 = EVAL “node_in_BDD 0 ^eval_policy_full_opt_rhs”;
201+
val assumption3 = EVAL “node_in_BDD 0 ^eval_table_full_opt_auto_rhs”;
202+
val assumption4 = EVAL “prop_in_BDD 0 ^eval_policy_full_opt_rhs = SOME ^var_policy”;
203+
val assumption5 = EVAL “prop_in_BDD 0 ^eval_table_full_opt_auto_rhs = SOME ^gen_var_table_auto”;
204+
val assumption6 = EVAL “fv_in_vars_exec policy_structure ^var_policy ^policy_order”;
205+
val assumption7 = EVAL “fv_in_vars_exec table_structure ^gen_var_table_auto ^policy_order”;
206+
val assumption8 = EVAL “ALL_DISTINCT ^policy_order”;
207+
val assumption9 = EVAL “^policy_order ≠ []”;
208+
209+
val _ = time_stage ("Stage 2 proof: step 3 :", cpu_stage2_proof_step3, real_stage2_proof_step3);
210+
val cpu_stage2_proof_step4 = Timer.startCPUTimer ();
211+
val real_stage2_proof_step4 = Timer.startRealTimer ();
212+
213+
val simp_thms_stage2 = LIST_CONJ [isIsomorph_exec_thm, assumption1, assumption2, assumption3, assumption4, assumption5, assumption6, assumption7, assumption8, assumption9]
214+
215+
val a = REWRITE_RULE [boolTheory.LET_THM] var_eq_thm_extract |> BETA_RULE;
216+
217+
val _ = time_stage ("Stage 2 proof: step 4 :", cpu_stage2_proof_step4, real_stage2_proof_step4);
218+
val cpu_stage2_proof_step5 = Timer.startCPUTimer ();
219+
val real_stage2_proof_step5 = Timer.startRealTimer ();
220+
221+
222+
val b = REWRITE_RULE [simp_thms_stage2, IS_SOME_DEF, IS_SOME_DEF, THE_DEF] a;
223+
224+
val var_policy_var_table_thm = SIMP_RULE bool_ss [correct_var_policy_var_tables_exec_thm1] b;
225+
226+
227+
val _ = time_stage ("Stage 2 proof: step 5 :", cpu_stage2_proof_step5, real_stage2_proof_step5);
228+
*)
177229

178230

179231
val _ = time_stage ("Stage 2 proof", start_cpu_stage2_tbdd, start_real_stage2_tbdd);

0 commit comments

Comments
 (0)