Skip to content

Conversation

luisacicolini
Copy link

No description provided.

@luisacicolini luisacicolini marked this pull request as draft February 20, 2025 16:55
Comment on lines +2736 to +2743
theorem msb_srem {x y : BitVec w} :
(BitVec.srem x y).msb
= (match x.msb, y.msb with
| false, false => BitVec.umod x y
| false, true => BitVec.umod x (.neg y)
| true, false => .neg (umod (.neg x) y)
| true, true => .neg (umod (.neg x) (.neg y))).msb := by
rfl
Copy link

Choose a reason for hiding this comment

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

We should drop msb, since there is a theorem statement one should be able to write about the sign of the result of srem that does not express it directly in terms of the case-split of umod, plus a msb.

Comment on lines +2774 to +2780
theorem msb_sdiv {x y : BitVec w} :
(BitVec.sdiv x y).msb
= (match x.msb, y.msb with
| false, false => udiv x y
| false, true => .neg (udiv x (.neg y))
| true, false => .neg (udiv (.neg x) y)
| true, true => udiv (.neg x) (.neg y)).msb := by
Copy link

Choose a reason for hiding this comment

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

Same comment as above, this time for sdiv. There's a legible theorem statement to be written here, and we should find it.

@luisacicolini
Copy link
Author

the correct lemmas now exist.

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.

2 participants