Formalize

From MechMath/MechMath-agent-team · View interactive version

Formalize is an AI agent skill from the GitHub repository MechMath/MechMath-agent-team. Use when turning textbook, paper, blueprint, or user-written mathematics into faithful Lean 4 declarations with sorry proofs, or when auditing/correcting an existing Lean statement to match its informal source.

How to use this skill

Skill file

Formalize

Turn informal mathematics into Lean 4 statement skeletons. The output should be

faithful declarations with real mathematical content and proofs left as

:= by sorry.

When to Use

Use this skill when:

formalized from informal mathematics.

informal source.

Lean declaration skeleton.

Workflow

  1. Read the source statement and the local Lean context where the declaration

will live.

  1. Extract the mathematical structure:
  1. Audit the source definitions first: resolve each named concept and list every

condition it entails (continuity, topology, completeness, etc.), so nothing

implicit is dropped. See reference-formalizer.md.

  1. Acid-test the Mathlib definitions: use the lean-search skill tools (leandex,

lean-explore, loogle, …) to find candidate types, read their actual

definitions, and confirm the axioms match the source condition by condition.

Prefer bundled Mathlib structures; bridge or define custom only when needed.

  1. Choose the declaration kind (def for a constructed object, structure for

data-plus-properties, theorem for an asserted proposition).

  1. Write the Lean declaration and any necessary supporting definitions. Leave

theorem proofs as := by sorry.

  1. Review the draft against reference-reviewer.md.

Fix semantic mismatches before accepting the declaration.

  1. Verify with the local Lean checker from the verification skill, usually:
python cli_tools/lean.py check FILE

Only accept the result when the semantic review passes and Lean reports no

errors other than intentional sorry warnings.

Boundaries

compile.

References

rules and common Lean encodings.

checklist.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.