let reduce_by_comparison ~with_alarms eval pos exp1 binop exp2 state =
(* Format.printf "red_by %a@." Cvalue.Model.pretty state; *)
let state, _loc1 = reduce_by_left_comparison ~with_alarms eval
pos exp1 binop exp2 state
in
let inv_binop = match binop with
| Gt -> Lt | Lt -> Gt | Le -> Ge | Ge -> Le
| _ -> binop
in
let state, _loc2 = reduce_by_left_comparison ~with_alarms eval
pos exp2 inv_binop exp1 state
in
(* Format.printf "red_by1 %a@." Cvalue.Model.pretty state; *)
(* Without relations, this is now the identity
begin match (pos, binop), loc1, loc2 with
| ((true, Eq) | (false, Ne)), Some left_loc , Some right_loc ->
Cvalue.Model.reduce_equality state left_loc right_loc
| _ -> state
end
*)
state