Skip to content

Commit

Permalink
Merge branch 'OCamlPro:next' into bv-primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
hra687261 authored Jul 10, 2023
2 parents 0405db3 + 9422063 commit be74d71
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 31 deletions.
6 changes: 3 additions & 3 deletions src/lib/reasoners/ite_rel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ let assume env _ la =
let assume env uf la =
if Options.get_timers() then
try
Timers.exec_timer_start Timers.M_Arrays Timers.F_assume;
Timers.exec_timer_start Timers.M_Ite Timers.F_assume;
let res =assume env uf la in
Timers.exec_timer_pause Timers.M_Arrays Timers.F_assume;
Timers.exec_timer_pause Timers.M_Ite Timers.F_assume;
res
with e ->
Timers.exec_timer_pause Timers.M_Arrays Timers.F_assume;
Timers.exec_timer_pause Timers.M_Ite Timers.F_assume;
raise e
else assume env uf la

Expand Down
59 changes: 31 additions & 28 deletions src/lib/util/timers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,24 @@ type ty_module =
| M_Expr
| M_Triggers
| M_Simplex
| M_Ite

let mtag k = match k with
| M_None -> 0
| M_Typing -> 1
| M_Sat -> 2
| M_Match -> 3
| M_CC -> 4
| M_UF -> 5
| M_Arith -> 6
| M_Arrays -> 7
| M_Sum -> 8
| M_Records-> 9
| M_AC -> 10
| M_Expr-> 11
| M_Triggers->12
| M_Simplex->13
| M_None -> 0
| M_Typing -> 1
| M_Sat -> 2
| M_Match -> 3
| M_CC -> 4
| M_UF -> 5
| M_Arith -> 6
| M_Arrays -> 7
| M_Sum -> 8
| M_Records -> 9
| M_AC -> 10
| M_Expr -> 11
| M_Triggers -> 12
| M_Simplex -> 13
| M_Ite -> 14

let nb_mtag = 14

Expand Down Expand Up @@ -109,20 +111,21 @@ let ftag f = match f with
let nb_ftag = 20

let string_of_ty_module k = match k with
| M_None -> "None"
| M_Typing -> "Typing"
| M_Sat -> "Sat"
| M_Match -> "Match"
| M_CC -> "CC"
| M_UF -> "UF"
| M_Arith -> "Arith"
| M_Arrays -> "Arrays"
| M_Sum -> "Sum"
| M_Records-> "Records"
| M_AC -> "AC"
| M_Expr-> "Expr"
| M_Triggers->"Triggers"
| M_Simplex->"Simplex"
| M_None -> "None"
| M_Typing -> "Typing"
| M_Sat -> "Sat"
| M_Match -> "Match"
| M_CC -> "CC"
| M_UF -> "UF"
| M_Arith -> "Arith"
| M_Arrays -> "Arrays"
| M_Sum -> "Sum"
| M_Records -> "Records"
| M_AC -> "AC"
| M_Expr -> "Expr"
| M_Triggers -> "Triggers"
| M_Simplex -> "Simplex"
| M_Ite -> "Ite"

let string_of_ty_function f = match f with
| F_add -> "add"
Expand Down
1 change: 1 addition & 0 deletions src/lib/util/timers.mli
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type ty_module =
| M_Expr
| M_Triggers
| M_Simplex
| M_Ite

type ty_function =
| F_add
Expand Down
28 changes: 28 additions & 0 deletions src/preludes/ria.ae
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,34 @@ theory Real_of_Int extends RIA =
{i <= real_of_int(x)}.
k <= x

(* floor(x) ≤ i iff x < i + 1 *)
axiom int_floor_ub:
forall x, y : real, i : int
[ int_floor(x), not_theory_constant(x), int_floor(x) in ]?, i], y |-> real_of_int(i + 1) ]
{ int_floor(x) <= i }.
x < y

(* i <= floor(x) iff i <= x *)
axiom int_floor_lb:
forall x, y : real, i : int
[ int_floor(x), not_theory_constant(x), int_floor(x) in [i, ?[, y |-> real_of_int(i) ]
{ i <= int_floor(x) }.
y <= x

(* ceil(x) ≤ i iff x ≤ i *)
axiom int_ceil_ub:
forall x, y : real, i : int
[ int_ceil(x), not_theory_constant(x), int_ceil(x) in ]?, i], y |-> real_of_int(i) ]
{ int_ceil(x) <= i }.
x <= y

(* i <= ceil(x) iff i - 1 < x *)
axiom int_ceil_lb:
forall x, y : real, i : int
[ int_ceil(x), not_theory_constant(x), int_ceil(x) in [i, ?[, y |-> real_of_int(i - 1) ]
{ i <= int_ceil(x) }.
y < x

(* can add other axioms on strict ineqs on rationals ? *)

end
Expand Down
2 changes: 2 additions & 0 deletions tests/arith/ceil_floor_propagate.ae
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
logic x: real
goal g: int_ceil(x) = 0 and int_floor(x) = 0 -> x = 0.
2 changes: 2 additions & 0 deletions tests/arith/ceil_floor_propagate.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

unknown

0 comments on commit be74d71

Please sign in to comment.