Skip to content

[Lean Squad] feat(formal-verification): Tasks 7+1 — Critique update + 3 new research targets (run 63)#61

Closed
github-actions[bot] wants to merge 3 commits intomainfrom
lean-squad/critique-research-run63-24810866349-4e5eb93e58432d12
Closed

[Lean Squad] feat(formal-verification): Tasks 7+1 — Critique update + 3 new research targets (run 63)#61
github-actions[bot] wants to merge 3 commits intomainfrom
lean-squad/critique-research-run63-24810866349-4e5eb93e58432d12

Conversation

@github-actions
Copy link
Copy Markdown

🔬 Lean Squad — automated formal verification, run 63.

Summary

This PR delivers two tasks:

  • Task 7 (Proof Utility Critique): Updated CRITIQUE.md to reflect the WrapBin and SqrtLinear additions from runs 61–62 (merging two open PRs into the baseline). Total: 338 theorems (326 proved, 12 sorry), 24 Lean files, 27 targets.
  • Task 1 (Research & Target Identification): Added 3 new research targets to RESEARCH.md and TARGETS.md.

Also includes the previously open (un-merged) PRs for WrapBin.lean and SqrtLinear.lean, merged cleanly into this branch.


Task 7: CRITIQUE.md updates

New entries

  • WrapBin.lean (7 new rows in Proved Theorems Table): wrapBin_range, wrapBin_identity, wrapBin_one_above, wrapBinCpp_bug_general (🐛 latent C++ bug), wrapBin_eq_wrapBinCpp_valid, wrapBinOffset_valid
  • SqrtLinear.lean (4 new rows): sqrtLinear_neg, sqrtLinear_ge_one, sqrtLinear_mono_ge_one, sqrtLinear_idempotent_ge_one, plus 3 sorry-guarded sqrt-branch theorems

Updated sections


Task 1: New Research Targets

# Target File Priority Tractability
28 ObstacleMath::get_lower_bound_angle ObstacleMath.cpp Medium MEDIUM — builds on WrapBin
29 crc16_signature fold/split (CCITT) crc.c High HIGH — List.foldl_append proof
30 math::computeBrakingDistanceFromVelocity TrajMath.hpp High MEDIUM — rational model, safety property

Rationale: Target 29 is the most tractable (structurally identical to the already-proved Crc16Fold.lean). Target 30 has direct flight safety relevance (braking distance underestimation → waypoint overshoot/collision). Target 28 is the natural continuation of the WrapBin work.


No Lean build required

This PR contains only documentation updates (CRITIQUE.md, RESEARCH.md, TARGETS.md) plus the merged-in WrapBin.lean and SqrtLinear.lean from prior open PRs. No new .lean files are added in this PR beyond what was previously submitted.

✅ Merged WrapBin.lean and SqrtLinear.lean from open PRs — both were previously verified with lake build (Lean 4.29.0, 0 errors).

Generated by 📐 Lean Squad, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/lean-squad.md@215d2d398def782d44e589268d89f949c7c7db9f

github-actions Bot and others added 3 commits April 23, 2026 01:17
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant