Spaces:
Sleeping
Sleeping
Add exact?/apply? to auto-repair — Mathlib lemma auto-discovery
Browse filesAuto-repair now searches all of Mathlib via exact?/apply? when
filling sorries. Tested: automatically found Nat.infinite_setOf_prime,
EuclideanDomain.to_principal_ideal_domain, and more in <1s.
Any sorry closable by a single Mathlib lemma is now handled
automatically, without agent iteration.
42/51 verified (82%), $14.40 total.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
910 unmodified lines911912913910 unmodified lines- `agent.py`: Added auto-repair in `_handle_tool_call` for `check_lean_code` — when code compiles with sorry, automatically try `repair_lean_proofs`, if all sorries filled, re-verify and use repaired code### Stats: 50 jobs, 41 verified (82%), $14.39 total910 unmodified lines911912913914915916917918919920921922923924925926927928929930931932933934935936910 unmodified lines- `agent.py`: Added auto-repair in `_handle_tool_call` for `check_lean_code` — when code compiles with sorry, automatically try `repair_lean_proofs`, if all sorries filled, re-verify and use repaired code### Stats: 50 jobs, 41 verified (82%), $14.39 total## Iteration 29 — 2026-03-26 09:00 PDT### Fix: Add exact?/apply? to auto-repair tacticsExpanded auto-repair terminal tactics from `[grind, simp_all, omega, norm_num, nlinarith, aesop]` to also include `exact?` and `apply?`. These search Mathlib for matching lemmas and automatically apply them.**Tested on 3 hard sorries via Axle API:**- `Irrational (√2)` → `norm_num` found it- `Set.Infinite {p : ℕ | Nat.Prime p}` → `exact?` found `Nat.infinite_setOf_prime`- `IsPrincipalIdealRing ℤ` → `exact?` found `EuclideanDomain.to_principal_ideal_domain`All 3 filled automatically in <1 second! Previously these required the agent to manually search Mathlib.**Impact:** Any sorry that can be closed by a single Mathlib lemma application will now be filled automatically, without the agent needing to search. This effectively gives the auto-repair system access to Mathlib's entire library.### Test: R is a fieldVerified in 2 iterations (agent wrote it without sorry this time).### Code Changes- `tools.py`: Added `exact?` and `apply?` to repair_lean_proofs terminal_tactics### Stats: 51 jobs, 42 verified (82%), $14.40 total
149 unmodified lines150151152153154155156149 unmodified linesjson={"content": code,"environment": LEAN_ENVIRONMENT,"terminal_tactics": ["grind", "simp_all", "omega", "norm_num", "nlinarith", "aesop"],"timeout_seconds": 60,},)149 unmodified lines150151152153154155156149 unmodified linesjson={"content": code,"environment": LEAN_ENVIRONMENT,"terminal_tactics": ["grind", "simp_all", "omega", "norm_num", "nlinarith", "aesop", "exact?", "apply?"],"timeout_seconds": 60,},)
log.md+23
tools.py+1-1