Lean Proof Refactoring & Abstraction-Concrete Duality
Turn long, concrete, or duplicated proofs into short callers backed by reusable abstract lemmas -- while keeping executable def kernels strictly
concrete (WAVE-13 G1).
Routing
- USE FOR: adjudicating long-proof findings (
CUT / CONSIDERED-NEGATIVE / DEFER), extracting shared lemmas, generalizingabstraction-safeRealstatements to ordered-ring mixins, and bridging abstractPropspecs to concretedefs viarfl/@[csimp]. - DO NOT USE FOR: first-time proving (
@lean-proof), correctness review (@lean-proof-review), or tautology triage (@lean-tautology-triage).
Workflow
- Scan & Classify -- Run
scripts/lean/proof_quality.py --lean-dir <dir>for long/branchy proofs andpython3 -m altproof.coupling_scannerto classifyRealstatements intoabstraction-safe,nat-mixed, orreal-specific. - Adjudicate (
CUT / CONSIDERED-NEGATIVE / DEFER) -- Extract (CUT) only when a block is reusable (>= 2sites or clean mathematical boundary); logCONSIDERED-NEGATIVEon single-use glue to prevent negative bundle-effect bloat. - Apply
WAVE-13 G1Abstraction-Concrete Duality -- Abstract inProp([CommRing R] [LinearOrder R] [IsOrderedRing R], parametric step theorems) and stay concrete in hotdefs (avoiding the1,600x..3,345xparametric WHNF penalty;rfl-bridged abstract proofs add<= 1%cost). - Gate -- Preserve public signatures byte-for-byte; verify
0errors/warnings underlake buildand record before/after metrics.
Recovery & STOP
- If an extraction fails to compile, forces >8 awkward context parameters, or increases net complexity without reuse, revert immediately and record
CONSIDERED-NEGATIVE. - On transient stale-
.oleanerrors in shared trees, retry targetedlake buildonce before diagnosing a regression.
Handoffs
- Predecessors:
lean-proof,lean-corpus-audit. - Successors:
lean-sair-kernel-optimization,lean-proof-review,lean-proof.
Detailed reference
- Fast 3-table lookup card:
../../references/cards/lean-proof-refactor-tables.md - Full handbook:
../../references/handbooks/lean-proof-refactor-handbook.md - Core templates:
../../templates/core/Template_Refactoring.md,../../templates/core/Template_ComputableTwin_Csimp.md
See also
../lean-sair-kernel-optimization/SKILL.md-- Kernel WHNF, SWAR & hardware lowering../lean-gateway/SKILL.md-- Top-level skill router
