Commit 896e2144 authored by MARCHE Claude's avatar MARCHE Claude

CE float value: nicer form (in progress)

parent 6bc9619b
theory T
theory T32
use import ieee_float.Float32
goal g1 : forall x:t. not (ge x (4.25:t))
goal g1 : forall x:t. eq x (0.0:t)
goal g2 : forall x:t. eq x (1.25:t)
goal g3 : forall x:t. not (eq x (0.0:t))
goal g4 : forall x:t. not (eq x (1.25:t))
goal g5 : forall x:t. not (ge x (4.25:t))
end
theory T64
use import ieee_float.Float64
goal g1 : forall x:t. eq x (0.0:t)
goal g2 : forall x:t. eq x (1.25:t)
goal g3 : forall x:t. not (eq x (0.0:t))
goal g4 : forall x:t. not (eq x (1.25:t))
goal g5 : forall x:t. not (ge x (4.25:t))
end
bench/ce/floats.mlw T g1 : Unknown (other)
bench/ce/floats.mlw T32 g1 : Unknown (other)
Counter-example model:File floats.mlw:
Line 5:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T g1 : Unknown (other)
bench/ce/floats.mlw T32 g2 : Unknown (other)
Counter-example model:File floats.mlw:
Line 7:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T32 g3 : Unknown (other)
Counter-example model:File floats.mlw:
Line 9:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T32 g4 : Unknown (other)
Counter-example model:File floats.mlw:
Line 11:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T32 g5 : Unknown (other)
Counter-example model:File floats.mlw:
Line 13:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T64 g1 : Unknown (other)
Counter-example model:File floats.mlw:
Line 22:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T64 g2 : Unknown (other)
Counter-example model:File floats.mlw:
Line 24:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T64 g3 : Unknown (other)
Counter-example model:File floats.mlw:
Line 26:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T64 g4 : Unknown (other)
Counter-example model:File floats.mlw:
Line 28:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T64 g5 : Unknown (other)
Counter-example model:File floats.mlw:
Line 30:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T32 g1 : Unknown (other)
Counter-example model:File floats.mlw:
Line 5:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T32 g2 : Unknown (other)
Counter-example model:File floats.mlw:
Line 7:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T32 g3 : Unknown (other)
Counter-example model:File floats.mlw:
Line 9:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T32 g4 : Unknown (other)
Counter-example model:File floats.mlw:
Line 11:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T32 g5 : Unknown (other)
Counter-example model:File floats.mlw:
Line 13:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T64 g1 : Unknown (other)
Counter-example model:File floats.mlw:
Line 22:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T64 g2 : Unknown (other)
Counter-example model:File floats.mlw:
Line 24:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T64 g3 : Unknown (other)
Counter-example model:File floats.mlw:
Line 26:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T64 g4 : Unknown (other)
Counter-example model:File floats.mlw:
Line 28:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T64 g5 : Unknown (other)
Counter-example model:File floats.mlw:
Line 30:
x = {"type" : "Integer" ,
"val" : "0" }
bench/ce/floats.mlw T g1 : Unknown (other)
bench/ce/floats.mlw T32 g1 : Unknown (other)
Counter-example model:File floats.mlw:
Line 5:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x01" , "sign" : "#b1" ,
"significand" : "#b01000000000000000000000" } }
bench/ce/floats.mlw T32 g2 : Unknown (other)
Counter-example model:File floats.mlw:
Line 7:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x00" , "sign" : "#b1" ,
"significand" : "#b10000000000000000000000" } }
bench/ce/floats.mlw T32 g3 : Unknown (other)
Counter-example model:File floats.mlw:
Line 9:
x = {"type" : "Float" ,
"val" : {"cons" : "Minus_zero" } }
bench/ce/floats.mlw T32 g4 : Unknown (other)
Counter-example model:File floats.mlw:
Line 11:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x7f" , "sign" : "#b0" ,
"significand" : "#b01000000000000000000000" } }
bench/ce/floats.mlw T32 g5 : Unknown (other)
Counter-example model:File floats.mlw:
Line 13:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x81" , "sign" : "#b0" ,
"significand" : "#b00010000000000000000000" } }
bench/ce/floats.mlw T g1 : Unknown (other)
bench/ce/floats.mlw T64 g1 : Unknown (other)
Counter-example model:File floats.mlw:
Line 22:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "-0x1.0000008000000p-1022" } }
bench/ce/floats.mlw T64 g2 : Unknown (other)
Counter-example model:File floats.mlw:
Line 24:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "-0x1.0000010000000p-1023" } }
bench/ce/floats.mlw T64 g3 : Unknown (other)
Counter-example model:File floats.mlw:
Line 26:
x = {"type" : "Float" ,
"val" : {"cons" : "Minus_zero" } }
bench/ce/floats.mlw T64 g4 : Unknown (other)
Counter-example model:File floats.mlw:
Line 28:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "0x1.4000000000000p0" } }
bench/ce/floats.mlw T64 g5 : Unknown (other)
Counter-example model:File floats.mlw:
Line 30:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "0x1.0800000000000p513" } }
bench/ce/floats.mlw T32 g1 : Unknown (other)
Counter-example model:File floats.mlw:
Line 5:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x01" , "sign" : "#b1" ,
"significand" : "#b01000000000000000000000" } }
bench/ce/floats.mlw T32 g2 : Unknown (other)
Counter-example model:File floats.mlw:
Line 7:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x00" , "sign" : "#b1" ,
"significand" : "#b10000000000000000000000" } }
bench/ce/floats.mlw T32 g3 : Unknown (other)
Counter-example model:File floats.mlw:
Line 9:
x = {"type" : "Float" ,
"val" : {"cons" : "Minus_zero" } }
bench/ce/floats.mlw T32 g4 : Unknown (other)
Counter-example model:File floats.mlw:
Line 11:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x7f" , "sign" : "#b0" ,
"significand" : "#b01000000000000000000000" } }
bench/ce/floats.mlw T32 g5 : Unknown (other)
Counter-example model:File floats.mlw:
Line 13:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x81" , "sign" : "#b0" ,
"significand" : "#b00010000000000000000000" } }
bench/ce/floats.mlw T64 g1 : Unknown (other)
Counter-example model:File floats.mlw:
Line 22:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "-0x1.0000008000000p-1022" } }
bench/ce/floats.mlw T64 g2 : Unknown (other)
Counter-example model:File floats.mlw:
Line 24:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "-0x1.0000010000000p-1023" } }
bench/ce/floats.mlw T64 g3 : Unknown (other)
Counter-example model:File floats.mlw:
Line 26:
x = {"type" : "Float" ,
"val" : {"cons" : "Minus_zero" } }
bench/ce/floats.mlw T64 g4 : Unknown (other)
Counter-example model:File floats.mlw:
Line 28:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "0x1.4000000000000p0" } }
bench/ce/floats.mlw T64 g5 : Unknown (other)
Counter-example model:File floats.mlw:
Line 30:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "0x1.0800000000000p513" } }
bench/ce/floats.mlw T g1 : Unknown (other)
bench/ce/floats.mlw T32 g1 : Unknown (other)
Counter-example model:File floats.mlw:
Line 5:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x01" , "sign" : "#b1" ,
"significand" : "#b00100000000000000000000" } }
bench/ce/floats.mlw T32 g2 : Unknown (other)
Counter-example model:File floats.mlw:
Line 7:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x00" , "sign" : "#b1" ,
"significand" : "#b00000000000000000000001" } }
bench/ce/floats.mlw T32 g3 : Unknown (other)
Counter-example model:File floats.mlw:
Line 9:
x = {"type" : "Float" ,
"val" : {"cons" : "Minus_zero" } }
bench/ce/floats.mlw T32 g4 : Unknown (other)
Counter-example model:File floats.mlw:
Line 11:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x7f" , "sign" : "#b0" ,
"significand" : "#b01000000000000000000000" } }
bench/ce/floats.mlw T32 g5 : Unknown (other)
Counter-example model:File floats.mlw:
Line 13:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#xc0" , "sign" : "#b0" ,
"significand" : "#b00000000000000000000001" } }
bench/ce/floats.mlw T g1 : Unknown (other)
bench/ce/floats.mlw T64 g1 : Unknown (other)
Counter-example model:File floats.mlw:
Line 22:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "-0x1.0100000000000p-1022" } }
bench/ce/floats.mlw T64 g2 : Unknown (other)
Counter-example model:File floats.mlw:
Line 24:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "-0x1.0000000000400p-1023" } }
bench/ce/floats.mlw T64 g3 : Unknown (other)
Counter-example model:File floats.mlw:
Line 26:
x = {"type" : "Float" ,
"val" : {"cons" : "Minus_zero" } }
bench/ce/floats.mlw T64 g4 : Unknown (other)
Counter-example model:File floats.mlw:
Line 28:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "0x1.4000000000000p0" } }
bench/ce/floats.mlw T64 g5 : Unknown (other)
Counter-example model:File floats.mlw:
Line 30:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "0x1.0000000000001p513" } }
bench/ce/floats.mlw T32 g1 : Unknown (other)
Counter-example model:File floats.mlw:
Line 5:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x01" , "sign" : "#b1" ,
"significand" : "#b00100000000000000000000" } }
bench/ce/floats.mlw T32 g2 : Unknown (other)
Counter-example model:File floats.mlw:
Line 7:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x00" , "sign" : "#b1" ,
"significand" : "#b00000000000000000000001" } }
bench/ce/floats.mlw T32 g3 : Unknown (other)
Counter-example model:File floats.mlw:
Line 9:
x = {"type" : "Float" ,
"val" : {"cons" : "Minus_zero" } }
bench/ce/floats.mlw T32 g4 : Unknown (other)
Counter-example model:File floats.mlw:
Line 11:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#x7f" , "sign" : "#b0" ,
"significand" : "#b01000000000000000000000" } }
bench/ce/floats.mlw T32 g5 : Unknown (other)
Counter-example model:File floats.mlw:
Line 13:
x = {"type" : "Float" , "val" : {"cons" : "Float_value" ,
"exponent" : "#xc0" , "sign" : "#b0" ,
"significand" : "#b00000000000000000000001" } }
bench/ce/floats.mlw T64 g1 : Unknown (other)
Counter-example model:File floats.mlw:
Line 22:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "-0x1.0100000000000p-1022" } }
bench/ce/floats.mlw T64 g2 : Unknown (other)
Counter-example model:File floats.mlw:
Line 24:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "-0x1.0000000000400p-1023" } }
bench/ce/floats.mlw T64 g3 : Unknown (other)
Counter-example model:File floats.mlw:
Line 26:
x = {"type" : "Float" ,
"val" : {"cons" : "Minus_zero" } }
bench/ce/floats.mlw T64 g4 : Unknown (other)
Counter-example model:File floats.mlw:
Line 28:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "0x1.4000000000000p0" } }
bench/ce/floats.mlw T64 g5 : Unknown (other)
Counter-example model:File floats.mlw:
Line 30:
x = {"type" : "Float" , "val" : {"cons" : "Float_hexa" ,
"value" : "0x1.0000000000001p513" } }
......@@ -34,6 +34,7 @@ type float_type =
| Minus_zero
| Not_a_number
| Float_value of string * string * string
| Float_hexa of string
type model_value =
| Integer of string
......@@ -99,6 +100,10 @@ let convert_float_value f =
let m = Mstr.add "exponent" (Json_base.String eb) m in
let m = Mstr.add "significand" (Json_base.String sb) m in
Json_base.Record m
| Float_hexa s ->
let m = Mstr.add "cons" (Json_base.String "Float_hexa") Stdlib.Mstr.empty in
let m = Mstr.add "value" (Json_base.String s) m in
Json_base.Record m
let rec convert_model_value value : Json_base.json =
match value with
......@@ -200,7 +205,8 @@ let print_float_human fmt f =
| Not_a_number ->
fprintf fmt "NaN"
| Float_value (b, eb, sb) ->
fprintf fmt "float(%s,%s,%s)" b eb sb
fprintf fmt "float_bits(%s,%s,%s)" b eb sb
| Float_hexa s -> fprintf fmt "%s" s
let rec print_array_human fmt (arr: model_array) =
fprintf fmt "(";
......
......@@ -22,6 +22,7 @@ type float_type =
| Minus_zero
| Not_a_number
| Float_value of string * string * string
| Float_hexa of string
type model_value =
| Integer of string
......
......@@ -211,15 +211,6 @@ and refine_variable_value (table: correspondence_table) key v =
let tv = refine_definition table t in
Mstr.add key (true, tv) table
let convert_float (f: Smt2_model_defs.float_type) : Model_parser.float_type =
match f with
| Plus_infinity -> Model_parser.Plus_infinity
| Minus_infinity -> Model_parser.Minus_infinity
| Plus_zero -> Model_parser.Plus_zero
| Minus_zero -> Model_parser.Minus_zero
| Not_a_number -> Model_parser.Not_a_number
| Float_value (b, eb, sb) -> Model_parser.Float_value (b, eb, sb)
(* Conversion to value referenced as defined in model_parser.
We assume that array indices fit into an integer *)
let convert_to_indice t =
......@@ -249,7 +240,7 @@ and convert_to_model_value (t: term): Model_parser.model_value =
| Integer i -> Model_parser.Integer i
| Decimal (d1, d2) -> Model_parser.Decimal (d1, d2)
| Fraction (s1, s2) -> Model_parser.Fraction (s1, s2)
| Float f -> Model_parser.Float (convert_float f)
| Float f -> Model_parser.Float f
| Bitvector bv -> Model_parser.Bitvector bv
| Boolean b -> Model_parser.Boolean b
| Other _s -> raise Not_value
......
......@@ -12,6 +12,31 @@
{
open Parse_smtv2_model_parser
exception SyntaxError
let interp_float b eb sb =
try
let is_neg = match b with
| "#b0" -> false
| "#b1" -> true
| _ -> raise Exit
in
if String.sub eb 0 2 = "#b" && String.length eb = 13 &&
String.sub sb 0 2 = "#x" && String.length sb = 15 then
(* binary 64 *)
let exp_base2 = String.sub eb 2 11 in
let exp = int_of_string ("0b" ^ exp_base2) - 1023 in
let mant_base16 = String.sub sb 2 13 in
Model_parser.Float_hexa((if is_neg then "-" else "")^
"0x1."^mant_base16^"p"^(string_of_int exp))
else
if String.sub eb 0 2 = "#x" && String.length eb = 4 &&
String.sub sb 0 2 = "#b" && String.length eb = 25 then
(* binary 32 *)
let exp_base16 = String.sub eb 2 2 in
let mant_base2 = String.sub sb 2 23 in
raise Exit (* TODO *)
else raise Exit
with Exit -> Model_parser.Float_value (b, eb, sb)
}
let atom = [^'('')'' ''\t''\n']
......@@ -63,13 +88,13 @@ rule token = parse
| "(_" space+ "BitVec" space+ num")" { BITVECTOR_TYPE }
| "(_" space+ "extract" space+ num space+ num ")" as s { BITVECTOR_EXTRACT s }
| "(_" space+ "+zero" space+ num space+ num ")" { FLOAT_VALUE Smt2_model_defs.Plus_zero }
| "(_" space+ "-zero" space+ num space+ num ")" { FLOAT_VALUE Smt2_model_defs.Minus_zero }
| "(_" space+ "+oo" space+ num space+ num ")" { FLOAT_VALUE Smt2_model_defs.Plus_infinity }
| "(_" space+ "-oo" space+ num space+ num ")" { FLOAT_VALUE Smt2_model_defs.Minus_infinity }
| "(_" space+ "NaN" space+ num space+ num ")" { FLOAT_VALUE Smt2_model_defs.Not_a_number }
| "(_" space+ "+zero" space+ num space+ num ")" { FLOAT_VALUE Model_parser.Plus_zero }
| "(_" space+ "-zero" space+ num space+ num ")" { FLOAT_VALUE Model_parser.Minus_zero }
| "(_" space+ "+oo" space+ num space+ num ")" { FLOAT_VALUE Model_parser.Plus_infinity }
| "(_" space+ "-oo" space+ num space+ num ")" { FLOAT_VALUE Model_parser.Minus_infinity }
| "(_" space+ "NaN" space+ num space+ num ")" { FLOAT_VALUE Model_parser.Not_a_number }
| "(fp" space+ (float_num as b) space+ (float_num as eb) space+ (float_num as sb) ")"
{ FLOAT_VALUE (Smt2_model_defs.Float_value (b, eb, sb)) }
{ FLOAT_VALUE (interp_float b eb sb) }
| num as integer
{ INT_STR (integer) }
......
......@@ -33,7 +33,7 @@
%token LET
%token AND LE GE NOT
%token DIV
%token <Smt2_model_defs.float_type> FLOAT_VALUE
%token <Model_parser.float_type> FLOAT_VALUE
%token <string> COMMENT
%token <string> BITVECTOR_VALUE
%token <string> BITVECTOR_EXTRACT
......
......@@ -13,14 +13,6 @@ open Stdlib
type variable = string
type float_type =
| Plus_infinity
| Minus_infinity
| Plus_zero
| Minus_zero
| Not_a_number
| Float_value of string * string * string
type array =
| Const of term
| Store of array * term * term
......@@ -29,7 +21,7 @@ and term =
| Integer of string
| Decimal of (string * string)
| Fraction of (string * string)
| Float of float_type
| Float of Model_parser.float_type
| Apply of (string * term list)
| Other of string
| Array of array
......@@ -54,12 +46,13 @@ type correspondence_table = (bool * definition) Mstr.t
let print_float fmt f =
match f with
| Plus_infinity -> Format.fprintf fmt "Plus_infinity"
| Minus_infinity -> Format.fprintf fmt "Minus_infinity"
| Plus_zero -> Format.fprintf fmt "Plus_zero"
| Minus_zero -> Format.fprintf fmt "Minus_zero"
| Not_a_number -> Format.fprintf fmt "NaN"
| Float_value (b, eb, sb) -> Format.fprintf fmt "(%s, %s, %s)" b eb sb
| Model_parser.Plus_infinity -> Format.fprintf fmt "Plus_infinity"
| Model_parser.Minus_infinity -> Format.fprintf fmt "Minus_infinity"
| Model_parser.Plus_zero -> Format.fprintf fmt "Plus_zero"
| Model_parser.Minus_zero -> Format.fprintf fmt "Minus_zero"
| Model_parser.Not_a_number -> Format.fprintf fmt "NaN"
| Model_parser.Float_value (b, eb, sb) -> Format.fprintf fmt "(%s, %s, %s)" b eb sb
| Model_parser.Float_hexa s -> Format.fprintf fmt "%s" s
let rec print_array fmt a =
match a with
......
......@@ -13,14 +13,6 @@ open Stdlib
type variable = string
type float_type =
| Plus_infinity
| Minus_infinity
| Plus_zero
| Minus_zero
| Not_a_number
| Float_value of string * string * string
type array =
| Const of term
| Store of array * term * term
......@@ -29,7 +21,7 @@ and term =
| Integer of string
| Decimal of (string * string)
| Fraction of (string * string)
| Float of float_type
| Float of Model_parser.float_type
| Apply of (string * term list)
| Other of string
| Array of array
......
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