Logotipo de Lean Proof Patterns

Lean Proof Patterns

Comunidad
scottnarmstrong
lean-proof-patterns

Úsalo al escribir, refactorizar o depurar demostraciones en Lean cuando necesites traducir de forma fiable el razonamiento matemático a tácticas explícitas, reescrituras controladas o una estructura de demostración fácil de mantener.

Add to TypingMind

Descripción general

Editorscottnarmstrong
RepositorioLeanAutoformalizationSkills
Nombre de la habilidadlean-proof-patterns
Estrellas
66
Forks
7
Archivos incluidos
3
LicenciaCC-BY-4.0
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando la petición encaja con la habilidad.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Archivos incluidos: 3

    Scripts, plantillas y referencias que el modelo puede leer mientras trabaja. Los archivos son de solo lectura y nunca se ejecutan.

  • Código abierto

    Publicada por scottnarmstrong en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Lean Proof Patterns en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/scottnarmstrong/LeanAutoformalizationSkills/tree/main/skills/lean-proof-patterns
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/scottnarmstrong/LeanAutoformalizationSkills.git /tmp/LeanAutoformalizationSkills
mkdir -p .claude/skills
cp -r /tmp/LeanAutoformalizationSkills/skills/lean-proof-patterns .claude/skills/lean-proof-patterns
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Lean Proof Patterns en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición encaja con la habilidad, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Lean Proof Patterns automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Lean Proof Patterns no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición que encaja con la habilidad, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

Lean Proof Patterns

Use this skill when the work is primarily about proving things in Lean rather than planning a project or searching for existing lemmas. It is especially useful when translating informal mathematics into Lean, cleaning up a rough proof, or replacing exploratory tactics with checked-in code.

Core Workflow

  1. Classify the proof step before touching tactics.
    • introduction or elimination
    • rewriting or normal-form change
    • case split or induction
    • arithmetic or algebraic closure
    • extensionality or structure unpacking
  2. Start with the simplest explicit proof shape that matches the mathematics.
    • intro, rintro, obtain, constructor, use
    • have, suffices, show, change
    • calc for chains of equalities or inequalities
  3. During exploration, use search tactics freely.
    • exact?, apply?, rw?, simp?, hint
    • do not leave them in finished code
  4. Before finishing, pin the proof down.
    • replace bare simp with simp only [...] when possible
    • replace search tactics with explicit lemmas
    • factor repeated proof fragments into helper lemmas

Production-Proof Rules

  • Prefer small have steps and calc blocks over large opaque tactic scripts.
  • Use automation that matches the goal shape.
    • ring, field_simp, linarith, nlinarith, omega, positivity, norm_num
    • gcongr, fun_prop, continuity, measurability when the domain fits
  • In performance-sensitive proofs, do not leave broad automation in place just because it closes the goal. If a large nlinarith/linarith is only combining already-named inequalities, replace it with monotonicity lemmas and a calc. Prefer linarith only [...] so the hypothesis set stays small. Treat Real.rpow and Real.exp expressions as opaque atoms when possible; extract the algebraic core over abstract reals if unfolding them causes excessive work.
  • Follow the repository's linter policy. Unused proof-locals, dead simp arguments, do-nothing tactics, and <;> applied to a single goal are mechanical fixes. Audit an unused binder in the statement against the source before changing it. A source premise may remain necessary to preserve the approved statement even if this proof does not use it. A frozen signature changes only through an author-approved successor and renewed audits.
  • Keep rewriting intentional.
    • rw for a specific rewrite
    • simp_rw under binders
    • conv only when targeted rewriting is genuinely needed
  • Replace broad definitional bridges like simpa [many, local, definitions] with exact, rfl, or dsimp plus targeted rw when possible.
  • Separate discovery from final form.
    • development proofs may use search and broad automation
    • checked-in proofs should be stable, readable, and predictable

Statement Hygiene

