Skip to content

Commit 2c4bb65

Browse files
edited the forward proof, make files, moved further test cases with new orders... etc
1 parent a7123c4 commit 2c4bb65

17 files changed

+2665
-15
lines changed

hol/policy_to_table/bdd_cake_trans/Holmakefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ EXTRA_CLEANS = $(if $(NEWHOLHEAP),$(NEWHOLHEAP) $(NEWHOLHEAP).o,) \
5151
$(wildcard *.sexp) \
5252
$(wildcard *.S) \
5353
$(wildcard *.o) \
54-
$(wildcard *~)
54+
$(wildcard *~) \
55+
.hol/ \
56+
*.uo \
57+
*.ui \
58+
*Theory.sml \
59+
*Theory.sig \
60+
*Script.ui \
61+
*Script.uo
5562

5663
OPTIONS = QUIT_ON_FAILURE
5764

hol/policy_to_table/bdd_cake_trans/apply_trans_to_IOLib.sig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ sig
33
include Abbrev
44

55
val sptrees_gen_bdds_policy_and_table : term * term * term -> (term * term * term)
6+
val time_stage : string * Timer.cpu_timer * Timer.real_timer -> {sys: Time.time, usr: Time.time} * Time.time
67

78
end

hol/policy_to_table/bdd_cake_trans/apply_trans_to_IOLib.sml

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ open optionTheory bdd_sptrees_genTheory pairTheory bdd_genTheory tables_specTheo
77
open sptrees_bdd_trans_ProgTheory;
88
open preamble basis ml_translatorLib ;
99

10-
open miscTheory ml_translatorTheory ListProgTheory ;
10+
open miscTheory ;
1111
open fromSexpTheory;
1212

1313

