Skip to content
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

[doc] Document the floating-point and bitvector primitives #762

Merged
merged 4 commits into from
Jul 27, 2023

Conversation

bclement-ocp
Copy link
Collaborator

Nominating for 2.5.0 @Halbaroth I guess :)

@Halbaroth Halbaroth added this to the 2.5.0 milestone Jul 27, 2023
Comment on lines +2 to +12
# SMT-LIB Version 2

Alt-Ergo has partial support for the [SMT-LIB
standard](http://smtlib.cs.uiowa.edu/papers/smt-lib-reference-v2.6-r2017-07-18.pdf)
language from the SMT community.

*Note*: As of version 2.5.0, enhanced support for the SMT-LIB language is
provided by the new [Dolmen](http://gbury.github.io/dolmen/) frontend. To use
it, pass the option `--frontend dolmen` to Alt-Ergo. This will become the
default in a future release.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wad doing the same doc...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BV primitives are only available using the Dolmen frontend, I had to mention it. I can remove that paragraph.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep your paragraph ;)

Comment on lines +144 to +145
*Note*: When using the `dolmen` frontend, `real_of_int` is also available in
the smtlib2 format as the `to_real` function from the `Reals_Ints` theory.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a table given the translation between these AE primitives and the SMT-LIB ones would be clearer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a table would be very helpful, people usually use either AE or SMT-LIB. This is in the documentation for the native input language anyways, so I'll remove these notes and add corresponding paragraphs in the SMT-LIB format doc.

Comment on lines 153 to 155
`int_floor` and `int_ceil` implement the standard `floor` and `ceil` functions.
They compute the greatest integer less than a real and the least integer
greater than a real, respectively.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By standard, you mean the SMT-LIB standard or the mathematical one? I guess they agree but who knows :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no floor or ceil functions in the SMT-LIB standard. Changed to usual instead.

Comment on lines 169 to 170
The `sqrt_real` function denotes the square root of a real number. Alt-Ergo
only computes rational under- and over-approximations.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it mean sqrt_real computes the under-approximation or the over-approximation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sqrt_real computes the square root. Internally, Alt-Ergo tracks both an under- and an over- approximation of the square root as rationals. I agree that this sentence is confusing, I will remove it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I agree we shouldn't write the square root without mentioning it's an approximation.

Copy link
Collaborator Author

@bclement-ocp bclement-ocp Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not an approximation.

Edited to clarify: if e is not a constant rational square (i.e. equal to r * r for some rational r), Alt-Ergo treats sqrt_real(e) as uninterpreted, with the constraint that sqrt_real_default(e) ≤ sqrt_real(e) ≤ sqrt_real_excess(e) where sqrt_real_default and sqrt_real_excess are the under- and over-approximation. sqrt_real_default and sqrt_real_excess always compute to rational numbers for all (constant) rational inputs, but sqrt_real doesn't.
(Also in all cases we do have the constraint sqrt_real(x) * sqrt_real(x) = x of course)

Comment on lines +8 to +9
See also the {{:https://ocamlpro.github.io/alt-ergo/}language documentation}.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you add a link here? There is very same link on the sidebar.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the odoc for the alt-ergo package (this page: https://ocamlpro.github.io/alt-ergo/odoc/dev/alt-ergo/index.html ), I don't see a link to the language doc in the sidebar?

(Sorry, this probably should have been in a separate PR, I just did it as I was in the doc folder)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, I thought it was in the sphinx documentation. You don't need to do a separate PR for such a small modification.


```alt-ergo
logic integer_round : fpa_rounding_mode, real -> int
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add an example of input file using the round function? Or a link to an examples in the appropriate directory of the repository.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

@bclement-ocp bclement-ocp changed the title [doc] Document the floating-point primitives [doc] Document the floating-point and bitvector primitives Jul 27, 2023
@bclement-ocp bclement-ocp merged commit 3a2e6c4 into OCamlPro:next Jul 27, 2023
10 checks passed
Halbaroth pushed a commit to Halbaroth/alt-ergo that referenced this pull request Jul 28, 2023
@Halbaroth Halbaroth mentioned this pull request Jul 28, 2023
@Halbaroth Halbaroth mentioned this pull request Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants