@louisultra/dsh-verymath 0.0.0-stage → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +133 -0
- package/LICENSE +21 -0
- package/NOTICE.md +35 -0
- package/README.md +108 -2
- package/README_EN.md +105 -0
- package/UPSTREAM.json +106 -0
- package/cordis.patch.yml +12 -0
- package/docs/capability-examples.md +581 -0
- package/docs/examples/README.md +32 -0
- package/docs/examples/bad_scan.md +10 -0
- package/docs/examples/broken-proof.lean +9 -0
- package/docs/examples/claims.md +7 -0
- package/docs/examples/knapsack.json +10 -0
- package/docs/examples/matrix.json +1 -0
- package/docs/examples/points.csv +21 -0
- package/docs/examples/qp.json +8 -0
- package/docs/examples/research-ws/project/GOALS.yaml +4 -0
- package/docs/examples/research-ws/workstreams/ws-lsa/report.md +13 -0
- package/docs/examples/research-ws/workstreams/ws-lsa/reviews/r1.json +1 -0
- package/docs/examples/research-ws/workstreams/ws-lsa/status.yaml +1 -0
- package/docs/examples/source.csv +4 -0
- package/lib/core/error.d.ts +20 -0
- package/lib/core/error.js +25 -0
- package/lib/core/gates.d.ts +42 -0
- package/lib/core/gates.js +217 -0
- package/lib/core/glossary.d.ts +101 -0
- package/lib/core/glossary.js +243 -0
- package/lib/core/graph.d.ts +118 -0
- package/lib/core/graph.js +460 -0
- package/lib/core/index.d.ts +120 -0
- package/lib/core/index.js +197 -0
- package/lib/core/paper.d.ts +163 -0
- package/lib/core/paper.js +73 -0
- package/lib/core/paths.d.ts +2 -0
- package/lib/core/paths.js +12 -0
- package/lib/core/sage.d.ts +61 -0
- package/lib/core/sage.js +212 -0
- package/lib/core/skills.d.ts +11 -0
- package/lib/core/skills.js +110 -0
- package/lib/tool/index.d.ts +21 -0
- package/lib/tool/index.js +1144 -0
- package/package.json +92 -4
- package/skills/after-ocr/SKILL.md +123 -0
- package/skills/after-ocr/references/audit-schema.md +94 -0
- package/skills/after-ocr/references/error-taxonomy.md +179 -0
- package/skills/after-ocr/scripts/merge_audit_logs.py +329 -0
- package/skills/after-ocr/scripts/scan_markdown_ocr.py +350 -0
- package/skills/after-ocr/tests/test_scripts.py +84 -0
- package/skills/discover-math-problems/SKILL.md +115 -0
- package/skills/discover-math-problems/references/artifact-contract.md +93 -0
- package/skills/discover-math-problems/references/autonomous-research-protocol.md +86 -0
- package/skills/discover-math-problems/references/conjecture-generation-protocol.md +63 -0
- package/skills/discover-math-problems/references/extremal-graph-variants.md +53 -0
- package/skills/graph-theory-paper-reading/SKILL.md +600 -0
- package/skills/invariant-computation/SKILL.md +169 -0
- package/skills/invariant-computation/examples/invariant_summary.example.json +51 -0
- package/skills/invariant-computation/manifest.yaml +46 -0
- package/skills/invariant-computation/references/INDEX.md +20 -0
- package/skills/invariant-computation/references/failure_modes.md +40 -0
- package/skills/invariant-computation/references/method_route_map.md +177 -0
- package/skills/invariant-computation/references/source_notes.md +19 -0
- package/skills/invariant-computation/references/tool_catalog.md +65 -0
- package/skills/invariant-computation/references/validation_checks.md +52 -0
- package/skills/invariant-computation/schema/invariant_summary.schema.json +260 -0
- package/skills/lean-formalization/SKILL.md +111 -0
- package/skills/lean-formalization/lean-runtime/config/env.example +5 -0
- package/skills/lean-formalization/lean-runtime/config/lean_agent.example.toml +28 -0
- package/skills/lean-formalization/lean-runtime/config/numina_runtime.example.toml +12 -0
- package/skills/lean-formalization/lean-runtime/examples/smoke/LocalLeanSmoke.lean +7 -0
- package/skills/lean-formalization/lean-runtime/prompts/complete_sorries.md +3 -0
- package/skills/lean-formalization/lean-runtime/prompts/formalize_statement.md +3 -0
- package/skills/lean-formalization/lean-runtime/prompts/prove_theorem.md +3 -0
- package/skills/lean-formalization/lean-runtime/prompts/repair_lean_file.md +3 -0
- package/skills/lean-formalization/lean-runtime/references/backend_adapter_checklist.md +36 -0
- package/skills/lean-formalization/lean-runtime/references/direct_lean_workflow.md +48 -0
- package/skills/lean-formalization/lean-runtime/references/failure_taxonomy.md +17 -0
- package/skills/lean-formalization/lean-runtime/references/interactive_orchestration.md +83 -0
- package/skills/lean-formalization/lean-runtime/references/lean_agent_capability_map.md +116 -0
- package/skills/lean-formalization/lean-runtime/references/lean_lsp_mcp_adapter.md +219 -0
- package/skills/lean-formalization/lean-runtime/references/lean_runtime_configuration.md +92 -0
- package/skills/lean-formalization/lean-runtime/references/numina_reverse_analysis.md +80 -0
- package/skills/lean-formalization/lean-runtime/references/numina_runtime.md +41 -0
- package/skills/lean-formalization/lean-runtime/references/numina_subagent_troubleshooting.md +77 -0
- package/skills/lean-formalization/lean-runtime/references/review_checklist.md +10 -0
- package/skills/lean-formalization/lean-runtime/references/specialist_agent_patterns.md +65 -0
- package/skills/lean-formalization/lean-runtime/schemas/config.schema.json +12 -0
- package/skills/lean-formalization/lean-runtime/schemas/result.schema.json +33 -0
- package/skills/lean-formalization/lean-runtime/schemas/task.schema.json +30 -0
- package/skills/lean-formalization/lean-runtime/scripts/ai4m_lean.py +222 -0
- package/skills/lean-formalization/lean-runtime/scripts/check_lean_project.py +134 -0
- package/skills/lean-formalization/lean-runtime/scripts/common.py +296 -0
- package/skills/lean-formalization/lean-runtime/scripts/configure_lean.py +222 -0
- package/skills/lean-formalization/lean-runtime/scripts/detect_sorry.py +49 -0
- package/skills/lean-formalization/lean-runtime/scripts/direct_task.py +100 -0
- package/skills/lean-formalization/lean-runtime/scripts/extract_minimal_failure.py +74 -0
- package/skills/lean-formalization/lean-runtime/scripts/numina_runtime.py +414 -0
- package/skills/lean-formalization/lean-runtime/scripts/smoke_test.py +75 -0
- package/skills/lean-formalization/lean-runtime/scripts/tool_status.py +79 -0
- package/skills/lean-formalization/lean-runtime/scripts/validate_patch.py +81 -0
- package/skills/lean-formalization/lean-runtime/scripts/verify_delivery.py +484 -0
- package/skills/lean-formalization/lean-runtime/tests/fixtures/after_bad.lean +4 -0
- package/skills/lean-formalization/lean-runtime/tests/fixtures/after_statement_changed.lean +4 -0
- package/skills/lean-formalization/lean-runtime/tests/fixtures/before.lean +4 -0
- package/skills/lean-formalization/lean-runtime/tests/fixtures/failure.lean +7 -0
- package/skills/lean-formalization/lean-runtime/tests/test_check_lean_project.py +59 -0
- package/skills/lean-formalization/lean-runtime/tests/test_cli.py +377 -0
- package/skills/lean-formalization/lean-runtime/tests/test_common_config.py +84 -0
- package/skills/lean-formalization/lean-runtime/tests/test_configure_lean.py +138 -0
- package/skills/lean-formalization/lean-runtime/tests/test_detect_sorry.py +24 -0
- package/skills/lean-formalization/lean-runtime/tests/test_direct_task.py +69 -0
- package/skills/lean-formalization/lean-runtime/tests/test_numina_runtime.py +168 -0
- package/skills/lean-formalization/lean-runtime/tests/test_validate_patch.py +29 -0
- package/skills/lean-setup/SKILL.md +99 -0
- package/skills/least-squares/README.md +85 -0
- package/skills/least-squares/SKILL.md +613 -0
- package/skills/least-squares/examples.md +380 -0
- package/skills/math-beamer/SKILL.md +325 -0
- package/skills/math-beamer/references/build-and-layout-audit.md +63 -0
- package/skills/math-beamer/references/math-domain-patterns.md +56 -0
- package/skills/math-beamer/references/template-policy.md +43 -0
- package/skills/math-beamer/references/template-source-index.md +51 -0
- package/skills/math-beamer/templates/catalog.yaml +235 -0
- package/skills/math-beamer/templates/packs/algebra-number-theory-talk/main.tex +45 -0
- package/skills/math-beamer/templates/packs/algebra-number-theory-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/algorithm-talk/main.tex +43 -0
- package/skills/math-beamer/templates/packs/algorithm-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/analysis-core-talk/main.tex +49 -0
- package/skills/math-beamer/templates/packs/analysis-core-talk/template.yaml +19 -0
- package/skills/math-beamer/templates/packs/backup-heavy-talk/main.tex +40 -0
- package/skills/math-beamer/templates/packs/backup-heavy-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/beamerposter-a0/main.tex +45 -0
- package/skills/math-beamer/templates/packs/beamerposter-a0/template.yaml +12 -0
- package/skills/math-beamer/templates/packs/combinatorics-graph-talk/main.tex +53 -0
- package/skills/math-beamer/templates/packs/combinatorics-graph-talk/template.yaml +18 -0
- package/skills/math-beamer/templates/packs/control-systems-talk/main.tex +51 -0
- package/skills/math-beamer/templates/packs/control-systems-talk/template.yaml +18 -0
- package/skills/math-beamer/templates/packs/course-lecture-zh/main.tex +43 -0
- package/skills/math-beamer/templates/packs/course-lecture-zh/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/data-experiment-results/main.tex +45 -0
- package/skills/math-beamer/templates/packs/data-experiment-results/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/dynamical-systems-talk/main.tex +42 -0
- package/skills/math-beamer/templates/packs/dynamical-systems-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/geometry-topology-talk/main.tex +43 -0
- package/skills/math-beamer/templates/packs/geometry-topology-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/information-coding-crypto-talk/main.tex +49 -0
- package/skills/math-beamer/templates/packs/information-coding-crypto-talk/template.yaml +18 -0
- package/skills/math-beamer/templates/packs/logic-foundations-category-talk/main.tex +51 -0
- package/skills/math-beamer/templates/packs/logic-foundations-category-talk/template.yaml +18 -0
- package/skills/math-beamer/templates/packs/numerical-analysis-talk/main.tex +51 -0
- package/skills/math-beamer/templates/packs/numerical-analysis-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/optimization-talk/main.tex +58 -0
- package/skills/math-beamer/templates/packs/optimization-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/pde-analysis-talk/main.tex +49 -0
- package/skills/math-beamer/templates/packs/pde-analysis-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/probability-statistics-talk/main.tex +52 -0
- package/skills/math-beamer/templates/packs/probability-statistics-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/reading-group-paper/main.tex +46 -0
- package/skills/math-beamer/templates/packs/reading-group-paper/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/seminar-minimal-en/main.tex +60 -0
- package/skills/math-beamer/templates/packs/seminar-minimal-en/template.yaml +13 -0
- package/skills/math-beamer/templates/packs/seminar-minimal-zh/main.tex +60 -0
- package/skills/math-beamer/templates/packs/seminar-minimal-zh/template.yaml +13 -0
- package/skills/math-beamer/templates/packs/theorem-proof-talk/main.tex +60 -0
- package/skills/math-beamer/templates/packs/theorem-proof-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/thesis-defense/main.tex +42 -0
- package/skills/math-beamer/templates/packs/thesis-defense/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/workshop-tutorial/main.tex +32 -0
- package/skills/math-beamer/templates/packs/workshop-tutorial/template.yaml +9 -0
- package/skills/math-beamer/templates/preview-gallery.md +32 -0
- package/skills/math-beamer/templates/previews/algebra-number-theory-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/algebra-number-theory-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/algorithm-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/algorithm-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/analysis-core-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/analysis-core-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/backup-heavy-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/backup-heavy-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/beamerposter-a0-content.png +0 -0
- package/skills/math-beamer/templates/previews/beamerposter-a0-cover.png +0 -0
- package/skills/math-beamer/templates/previews/combinatorics-graph-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/combinatorics-graph-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/control-systems-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/control-systems-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/course-lecture-zh-content.png +0 -0
- package/skills/math-beamer/templates/previews/course-lecture-zh-cover.png +0 -0
- package/skills/math-beamer/templates/previews/data-experiment-results-content.png +0 -0
- package/skills/math-beamer/templates/previews/data-experiment-results-cover.png +0 -0
- package/skills/math-beamer/templates/previews/dynamical-systems-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/dynamical-systems-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/geometry-topology-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/geometry-topology-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/information-coding-crypto-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/information-coding-crypto-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/logic-foundations-category-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/logic-foundations-category-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/numerical-analysis-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/numerical-analysis-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/optimization-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/optimization-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/pde-analysis-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/pde-analysis-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/probability-statistics-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/probability-statistics-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/reading-group-paper-content.png +0 -0
- package/skills/math-beamer/templates/previews/reading-group-paper-cover.png +0 -0
- package/skills/math-beamer/templates/previews/seminar-minimal-en-content.png +0 -0
- package/skills/math-beamer/templates/previews/seminar-minimal-en-cover.png +0 -0
- package/skills/math-beamer/templates/previews/seminar-minimal-zh-content.png +0 -0
- package/skills/math-beamer/templates/previews/seminar-minimal-zh-cover.png +0 -0
- package/skills/math-beamer/templates/previews/theorem-proof-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/theorem-proof-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/thesis-defense-content.png +0 -0
- package/skills/math-beamer/templates/previews/thesis-defense-cover.png +0 -0
- package/skills/math-beamer/templates/previews/workshop-tutorial-content.png +0 -0
- package/skills/math-beamer/templates/previews/workshop-tutorial-cover.png +0 -0
- package/skills/math-beamer/templates/review-report.md +54 -0
- package/skills/math-beamer/templates/slide-source-ledger.md +22 -0
- package/skills/math-beamer/templates/source-packet.md +50 -0
- package/skills/math-glossary/SKILL.md +347 -0
- package/skills/math-glossary/references/glossary-schema.md +71 -0
- package/skills/math-glossary/references/glossary-usage-guide.md +176 -0
- package/skills/math-glossary/references/glossary-web-template.md +127 -0
- package/skills/math-glossary/references/glossary.schema.json +76 -0
- package/skills/math-glossary/references/user-manual.md +435 -0
- package/skills/math-glossary/requirements-ai.txt +3 -0
- package/skills/math-glossary/requirements.txt +3 -0
- package/skills/math-glossary/scripts/glossary_backup.py +42 -0
- package/skills/math-glossary/scripts/glossary_build.py +467 -0
- package/skills/math-glossary/scripts/glossary_enrich_examples.py +283 -0
- package/skills/math-glossary/scripts/glossary_export.py +333 -0
- package/skills/math-glossary/scripts/glossary_web.py +1265 -0
- package/skills/math-paper-reading/README.md +163 -0
- package/skills/math-paper-reading/SKILL.md +48 -0
- package/skills/math-paper-reading/agent_router.md +36 -0
- package/skills/math-paper-reading/references/proof_pattern_taxonomy.md +123 -0
- package/skills/math-paper-reading/references/quality_rubric.md +36 -0
- package/skills/math-paper-reading/skill_base.md +627 -0
- package/skills/math-paper-reading/skill_literature_search.md +866 -0
- package/skills/math-paper-reading/skill_paper_deep_read.md +1024 -0
- package/skills/math-paper-reading/skill_pathway_proof.md +718 -0
- package/skills/math-paper-reading/skill_reference_manager.md +746 -0
- package/skills/matlab-runner/SKILL.md +217 -0
- package/skills/matlab-runner/examples/README.md +33 -0
- package/skills/matlab-runner/examples/matrix_report.m +28 -0
- package/skills/matlab-runner/examples/plot_damped_sine.m +64 -0
- package/skills/matlab-runner/examples/test_vector_norm.m +12 -0
- package/skills/matlab-runner/references/client-setup.md +24 -0
- package/skills/matlab-runner/references/file-session-safety.md +86 -0
- package/skills/matlab-runner/references/numerical-safety.md +126 -0
- package/skills/matlab-runner/references/resource-safety.md +125 -0
- package/skills/mixed-integer-programming/SKILL.md +119 -0
- package/skills/mixed-integer-programming/lp-examples.md +251 -0
- package/skills/mixed-integer-programming/mip-examples-verified.md +118 -0
- package/skills/open-problem-research-pipeline/SKILL.md +76 -0
- package/skills/open-problem-research-pipeline/skill_literature_analysis.md +201 -0
- package/skills/open-problem-research-pipeline/skill_literature_proof_framework.md +206 -0
- package/skills/open-problem-research-pipeline/skill_literature_search.md +172 -0
- package/skills/open-problem-research-pipeline/skill_qskill.md +177 -0
- package/skills/osqp-solver/SKILL.md +245 -0
- package/skills/osqp-solver/references/citation.md +25 -0
- package/skills/osqp-solver/references/dual-infeasible-example.json +14 -0
- package/skills/osqp-solver/references/feasible-example.json +21 -0
- package/skills/osqp-solver/references/primal-infeasible-example.json +17 -0
- package/skills/osqp-solver/references/python-api.md +95 -0
- package/skills/osqp-solver/references/verification.md +94 -0
- package/skills/osqp-solver/scripts/check_osqp_environment.py +120 -0
- package/skills/osqp-solver/scripts/solve_qp.py +943 -0
- package/skills/paper-writing/SKILL.md +115 -0
- package/skills/paper-writing/skill_claim_evidence_ledger.md +55 -0
- package/skills/paper-writing/skill_formula_environment_and_readability.md +41 -0
- package/skills/paper-writing/skill_latex_build_and_layout_audit.md +73 -0
- package/skills/paper-writing/skill_notation_and_variable_consistency.md +42 -0
- package/skills/paper-writing/skill_paper_skeleton_and_logical_architecture.md +54 -0
- package/skills/paper-writing/skill_proof_obligation_and_assumption_audit.md +57 -0
- package/skills/paper-writing/templates/claim-evidence-ledger.md +23 -0
- package/skills/paper-writing/templates/proof-obligation-ledger.md +22 -0
- package/skills/paper-writing/templates/rapid-prototype-paper-skeleton.md +46 -0
- package/skills/paper-writing/templates/source-packet.md +37 -0
- package/skills/paper-writing/templates/submission-readiness.md +41 -0
- package/skills/proof-blueprint-review/SKILL.md +129 -0
- package/skills/proof-blueprint-review/references/agent-mediated-proof-protocol.md +57 -0
- package/skills/proof-blueprint-review/references/generation-agent.md +45 -0
- package/skills/proof-blueprint-review/references/proof-acceptance-contract.md +41 -0
- package/skills/proof-blueprint-review/references/verification-agent.md +37 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Invariant Computation Summary",
|
|
4
|
+
"description": "Backend-neutral evidence summary for one invariant-computation run.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"schema_version",
|
|
8
|
+
"object",
|
|
9
|
+
"invariant",
|
|
10
|
+
"coefficient_ring_or_field",
|
|
11
|
+
"conventions",
|
|
12
|
+
"backend",
|
|
13
|
+
"command_or_code_path",
|
|
14
|
+
"validation_checks",
|
|
15
|
+
"remaining_uncertainty",
|
|
16
|
+
"next_repair_route"
|
|
17
|
+
],
|
|
18
|
+
"properties": {
|
|
19
|
+
"schema_version": {
|
|
20
|
+
"const": 1
|
|
21
|
+
},
|
|
22
|
+
"object": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"required": [
|
|
25
|
+
"source",
|
|
26
|
+
"representation"
|
|
27
|
+
],
|
|
28
|
+
"properties": {
|
|
29
|
+
"source": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"minLength": 1
|
|
32
|
+
},
|
|
33
|
+
"representation": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"minLength": 1
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"additionalProperties": true
|
|
39
|
+
},
|
|
40
|
+
"invariant": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"required": [
|
|
43
|
+
"requested",
|
|
44
|
+
"computed",
|
|
45
|
+
"value",
|
|
46
|
+
"result_quality"
|
|
47
|
+
],
|
|
48
|
+
"properties": {
|
|
49
|
+
"requested": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"minLength": 1
|
|
52
|
+
},
|
|
53
|
+
"computed": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"minLength": 1
|
|
56
|
+
},
|
|
57
|
+
"value": {},
|
|
58
|
+
"result_quality": {
|
|
59
|
+
"enum": [
|
|
60
|
+
"exact",
|
|
61
|
+
"certified_numerical",
|
|
62
|
+
"heuristic",
|
|
63
|
+
"partial",
|
|
64
|
+
"failed"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"additionalProperties": true
|
|
69
|
+
},
|
|
70
|
+
"coefficient_ring_or_field": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"minLength": 1
|
|
73
|
+
},
|
|
74
|
+
"conventions": {
|
|
75
|
+
"type": "array",
|
|
76
|
+
"items": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"minLength": 1
|
|
79
|
+
},
|
|
80
|
+
"uniqueItems": true
|
|
81
|
+
},
|
|
82
|
+
"backend": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"required": [
|
|
85
|
+
"route",
|
|
86
|
+
"name",
|
|
87
|
+
"version_evidence"
|
|
88
|
+
],
|
|
89
|
+
"properties": {
|
|
90
|
+
"route": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"minLength": 1
|
|
93
|
+
},
|
|
94
|
+
"name": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"minLength": 1
|
|
97
|
+
},
|
|
98
|
+
"version_evidence": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"minLength": 1
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"additionalProperties": true
|
|
104
|
+
},
|
|
105
|
+
"command_or_code_path": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"minLength": 1
|
|
108
|
+
},
|
|
109
|
+
"validation_checks": {
|
|
110
|
+
"type": "array",
|
|
111
|
+
"minItems": 1,
|
|
112
|
+
"items": {
|
|
113
|
+
"type": "object",
|
|
114
|
+
"required": [
|
|
115
|
+
"name",
|
|
116
|
+
"kind",
|
|
117
|
+
"status",
|
|
118
|
+
"evidence"
|
|
119
|
+
],
|
|
120
|
+
"properties": {
|
|
121
|
+
"name": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"minLength": 1
|
|
124
|
+
},
|
|
125
|
+
"kind": {
|
|
126
|
+
"enum": [
|
|
127
|
+
"structural",
|
|
128
|
+
"invariant_cross_check",
|
|
129
|
+
"other"
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
"status": {
|
|
133
|
+
"enum": [
|
|
134
|
+
"passed",
|
|
135
|
+
"failed",
|
|
136
|
+
"not_checked",
|
|
137
|
+
"inconclusive"
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
"evidence": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"minLength": 1
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"additionalProperties": true
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"remaining_uncertainty": {
|
|
149
|
+
"type": "array",
|
|
150
|
+
"items": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"minLength": 1
|
|
153
|
+
},
|
|
154
|
+
"uniqueItems": true
|
|
155
|
+
},
|
|
156
|
+
"next_repair_route": {
|
|
157
|
+
"type": [
|
|
158
|
+
"string",
|
|
159
|
+
"null"
|
|
160
|
+
],
|
|
161
|
+
"minLength": 1
|
|
162
|
+
},
|
|
163
|
+
"classification_caveat": {
|
|
164
|
+
"type": "string",
|
|
165
|
+
"minLength": 1
|
|
166
|
+
},
|
|
167
|
+
"classification_theorem_evidence": {
|
|
168
|
+
"type": "string",
|
|
169
|
+
"minLength": 1
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"allOf": [
|
|
173
|
+
{
|
|
174
|
+
"anyOf": [
|
|
175
|
+
{
|
|
176
|
+
"required": [
|
|
177
|
+
"classification_caveat"
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"required": [
|
|
182
|
+
"classification_theorem_evidence"
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"if": {
|
|
189
|
+
"properties": {
|
|
190
|
+
"invariant": {
|
|
191
|
+
"properties": {
|
|
192
|
+
"result_quality": {
|
|
193
|
+
"enum": [
|
|
194
|
+
"exact",
|
|
195
|
+
"certified_numerical",
|
|
196
|
+
"heuristic",
|
|
197
|
+
"partial"
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"required": [
|
|
202
|
+
"result_quality"
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"required": [
|
|
207
|
+
"invariant"
|
|
208
|
+
]
|
|
209
|
+
},
|
|
210
|
+
"then": {
|
|
211
|
+
"properties": {
|
|
212
|
+
"invariant": {
|
|
213
|
+
"properties": {
|
|
214
|
+
"value": {
|
|
215
|
+
"not": {
|
|
216
|
+
"type": "null"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"if": {
|
|
226
|
+
"properties": {
|
|
227
|
+
"invariant": {
|
|
228
|
+
"properties": {
|
|
229
|
+
"result_quality": {
|
|
230
|
+
"enum": [
|
|
231
|
+
"heuristic",
|
|
232
|
+
"partial",
|
|
233
|
+
"failed"
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"required": [
|
|
238
|
+
"result_quality"
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
"required": [
|
|
243
|
+
"invariant"
|
|
244
|
+
]
|
|
245
|
+
},
|
|
246
|
+
"then": {
|
|
247
|
+
"properties": {
|
|
248
|
+
"remaining_uncertainty": {
|
|
249
|
+
"minItems": 1
|
|
250
|
+
},
|
|
251
|
+
"next_repair_route": {
|
|
252
|
+
"type": "string",
|
|
253
|
+
"minLength": 1
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
],
|
|
259
|
+
"additionalProperties": true
|
|
260
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lean-formalization
|
|
3
|
+
description: Use for interactive Lean 4 formal verification by coding agents with reusable Lean/mathlib workspaces, theorem formalization, proof repair, sorry completion, patch review, optional adapter-first Lean-specialist backend work, and minimal failure handoff.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Lean Formalization
|
|
7
|
+
|
|
8
|
+
## DSH Integration Notes
|
|
9
|
+
|
|
10
|
+
- 本技能由 `@louisultra/dsh-verymath` 插件提供;`lean-runtime/` 支撑层随包内嵌于本技能目录
|
|
11
|
+
(上游为兄弟目录;此处按 DSH 技能发现约定调整,所有 `lean-runtime/` 引用改读 `lean-runtime/`)。
|
|
12
|
+
- DSH 工具优先:`verymath_lean_detect_sorry`(无 Lean 也可用的 sorry/admit/axiom 纯文本检测)。
|
|
13
|
+
patch 结构安全审查(陈述漂移 + 禁用词)用随包脚本 `python3 lean-runtime/scripts/ai4m_lean.py review`
|
|
14
|
+
经 bash 执行;环境探测用 `ai4m_lean.py doctor` / `env`(同样是 bash)。本插件没有额外的 lean 审查工具。
|
|
15
|
+
- 编译验证(lake build / lake env lean)需要真实 Lean 工具链,先跑 `ai4m_lean.py doctor` 看两级 readiness;
|
|
16
|
+
**elan shim 陷阱**——`.elan/bin` 下的 lean/lake 不可跑 `--version`(会触发 GB 级隐式工具链下载),
|
|
17
|
+
版本一律从项目 `lean-toolchain` 文件读取。
|
|
18
|
+
- mathlib 缓存与共享工作区概念(`${AI4MATH_HOME:-~/.ai4math}/lean-workspace`)继续适用;
|
|
19
|
+
安装/下载一律先经用户批准。
|
|
20
|
+
- Numina/Archon 后端为可选 adapter,默认路径不需要任何 API key;DSH 接入默认不配置后端。
|
|
21
|
+
|
|
22
|
+
Use this skill when the user wants a coding agent to do Lean 4 formalization, proof repair, theorem transcription, sorry completion, review of a Lean patch, or optional Lean-specialist backend work.
|
|
23
|
+
|
|
24
|
+
If the user only wants Lean 4, `elan`, `lake`, or a reusable mathlib workspace configured, use the sibling `../lean-setup/SKILL.md` entrypoint and do not ask for a theorem target.
|
|
25
|
+
|
|
26
|
+
Shared scripts, prompts, schemas, examples, and references live in the non-user-facing `lean-runtime/` support layer. Treat `lean-setup` and `lean-formalization` as the two public entrypoints; do not ask users to invoke `lean-runtime` directly.
|
|
27
|
+
|
|
28
|
+
This is a coding-agent-first Lean skill. The coding agent is the primary Lean worker. It reads and edits Lean files, runs Lean/Lake checks, diagnoses errors, preserves theorem statements, and iterates with the user. Default execution mode is coding-agent mode.
|
|
29
|
+
|
|
30
|
+
Incorporate publicly documented Lean-specialist agent patterns into the default coding-agent workflow. Use systems such as Numina, LeanDojo/ReProver, LeanCopilot, COPRA-style proof search, Lean LSP, MCP, and lightweight iterative proof agents as related-work references for mechanisms such as project gating, statement normalization, theorem-state loops, premise retrieval, bounded tactic/proof search, validation oracles, failure memory, and minimized handoff. Treat specialist-agent patterns as mechanisms, not mandatory external services.
|
|
31
|
+
|
|
32
|
+
This skill must act as a distilled Lean-agent capability layer, not only as a list of related projects. The default path should execute the distilled loop from `lean-runtime/references/lean_agent_capability_map.md`: project gate, statement normalization, local context pack, retrieve-before-inventing, bounded tactic/proof attempts, failed-route memory, local validation, and minimal failure handoff. Use `lean-runtime/references/lean_lsp_mcp_adapter.md` when the user explicitly asks for Lean LSP/MCP, richer goal-state tooling, or MCP-backed theorem search.
|
|
33
|
+
|
|
34
|
+
Lean-specialist backend adapters are adapter-first optional escalation paths. Built-in recommended adapter: official Numina Lean Agent runtime. Numina and Archon are recommended adapter candidates, not defaults or hard requirements. Other Lean-specialist backends may be connected by the coding agent through the backend adapter checklist; do not call any backend until deployment, readiness checks, invocation, validation, and failure triage are documented. Use a backend adapter only when the user asks for the official Lean Agent, Numina, Archon, batch proof search, or an approved external subagent run.
|
|
35
|
+
|
|
36
|
+
Match the user's language by default. If the user's language is ambiguous, default to Chinese. If the user writes Chinese, respond in Chinese from the first turn unless they ask otherwise. A language switch is not a task reset. Keep the current environment state, prior diagnosis, and recommended next action, then continue leading in the new language.
|
|
37
|
+
|
|
38
|
+
Lead the interaction; do not wait for the user to drive every step. When the user's request is broad or underspecified, first orient yourself to the Lean project/workspace state, then propose the next useful action in plain language. Do not open with a passive "send me the file" checklist when you can inspect context or offer a concrete starting path.
|
|
39
|
+
|
|
40
|
+
If no target is available, run or propose a safe local smoke/readiness check. Use the bundled smoke test when no user target is available. Then recommend a default path, such as checking the shared Lean workspace, running the built-in smoke theorem, or inspecting a Lean project. Check backend readiness only when the user wants an optional Lean-specialist backend path. Avoid ending with only "send me a file" or an equivalent passive handoff.
|
|
41
|
+
|
|
42
|
+
The bundled CLI is a helper toolbox, not the workflow driver. Prefer normal coding-agent judgment, direct file edits, `rg`, Lean/Lake validation, and repository context. Use helper commands only when their deterministic output is useful.
|
|
43
|
+
|
|
44
|
+
Use backend adapters through a human-in-the-loop workflow. The built-in recommended Numina adapter lives under shared local state at `${AI4MATH_HOME:-~/.ai4math}/numina-runtime/`; the coding agent explains clone, setup, API-key, proxy/MCP, and upstream runner implications before running setup or calling the official runner. Archon and other backend adapters must follow `lean-runtime/references/backend_adapter_checklist.md`. Do not turn helper commands into a closed proof workflow.
|
|
45
|
+
|
|
46
|
+
Opening readiness should inspect local Lean readiness first; inspect Numina or another backend readiness only when the user asks for an optional Lean-specialist backend. Do not require API keys for the default coding-agent path. Default coding-agent Lean work must not require any backend adapter. Shared workspace is the default Lean project context; Numina may target it instead of upstream examples.
|
|
47
|
+
|
|
48
|
+
Do not remove the built-in official Numina adapter recipe. Treat Numina and Archon as recommended adapter candidates with explicit approval, while keeping the direct coding-agent Lean workflow useful without external APIs.
|
|
49
|
+
|
|
50
|
+
## Agent Playbook
|
|
51
|
+
|
|
52
|
+
1. Start by orienting the session: inspect the current repository/workspace when possible, distinguish an existing Lake project, shared Lean workspace, and local Lean validation readiness, then summarize what is already usable. Mention Numina runtime or credentials/auth only when the user asks for an optional backend adapter path. Treat upstream Numina example projects as demos only; do not let their pinned `lean-toolchain` make the shared workspace look broken.
|
|
53
|
+
2. If the user has not provided a precise target, offer a small next-step menu such as run the bundled smoke test, repair an existing Lean file, formalize a natural-language/LaTeX theorem, or inspect a Lean project. Include backend readiness or credential setup only when the user asks for an optional backend adapter path. Recommend one default path based on what inspection found.
|
|
54
|
+
3. Ask at most one blocking question at a time. Prefer a concrete recommendation plus one decision question over a list of required inputs.
|
|
55
|
+
4. Understand the user's intent: direct coding-agent repair/formalization, configure or call a backend adapter, repair a file, formalize a statement, prove a target, complete `sorry`, review a patch, batch a folder, or minimize a failure.
|
|
56
|
+
5. Locate the relevant Lean project, files, declarations, imports, and current errors. Use the user's existing Lake project when available; otherwise use the shared workspace as the coding-agent project context and optional Numina target project.
|
|
57
|
+
6. For standalone files, use or create the shared workspace `${AI4MATH_HOME:-~/.ai4math}/lean-workspace`; do not create a second project-local workspace unless the user asks for isolation.
|
|
58
|
+
7. When reporting readiness, lead with local Lean readiness. Report backend readiness only when the optional backend adapter path is requested. If backend credentials are missing, say that only the optional backend adapter path needs configuration.
|
|
59
|
+
8. Before any backend adapter setup or run, inspect readiness, explain the deployment/call, target project, prompt, result directory, credential/proxy/MCP state, and local validation plan; proceed only after approval.
|
|
60
|
+
9. For natural-language or LaTeX input, draft the Lean declaration and ask for confirmation before long proof work.
|
|
61
|
+
10. Edit Lean directly in small steps for the default coding-agent path, using the distilled Lean-agent loop: inspect theorem state, build a local context pack, retrieve nearby lemmas before inventing, run bounded proof attempts, record failed routes, and extract minimal failures when blocked. If a backend adapter is approved, call it for proof search/formalization, then run Lean/Lake validation and patch safety checks before accepting results.
|
|
62
|
+
11. Preserve theorem statements unless the user explicitly approves a change.
|
|
63
|
+
12. Reject final patches that contain `sorry`, `admit`, or newly introduced `axiom`.
|
|
64
|
+
13. If blocked, stop cleanly with the smallest useful failing Lean fragment, exact errors/goals, and the next mathematical decision needed.
|
|
65
|
+
|
|
66
|
+
## Helper Toolbox
|
|
67
|
+
|
|
68
|
+
Use `python lean-runtime/scripts/ai4m_lean.py <command>` when it saves effort or reduces risk:
|
|
69
|
+
|
|
70
|
+
- `env` / `doctor`: inspect Lean workspace, local tool availability, and optional backend readiness when requested.
|
|
71
|
+
- `configure --create-workspace`: create or reuse the shared managed workspace.
|
|
72
|
+
- `configure --setup-numina --project-name <name>`: after user approval, clone/configure the official Numina runtime under `${AI4MATH_HOME:-~/.ai4math}/numina-runtime/`.
|
|
73
|
+
- `smoke-test`: run the bundled `lean-runtime/examples/smoke/LocalLeanSmoke.lean` target in the shared workspace without external API calls; this is a local Lean smoke theorem, not a Numina run.
|
|
74
|
+
- `check`: run a structured Lean/Lake validation.
|
|
75
|
+
- `review` / `detect-sorry`: guard against placeholders, axioms, and statement drift.
|
|
76
|
+
- `minimize-failure`: extract a compact failing Lean fragment.
|
|
77
|
+
- `prove` / `formalize` / `repair` / `complete-sorries` / `batch`: optional dry-run task envelopes for coding-agent bookkeeping; use a backend adapter only when the optional backend path is approved and documented.
|
|
78
|
+
- `verify-delivery`: validate this skill package.
|
|
79
|
+
|
|
80
|
+
All helper commands emit machine-readable JSON on stdout. Human-readable diagnostics go to stderr or log files.
|
|
81
|
+
|
|
82
|
+
## Numina Runtime
|
|
83
|
+
|
|
84
|
+
When using the built-in recommended Numina adapter, follow `lean-runtime/references/numina_runtime.md`. For auth/proxy/MCP/failure triage, follow `lean-runtime/references/numina_subagent_troubleshooting.md`. For Archon or any other backend adapter, follow `lean-runtime/references/backend_adapter_checklist.md`. Proof strategy is a human-in-the-loop process with the user, the coding agent, local Lean checks, and, when approved, a documented backend adapter.
|
|
85
|
+
|
|
86
|
+
## Safety Rules
|
|
87
|
+
|
|
88
|
+
- Do not call external model APIs or mutate Numina runtime state without approval.
|
|
89
|
+
- If the user asks for the official Lean Agent, Numina, Archon, batch proof search, or external subagent, explain needed credentials/setup directly.
|
|
90
|
+
- Do not commit local machine-specific paths.
|
|
91
|
+
- Do not call external APIs during `env`, `doctor`, `check`, `review`, `detect-sorry`, tests, or dry-runs.
|
|
92
|
+
- Do not store secrets in tracked files; use environment variables or `${AI4MATH_HOME:-~/.ai4math}/numina-runtime/.env.local`.
|
|
93
|
+
- Do not accept final Lean patches containing `sorry`, `admit`, or newly introduced `axiom`.
|
|
94
|
+
- Do not silently weaken theorem statements or change existing project versions.
|
|
95
|
+
- Do not let helper command availability override a better coding-agent path.
|
|
96
|
+
- Do not remove the built-in official Numina adapter recipe.
|
|
97
|
+
|
|
98
|
+
## References
|
|
99
|
+
|
|
100
|
+
- Read `lean-runtime/references/direct_lean_workflow.md` for the default coding-agent proof/repair/formalization loop.
|
|
101
|
+
- Read `lean-runtime/references/lean_agent_capability_map.md` when checking whether Lean-agent abilities have been distilled into the default workflow or delegated to adapters.
|
|
102
|
+
- Read `lean-runtime/references/lean_lsp_mcp_adapter.md` when the user asks to connect Lean LSP/MCP, goal-state MCP tooling, or MCP-backed theorem search.
|
|
103
|
+
- Read `lean-runtime/references/specialist_agent_patterns.md` when adapting ideas from Numina, LeanDojo/ReProver, LeanCopilot, COPRA-style proof search, Lean LSP/MCP, or other Lean-specialist agents.
|
|
104
|
+
- Read `lean-runtime/references/lean_runtime_configuration.md` when setting up or diagnosing the reusable Lean workspace.
|
|
105
|
+
- Read `lean-runtime/references/numina_runtime.md` when the user wants the official Numina deployment/call path.
|
|
106
|
+
- Read `lean-runtime/references/numina_subagent_troubleshooting.md` when Numina auth, proxy, MCP, or runner failures appear.
|
|
107
|
+
- Read `lean-runtime/references/backend_adapter_checklist.md` before connecting Archon or any other backend adapter.
|
|
108
|
+
- Read `lean-runtime/references/interactive_orchestration.md` when guiding user intake and task decomposition.
|
|
109
|
+
- Read `lean-runtime/references/review_checklist.md` before accepting a Lean patch.
|
|
110
|
+
- Read `lean-runtime/references/failure_taxonomy.md` when reporting a blocked proof.
|
|
111
|
+
- Read `lean-runtime/references/numina_reverse_analysis.md` when explaining which Numina mechanisms are incorporated locally and which are delegated to the optional official runtime.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Copy values into an ignored local file or export them manually.
|
|
2
|
+
export AI4MATH_HOME="~/.ai4math"
|
|
3
|
+
export AI4MATH_LEAN_WORKSPACE="~/.ai4math/lean-workspace"
|
|
4
|
+
export AI4MATH_LEAN_TOOLCHAIN="leanprover/lean4:v4.28.0"
|
|
5
|
+
export AI4MATH_NUMINA_HOME="~/.ai4math/numina-runtime"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[lean]
|
|
2
|
+
default_cwd = "."
|
|
3
|
+
validate_command = "lake build"
|
|
4
|
+
single_file_check_template = "lake env lean {file}"
|
|
5
|
+
workspace_mode = "reuse-managed"
|
|
6
|
+
managed_workspace_path = "~/.ai4math/lean-workspace"
|
|
7
|
+
managed_workspace_root = "~/.ai4math/lean-workspaces"
|
|
8
|
+
managed_workspace_template = "math"
|
|
9
|
+
reuse_managed_workspace = true
|
|
10
|
+
workspace_key = "lean-toolchain"
|
|
11
|
+
align_workspace_versions = true
|
|
12
|
+
preferred_toolchain = "leanprover/lean4:v4.28.0"
|
|
13
|
+
preferred_mathlib_rev = "auto"
|
|
14
|
+
allow_user_project_version_changes = false
|
|
15
|
+
|
|
16
|
+
[agent]
|
|
17
|
+
mode = "coding-agent"
|
|
18
|
+
backend = "none"
|
|
19
|
+
max_local_iterations = 5
|
|
20
|
+
require_user_statement_confirmation = true
|
|
21
|
+
|
|
22
|
+
[policy]
|
|
23
|
+
no_sorry = true
|
|
24
|
+
no_admit = true
|
|
25
|
+
no_axiom = true
|
|
26
|
+
do_not_change_statement = true
|
|
27
|
+
allow_new_lemmas = true
|
|
28
|
+
default_max_rounds = 5
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[numina]
|
|
2
|
+
upstream_url = "https://github.com/project-numina/numina-lean-agent"
|
|
3
|
+
runtime_home = "~/.ai4math/numina-runtime"
|
|
4
|
+
default_project_name = "myproofs"
|
|
5
|
+
default_prompt_file = "prompts/autosearch/main_entry.md"
|
|
6
|
+
default_max_rounds = 10
|
|
7
|
+
store_secrets_here = false
|
|
8
|
+
|
|
9
|
+
[policy]
|
|
10
|
+
require_user_approval_before_setup = true
|
|
11
|
+
require_user_approval_before_run = true
|
|
12
|
+
validate_outputs_with_local_lean = true
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Backend Adapter Checklist
|
|
2
|
+
|
|
3
|
+
Use this checklist before connecting any Lean-specialist backend. Backend integration is adapter-first: default coding-agent Lean work must not require any backend adapter, and every backend call must pass through an explicit adapter contract.
|
|
4
|
+
|
|
5
|
+
## Support Status
|
|
6
|
+
|
|
7
|
+
- `built_in_recipe`: optional adapter recipe maintained in this repository.
|
|
8
|
+
The agent still needs explicit approval, documented readiness, invocation,
|
|
9
|
+
local validation, and failure triage before use.
|
|
10
|
+
- `adapter_recipe`: documented adapter recipe for explicit user-approved
|
|
11
|
+
escalation. Treat it as opt-in, not as a default dependency.
|
|
12
|
+
- `candidate`: recommended backend family or related work, but no complete
|
|
13
|
+
adapter recipe is maintained here.
|
|
14
|
+
- `unsupported`: related work only; do not call it automatically.
|
|
15
|
+
|
|
16
|
+
Built-in recommended adapter: official Numina Lean Agent runtime.
|
|
17
|
+
|
|
18
|
+
Numina and Archon are recommended adapter candidates, not defaults or hard requirements. The official Numina runtime is `built_in_recipe`; Lean LSP/MCP is `adapter_recipe` in `lean_lsp_mcp_adapter.md` for goal-state tooling and MCP-backed theorem search when the user explicitly asks for it. Other Lean-specialist backends may be connected by the coding agent through the backend adapter checklist, but do not call any backend until deployment, readiness checks, invocation, validation, and failure triage are documented.
|
|
19
|
+
|
|
20
|
+
## Adapter Contract
|
|
21
|
+
|
|
22
|
+
Document all of the following before calling a backend adapter:
|
|
23
|
+
|
|
24
|
+
- Name, upstream source, license, and support status.
|
|
25
|
+
- Trigger phrases that justify using this backend.
|
|
26
|
+
- Setup location, install commands, network access, and local state written.
|
|
27
|
+
- Required tools, credentials, API keys, proxy settings, or MCP scope.
|
|
28
|
+
- Readiness checks that do not call external model APIs.
|
|
29
|
+
- Invocation command, working directory, target project/file/folder, prompt, result directory, and round limits.
|
|
30
|
+
- Mutation boundary: which files may be changed, where generated outputs go, and which actions require approval.
|
|
31
|
+
- Local validation gate: Lean/Lake check, `detect-sorry`, `review`, and theorem statement drift checks.
|
|
32
|
+
- Failure triage: auth, proxy, MCP, toolchain, runner, timeout, and fallback to the coding-agent path.
|
|
33
|
+
|
|
34
|
+
## Non-Claim Rule
|
|
35
|
+
|
|
36
|
+
Do not call a backend adapter unless its setup, call, credential, mutation, and validation contracts are documented. Undocumented adapters may be cited as related work or recommended candidates only.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Direct Coding-Agent Lean Workflow
|
|
2
|
+
|
|
3
|
+
This is the default distilled Lean-agent workflow. The coding agent reads and edits Lean directly, runs Lean/Lake checks, and iterates from concrete errors/goals. It incorporates Lean-specialist agent patterns into local work: project gating, statement normalization, theorem-state loops, premise retrieval, bounded proof attempts, failed-strategy memory, validation oracles, and minimal failure handoff. Backend adapters remain optional and adapter-first; Numina, Lean LSP/MCP, Archon, LeanCopilot, and other systems are adapter candidates, but no backend is required for ordinary Lean formalization, proof repair, or sorry completion.
|
|
4
|
+
|
|
5
|
+
## Guidance-First Loop
|
|
6
|
+
|
|
7
|
+
1. Read the user's request and classify whether this is repair, theorem formalization, proof completion, sorry completion, patch review, Numina setup/call, or output validation.
|
|
8
|
+
2. Inspect the target files, imports, nearby lemmas, and current Lean errors.
|
|
9
|
+
3. Choose the validation context: existing Lake project first, managed workspace only for standalone files.
|
|
10
|
+
4. For formalization, draft the Lean declaration and ask for confirmation before long proof work.
|
|
11
|
+
5. Build a compact local context pack from current goals, nearby proofs, relevant declarations, imports, and failed attempts.
|
|
12
|
+
6. Retrieve before inventing: use existing imports, nearby lemmas, local project declarations, and mathlib names before adding helper lemmas.
|
|
13
|
+
7. Run bounded proof attempts: make one small Lean edit or tactic route at a time, then stop and inspect feedback.
|
|
14
|
+
8. Run Lean/Lake validation after meaningful edits, usually `lake env lean <file>`, `lake build`, or the helper `check` command.
|
|
15
|
+
9. Diagnose the first concrete Lean error or unsolved goal before changing strategy.
|
|
16
|
+
10. Record failed routes so the agent does not cycle over the same tactic family, rewrite, or statement weakening.
|
|
17
|
+
11. Add helper lemmas only when they reduce proof complexity and keep theorem statements unchanged.
|
|
18
|
+
12. Review the final patch with direct inspection and, when useful, `review` or `detect-sorry`.
|
|
19
|
+
13. If blocked, use direct reduction and/or `minimize-failure` to return the smallest failing Lean fragment plus exact errors/goals and tried routes.
|
|
20
|
+
|
|
21
|
+
## When to Use Helpers
|
|
22
|
+
|
|
23
|
+
Use helpers for mechanical checks:
|
|
24
|
+
|
|
25
|
+
- environment and workspace readiness: `env`, `doctor`, `configure`;
|
|
26
|
+
- validation: `check`;
|
|
27
|
+
- safety guards: `review`, `detect-sorry`;
|
|
28
|
+
- failure handoff: `minimize-failure`;
|
|
29
|
+
- package QA: `verify-delivery`.
|
|
30
|
+
|
|
31
|
+
Do not route creative proof search through helper commands. `prove`, `formalize`, `repair`, `complete-sorries`, and `batch` only produce optional task envelopes for bookkeeping. Use the official Numina runner or Lean LSP/MCP adapter only when the optional backend path is approved and the matching adapter recipe has been reviewed.
|
|
32
|
+
|
|
33
|
+
## Workspace Choice
|
|
34
|
+
|
|
35
|
+
Prefer a user's existing Lake project when the target file is inside one. For standalone `.lean` files, use the reusable `${AI4MATH_HOME:-~/.ai4math}/lean-workspace` so Lean, Lake, and mathlib artifacts are shared across tasks and projects.
|
|
36
|
+
|
|
37
|
+
When a user project has its own `lean-toolchain` and mathlib revision, keep those versions unless the user explicitly approves a change. When creating a managed workspace, default to the AI4Math canonical toolchain `leanprover/lean4:v4.28.0` unless the user explicitly overrides it; use a versioned workspace for other standalone revisions instead of overwriting the canonical workspace.
|
|
38
|
+
|
|
39
|
+
## Good Stopping Points
|
|
40
|
+
|
|
41
|
+
Stop with success when the relevant Lean file or project validates and no unsafe placeholders remain.
|
|
42
|
+
|
|
43
|
+
Stop with a minimal failure when:
|
|
44
|
+
|
|
45
|
+
- the remaining proof step requires a human mathematical decision;
|
|
46
|
+
- the theorem statement appears ambiguous or unconfirmed;
|
|
47
|
+
- progress would require weakening a statement without approval;
|
|
48
|
+
- repeated local attempts are cycling over the same Lean error.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Failure Taxonomy
|
|
2
|
+
|
|
3
|
+
Use these categories in result JSON and summaries:
|
|
4
|
+
|
|
5
|
+
- `missing_lean_project`: target is not inside a Lake project and no managed workspace is available.
|
|
6
|
+
- `lean_workspace_setup_failed`: creating or building the reusable managed workspace failed.
|
|
7
|
+
- `lean_build_failed`: `lake build` failed for the target project or managed workspace.
|
|
8
|
+
- `lean_file_failed`: single-file Lean validation failed.
|
|
9
|
+
- `target_missing`: requested Lean file or folder does not exist.
|
|
10
|
+
- `statement_ambiguous`: natural-language theorem needs user confirmation.
|
|
11
|
+
- `statement_unconfirmed`: long proof work should wait until the user confirms the Lean declaration.
|
|
12
|
+
- `statement_changed`: patch changed the theorem statement without approval.
|
|
13
|
+
- `unsafe_patch`: patch introduced `sorry`, `admit`, or `axiom`.
|
|
14
|
+
- `proof_budget_exhausted`: max local iterations reached with remaining goals.
|
|
15
|
+
- `human_math_decision_needed`: remaining step needs a mathematical lemma or strategy decision.
|
|
16
|
+
|
|
17
|
+
This direct skill should not report Numina, model, API-key, Claude-login, or external-backend failures because those are not runtime dependencies.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Interactive Orchestration
|
|
2
|
+
|
|
3
|
+
The coordinating coding agent owns user interaction, Lean proof/formalization work, incorporated Lean-specialist agent patterns, adapter-first optional backend orchestration, and final validation. It can delegate proof search/formalization to a documented backend adapter when the user asks for that path.
|
|
4
|
+
|
|
5
|
+
This reference covers the guidance layer: session opening, intake, task classification, direct coding-agent Lean work, specialist-agent pattern selection, optional Lean-specialist backend adapter deployment/calls, local Lean validation, result review, bounded iteration, and minimal failure handoff.
|
|
6
|
+
|
|
7
|
+
## Session Opening
|
|
8
|
+
|
|
9
|
+
If the user's language is ambiguous, default to Chinese. The skill display name, repository name, or command name is not enough evidence to choose English.
|
|
10
|
+
|
|
11
|
+
This is a coding-agent-first Lean skill. Backend integration is adapter-first. Built-in recommended adapter: official Numina Lean Agent runtime. Numina and Archon are recommended adapter candidates, not defaults or hard requirements. Other Lean-specialist backends may be connected by the coding agent through the backend adapter checklist; do not call any backend until deployment, readiness checks, invocation, validation, and failure triage are documented.
|
|
12
|
+
|
|
13
|
+
The default coding-agent path should still absorb Lean-specialist agent mechanisms as a distilled Lean-agent loop: project gating, statement normalization, local context packs, theorem-state loops, retrieve-before-inventing, bounded proof search, failed-strategy memory, Lean/Lake validation, and minimized failure handoff. Use `lean_agent_capability_map.md` to distinguish default distilled capabilities from adapter-only capabilities.
|
|
14
|
+
|
|
15
|
+
Lead the interaction; do not wait for the user to drive every step. On a broad request, first orient to the current state instead of asking for every input at once:
|
|
16
|
+
|
|
17
|
+
- inspect whether the current directory is a Lake project;
|
|
18
|
+
- check whether the shared `${AI4MATH_HOME:-~/.ai4math}/lean-workspace` exists;
|
|
19
|
+
- inspect local Lean/Lake readiness and shared workspace state;
|
|
20
|
+
- inspect backend runtime, upstream checkout, tools, and credential/auth readiness only when the user asks for an optional backend adapter;
|
|
21
|
+
- say what can be done immediately and what would require confirmation.
|
|
22
|
+
|
|
23
|
+
Opening readiness should inspect local Lean readiness first. Inspect Numina or another backend readiness only when the user asks for an optional Lean-specialist backend. Do not require API keys for the default coding-agent path. Shared workspace is the default Lean project context; Numina may target it instead of upstream examples.
|
|
24
|
+
|
|
25
|
+
When checking Numina, distinguish runtime readiness from upstream demo readiness. The runtime can be usable with the shared Lean workspace even if an upstream example or benchmark pins a different `lean-toolchain`. Report that as an example-project issue, not as a failure of the shared environment.
|
|
26
|
+
|
|
27
|
+
A language switch is not a task reset. Restate the current state in the user's language, keep the prior diagnosis, and continue with the recommended next action instead of returning to generic intake.
|
|
28
|
+
|
|
29
|
+
If no target is available, run or propose a safe local smoke/readiness check. Use the bundled smoke test when no user target is available. Good examples are `smoke-test` against `examples/smoke/LocalLeanSmoke.lean`, `lake build` for the user's current Lake project when it is already present, or a helper `doctor` check when environment status is the question. Avoid ending with only "send me a file" or an equivalent passive handoff.
|
|
30
|
+
|
|
31
|
+
If no precise target is provided, offer a small menu and recommend one path. For example:
|
|
32
|
+
|
|
33
|
+
- run the bundled smoke test to verify the local Lean/mathlib validation layer;
|
|
34
|
+
- repair or complete an existing Lean file with the coding agent;
|
|
35
|
+
- formalize a natural-language or LaTeX theorem with the coding agent;
|
|
36
|
+
- inspect a Lean/Lake project and summarize readiness;
|
|
37
|
+
- if the user asks for an optional backend adapter, configure missing credentials/auth for that adapter;
|
|
38
|
+
- if the user asks for an optional backend adapter, run an adapter readiness check;
|
|
39
|
+
- if the user asks for an optional backend adapter, prepare the shared workspace as the target project;
|
|
40
|
+
- if the user asks for an optional backend adapter, call the approved adapter on a natural-language/LaTeX theorem or Lean file.
|
|
41
|
+
- if the user asks for Lean LSP/MCP, read `lean_lsp_mcp_adapter.md`, explain MCP scope and security, then configure only after approval.
|
|
42
|
+
|
|
43
|
+
Ask at most one blocking question at a time. A good opening ends with one decision question, not a checklist.
|
|
44
|
+
|
|
45
|
+
## Intake Questions
|
|
46
|
+
|
|
47
|
+
Ask only when not inferable:
|
|
48
|
+
|
|
49
|
+
- Is this repair, theorem formalization, proof completion, sorry completion, patch review, or batch work?
|
|
50
|
+
- What target file/folder and declaration should be used?
|
|
51
|
+
- Is changing the theorem statement allowed?
|
|
52
|
+
- Should standalone work use the reusable managed workspace?
|
|
53
|
+
- If you want an optional backend adapter, should we configure/call it now, or only inspect readiness?
|
|
54
|
+
- For natural-language or LaTeX input, what statement should be considered authoritative?
|
|
55
|
+
|
|
56
|
+
Prefer asking these only after orientation. If the repository already reveals the likely next step, state the recommendation and ask for confirmation.
|
|
57
|
+
|
|
58
|
+
## Decomposition
|
|
59
|
+
|
|
60
|
+
Break large requests into small Lean targets that the coding agent can work on directly, and that Numina can run against if the optional backend path is approved. Each target should be checkable afterward with Lean/Lake commands or the helper `check` command.
|
|
61
|
+
|
|
62
|
+
For natural-language or LaTeX statements, draft the Lean declaration first and ask for confirmation before long proof work. Once the declaration is confirmed, treat statement preservation as a hard guardrail.
|
|
63
|
+
|
|
64
|
+
## Backend Run
|
|
65
|
+
|
|
66
|
+
Before any backend adapter call, state the target project/file, prompt file, max rounds, result directory, credential/proxy/MCP state, and validation plan. Ask for approval before any external model call or runtime mutation.
|
|
67
|
+
|
|
68
|
+
After the adapter returns, inspect changed Lean files, run local Lean/Lake validation, and reject results containing `sorry`, `admit`, new `axiom`, or unapproved theorem statement changes.
|
|
69
|
+
|
|
70
|
+
Backend adapters must satisfy `backend_adapter_checklist.md` before they are called.
|
|
71
|
+
|
|
72
|
+
## Iteration Policy
|
|
73
|
+
|
|
74
|
+
Stop when:
|
|
75
|
+
|
|
76
|
+
- validation succeeds without `sorry`, `admit`, or new `axiom`;
|
|
77
|
+
- max local iterations are reached;
|
|
78
|
+
- Lean workspace setup is missing or broken;
|
|
79
|
+
- backend adapter credentials/auth are missing and the user specifically requires that adapter;
|
|
80
|
+
- the remaining error requires a human mathematical decision;
|
|
81
|
+
- the only path forward would weaken the theorem statement without approval.
|
|
82
|
+
|
|
83
|
+
When stopping before success, reduce the problem to the smallest useful failing fragment. Use `minimize-failure` when it helps, then report exact Lean errors/goals and the next human decision needed.
|