Conversation
…onfirmed) + REPORT.md update (run 61) Add WrapBin.lean: formal verification of ObstacleMath::wrap_bin from src/lib/collision_prevention/ObstacleMath.cpp. Key results: - 20 theorems, 0 sorry, verified by lake build with Lean 4.29.0 - Two models: wrapBin (Euclidean %, provably safe for all Int) and wrapBinCpp (Int.tmod, faithfully models C++ truncation-toward-zero semantics) - wrapBin_range / wrapBin_nonneg / wrapBin_lt_count: full range proof - wrapBinCpp_bug_general: formally proves C++ wrap_bin(-1, n) = -1 for n > 1 (negative index — latent bug confirmed by proof) - wrapBin_eq_wrapBinCpp_valid: both models agree on non-negative inputs - wrapBinOffset_valid: get_offset_bin_index call site is formally safe despite bug - tmod_neg1_gt1 (private): key lemma for the bug proof using Int.tmod match reduction Also add wrap_bin_informal.md informal spec (preconditions, postconditions, edge cases, examples table, C++ bug analysis). Update REPORT.md for run 61: - Status: 259 → 314 theorems, 123 → 141 examples, 6 → 9 sorry, 20 → 23 files - Add Layer 4 WrapBin, Layer 6 CommanderArming, Layer 8 Atmosphere sections - Add Bug 3 finding (wrap_bin latent C++ truncation bug) - Add runs 55-61 timeline entries - Update file inventory table with Atmosphere, CommanderArming, WrapBin rows Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… + 3 sorry (run 62) Add formal verification of math::sqrt_linear from PX4 mathlib. ## New files - formal-verification/lean/FVSquad/SqrtLinear.lean: Lean 4 spec + implementation - formal-verification/specs/sqrt_linear_informal.md: informal specification ## Summary - 15 theorems total: 12 proved without sorry, 3 sorry (sqrt branch) - Tasks 3 (Formal Spec Writing) + 4 (Implementation Extraction) - Three-branch model: negative→0, sqrt branch (axiomatised), identity (x≥1→x) - All non-sqrt theorems proved: neg→0, ge_one→identity, monotone, idempotent - Sorry-guarded: sqrtLinear_zero, sqrtLinear_sqrt_nonneg, sqrtLinear_sqrt_lt_one (all require Real.sqrt from Mathlib) ## Verification lake build passed with Lean 4.29.0. 3 sorry in SqrtLinear.lean (all clearly documented as needing Mathlib Real.sqrt). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ch targets (run 63) Task 7 (Proof Utility Critique): - Update CRITIQUE.md: Last Updated → 2026-04-23 - Overall Assessment: 338 total theorems (326 proved, 12 sorry), 24 files, 27 targets - Add WrapBin theorems to Proved Theorems Table (7 new rows; latent C++ bug highlighted) - Add SqrtLinear theorems to Proved Theorems Table (4 new rows; 3 sorry-guarded) - Update Known Sorry-Guarded Theorems: now 12 (6 WrapAngle + 3 Atmosphere + 3 SqrtLinear) - Add Positive Findings #19 (WrapBin latent C++ bug) and #20 (SqrtLinear branches) - Update Gaps and Recommendations: add items 10–12 for WrapBin fix, SqrtLinear sorry, get_lower_bound_angle - Update Paper Review: stale items now include Atmosphere, WrapBin, SqrtLinear (runs 49–62); bug count in abstract is stale (3 bugs not 2) Task 1 (Research & Target Identification): - Add 3 new targets to RESEARCH.md (run 63 section): - Target 28: ObstacleMath::get_lower_bound_angle (builds on WrapBin) - Target 29: crc16_signature fold/split CCITT (same structure as Crc16Fold) - Target 30: math::computeBrakingDistanceFromVelocity (safety: non-neg + monotone) - Update TARGETS.md: targets 25/26 status updated (proved/partial); new targets 28–30 added - Updated priority order for run 63 Also includes merged PR content: WrapBin.lean (20 thms), SqrtLinear.lean (15 thms) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ms proved, 0 sorry (run 65) Add formal verification for math::computeBrakingDistanceFromVelocity (TrajMath.hpp): - Informal spec: formal-verification/specs/braking_dist_informal.md - Lean 4 spec + implementation + proofs: formal-verification/lean/FVSquad/BrakingDist.lean * brakingDist_zero_v: zero velocity → zero distance * brakingDist_nonneg: non-negativity for v≥0, a>0, j>0, d≥0 * brakingDist_pos: positivity for v>0 * brakingDist_mono_v: monotone in velocity (safety: faster → farther) * brakingDist_mono_d: monotone in delay (longer delay → farther) * brakingDist_no_delay: no-delay case = v²/(2a) * brakingDist_no_delay_nonneg: no-delay non-negativity * brakingDist_alt_form: v*(v/(2a) + d/j) = v²/(2a) + v*d/j * brakingDist_double_v_no_delay: doubling velocity quadruples no-delay distance - RESEARCH.md: new targets 31 (expo) and 32 (lerp) identified with full analysis - TARGETS.md: target 30 advanced to Phase 5 ✅ Proved; targets 31+32 added; dup row 29 removed - lake build passes with Lean v4.29.0 (26 jobs, 12 pre-existing sorry in unrelated files) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔬 Lean Squad — automated formal verification | run 65
Summary
This PR completes formal verification of
math::computeBrakingDistanceFromVelocity(Tasks 1–5) and adds two new research targets (Task 1).Merges PRs Included
This PR incorporates merged-in content from open PRs #59 (WrapBin), #60 (SqrtLinear), and #61 (CRITIQUE/RESEARCH/TARGETS) into a clean additive branch.
Task 3+4+5:
math::computeBrakingDistanceFromVelocity(Target 30)Source:
src/lib/mathlib/math/TrajMath.hppline 107Files Changed
formal-verification/lean/FVSquad/BrakingDist.leanformal-verification/specs/braking_dist_informal.mdformal-verification/lean/FVSquad/Basic.leanimport FVSquad.BrakingDistformal-verification/TARGETS.mdformal-verification/RESEARCH.mdRunning Totals After This PR
sorryremaining