Upstreaming bit, div2, bodd and establishing binary recursion.#1737
Upstreaming bit, div2, bodd and establishing binary recursion.#1737linesthatinterlace wants to merge 17 commits intoleanprover-community:mainfrom
bit, div2, bodd and establishing binary recursion.#1737Conversation
Add bit arithmetic lemmas (bit_false, bit_true, bit_add, bit_add_bit), complete the leastBits/ofLeastBits section with simp lemmas, inverse proofs, injectivity, and the connection between bits and leastBits via bits_eq_leastBits_elim. Remove grind attributes from bodd_val, div2_val, bit_val to prevent grind from escaping into arithmetic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rename bits → bitsList, ofBits → ofBitsList, leastBits → leastBitsList, ofLeastBits → ofLeastBitsList to avoid clashes with existing Nat.ofBits. Add testBit lemmas for bitsList/ofBitsList, getElem_bitsList, bitsList_eq_ofFn_testBit. Sketch toBitVec, toLeastBitVec, ofBitVec, ofLeastBitVec definitions. Remove grind attributes from _val lemmas. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change binaryElim's bit callback from Nat → α → α to Bool → α → α, since only n.bodd is ever used. This simplifies all binaryElim-based definitions. Add binaryElim_bit/binaryElim_bit_apply showing binaryElim 0 1 bit = id. Remove BitVec sketches for now. Tidy docstrings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AlexeyMilovanov
left a comment
There was a problem hiding this comment.
The CI is currently failing, but I verified locally that these suggestions fix it. I think it's just the strict simpNF linter catching these 6 lemmas. With @[simp] removed here, both lake build and lake lint pass perfectly
…ies into binary_rewrite
Co-authored-by: Alexey Milovanov <almas239@gmail.com>
|
I think we could use this opportunity to change |
|
I would be fine with changing |
|
(I note by the way that we don't have the following inductive definitions. I am not proposing to add them and it isn't clear they would be suitable in batteries! However, I could certainly imagine Nat.Odd and Nat.Even existing.) |
This PR aims to produce a cleanly structured characterisation of
bodd,div2andbit, and use them to define a form of binary induction that is clean and easy to work with.