Skip to content

feat(Boole): add verified algorithm examples#369

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

feat(Boole): add verified algorithm examples#369
Robertboy18 wants to merge 2 commits intoleanprover:Boole-sandboxfrom
Robertboy18:feat/boole-examples

Conversation

@Robertboy18
Copy link

@Robertboy18 Robertboy18 commented Feb 25, 2026

Summary

Excited to be contributing to CsLib! I think there is a lot we can do: )! So here is what I did

  • Add new verified Boole examples: selection sort, linear search, prefix sums, Euclid GCD, and two-sum.
  • Promote insertion sort from feature_requests/ into examples/ after strengthening invariants/spec.
  • Add more explanatory comments in the selection sort example.
  • Update lake-manifest.json Strata pin (the previously pinned Strata commit is no longer available upstream, which breaks lake update).

Files

  • Cslib/Languages/Boole/examples/insertion_sort.lean
  • Cslib/Languages/Boole/examples/selection_sort.lean
  • Cslib/Languages/Boole/examples/linear_search.lean
  • Cslib/Languages/Boole/examples/prefix_sums.lean
  • Cslib/Languages/Boole/examples/euclid_gcd.lean (uses a free ensures helper GCDProperties)
  • Cslib/Languages/Boole/examples/two_sum.lean (soundness-only spec)
  • remove Cslib/Languages/Boole/feature_requests/quantifier_syntax/insertion_sort.lean

All new/updated examples include a Lean-based proof like other examples?!

  • example : Strata.smtVCsCorrect ... := by gen_smt_vcs; all_goals grind

Adds new verified Boole examples: selection sort, insertion sort, linear search, prefix sums, Euclid GCD, and two-sum.

Also updates the Strata pin in lake-manifest.json because the previously pinned commit is no longer available upstream.
Copilot AI review requested due to automatic review settings February 25, 2026 18:55
Copy link

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.

Pull request overview

This PR adds verified algorithm examples to the Boole language examples directory, demonstrating program verification using the Strata/Boole framework. The PR promotes insertion sort from feature requests to examples after fixing verification issues, and adds five new verified examples (selection sort, linear search, prefix sums, Euclid's GCD, and two-sum).

Changes:

  • Updated Strata dependency to a commit that is available upstream
  • Promoted and fixed insertion sort implementation with strengthened invariants
  • Added five new verified algorithm examples with Lean-based proofs

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lake-manifest.json Updates Strata revision to available upstream commit
feature_requests/quantifier_syntax/insertion_sort.lean Removed buggy version that had incorrect VCs
examples/insertion_sort.lean Added corrected and verified insertion sort with stronger invariants
examples/selection_sort.lean Added verified selection sort with adjacent-order sortedness spec
examples/linear_search.lean Added verified linear search with completeness and soundness properties
examples/prefix_sums.lean Added verified prefix sums using uninterpreted function with axioms
examples/euclid_gcd.lean Added verified Euclid's GCD using free ensures helper pattern
examples/two_sum.lean Added verified two-sum with soundness-only specification

set_option maxHeartbeats 1000000 in
example : Strata.smtVCsCorrect insertionSortPgm := by
gen_smt_vcs
all_goals grind
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Missing end Strata at the end of the file. All other example files in the directory end with end Strata to close the namespace.

Suggested change
all_goals grind
all_goals grind
end Strata

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,102 @@
import Strata.MetaVerifier

---------------------------------------------------------------------
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

The separator line has 69 dashes, but the convention in other example files is to use 60 dashes (as seen in find_max.lean, stack_array_based.lean, and all other new examples in this PR).

Suggested change
---------------------------------------------------------------------
------------------------------------------------------------

Copilot uses AI. Check for mistakes.
@Robertboy18
Copy link
Author

Follow-up: I pushed commit 5693c20 to address Copilot’s notes in Cslib/Languages/Boole/examples/insertion_sort.lean:

  • Added the missing end Strata.
  • Normalized the section separator line to match the other Boole examples.

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