-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Models for reals must be in real format #926
Comments
Halbaroth
added a commit
to Halbaroth/alt-ergo
that referenced
this issue
Nov 13, 2023
This PR fixes the issue OCamlPro#926 about printing reals in models. The current printer always displays positive reals as rational number of the form `(/ x.0 y.0)` where `x` and `y` are positive integers. Negative reals are prefixed by their sign and simplify the expression if the denominator is one.
Merged
Halbaroth
added a commit
to Halbaroth/alt-ergo
that referenced
this issue
Nov 13, 2023
This PR fixes the issue OCamlPro#926 about printing reals in models. The current printer always displays positive reals as rational number of the form `(/ x.0 y.0)` where `x` and `y` are positive integers. Negative reals are prefixed by their sign and the printer simplifies the expression if the denominator is one. Notice that by the current implementation of Zarith: ```ocaml type t = { num: Z.t; (** Numerator. *) den: Z.t; (** Denominator, >= 0 *) } (* Type of rationals. Invariants: - den is always >= 0; - num and den have no common factor; - if den=0, then num is -1, 0 or 1. - if num=0, then den is -1, 0 or 1. *) ``` Any rational number of the form `0/q` satisfies `q = -1` or `q = 0` or `q = 1`. Thus the printer will always output `0.0` in this case but for the case `0/0` which shouldn't occur.
Halbaroth
added a commit
to Halbaroth/alt-ergo
that referenced
this issue
Nov 13, 2023
This PR fixes the issue OCamlPro#926 about printing reals in models. The current printer always displays positive reals as rational number of the form `(/ x y)` where `x` and `y` are positive integers. Negative reals are prefixed by their sign and the printer simplifies the expression if the denominator is one. Notice that by the current implementation of Zarith: ```ocaml type t = { num: Z.t; (** Numerator. *) den: Z.t; (** Denominator, >= 0 *) } (* Type of rationals. Invariants: - den is always >= 0; - num and den have no common factor; - if den=0, then num is -1, 0 or 1. - if num=0, then den is -1, 0 or 1. *) ``` Any rational number of the form `0/q` satisfies `q = -1` or `q = 0` or `q = 1`. Thus the printer will always output `0.0` in this case but for the case `0/0` which shouldn't occur.
Halbaroth
added a commit
to Halbaroth/alt-ergo
that referenced
this issue
Nov 13, 2023
This PR fixes the issue OCamlPro#926 about printing reals in models. The current printer always displays positive reals as rational number of the form `(/ x y)` where `x` and `y` are positive integers. Negative reals are prefixed by their sign and the printer simplifies the expression if the denominator is one. Notice that by the current implementation of Zarith: ```ocaml type t = { num: Z.t; (** Numerator. *) den: Z.t; (** Denominator, >= 0 *) } (* Type of rationals. Invariants: - den is always >= 0; - num and den have no common factor; - if den=0, then num is -1, 0 or 1. - if num=0, then den is -1, 0 or 1. *) ``` Any rational number of the form `0/q` satisfies `q = -1` or `q = 0` or `q = 1`. Thus the printer will always output `0.0` in this case but for the case `0/0` which shouldn't occur.
Halbaroth
added a commit
to Halbaroth/alt-ergo
that referenced
this issue
Nov 13, 2023
This PR fixes the issue OCamlPro#926 about printing reals in models. The current printer always displays positive reals as rational numbers of the form `(/ x y)` where `x` and `y` are positive integers. Negative reals are represented by the expression `(/ (- x) y)` where `x` and `y` are positive integers. The printer simplifies the expression if the denominator is one. Notice that by the current implementation of Zarith: ```ocaml type t = { num: Z.t; (** Numerator. *) den: Z.t; (** Denominator, >= 0 *) } (* Type of rationals. Invariants: - den is always >= 0; - num and den have no common factor; - if den=0, then num is -1, 0 or 1. - if num=0, then den is -1, 0 or 1. *) ``` Any rational number of the form `0/q` satisfies `q = -1` or `q = 0` or `q = 1`. Thus the printer will always output `0.0` in this case but for the case `0/0` which shouldn't occur.
Merged
bclement-ocp
pushed a commit
that referenced
this issue
Nov 13, 2023
This PR fixes the issue #926 about printing reals in models. The current printer always displays positive reals as rational numbers of the form `(/ x y)` where `x` and `y` are positive integers. Negative reals are represented by the expression `(/ (- x) y)` where `x` and `y` are positive integers. The printer simplifies the expression if the denominator is one. Notice that by the current implementation of Zarith: ```ocaml type t = { num: Z.t; (** Numerator. *) den: Z.t; (** Denominator, >= 0 *) } (* Type of rationals. Invariants: - den is always >= 0; - num and den have no common factor; - if den=0, then num is -1, 0 or 1. - if num=0, then den is -1, 0 or 1. *) ``` Any rational number of the form `0/q` satisfies `q = -1` or `q = 0` or `q = 1`. Thus the printer will always output `0.0` in this case but for the case `0/0` which shouldn't occur.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alt-Ergo can output things like:
(declare-fun x () Real 2)
but this is not correct it must be(declare-fun x () Real 2.0)
.The text was updated successfully, but these errors were encountered: