EuclideanDivision: THEORY
 BEGIN
  IMPORTING Int
  IMPORTING Abs
  % do not edit above this line
  
  IMPORTING ints@tdiv, ints@tmod
  
  div_total(x: int): int
  
  % Why3 div
  div(x:int,
    x1:int): MACRO int =  IF x1 /= 0 THEN tdiv(x, x1) ELSE div_total(x) ENDIF
  
  % Why3 mod1
  mod1(x:int, x1:int): int
  
  mod_total(x: int): int
  
  % Why3 div_mod
  div_mod: LEMMA FORALL (x:int, y:int): (NOT (y = 0)) => (x = ((y * div(x,
    y)) + mod1(x, y)))
  
  % Why3 div_bound
  div_bound: LEMMA FORALL (x:int, y:int): ((x >= 0) AND (y >  0)) =>
    ((0 <= div(x, y)) AND (div(x, y) <= x))
  
  % Why3 mod_bound
  mod_bound: LEMMA FORALL (x:int, y:int): (NOT (y = 0)) => ((0 <= mod1(x,
    y)) AND (mod1(x, y) <  abs(y)))
  
  % Why3 mod_1
  mod_1: LEMMA FORALL (x:int): (mod1(x, 1) = 0)
  
  % Why3 div_1
  div_1: LEMMA FORALL (x:int): (div(x, 1) = x)
  
  % Why3 div_inf
  div_inf: LEMMA FORALL (x:int, y:int): ((0 <= x) AND (x <  y)) => (div(x,
    y) = 0)
  
  % Why3 div_inf_neg
  div_inf_neg: LEMMA FORALL (x:int, y:int): ((0 <  x) AND (x <= y)) =>
    (div((-x), y) = (-1))
  
  % Why3 mod_0
  mod_0: LEMMA FORALL (y:int): (NOT (y = 0)) => (mod1(0, y) = 0)
  
  % Why3 div_1_left
  div_1_left: LEMMA FORALL (y:int): (y >  1) => (div(1, y) = 0)
  
  % Why3 div_minus1_left
  div_minus1_left: LEMMA FORALL (y:int): (y >  1) => (div((-1), y) = (-1))
  
  % Why3 mod_1_left
  mod_1_left: LEMMA FORALL (y:int): (y >  1) => (mod1(1, y) = 1)
  
  % Why3 mod_minus1_left
  mod_minus1_left: LEMMA FORALL (y:int): (y >  1) => (mod1((-1),
    y) = (y - 1))
  
  % Why3 div_mult
  div_mult: LEMMA FORALL (x:int, y:int, z:int): (x >  0) =>
    (div(((x * y) + z), x) = (y + div(z, x)))
  
  % Why3 mod_mult
  mod_mult: LEMMA FORALL (x:int, y:int, z:int): (x >  0) =>
    (mod1(((x * y) + z), x) = mod1(z, x))
  
  
 END EuclideanDivision
 