The statement must say what you claim, independently of how far the proof has got. When a step will not close, fix the proof; never reshape the goal into something provable.

  • A genuine predicate defined by the source, such as an induction state, may be a literal def : Prop, provided it takes the objects it constrains as parameters. A theorem-shaped predicate, standing-assumption package, result bundle, or generic “input/bridge/consequence” interface may not replace a source theorem. def myEstimate : Prop := ∀ ... consumed as theorem main (h : myEstimate) : Goal leaves the mathematics untouched and only hides it from the reader and from the status report.
  • No placeholder definition and no fallback body. A definition must already denote the intended object on its whole carrier; do not add a default branch so that a later statement can quantify over an unfinished construction.
  • No hypothesis that is a proof step, estimate, or witness of the target rather than a premise of the source. If the source proves A → B, intermediate claims belong in the proof or in helper lemmas; A → Step → B is a different theorem.
  • No hypothesis that is the conclusion itself at a weaker scale, radius, or domain.

A conditional theorem is legitimate when every hypothesis is a source premise, a separately approved standing assumption, or an external input recorded as a trust boundary. It is not legitimate when a hypothesis is the part of the argument that is unfinished. All of these forms elaborate and pass the build, and naming one honestly in the handoff does not make the statement correct. A text linter that checks placeholders and banned tactics will not catch them, so check project-owned Prop definitions by hand and treat a nullary one as an unproved theorem until shown otherwise. When the input you need does not exist, stop and report the exact missing statement.

Module Files

For repositories using Lean's module system, follow the pinned toolchain's visibility rules and the project's chosen header conventions.

  • Header. The file starts with a copyright comment, then module, then public import for what statements need and plain import for proof-only dependencies. The module docstring follows, then public section.
  • Definition bodies are hidden unless the definition is @[expose]. A public theorem that needs to unfold a definition fails with "Not a definitional equality … must be exposed", even in the same file. This is verified for rfl; expect the same for decide and for cross-module unfolding. Fix it either by proving and using an unfolding lemma (f_def, f_apply), or by exposing a definition whose body is its meaning. Never weaken the statement to avoid the error.
  • Proofs are never exported. Nothing downstream may depend on how a theorem was proved.
  • Registry interfaces. If a publication registry imposes additional visibility rules on comparison, challenge, or solution files, apply those rules only to the relevant export interface.

See the lean-project-architecture skill's references/module-system.md for the full rules.

Debugging Heuristics

  • If Lean is not seeing the goal in the right form, try show, change, or an explicit helper lemma before escalating to clever tactics.
  • If automation nearly works, inspect what it wants and feed it the missing monotonicity, positivity, or side inequalities.
  • If the proof is repeating the same shape, stop and extract a lemma instead of copying tactics.
  • When the task is elaboration cleanup, profile before and after each candidate change, and keep only edits that improve the relevant profiler category. Treat wall time as secondary when the machine is busy.

References

Archivos incluidos

El modelo los lee según los necesita mientras la habilidad está cargada. Son archivos de solo lectura y nunca se ejecutan.

Preguntas frecuentes

¿Qué hace la habilidad de IA Lean Proof Patterns?

Úsalo al escribir, refactorizar o depurar demostraciones en Lean cuando necesites traducir de forma fiable el razonamiento matemático a tácticas explícitas, reescrituras controladas o una estructura de demostración fácil de mantener.

¿Por qué usar Lean Proof Patterns en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Lean Proof Patterns está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Lean Proof Patterns en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/scottnarmstrong/LeanAutoformalizationSkills/tree/main/skills/lean-proof-patterns. TypingMind lee el archivo SKILL.md de esa carpeta, empaqueta los archivos de la carpeta e instala el conjunto como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Lean Proof Patterns?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Lean Proof Patterns?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Lean Proof Patterns con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Lean Proof Patterns?

Sí. scottnarmstrong la ha publicado en GitHub bajo la licencia CC-BY-4.0. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