feat(Boole): add verified queue and deque examples #539
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
This seems to be the same as if i + 1 == n then 0 else i + 1, is there a reason why the axiomatic definition is preferred?
Yes, that’s exactly the intended meaning! I originally wrote it axiomatically because the direct Boole conditional version currently triggers a VC-generation/elaboration issue for integer-valued if branches: the generated VC contains something like ite (tail + 1 = n) 0 ..., and Lean reports that the 0 has type Int but a Prop was expected. So NextIndex is just a workaround for expressing the same circular successor while keeping the example verifiable. I agree the conditional version is clearer, and I’m happy to switch once that VC issue is fixed or add a short comment explaining the helper.
Thanks! I understand now. Maybe it would be helpful if you added a quick bit about that in the comment too, because it explains why mod doesn't work but not the issue with the if/else, which seems to be the other obvious non-axiomatic approach (compared to mod).
I just pushed the comment! Thanks
@Robertboy18 can you solve the conflicts? We don't have too much constraints to accept this PR in the Boole-sandbox branch, it the conflict is solved.
@arademaker conflicts should be fixed now :) I also updated the examples to the current Boole verifier API and built all three examples locally.
conflicts are fixed now! the CI failure looks unrelated to this PR: the runner can’t find cvc5, and the existing Boole-sandbox runs seem to fail for the same reason. the examples build locally with cvc5 installed :)
Hi @arademaker! I merged the latest Boole-sandbox (Lean 4.34) into this, and the queue examples verify with cvc5. CI now passes Build and Test, after I swapped the deprecated if_pos/if_neg in bubble_sort and loop_simple. Lint still fails on missing docstrings in some older examples like MaxExample, but that's already the case on the branch, so I'm happy to fix it in a separate PR :) Could you take another look when you have a moment?
The last CI run got cut off by a runner shutdown during lake lint. Could someone re-run it? :)
Arleee1
Robertboy18
I wanted to keep building out the Boole examples, so this adds three verified data-structure examples: an array-backed FIFO queue, a circular queue and an array-backed deque. It also sets up cvc5 in CI so the
Strata.Boole.verify "cvc5"checks can run, and notes intwo_sumandseq_slicingwhysmtis left out of their fallback chains.The sandbox has moved to Lean 4.34 since I opened this, so I merged the current Boole-sandbox in. The queue examples,
two_sumandseq_slicingbuild with--wfail --iofailagainst it, using cvc5 from thecvc5package. While rechecking,bubble_sortandloop_simplefailed that build becauseif_posandif_negare now deprecated, so they useite_eq_leftandite_eq_rightinstead.I had a bit of AI help with the merge and the 4.34 fixes. Let me know if you have any questions :)