feat: Port 20 more numeric-only Dafny synthesis tasks (batch 7)#116
feat: Port 20 more numeric-only Dafny synthesis tasks (batch 7)#116
Conversation
- RemoveFront: Remove first element from array - Replace: Replace elements above threshold with -1 - ReturnSeven: Simple constant function returning 7 - Reverse: Reverse array in-place - Rotate: Rotate array by offset - SelectionSort: Sort array preserving elements - SeqToArray: Convert list to array - SetToSeq: Convert set to list (simulated with dedup) - SlopeSearch: Search in 2D sorted array - SwapArithmetic: Swap two integer values All specifications use Hoare triple style with sorry proofs. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…nation_by - Replace mvcgen tactic with sorry in Hoare triple proofs - Add termination_by sorry for recursive functions - Import Multiset module where needed - Add Inhabited instance for Color type - Fix toFinset to toMultiset conversions - Fix deprecated indexOf? to idxOf? - Simplify Array.swap calls to avoid type issues - Fix BeeConst operator issues All files now compile successfully with sorry placeholders.
- Add SynthesisTask622: Find median of two sorted arrays - Add SynthesisTask445: Element-wise multiplication - Add SynthesisTask623: Power of list elements - Add SynthesisTask762: Check if month has 30 days - Add SynthesisTask600: Check if number is even - Add SynthesisTask741: Check if all characters are the same - Add SynthesisTask262: Split array into two parts - Add SynthesisTask61: Count substrings with sum of digits equal to length - Add SynthesisTask458: Calculate rectangle area - Add SynthesisTask424: Extract rear characters from strings - Add SynthesisTask170: Sum elements in array range - Add SynthesisTask171: Calculate pentagon perimeter - Add SynthesisTask139: Calculate circle circumference - Add SynthesisTask790: Check if even-indexed elements are even - Add SynthesisTask257: Swap two integers - Add SynthesisTask565: Split string into characters - Add SynthesisTask581: Calculate square pyramid surface area - Add SynthesisTask775: Check if odd-indexed elements are odd - Add SynthesisTask452: Calculate loss given cost and selling price - Add SynthesisTask106: Append array elements to sequence All implementations use sorry placeholders and follow Hoare triple style. Updated SYNTHESIS_PORTING_SUMMARY.md to reflect 40 total ported tasks. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Claude finished @alok's task —— View job Code Review for PR #116: Port 20 numeric-only Dafny synthesis tasks (batch 7)Review Checklist
Overall AssessmentThis PR successfully adds 20 new numeric-only Dafny synthesis task specifications as part of batch 7. The implementation quality is high, and most files follow the established patterns and guidelines. ✅ Strengths
|
There was a problem hiding this comment.
Pull Request Overview
This PR continues the porting of Dafny synthesis tasks to Lean, adding 20 new numeric-only specifications and updating the build setup and a couple of numpy-style examples.
- Introduce a new
DafnyBenchmarkslibrary inlakefile.leanto include the ported modules. - Refactor
NumpySpec/Numpy_Sort.leanandNumpySpec/Numpy_Absolute.leanto use the new quotation-based Hoare triple syntax and, in the latter, provide a concrete implementation. - Add 20 new
NumpySpec/DafnyBenchmarks/*.leanfiles withsorryplaceholders for implementations and matching specification theorems.
Reviewed Changes
Copilot reviewed 242 out of 242 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lakefile.lean | Added lean_lib DafnyBenchmarks with glob for new modules |
| NumpySpec/Numpy_Sort.lean | Updated Hoare triple syntax for numpy_sort |
| NumpySpec/Numpy_Absolute.lean | Provided implementation for numpy_absolute and updated spec |
Comments suppressed due to low confidence (2)
lakefile.lean:48
- The new library is declared as
DafnyBenchmarks, but the glob targetsNumpySpec.DafnyBenchmarks. Ensure the library name and module path align so all ported files are included correctly.
lean_lib DafnyBenchmarks where
NumpySpec/Numpy_Absolute.lean:28
- [nitpick] The
mvcgeninvocation is indented under the spec and followed bysorry. For clarity, place tactic calls on their own line and align indentation with the surrounding proof steps.
mvcgen [numpy_absolute]
| ⦃⇓result => ⌜∀ i j : Fin n, i < j → result[i] ≤ result[j]⌝ ∧ | ||
| ⌜∀ x : Float, (result.toList.count x) = (a.toList.count x)⌝⦄ := by |
There was a problem hiding this comment.
The postcondition is split into two separate ⌜...⌝ quotations joined by ∧. To avoid parsing ambiguities, consider wrapping the entire conjunction inside a single ⌜...⌝.
| ⦃⇓result => ⌜∀ i j : Fin n, i < j → result[i] ≤ result[j]⌝ ∧ | |
| ⌜∀ x : Float, (result.toList.count x) = (a.toList.count x)⌝⦄ := by | |
| ⦃⇓result => ⌜(∀ i j : Fin n, i < j → result[i] ≤ result[j]) ∧ | |
| (∀ x : Float, (result.toList.count x) = (a.toList.count x))⌝⦄ := by |
Summary
Continue porting Dafny synthesis tasks, focusing exclusively on numeric types (Int, Nat, Float).
Changes
sorryplaceholders (type signatures only)Test plan
lake buildto verify all files compileThis continues the work from PR #115 (batch 6).
🤖 Generated with Claude Code