lean-asymptotic-algorithms
Skill3 starsChanged 13 days agoApache-2.0View on GitHub
USE FOR: asymptotic algorithm substitution -- subresultant PRS, Dulmage-Mendelsohn permanents, dynamic Meissel-Lehmer/Mobius sieves (`KERNEL-LAW-17`, `-29`, `-30`), and schedule folding. DO NOT USE FOR: low-level WHNF lambda/SWAR rewriting alone (`@lean-kernel-optimization`) or general graph/lattice math (`@lean-math-discrete`). TRIGGERS: subresultant, PRS, Habicht, Dulmage-Mendelsohn, permanent, Meissel-Lehmer, Mobius sieve, wheel sieve, schedule folding, anti-gating.
In this repository43 other files it gives its agents.
- AGENTS.mdAGENTS.md
- counterexample-first-provingSkill
- hol-metamath-adapterSkill
- isabelle-isar-adapterSkill
- itp-cross-portingSkill
- lean-ai-formalizationSkill
- lean-bisectSkill
- lean-blueprintSkill
- lean-buildSkill
- lean-computational-reflectionSkill
- lean-core-onlySkill
- lean-corpus-auditSkill
- lean-dependency-managementSkill
- lean-doc-syncSkill
- lean-egraph-cpsat-superoptSkill
- lean-gatewaySkill
- lean-kernel-optimizationSkill
- lean-knowledge-formalizationSkill
- lean-math-analysisSkill
- lean-math-discreteSkill
- lean-math-dynamicalSkill
- lean-math-foundationsSkill
- lean-math-optimizationSkill
- lean-math-stochasticSkill
- lean-mweSkill
- lean-pedagogical-expositionSkill
- lean-proof-refactorSkill
- lean-proof-repairSkill
- lean-proof-reviewSkill
- lean-proofSkill
- lean-researchSkill
- lean-retro-methodologySkill
- lean-review-councilSkill
- lean-security-formalizationSkill
- lean-setupSkill
- lean-specificationSkill
- lean-tautology-triageSkill
- lean-unboxed-limbs-swarSkill
- lean-upstream-prSkill
- lean-verification-gateSkill
- lean-worker-wrapper-cpsSkill
- research-councilSkill
- rocq-proof-adapterSkill
The file
Files
Asymptotic Algorithm Substitution for Lean 4 Kernel Evaluation
Substitute asymptotically faster exact algorithms so kernel reductions (rfl, decide +kernel) scale across all input
regimes without static tables (KERNEL-LAW-30) or artificial cutoffs (KERNEL-LAW-29).
Routing
- USE FOR: Subresultant PRS (Habicht/Ducos, avoiding Kronecker integer blowup), Dulmage-Mendelsohn sparse permanent factoring, dynamic Meissel-Lehmer / Mobius mod-30 sieves, and schedule folding.
- DO NOT USE FOR: WHNF lambda/SWAR rewriting (
@lean-kernel-optimization) or general graph/lattice math (@lean-math-discrete).
Workflow
- Diagnose Bottleneck -- Spot exponential recursion, $2^{2^k}$ pseudo-remainder blowup, dense Kronecker packing
(
> 100limbs), or static tables vialean_metrics(action: "altproof"). - Select Asymptotic Recurrence -- Apply Subresultant PRS for discriminants/GCD, Dulmage-Mendelsohn Hopcroft-Karp + SCC blocks for permanents, or Legendre $\phi(x,a)$ + dynamic 8-spoke mod-30 sieve.
- Keep Kernel Total Functions -- Implement Section-2 functions over primitive
Nat.*/@Nat.recwith zero static tables (KERNEL-LAW-30) or band cutoffs (KERNEL-LAW-29). - Certify & Benchmark -- Prove
∀ n, fastFn n = specFn nunder 3 axioms (kernel_decide) and verifyreal - twinlitinstructions:u.
Recovery & STOP
- Reject embedded lookup tables or slow fallbacks past fixed cutoffs (
KERNEL-LAW-29/KERNEL-LAW-30). - Revert Kronecker packing if quadratic GMP growth loses to subresultant or limb arrays (
KERNEL-LAW-29B).
Handoffs
- Predecessors:
lean-specification,lean-math-discrete. - Successors:
lean-kernel-optimization,lean-proof-review,lean-verification-gate.
Detailed reference
- Card:
../../references/cards/lean-asymptotic-algorithms-tables.md - Handbook:
../../references/handbooks/lean-asymptotic-algorithms-handbook.md - Template:
../../templates/core/Template_AsymptoticAlgorithms.md
See also
../lean-kernel-optimization/SKILL.md--KERNEL-LAW-01..31cost model../lean-unboxed-limbs-swar/SKILL.md-- Unboxed< 2^63limbs & SWAR
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

