@@ -46,8 +46,8 @@ val _ = Hol_datatype `
4646 arithm_atom =
4747 a_True (* T *)
4848 | a_False (* F *)
49- | arithm_gt of arith_lv => bitv (* lval > v *)
50- | arithm_lt of arith_lv => bitv (* lval < v *)
49+ | arithm_ge of arith_lv => bitv (* lval ≤ v *)
50+ | arithm_le of arith_lv => bitv (* lval ≥ v *)
5151 (* | arithm_eq of arith_lv => num (* lval = v *) *) (* this will be added to input policy *)
5252`;
5353
9393Definition eval_arithm_atom_def:
9494 (eval_arithm_atom pd a_True = SOME T) ∧
9595 (eval_arithm_atom pd a_False = SOME F) ∧
96- (eval_arithm_atom pd (arithm_gt lval bv) =
96+ (eval_arithm_atom pd (arithm_ge lval bv) =
9797 case resolve_lval pd lval of
98- | SOME (val_bs bv') => bitv_binpred binop_gt bv' bv
98+ | SOME (val_bs bv') => bitv_binpred binop_ge bv' bv
9999 | _ => NONE ) ∧
100- (eval_arithm_atom pd (arithm_lt lval bv) =
100+ (eval_arithm_atom pd (arithm_le lval bv) =
101101 case resolve_lval pd lval of
102- SOME (val_bs bv') => bitv_binpred binop_lt bv' bv
102+ SOME (val_bs bv') => bitv_binpred binop_le bv' bv
103103 | _ => NONE )
104104End
105105
@@ -271,15 +271,15 @@ End
271271
272272
273273
274- Definition all_convertable_def :
275- all_convertable m_e policy =
274+ Definition all_convertable_to_var_def :
275+ all_convertable_to_var m_e policy =
276276 EVERY (λ(pred,_). pred_a2v m_e pred ≠ NONE ) policy
277277End
278278
279279
280- Definition convert_def :
281- convert policy m_e =
282- if all_convertable m_e policy then
280+ Definition convert_arith_to_var_policy_def :
281+ convert_arith_to_var_policy policy m_e =
282+ if all_convertable_to_var m_e policy then
283283 SOME (MAP (λ(pred,act). (THE (pred_a2v m_e pred), act)) policy)
284284 else
285285 NONE
@@ -295,7 +295,7 @@ val test_me = ``[
295295
296296(* Sample policies *)
297297val empty_policy = ``[] : (arith_pred # string) list``;
298- val all_convertable_policy = ``[
298+ val all_convertable_to_var_policy = ``[
299299 (arith_a (arithm_gt (lv_x "x") 5), "allow");
300300 (arith_a (arithm_lt (lv_x "y") 2), "deny")
301301]``;
@@ -304,18 +304,18 @@ val partially_convertable_policy = ``[
304304 (arith_a (arithm_eq (lv_x "z") 1), "log") (* Unmapped *)
305305]``;
306306
307- EVAL ``convert ^empty_policy ^test_me``;
307+ EVAL ``convert_arith_to_var_policy ^empty_policy ^test_me``;
308308(* SOME []*)
309- EVAL ``convert ^all_convertable_policy ^test_me``;
309+ EVAL ``convert_arith_to_var_policy ^all_convertable_to_var_policy ^test_me``;
310310(* [(Var "x_gt_5", "allow"); (Var "y_lt_2", "deny")]*)
311- EVAL ``convert ^partially_convertable_policy ^test_me``;
311+ EVAL ``convert_arith_to_var_policy ^partially_convertable_policy ^test_me``;
312312(* NONE*)
313313
314314val complex_policy = ``[
315315 (arith_not (arith_a (arithm_gt (lv_x "x") 5)), "reject");
316316 (arith_and (arith_a a_True) (arith_a (arithm_lt (lv_x "y") 2)), "special")
317317]``;
318- EVAL ``convert ^complex_policy ^test_me``;
318+ EVAL ``convert_arith_to_var_policy ^complex_policy ^test_me``;
319319
320320(*
321321 SOME [
@@ -413,7 +413,7 @@ Theorem policy_airth_to_var_sem_conversion_correct:
413413 (∀var atom.
414414 ALOOKUP m_e var = SOME atom ⇒
415415 ALOOKUP m_v var = eval_arithm_atom packet_input atom) ∧
416- (convert arith_policy m_e = SOME var_policy)
416+ (convert_arith_to_var_policy arith_policy m_e = SOME var_policy)
417417 ⇒
418418 sem_arith_policy arith_policy packet_input =
419419 sem_policy var_policy m_v
@@ -423,7 +423,7 @@ Proof
423423 ‘check_arith_pred_sem arith_policy packet_input = check_sem_pred var_policy m_v’
424424 suffices_by rw[] >>
425425
426- fs[convert_def ] >>
426+ fs[convert_arith_to_var_policy_def ] >>
427427 rw[check_arith_pred_sem_def, check_sem_pred_def] >>
428428
429429 rw[MAP_MAP_o] >>
@@ -433,9 +433,9 @@ Proof
433433 Cases_on ‘x’ >> rw[] >>
434434 rename1 ‘(pred, act)’ >>
435435
436- (* Since all_convertable holds, pred_a2v m_e pred ≠ NONE *)
436+ (* Since all_convertable_to_var holds, pred_a2v m_e pred ≠ NONE *)
437437 ‘pred_a2v m_e pred ≠ NONE ’ by (
438- fs[all_convertable_def , EVERY_MEM] >>
438+ fs[all_convertable_to_var_def , EVERY_MEM] >>
439439 rgs[ELIM_UNCURRY] >>
440440 res_tac >>
441441 fs[FST]
0 commit comments