From algo-math-structurer
Transform Python algorithm code into formal mathematical documents with proofs. Trigger with 'formalise cet algorithme', 'génère les preuves mathématiques', 'transforme ce code en théorèmes', 'algo-math', 'prove this algorithm'.
How this skill is triggered — by the user, by Claude, or both
Slash command
/algo-math-structurer:algorithm-formalizationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Transform Python algorithm code into formal mathematical documents with definitions, theorems, proofs, and complexity analysis - compiled to PDF via pdflatex.
Transform Python algorithm code into formal mathematical documents with definitions, theorems, proofs, and complexity analysis - compiled to PDF via pdflatex.
references/proof-patterns.md)references/latex-template.mdpdflatex -interaction=nonstopmode document.texRequired: Python algorithm code (function or module) Optional: Focus area (correctness, termination, complexity, all), proof depth (concise, detailed)
Analyze Python code: functions, parameters, return values, control flow (loops, recursion, conditionals), base cases, variable types.
Identify: preconditions, postconditions, loop invariants, termination conditions, complexity constraints.
Define domains (ℕ, ℤ, ℝ), operators, functions, predicates using standard mathematical notation.
Consult references/proof-patterns.md for the decision guide. Select proof strategy:
Fill references/latex-template.md with: algorithm pseudocode, definitions (definition env), theorems (theorem env), lemmas (lemma env), proofs (proof env), complexity analysis.
pdflatex -interaction=nonstopmode document.tex
Run twice for references.
If pdflatex fails: return raw .tex + compilation log + suggested fixes.
NEVER hallucinate mathematical properties. If unidentifiable, state: "No [property] identified."
NEVER claim proof complete with unproven assumptions. Enumerate ALL assumptions explicitly.
Cap analysis to ~200 lines or single function. Beyond: "Input exceeds analysis scope."
Stochastic algorithms → probabilistic proofs, NOT deterministic.
Approximation algorithms → state bounds, NOT exact correctness.
No loops/recursion → trivial termination. State explicitly. No vacuous proof.
Library calls (numpy, torch) → black-box with stated assumptions.
Python only. Reject other languages.
Classical algorithms only. Reject neural training, RL, generative models.
PDF with 5 sections:
| Case | Handling |
|---|---|
| Syntax errors | Report, best-effort on parseable portions |
| Empty/trivial input | "Input does not contain an analyzable algorithm." |
| No loops/recursion | Termination trivial, skip vacuous proof |
| Mutually recursive | Analyze as unit, joint termination proof |
| I/O side effects | Excluded from formal model |
| External libraries | Black-box with stated assumptions |
| Unbounded input | Termination assumes finite input |
| Nested algorithms | Analyze outer, inner as assumptions |
| Obfuscated code | Normalize variable names |
references/latex-template.mdreferences/proof-patterns.mdCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub baptistecaille/research-plugin --plugin algo-math-structurer