@@ -17,10 +17,31 @@ val _ = translation_extends "sptrees_bdd_trans_Prog";
1717
val _ = type_abbrev("action_policy_type", “:((string# num list) action_expr) policy”);
1818

1919

20+
21+
fun time_stage (stage_name, timer_cpu, timer_real) =
22+
let
23+
val cpu_time = Timer.checkCPUTimer timer_cpu
24+
val real_time = Timer.checkRealTimer timer_real
25+
val _ = HOL_MESG (stage_name ^ " completed in: " ^
26+
Time.toString (#usr cpu_time) ^ " user, " ^
27+
Time.toString (#sys cpu_time) ^ " system, " ^
28+
Time.toString real_time ^ " real\n")
29+
in
30+
(cpu_time, real_time)
31+
end
32+
33+
34+
35+
36+
2037
fun sptrees_gen_bdds_policy_and_table (var_policy, policy_order, policy_full_order) =
2138

2239
let
2340

41+
val start_cpu_stage2_io = Timer.startCPUTimer ();
42+
val start_real_stage2_io = Timer.startRealTimer ();
43+
44+
2445
Definition policy_order_test_def:
2546
policy_order_test = (^policy_order:string list)
2647
End
@@ -90,6 +111,9 @@ val prog =
90111

91112
val _ = astToSexprLib.write_ast_to_file "../../bdd_cake_test/test_bdd_policy.sexp" prog;
92113

114+
val _ = time_stage ("Stage 2 from var policy to sexp - cakeML trans ", start_cpu_stage2_io, start_real_stage2_io);
115+
val start_cpu_stage2_io2 = Timer.startCPUTimer ();
116+
val start_real_stage2_io2 = Timer.startRealTimer ();
93117

94118
val status_compile_sexp = OS.Process.system "cd ../../bdd_cake_test/ && CML_STACK_SIZE=2048 CML_HEAP_SIZE=8192 ./cake --sexp=true --exclude_prelude=true --skip_type_inference=false --jump=false --reg_alg=0 < test_bdd_policy.sexp > test_bdd_policy.cake.S"
95119

@@ -112,7 +136,9 @@ val _ = if OS.Process.isSuccess status_exec
112136
else (print "Nej, policy cc compilation failed\n";
113137
OS.Process.exit OS.Process.failure)
114138

115-
139+
val _ = time_stage ("Stage 2 cakeML compiliation var policy to bdd ", start_cpu_stage2_io2, start_real_stage2_io2);
140+
val start_cpu_stage2_io3 = Timer.startCPUTimer ();
141+
val start_real_stage2_io3 = Timer.startRealTimer ();
116142

117143
(*
118144
@@ -138,6 +164,8 @@ val ins = TextIO.openIn "../../bdd_cake_test/bdd_policy_cakeml_export.txt";
138164
val policy_content_str = TextIO.inputAll ins;
139165
val _ = TextIO.closeIn ins;
140166

167+
val _ = time_stage ("Stage 2 from Policy to var BDD total ", start_cpu_stage2_io, start_real_stage2_io);
168+
141169
(*open Term;*)
142170

143171
val policy_bdd_content_term =
@@ -226,6 +254,11 @@ val prog =
226254

227255
val _ = astToSexprLib.write_ast_to_file "../../bdd_cake_test/test_bdd_table.sexp" prog;
228256

257+
val _ = time_stage ("Stage 2 prepp out table and recompile cakeml translation ", start_cpu_stage2_io3, start_real_stage2_io3);
258+
val start_cpu_stage2_io4 = Timer.startCPUTimer ();
259+
val start_real_stage2_io4 = Timer.startRealTimer ();
260+
261+
229262

230263
val status = OS.Process.system "cd ../../bdd_cake_test/ && CML_STACK_SIZE=2048 CML_HEAP_SIZE=8192 ./cake --sexp=true --exclude_prelude=true --skip_type_inference=false --jump=false --reg_alg=0 < test_bdd_table.sexp > test_bdd_table.cake.S && cc test_bdd_table.cake.S basis_ffi.c -lm -o test_bdd_table.cake -lm && time ./test_bdd_table.cake > bdd_table_cakeml_export.txt"
231264

@@ -272,9 +305,9 @@ end;
272305

273306

274307

308+
val _ = time_stage ("Stage 2 cakeML compiliation var table to BDD ", start_cpu_stage2_io4, start_real_stage2_io4);
275309

276-
277-
310+
val _ = time_stage ("Stage 2 from TABLE to var BDD total ", start_cpu_stage2_io3, start_real_stage2_io3);
278311

279312
in
280313
(policy_bdd_content_term, gen_var_table_auto, table_bdd_content_term)

hol/policy_to_table/bdd_cake_trans/bdd_trans_ProgScript.sml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
open HolKernel Parse boolLib bossLib;
2-
open optionTheory pairTheory bdd_genTheory policy_specTheory pred_specTheory;
2+
(*open optionTheory pairTheory bdd_genTheory policy_specTheory pred_specTheory;
33
open preamble basis ml_translatorLib ;
44
55
open miscTheory ml_translatorTheory ListProgTheory ;
66
open fromSexpTheory;
7-
7+
*)
88

99

1010
val _ = new_theory "bdd_trans_Prog";

hol/policy_to_table/bdd_cake_trans/bdd_trans_new_ProgScript.sml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
open HolKernel Parse boolLib bossLib;
2-
open optionTheory pairTheory bdd_gen_newTheory bdd_genTheory policy_specTheory pred_specTheory;
2+
(*open optionTheory pairTheory bdd_gen_newTheory bdd_genTheory policy_specTheory pred_specTheory;
33
open preamble basis ml_translatorLib ;
44
55
open miscTheory ml_translatorTheory ListProgTheory ;
66
open fromSexpTheory;
7-
7+
*)
88

99

1010

hol/policy_to_table/bdd_cake_trans/internet_firewall_policies/Holmakefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ EXTRA_CLEANS = $(if $(NEWHOLHEAP),$(NEWHOLHEAP) $(NEWHOLHEAP).o,) \
3838
$(wildcard *.sexp) \
3939
$(wildcard *.S) \
4040
$(wildcard *.o) \
41-
$(wildcard *~)
41+
$(wildcard *~) \
42+
.hol/ \
43+
*.uo \
44+
*.ui \
45+
*Theory.sml \
46+
*Theory.sig \
47+
*Script.ui \
48+
*Script.uo
4249

4350
OPTIONS = QUIT_ON_FAILURE
4451

0 commit comments

Comments
 (0)