sage-check
БесплатноЗапускает вложенные скриптыНе проверенNumeric sanity check of every lemma, identity and parameter claim on small parameters, with exhaustive search where feasible. Use it before writing a proof…
от jiayaoqijia★ 81 звезда на GitHubОб этом скилле
sage-check: test every lemma on small cases first
Why
Proving a false lemma wastes days, and formalising one in Lean wastes weeks. Most wrong statements fail on a toy instance: a small prime, a small ring dimension, a 2×2 case. Run a finite check before proving and before formalising.
Protocol
- Transcribe the statement exactly as in THEORY.md. Include every quantifier and side condition. Each checked statement gets an ID matching THEORY.md / CLAIMS.md.
- Choose a parameter grid.
- Include every smallest case (p ∈ {2, 3, 5, 7, 11, 13}, n ∈ {1, 2, 4, 8}).
- Cover both residue classes the statement distinguishes (for example p ≡ 1 and p ≡ 3 mod 4).
- Include the boundary of any inequality hypothesis, on both sides.
- Include at least one parameter as large as the experiments use, if it is feasible.
- Test the hypotheses too. Check that the hypotheses are satisfiable on the grid, because a vacuous theorem "passes" every check. Then check the conclusion.
- Search exhaustively wherever the space is finite and small (≤ 10⁷ cases). Otherwise use random sampling with a fixed seed, and report the seed and the sample size.
- Also test the converse. If a condition is claimed to be necessary and sufficient, test both directions separately.
- Use exact arithmetic:
ZMod/GF,Integer,QQ,sympy.Rational. Use no floats unless the statement is about floats. For asymptotic claims, check the exact finite formula on a range and fit the trend; do not trust a plotted curve. - Output one JSON line per check:
{"check": ID, "params": {...}, "cases": N, "passed": bool, "counterexample": {...} | null}. Save the script underchecks/and the output underresults/checks/, then add an EVIDENCE row if any number from it reaches the paper. - If a check fails, give the minimal counterexample (smallest parameters) to
falsifierandtheorist. Do not patch the statement silently.
Script template
scripts/sanity_check_template.py is a runnable skeleton with a guarded Sage import,
a check(...) helper that stops at the first counterexample, and a toy statement
about roots of unity mod p. Copy it, then replace the STATEMENTS list.
python3 skills/sage-check/scripts/sanity_check_template.py # pure Python
sage -python skills/sage-check/scripts/sanity_check_template.py # uses Sage if present
Typical checks by area
| area | what to check on toy parameters |
|---|---|
| algebra | existence and order of roots of unity mod p; factorisation of Φ_m mod p (number and degree of factors = ord_m(p)); injectivity of encodings; polynomial identities coefficient by coefficient |
| FHE | noise bound vs measured noise on a toy scheme (the bound must hold on every sample); correctness of the claimed decryption condition at its boundary; operation counts by instrumented toy evaluation |
| lattice | toy LWE instances solved by LLL/BKZ in small dimensions, compared with the estimator's predicted β |
| symmetric | S-box properties (DDT/LAT/differential uniformity) by exhaustive computation; small-round trail probabilities by exhaustive search on scaled-down versions |
| protocols | secret-sharing reconstruction thresholds; OT/PSI correctness on small sets; communication formulas vs counted messages |
Tooling notes
- In Sage,
GF(p),Zmod(n),CyclotomicField(m)andcyclotomic_polynomial(m)cover most checks. Run withsage -python script.pyso the same file stays importable as plain Python. - In pure Python,
sympy(cyclotomic_poly,factor_list(..., modulus=p),n_order,primitive_root) andpow(a, -1, p)are enough for most toy checks. - Mathematica, if connected, is useful for closed forms and series. Treat its output as a hint, then recheck with exact finite computation.
Установить sage-check в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл sage-check?
Numeric sanity check of every lemma, identity and parameter claim on small parameters, with exhaustive search where feasible. Use it before writing a proof, before Lean formalisation, and whenever a falsifier needs a counterexample search. Works with SageMath if installed and falls back to pure Python/sympy otherwise.
Как установить скилл sage-check?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл sage-check запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic