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

BinInt: 3 lemmas about testbit, mod _ 2^, ones #9425

Merged
merged 1 commit into from Mar 15, 2019

Conversation

Projects
None yet
4 participants
@andres-erbsen
Copy link
Contributor

commented Jan 28, 2019

Kind: feature

  • Entry added in CHANGES.md.

Here are three lemmas about Z.testbit that I have needed to copy-paste into multiple projects. For example, they appear here in Word/Properties.v. I am proposing placing them into BinInt.v right after the dependencies become available.

The lemma statements are as follows:

Z.testbit_mod_pow2 : forall a n i : Z, 0 <= n -> Z.testbit (a mod 2 ^ n) i = ((i <? n) && Z.testbit a i)%bool
Z.testbit_ones : forall n i : Z, 0 <= n -> Z.testbit (Z.ones n) i = ((0 <=? i) && (i <? n))%bool
Z.testbit_ones_nonneg : forall n i : Z, 0 <= n -> 0 <= i -> Z.testbit (Z.ones n) i = (i <? n)

@andres-erbsen andres-erbsen requested a review from herbelin as a code owner Jan 28, 2019

@andres-erbsen

This comment has been minimized.

Copy link
Contributor Author

commented Jan 29, 2019

I don't understand the equations failure. what is the recommended procedure for debugging this?

@JasonGross

This comment has been minimized.

Copy link
Contributor

commented Jan 29, 2019

"Error: Unable to locate library ordinals." Sounds like an unrelated error. Maybe a bug in equations itself, maybe a bug in parallelism somewhere.

@andres-erbsen

This comment has been minimized.

Copy link
Contributor Author

commented Feb 8, 2019

ci build again

@andres-erbsen

This comment has been minimized.

Copy link
Contributor Author

commented Feb 14, 2019

The CI failures look spurious (and different between runs). Any chance of getting a review on this?

Qed.

Lemma testbit_ones_nonneg n i (Hn : 0 <= n) (Hi: 0 <= i)
: testbit (ones n) i = (i <? n)%bool.

This comment has been minimized.

Copy link
@vbgl

vbgl Feb 14, 2019

Contributor

Why do you need the bool scope annotation here?

@@ -1259,6 +1259,30 @@ Proof.
f_equal. now rewrite <- add_assoc, add_opp_diag_r, add_0_r.
Qed.

(** * [testbit] in terms of comparision. *)

Lemma testbit_mod_pow2 a n i (H:0<=n)

This comment has been minimized.

Copy link
@vbgl

vbgl Feb 14, 2019

Contributor

A bit of whitespace around : and <= would not hurt.

@vbgl

This comment has been minimized.

Copy link
Contributor

commented Feb 14, 2019

Hugo, what do you think about these changes? Could you be assigned to this PR? Thanks.

ping @herbelin

@andres-erbsen

This comment has been minimized.

Copy link
Contributor Author

commented Mar 13, 2019

bump?

@vbgl vbgl self-assigned this Mar 14, 2019

@vbgl

This comment has been minimized.

Copy link
Contributor

commented Mar 14, 2019

Please rebase and squash. I’ll take care of merging when CI goes through (unless someone opposes).

@vbgl vbgl added this to the 8.10+beta1 milestone Mar 14, 2019

@vbgl vbgl force-pushed the andres-erbsen:testbit-lemmas branch from 69b2639 to b7df34e Mar 14, 2019

@vbgl

This comment has been minimized.

Copy link
Contributor

commented Mar 14, 2019

I took care of the rebasing. Let’s only wait for the CI to complete.

@vbgl vbgl removed the needs: squashing label Mar 14, 2019

@vbgl

vbgl approved these changes Mar 14, 2019

@andres-erbsen

This comment has been minimized.

Copy link
Contributor Author

commented Mar 15, 2019

Thanks! CI failure is #9767 as expected.

@vbgl

vbgl approved these changes Mar 15, 2019

@vbgl vbgl merged commit b7df34e into coq:master Mar 15, 2019

7 of 9 checks passed

GitLab CI pipeline Pipeline completed with errors on GitLab CI
Details
library:ci-bedrock2 script_failure on GitLab CI
Details
Pull request checks Passed.
Details
coq.coq Build #20190314.7 succeeded
Details
coq.coq (Windows) Windows succeeded
Details
coq.coq (macOS) macOS succeeded
Details
doc:ml-api:odoc: ml-api artifact Link to ml-api build artifact.
Details
doc:refman: refman artifact Link to refman build artifact.
Details
doc:refman: stdlib artifact Link to stdlib build artifact.
Details

vbgl added a commit that referenced this pull request Mar 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.