theory ModelInt

use int.Int

(* PASS *)
goal test0 : forall x:int. not (0 < x < 1)

(* CE *)
goal test1 : forall x:int. not (0 <= x <= 1)

use int.EuclideanDivision

(* CE *)
goal test2 : forall x:int. div x x = 1

(* CE *)
goal test_overflow:
  forall x y :  int.
     0 <= x <= 65535 /\ 0 <= y <= 65535 -> 0 <= x + y <= 65535

(* CE *)
goal test_overflow2:
  forall x y :  int.
     -2 <= x <= 65535 /\ -2 <= y <= 65535 -> -2 <= x + y <= 65535

predicate is_int16 (x:int) = -65536 <= x <= 65535

(* CE *)
goal test_overflow_int16:
  forall x y :  int.
     is_int16 x /\ is_int16 y -> is_int16 (x + y)

(* CE *)
goal test_overflow_int16_alt:
  forall x y :  int.
      -65536 <= x <= 65535 /\ -65536 <= y <= 65535 -> -65536 <= x+y <= 65535

(* CE *)
goal test_overflow_int16_bis:
  forall x y :  int.
     is_int16 x /\ is_int16 y /\
     (0 <= x) /\ (x <= y) -> is_int16 (x + y)

predicate is_int32 (x:int) = -2147483648 <= x <= 2147483647

(* CE *)
goal test_overflow_int32:
  forall x y :  int.
     is_int32 x /\ is_int32 y -> is_int32 (x + y)

(* CE *)
goal test_overflow_int32_bis:
  forall x y :  int.
     is_int32 x /\ is_int32 y /\ 0 <= x <= y -> is_int32 (x + y)

(* CE *)
goal test_overflow_int32_bis_inline:
  forall x y :  int.
     -2147483648 <= x <= 2147483647 /\ -2147483648 <= y <= 2147483647 /\ 0 <= x <= y -> -2147483648 <= x + y <= 2147483647

end
