Skip to content

Commit d33e330

Browse files
edited definitions of eval, and a few other parts
1 parent 2fdfbb1 commit d33e330

File tree

2 files changed

+849
-57
lines changed

2 files changed

+849
-57
lines changed

hol/policy_arith_to_varScript.sml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ Definition eval_arithm_atom_def:
9595
(eval_arithm_atom pd a_False = SOME F) ∧
9696
(eval_arithm_atom pd (arithm_gt lval bv) =
9797
case resolve_lval pd lval of
98-
| SOME (val_bs bv') => bitv_binpred binop_lt bv' bv
98+
| SOME (val_bs bv') => bitv_binpred binop_gt bv' bv
9999
| _ => NONE) ∧
100100
(eval_arithm_atom pd (arithm_lt lval bv) =
101101
case resolve_lval pd lval of
102-
SOME (val_bs bv') => bitv_binpred binop_gt bv' bv
102+
SOME (val_bs bv') => bitv_binpred binop_lt bv' bv
103103
| _ => NONE)
104104
End
105105

@@ -108,36 +108,32 @@ End
108108

109109
(*
110110
111-
val ttl_bv = “(n2v 64, LENGTH (n2v 10))”;
112-
val version_bs = “(n2v 4, LENGTH (n2v 4))”;
111+
val test_bs = “(n2v 1, (4:num))”;
112+
val version_bs = “(n2v 1, (4:num))”;
113113
val ether_bs = “(n2v 4, LENGTH (n2v 0x8080))”;
114-
114+
115+
116+
val ttl_bv = “(n2v 4, (4:num))”;
117+
118+
119+
115120
val example_pd = “[ ("h", val_record [
116121
("ip", val_record [
117-
("ttl", val_bs ^ttl_bv );
122+
("ttl", val_bs (n2v 7, (4:num)) );
118123
("version", val_bs ^version_bs)
119124
]);
120125
("ether", val_bs ^ether_bs)
121126
])
122127
]”;
123128
124-
val sixty_bs = “(n2v 60, LENGTH (n2v 10))”;
125-
126129
127-
val h_ip_ttl = “lv_acc (lv_acc (lv_x "h") "ip") "ttl"”;
128-
val result1 = EVAL “resolve_lval ^example_pd ^h_ip_ttl”;
130+
val p_ttl_gt_60 = “(arithm_lt (lv_acc (lv_acc (lv_x "h") "ip") "ttl") (n2v 3, (4:num)))”;
131+
EVAL “eval_arithm_atom ^example_pd ^p_ttl_gt_60”;
129132
130-
val h_eth_src = “lv_acc (lv_acc (lv_x "h") "eth") "src"”;
131-
val result2 = EVAL “resolve_lval ^example_pd ^h_eth_src”;
132133
133-
134-
val p_ttl_gt_60 = “(arithm_gt (lv_acc (lv_acc (lv_x "h") "ip") "ttl") ^sixty_bs)”;
135-
EVAL “eval_arithm_atom ^example_pd ^p_ttl_gt_60”;
136-
(* T *)
137-
138-
val p_ttl_lt_60 = “(arithm_lt (lv_acc (lv_acc (lv_x "h") "ip") "ttl") ^sixty_bs)”;
139-
EVAL “eval_arithm_atom ^example_pd ^p_ttl_lt_60”;
140-
(* F *)
134+
135+
val p_ttl_gt_60 = “(arithm_gt (lv_acc (lv_acc (lv_x "h") "ip") "ttl") (n2v 3, (4:num)))”;
136+
EVAL “eval_arithm_atom ^example_pd ^p_ttl_gt_60”;
141137
*)
142138

143139

0 commit comments

Comments
 (0)