Skip to content

feat(Boole): Bring Boole sandbox to Lean 4.29 and add queue examples#539

Open
Robertboy18 wants to merge 2 commits intoleanprover:Boole-sandboxfrom
Robertboy18:feat/boole-queue-deque-examples
Open

feat(Boole): Bring Boole sandbox to Lean 4.29 and add queue examples#539
Robertboy18 wants to merge 2 commits intoleanprover:Boole-sandboxfrom
Robertboy18:feat/boole-queue-deque-examples

Conversation

@Robertboy18
Copy link
Copy Markdown

I wanted to keep building out the Boole examples, but noticed the sandbox was still pinned to Lean 4.27 while newer Strata support for old(...) and global modifies had landed upstream. This PR updates the Boole sandbox to Lean 4.29.1 and adds/finishes verified data-structure examples: stack, FIFO queue, circular queue, and array-backed deque!

Let me know if you have any questions: )!

Copilot AI review requested due to automatic review settings May 3, 2026 04:04
@Robertboy18 Robertboy18 force-pushed the feat/boole-queue-deque-examples branch from 0ad4c54 to 5df3164 Compare May 3, 2026 04:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Comment on lines +19 to +26
// `NextIndex(i, n)` is `(i + 1) mod n`, axiomatized without using `mod`.
function NextIndex(i : int, n : int) : int;

axiom (∀ i : int, n : int ::
n > 0 && 0 <= i && i < n ==> 0 <= NextIndex(i, n) && NextIndex(i, n) < n);
axiom (∀ n : int :: n > 0 ==> NextIndex(n - 1, n) == 0);
axiom (∀ i : int, n : int ::
n > 0 && 0 <= i && i + 1 < n ==> NextIndex(i, n) == i + 1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

@Arleee1 Arleee1 May 4, 2026

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I just pushed the comment! Thanks

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.

3 participants