feat: Port 70 Dafny benchmark specifications (batch 4 of 4)#112
feat: Port 70 Dafny benchmark specifications (batch 4 of 4)#112
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 PR Review: feat: Port 70 Dafny benchmark specifications (batch 4 of 4)I've reviewed this PR which adds the final batch of 20 synthesis tasks to complete the porting of 70 Dafny benchmark specifications to Lean 4. Here's my detailed feedback: Review Tasks
✅ Positive Aspects
|
There was a problem hiding this comment.
Pull Request Overview
Adds the final batch of 20 Dafny synthesis task specifications to the Lean 4 port and refines the existing NumpySpec setup.
- Registers a new
DafnyBenchmarkslibrary in the Lakefile - Updates
numpy_sortandnumpy_absoluteto use concise bracket notation and provides an implementation fornumpy_absolute - Adds 20 new specification stubs under
NumpySpec/DafnyBenchmarks(all proofs left assorry)
Reviewed Changes
Copilot reviewed 180 out of 180 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lakefile.lean | Add DafnyBenchmarks lean_lib and include its modules |
| NumpySpec/Numpy_Sort.lean | Switch to bracket notation in the sort specification |
| NumpySpec/Numpy_Absolute.lean | Provide numpy_absolute implementation and simplify spec |
| NumpySpec/DafnyBenchmarks/porting_log.txt | Initial porting log (needs update for batch 4) |
| NumpySpec/DafnyBenchmarks/UpdateMap.lean | New updateMap function and Hoare triple spec |
| NumpySpec/DafnyBenchmarks/UpdateArray.lean | New updateElements function and spec |
| NumpySpec/DafnyBenchmarks/TwoSum*.lean (3 files) | Add three variants of two-sum specs |
| NumpySpec/DafnyBenchmarks/Triple*.lean (4 files) | Add four variants of triple multiplication specs |
| … (and 20 more new synthesis task files) | Bulk-addition of remaining synthesis stubs |
Comments suppressed due to low confidence (1)
NumpySpec/DafnyBenchmarks/porting_log.txt:6
- The porting log lists only the first 10 specifications. Since this PR adds 20 more synthesis tasks (batch 4), please update the log to reflect the newly added files and their status.
Files Ported:
| @[default_target] | ||
| lean_lib DafnyBenchmarks where | ||
| -- Include all DafnyBenchmarks modules | ||
| globs := #[.andSubmodules `NumpySpec.DafnyBenchmarks] |
There was a problem hiding this comment.
[nitpick] The DafnyBenchmarks library is configured but includes modules under the NumpySpec.DafnyBenchmarks namespace. Consider aligning the library name, namespace, and directory structure (e.g., remove the NumpySpec. prefix or rename the library) to avoid confusion when importing modules.
| globs := #[.andSubmodules `NumpySpec.DafnyBenchmarks] | |
| globs := #[.andSubmodules `DafnyBenchmarks] |
| ⦃⇓result => ∀ i : Fin n, result[i] = Float.abs x[i]⦄ := by | ||
| ⦃⇓result => ⌜∀ i : Fin n, result[i] = x[i].abs⌝⦄ := by | ||
| mvcgen [numpy_absolute] | ||
| sorry |
There was a problem hiding this comment.
The mvcgen tactic is called but immediately followed by sorry, so no proof is actually generated. Either remove the tactic invocation or replace sorry with the generated proof to keep the proof structure clear.
| sorry | |
| intro h_pre | |
| simp [numpy_absolute, Vector.map] | |
| intro i | |
| rfl |
Summary
Complete porting of 70 Dafny benchmark specifications to Lean 4 across 4 batches:
This PR adds the final batch of 20 synthesis tasks.
Changes in Batch 4
Natwith bounds instead ofFintypesString.Posconstruction issuessorryplaceholders (type signatures only)Key Features
Std.Do.TripleTest plan
lake buildto verify all files compile🤖 Generated with Claude Code