Skip to content

Qround.v: Add more rounding functions#291

Open
RyanGlScott wants to merge 8 commits into
rocq-prover:masterfrom
RyanGlScott:T283-more-rounding-functions
Open

Qround.v: Add more rounding functions#291
RyanGlScott wants to merge 8 commits into
rocq-prover:masterfrom
RyanGlScott:T283-more-rounding-functions

Conversation

@RyanGlScott

Copy link
Copy Markdown
Contributor

This adds three additional rounding functions to Qround.v (Qtruncate, Qround_away, and Qround_to_even) to complement the existing Qfloor and Qceiling functions. It also proves some corresponding properties (e.g., that each function respects <=).

Fixes #283.

  • Added changelog.
  • Added / updated documentation.

Comment thread theories/QArith/Qround.v
Comment on lines +457 to +459
(** Properties about how [Qfloor] and [Qceiling] interact with [Qplus] *)

Lemma Qfloor_add_Z_r : forall (x:Q) (z:Z), Qfloor (x + inject_Z z) = (Qfloor x + z)%Z.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note that this property (and the related properties below) are all defined at the bottom of the file so that their proofs can take advantage of Qfloor_comp and Qceiling_comp. If you'd prefer, I can rearrange these proofs, although I may need to inline some of the details of Q{floor,ceiling}_comp to accommodate this.

Comment thread theories/QArith/Qround.v
now apply (Qplus_le_compat _ _ _ _ (Qle_refl x)).
Qed.

Lemma Qround_to_even_resp_le : forall x y, x <= y -> (Qround_to_even x <= Qround_to_even y)%Z.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The implementation of this proof is particularly verbose. If you have ideas on how to make this cleaner, I'd love to hear them!

@RyanGlScott

RyanGlScott commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

EDIT: Never mind, this was fixed with a rebase over #290.


The smtcoq CI job fails with:

       error: Failed to open archive (Source threw exception: error: unable to download 'https://github.com/smtcoq/smtcoq/archive/coq-master.tar.gz': HTTP error 404

I think this is because the smtcoq repo no longer has a coq-master branch, but rather a rocq-master branch. I believe #290 is working on addressing this. Should I wait until #290 lands first?

@RyanGlScott
RyanGlScott force-pushed the T283-more-rounding-functions branch from 0284b8d to 19b9c4d Compare July 15, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QArith: Add more rounding modes to complement Qfloor and Qceiling

1 participant