-
Notifications
You must be signed in to change notification settings - Fork 454
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
feat: lemmas for Bitvector division when denominator is zero #5609
Conversation
These lemmas explain what happens when the denominator is zero. This is used by bv_decide for bitblasting.
Mathlib CI status (docs):
|
I think you can also drop the |
Co-authored-by: Tobias Grosser <[email protected]>
Co-authored-by: Tobias Grosser <[email protected]>
@tobiasgrosser done, the names are terser now. |
This LGTM now. Thank you, @bollu. |
Given that neg proofs are unlikely to refer to sdiv/smod proofs, we could consider moving sdiv/smod after neg/sub. I guess @kim-em may have an opinion here. |
Divison proofs are more likely to depend on add/sub/mul proofs than the other way around. This prepares for leanprover#5609, which adds division proofs that depend on negation to already be defined. This PR only moves proofs, but does not change the proofs with the exception of the last `simp` on toNat_smod being turned into a `simp only` to ensure the proof stability there.
I implemented this in #5623. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is udiv
the decided simp nf of division on BitVec? For <
we have <
and slt
while udiv
seems to be udiv
and sdiv
instead of /
and sdiv
?
Divison proofs are more likely to depend on add/sub/mul proofs than the other way around. This prepares for leanprover#5609, which adds division proofs that depend on negation to already be defined. This PR only moves proofs, but does not change the proofs with the exception of the last `simp` on toNat_smod being turned into a `simp only` to ensure the proof stability there.
Divison proofs are more likely to depend on add/sub/mul proofs than the other way around. This prepares for leanprover#5609, which adds division proofs that depend on negation to already be defined. This PR only moves proofs, but does not change the proofs with the exception of the last simp on toNat_smod being turned into a simp only which was needed for proof stability.
Divison proofs are more likely to depend on add/sub/mul proofs than the other way around. This cleans up leanprover#5609, which added division proofs that rely on negation to already be defined.
Divison proofs are more likely to depend on add/sub/mul proofs than the other way around. This cleans up leanprover#5609, which added division proofs that rely on negation to already be defined.
Divison proofs are more likely to depend on add/sub/mul proofs than the other way around. This cleans up #5609, which added division proofs that rely on negation to already be defined.
) This PR is a follow-up to #5609, where we add lemmas characterizing `smtUDiv` and `smtSDiv`'s behavior when the denominator is zero. We build some `slt` theory, connecting it to `msb` for a clean proof. I chose not to characterize `slt` in terms of `msb` a `simp` lemma, since I anticipate use cases where we want to keep the arithmetic interpretation of `slt`.
…anprover#5616) This PR is a follow-up to leanprover#5609, where we add lemmas characterizing `smtUDiv` and `smtSDiv`'s behavior when the denominator is zero. We build some `slt` theory, connecting it to `msb` for a clean proof. I chose not to characterize `slt` in terms of `msb` a `simp` lemma, since I anticipate use cases where we want to keep the arithmetic interpretation of `slt`.
These lemmas explain what happens when the denominator is zero with
udiv
,umod
,sdiv
,smod
. A follow-up PR will show what happens withsmtUDiv
andsmtSMod
, since these need some more bitvector theory.These lemmas will be used by
bv_decide
for bitblasting.The theorems
{sdiv, smod}_zero
are located afterneg
theory has been built for the purpose of writing terse proofs.