Attention une mise à jour du service Gitlab va être effectuée le mardi 18 janvier (et non lundi 17 comme annoncé précédemment) entre 18h00 et 18h30. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit e4af0ac2 authored by MARCHE Claude's avatar MARCHE Claude
Browse files

Removed all apparent soundness bugs with integer division

parent 5cd2f3d6
......@@ -7,12 +7,14 @@ theory BuiltIn
meta "eliminate_algebraic" "keep_recs"
end
(*
theory int.EuclideanDivision
syntax function div "(%1 / %2)"
syntax function mod "(%1 % %2)"
end
*)
theory map.Map
syntax type map "(%1,%2) farray"
......
......@@ -10,6 +10,8 @@ theory BuiltIn
meta "eliminate_algebraic" "keep_recs"
end
(*
theory int.EuclideanDivision
(* workaround for the "-1 % 32 = -1" bug *)
......@@ -19,7 +21,7 @@ theory int.EuclideanDivision
syntax function mod "safe_modulo(%1,%2)"
end
*)
(*
Local Variables:
......
......@@ -152,6 +152,7 @@ theory bool.Bool
end
*)
(* CVC4 division does not seem to be the Euclidean one
theory int.EuclideanDivision
syntax function div "(div %1 %2)"
syntax function mod "(mod %1 %2)"
......@@ -160,6 +161,7 @@ theory int.EuclideanDivision
remove prop Mod_1
remove prop Div_1
end
*)
(*
theory real.Truncate
......
......@@ -70,17 +70,25 @@ theory int.Abs
end
(* wrong: Euclidean division is NOT division round down
e.g : div (-1) (-2) is 1, not 0 *)
(*
theory int.EuclideanDivision
syntax function div "int<dn>(%1 / %2)"
end
*)
(* Gappa <- 0.16.4 has a bug,
it says that div (-1) 2 can have any value *)
(*
theory int.ComputerDivision
syntax function div "int<zr>(%1 / %2)"
end
*)
theory real.Real
......
......@@ -132,6 +132,7 @@ theory bool.Bool
syntax function implb "(=> %1 %2)"
end
(* needs to be checked
theory int.EuclideanDivision
syntax function div "(div %1 %2)"
syntax function mod "(mod %1 %2)"
......@@ -140,6 +141,7 @@ theory int.EuclideanDivision
remove prop Mod_1
remove prop Div_1
end
*)
theory real.FromInt
syntax function from_int "(to_real %1)"
......
......@@ -129,6 +129,7 @@ theory bool.Bool
end
(* needs to checked
theory int.EuclideanDivision
syntax function div "(div %1 %2)"
syntax function mod "(mod %1 %2)"
......@@ -137,6 +138,7 @@ theory int.EuclideanDivision
remove prop Mod_1
remove prop Div_1
end
*)
(*
Local Variables:
......
......@@ -133,6 +133,7 @@ theory bool.Bool
end
(* needs to be checked
theory int.EuclideanDivision
syntax function div "(div %1 %2)"
syntax function mod "(mod %1 %2)"
......@@ -141,7 +142,7 @@ theory int.EuclideanDivision
remove prop Mod_1
remove prop Div_1
end
*)
theory map.Map
......
......@@ -132,6 +132,7 @@ theory bool.Bool
syntax function implb "(=> %1 %2)"
end
(* needs to be checked
theory int.EuclideanDivision
syntax function div "(div %1 %2)"
syntax function mod "(mod %1 %2)"
......@@ -140,6 +141,7 @@ theory int.EuclideanDivision
remove prop Mod_1
remove prop Div_1
end
*)
theory real.FromInt
syntax function from_int "(to_real %1)"
......
......@@ -132,6 +132,7 @@ end
*)
(* needs to be checked
theory int.EuclideanDivision
syntax function div "(div %1 %2)"
syntax function mod "(mod %1 %2)"
......@@ -140,6 +141,7 @@ theory int.EuclideanDivision
remove prop Mod_1
remove prop Div_1
end
*)
(*
Local Variables:
......
......@@ -4,10 +4,14 @@ theory EuclideanDivTest
use import int.Int
use import int.EuclideanDivision
goal ok1 : div (-1) (-2) = -1
goal ok2 : mod (-1) (-2) = 1
goal smoke1 : div (-1) (-2) = 0
goal smoke2 : mod (-1) (-2) = -1
goal ok1 : div (-1) 2 = -1
goal ok2 : mod (-1) 2 = 1
goal ok3 : div (-1) (-2) = 1
goal ok4 : mod (-1) (-2) = 1
goal smoke1 : div (-1) 2 = 0
goal smoke2 : mod (-1) 2 = -1
goal smoke3 : div (-1) (-2) = 0
goal smoke4 : mod (-1) (-2) = -1
end
......@@ -16,9 +20,13 @@ theory ComputerDivTest
use import int.Int
use import int.ComputerDivision
goal ok1 : div (-1) (-2) = 0
goal ok2 : mod (-1) (-2) = -1
goal smoke1 : div (-1) (-2) = -1
goal smoke2 : mod (-1) (-2) = 1
goal ok1 : div (-1) 2 = 0
goal ok2 : mod (-1) 2 = -1
goal ok3 : div (-1) (-2) = 0
goal ok4 : mod (-1) (-2) = -1
goal smoke1 : div (-1) 2 = -1
goal smoke2 : mod (-1) 2 = 1
goal smoke3 : div (-1) (-2) = -1
goal smoke4 : mod (-1) (-2) = 1
end
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment