Contract
- Input: mathematical statement to prove and target proof assistant.
- Output: verified source + Markdown narrative.
- Side effects: none.
- Dependencies: none.
- Stop condition: proof verified by the assistant's kernel.
- Risk: low.
- Boundary: produces verified proof artifacts; no new external system changes.
Formal Proof Development
Build a proof in a proof assistant — Lean 4, Coq, Isabelle, Agda — that the assistant's kernel can verify, with a literate narrative for publication.
When to use
- A proof needs machine-verifiable rigour.
- A paper's appendix should include a formal proof (increasing trust).
- The researcher is formalising a known result or building a library (e.g.
mathlib).
Process
1. Pick the assistant
- Lean 4 + mathlib — large library, active community, default for many.
- Coq — mature; MathComp library for combinatorics.
- Isabelle / HOL — strong for analysis, logic, and computer-science theorems.
- Agda — small, expressive, dependent types.
State the choice and why.
Completion criterion: assistant named; rationale stated.
2. Encode the statement
Translate the mathematical statement into the assistant's syntax:
- Use existing types (
ℕ, ℝ, Group, TopologicalSpace).
- Match the statement's quantifier structure.
- State the theorem header with named variables and explicit hypotheses.
Completion criterion: theorem header compiles; types check.
3. Choose proof strategy
- Library search —
library_search / Search / find for an existing lemma.
- Tactic decomposition —
intro, apply, cases, induction, simp.
- Manual proof — explicit term construction (
exact, λ).
- Proof by reflection — for decidable equalities.
- Proof by automation —
aesop, omega, nlinarith, field_simp.
Completion criterion: strategy named.
4. Build and verify
Write the proof step by step. After each step:
- Run the assistant's checker (
lake build, coqc, isabelle build).
- Replace
sorry and Admitted with verified tactics.
- Record the verified proof's hash or kernel confirmation.
Completion criterion: proof fully verified (no sorry/Admitted).
5. Literate export
For a paper:
- Use
preprint / Lean+LaTeX integration, or extract the proof as LaTeX with a translator.
- Annotate key tactics with comments explaining the mathematical intuition.
- Cite the formal proof in the paper ("Verified in Lean 4; see Appendix B").
Completion criterion: narrative + verified proof saved; cross-reference to paper present.
Notes
- Pair with
math-pure-proofs for informal reasoning.
- For paper inclusion, use a versioned Git tag of the formal proof.
1---2name: math-formal-proof3description: Develop formal mathematical proofs in proof assistants (Lean 4, Coq, Isabelle, Agda) with literate programming, tactic-driven construction, and verification.4---56## Contract78- **Input:** mathematical statement to prove and target proof assistant.9- **Output:** verified source + Markdown narrative.10- **Side effects:** none.11- **Dependencies:** none.12- **Stop condition:** proof verified by the assistant's kernel.13- **Risk:** low.14- **Boundary:** produces verified proof artifacts; no new external system changes.1516# Formal Proof Development1718Build a **proof** in a proof assistant — Lean 4, Coq, Isabelle, Agda — that the assistant's kernel can verify, with a literate narrative for publication.1920## When to use2122- A proof needs machine-verifiable rigour.23- A paper's appendix should include a formal proof (increasing trust).24- The researcher is formalising a known result or building a library (e.g. `mathlib`).2526## Process2728### 1. Pick the assistant2930- **Lean 4 + mathlib** — large library, active community, default for many.31- **Coq** — mature; MathComp library for combinatorics.32- **Isabelle / HOL** — strong for analysis, logic, and computer-science theorems.33- **Agda** — small, expressive, dependent types.3435State the choice and why.3637**Completion criterion:** assistant named; rationale stated.3839### 2. Encode the statement4041Translate the mathematical statement into the assistant's syntax:4243- Use existing types (`ℕ`, `ℝ`, `Group`, `TopologicalSpace`).44- Match the statement's quantifier structure.45- State the theorem header with named variables and explicit hypotheses.4647**Completion criterion:** theorem header compiles; types check.4849### 3. Choose proof strategy5051- **Library search** — `library_search` / `Search` / `find` for an existing lemma.52- **Tactic decomposition** — `intro`, `apply`, `cases`, `induction`, `simp`.53- **Manual proof** — explicit term construction (`exact`, `λ`).54- **Proof by reflection** — for decidable equalities.55- **Proof by automation** — `aesop`, `omega`, `nlinarith`, `field_simp`.5657**Completion criterion:** strategy named.5859### 4. Build and verify6061Write the proof step by step. After each step:6263- Run the assistant's checker (`lake build`, `coqc`, `isabelle build`).64- Replace `sorry` and `Admitted` with verified tactics.65- Record the verified proof's hash or kernel confirmation.6667**Completion criterion:** proof fully verified (no `sorry`/`Admitted`).6869### 5. Literate export7071For a paper:7273- Use `preprint` / Lean+LaTeX integration, or extract the proof as LaTeX with a translator.74- Annotate key tactics with comments explaining the mathematical intuition.75- Cite the formal proof in the paper ("Verified in Lean 4; see Appendix B").7677**Completion criterion:** narrative + verified proof saved; cross-reference to paper present.7879## Notes8081- Pair with `math-pure-proofs` for informal reasoning.82- For paper inclusion, use a versioned Git tag of the formal proof.