lean4-development
Skill2 starsChanged 4 months agoMITView on GitHub
Build, port, prove, test, or review Lean 4 libraries and executables while pinning the actual Lean toolchain and keeping proof claims honest. Use for Lean 4 code, Lake packages, theorem-proving experiments, executable refinement proofs, or migrations from older Lean versions.
In this repository27 other files it gives its agents.
- capture-collaboration-evidenceSkill
- clarify-before-buildingSkill
- cross-platform-project-build-archSkill
- deep-code-reviewSkill
- dispatchSkill
- erect-agent-stackSkill
- fix-zig-deps-hashSkill
- gather-project-intentionsSkill
- handoffSkill
- i18nSkill
- llvm-guided-optimizationSkill
- mechatron-ciSkill
- memoriesSkill
- mficSkill
- no-ai-slopSkill
- onboardSkill
- performance-profilingSkill
- planning-workSkill
- scaffold-zig-projectSkill
- shipSkill
- test-isolationSkill
- universal-app-frontendSkill
- walking-decisionsSkill
- writing-bendSkill
- writing-nixSkill
- writing-rocSkill
- zig-microbenchmarksSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 10 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use Lean as both a programming language and a proof checker without conflating successful execution, cross-implementation agreement, and a …
- Distinctive: line 26
Keep these boundaries explicit:
- Distinctive: line 42
Before implementation, add at least one failing executable control derived from the external contract and one theorem statement that cannot …
- Distinctive: line 46
use external official vectors or an independent implementation for exact differential checks.
- Distinctive: line 48
use Lean theorems for invariants and refinement properties.
- Distinctive: line 49
use exhaustive finite checks, metamorphic properties, or mutation controls where no external oracle exists.
- Distinctive: line 51
keep cross-language tests outside Lean so Lean cannot redefine its own oracle.
- Distinctive: line 53
Prefer small proved components composed into a larger result.
- Very specific: line 60
do not use sorry, admit, new axiom declarations, or unsafe definitions in their dependency path.
- Very specific: line 62
prefer ordinary proof terms, simp, omega, grind, and decidable finite reasoning that produces kernel-checkable terms.
- Very specific: line 64
treat native_decide, compiler execution, FFI results, benchmarks, and generated expected values as tests unless their additional trust …
- Very specific: line 67
run #print axioms TheoremName for headline theorems and record every remaining axiom rather than assuming none.
- Distinctive: line 90
Do not claim overflow safety from test coverage alone.
- Very specific: line 96
Use nix build as the canonical build path, with Lake invoked inside the derivation.
- Very specific: line 111
Use lake shake only as a dependency diagnostic, not as proof.
- Distinctive: line 129
Never describe cryptographic security, distribution quality, constant-time behavior, absence of compiler bugs, or OS entropy quality as …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Lean 4 development
Use Lean as both a programming language and a proof checker without conflating successful execution, cross-implementation agreement, and a kernel-checked theorem.
Pin the language before writing code
Lean intentionally has limited compatibility between monthly releases. Read the
project's lean-toolchain, Nix input, or package derivation first and run
lean --version plus lake --version through that environment. Do not search
the Nix store or silently use an ambient Elan toolchain.
For this fleet, require the project's Nix derivation. If none exists, add one and pin an exact Lean version before adopting syntax or APIs. Check the matching Lean reference and the pinned release's source/API when memory and the compiler disagree.
Separate four artifacts
Keep these boundaries explicit:
- A mathematical specification using
Nat,Int, finite types, or predicates chosen for tractable reasoning. - A pure executable implementation with no CLI, environment, filesystem, or entropy I/O.
- Refinement theorems connecting executable results to the specification.
- A thin executable adapter that owns parsing, formatting, entropy, and other effects.
An executable implementation is not automatically a specification. A theorem about a second model is not evidence about production code until a refinement theorem connects them.
Work red to green
Before implementation, add at least one failing executable control derived from the external contract and one theorem statement that cannot yet elaborate or close. Then:
- use external official vectors or an independent implementation for exact differential checks;
- use Lean theorems for invariants and refinement properties;
- use exhaustive finite checks, metamorphic properties, or mutation controls where no external oracle exists;
- keep cross-language tests outside Lean so Lean cannot redefine its own oracle.
Prefer small proved components composed into a larger result. State exactly which boundary remains empirical.
Keep the trusted proof path small
For claims intended to be kernel-checked:
- do not use
sorry,admit, newaxiomdeclarations, orunsafedefinitions in their dependency path; - prefer ordinary proof terms,
simp,omega,grind, and decidable finite reasoning that produces kernel-checkable terms; - treat
native_decide, compiler execution, FFI results, benchmarks, and generated expected values as tests unless their additional trust assumptions are deliberately accepted and reported; - run
#print axioms TheoremNamefor headline theorems and record every remaining axiom rather than assuming none; - compile or elaborate the proof modules with trust level zero when practical;
- mutation-check at least one important theorem or external gate by breaking the implementation and observing failure before restoring it.
Classical.choice, quotient soundness, and propositional extensionality are
standard Lean axioms with different implications from a project-specific
assumption. Report them accurately instead of calling any nonempty axiom list a
failure.
Machine integers need a model
UInt32, UInt64, USize, arrays, and byte buffers are efficient executable
types, but modular arithmetic and bounds can make direct proofs awkward. Choose
one of these deliberately:
- implement in
BitVec nor a bounded subtype and extract/execute it; - implement in machine integers and prove correspondence to a
Nat/Intmodel under explicit bounds; - retain a slower proved reference implementation and compare an optimized implementation through an external differential gate.
Do not claim overflow safety from test coverage alone. Conversely, do not make the runtime unusably slow solely to maximize the amount proved; measure the tradeoff and preserve both paths when that is useful.
Build and verification floor
Use nix build as the canonical build path, with Lake invoked inside the
derivation. Follow cross-platform-project-build-arch; do not maintain an
optional non-Nix backend. The commands below describe the inner build/check
steps, not a second contributor build recipe. A proof-oriented package should
normally gate:
lake build
lake test
lean -t 0 <headline proof module>
source scan for sorry/admit/project axioms
#print axioms for headline theorems
external differential and mutation controlsUse lake shake only as a dependency diagnostic, not as proof. Run the shipped
executable as an installed-package smoke test so an elaborated but unshipped
target cannot create a false green.
Report the scope of correctness
End proof-oriented work with a short claim matrix:
- theorem proved and its exact statement;
- executable code covered by a refinement theorem;
- behavior checked only by external vectors or differential tests;
- security, probability, numerical-error, parser, I/O, and compiler properties not proved;
- axioms and trusted components;
- build and runtime cost relative to an ordinary implementation;
- recommendation: production implementation, proved reference oracle, selective proof layer, or no Lean adoption.
Never describe cryptographic security, distribution quality, constant-time behavior, absence of compiler bugs, or OS entropy quality as proved merely because the surrounding Lean functions type-check.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

