lean-computational-reflection
Skill3 starsChanged 13 days agoApache-2.0View on GitHub
USE FOR: CPDT Ch. 15 / FRAP computational reflection (`denote (compile e) = denote e`), Section 1/2/3 Duality (`KERNEL-LAW-22`, `-31`), `@[csimp]` twins, and proof compression. DO NOT USE FOR: ordinary proof refactoring (`@lean-proof-refactor`) or raw low-level SWAR bitboard tuning (`@lean-unboxed-limbs-swar`). TRIGGERS: computational reflection, CPDT, denote compile, Section 1/2/3, zero Prop leakage, csimp twin, kernel_decide.
In this repository43 other files it gives its agents.
- AGENTS.mdAGENTS.md
- counterexample-first-provingSkill
- hol-metamath-adapterSkill
- isabelle-isar-adapterSkill
- itp-cross-portingSkill
- lean-ai-formalizationSkill
- lean-asymptotic-algorithmsSkill
- lean-bisectSkill
- lean-blueprintSkill
- lean-buildSkill
- lean-core-onlySkill
- lean-corpus-auditSkill
- lean-dependency-managementSkill
- lean-doc-syncSkill
- lean-egraph-cpsat-superoptSkill
- lean-gatewaySkill
- lean-kernel-optimizationSkill
- lean-knowledge-formalizationSkill
- lean-math-analysisSkill
- lean-math-discreteSkill
- lean-math-dynamicalSkill
- lean-math-foundationsSkill
- lean-math-optimizationSkill
- lean-math-stochasticSkill
- lean-mweSkill
- lean-pedagogical-expositionSkill
- lean-proof-refactorSkill
- lean-proof-repairSkill
- lean-proof-reviewSkill
- lean-proofSkill
- lean-researchSkill
- lean-retro-methodologySkill
- lean-review-councilSkill
- lean-security-formalizationSkill
- lean-setupSkill
- lean-specificationSkill
- lean-tautology-triageSkill
- lean-unboxed-limbs-swarSkill
- lean-upstream-prSkill
- lean-verification-gateSkill
- lean-worker-wrapper-cpsSkill
- research-councilSkill
- rocq-proof-adapterSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 54
Stop immediately if any Prop witness, Fin proof field, or Classical.choice branch enters Section 2's transitive call cone (KernelLawAuditor …
- Very specific: line 56
Never use native_decide or bv_decide on kernel-scored reflective obligations.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Computational Reflection & Section 1/2/3 Duality (KERNEL-LAW-22, KERNEL-LAW-31)
Replace bloated tactical proof scripts over fixed schedules, circuits, and normal forms with certified computational
decision procedures checked once in Lean 4's kernel (rfl), isolated via the Section 1/2/3 Duality split.
Routing
- USE FOR: reifying arithmetic/boolean/schedule syntax (
Expr,denote), writing reflective simplifiers proved sound once (∀ e, denote (simplify e) = denote e), splitting cold specs/proofs from monomorphic runtimedefs (KERNEL-LAW-31), and pairing inductive specs with fast@[csimp]twins (KERNEL-LAW-07). - DO NOT USE FOR: general lemma extraction without reflection (
@lean-proof-refactor) or e-graph solver search (@lean-egraph-cpsat-superopt).
Workflow
- Isolate Section 1 (Cold Syntax & Spec) -- Define inductive ASTs (
Expr,BitCircuit),abbrevbit masks, and clean mathematicaldenotesemantics completely outside the hot runtime cone (KERNEL-LAW-25B). - Implement Section 2 (Zero-
PropKernel Evaluator) -- Write monomorphic concretedef simplify/implover unboxedNat/Boolwith zeroProp,Fin,Subtype, or typeclass dictionaries (KERNEL-LAW-22,KERNEL-LAW-23). - Prove Section 3 (Reflective Soundness &
@[csimp]) -- Prove generic soundness∀ e, denote (simplify e) = denote eand bridge concrete instantiations (fast = spec) viarfl(<= 1%overhead, avoiding the1,600x..3,345xpenalty). - Discharge Ground Goals via
kernel_decide-- Close concrete evaluations withrfl | decide +kernel | omega, strictly within[propext, Classical.choice, Quot.sound].
Recovery & STOP
- Stop immediately if any
Propwitness,Finproof field, orClassical.choicebranch enters Section 2's transitive call cone (KernelLawAuditorLaw 22 /KERNEL-LAW-22). - Never use
native_decideorbv_decideon kernel-scored reflective obligations.
Handoffs
- Predecessors:
lean-proof,lean-proof-refactor. - Successors:
lean-kernel-optimization,lean-proof-review,lean-verification-gate.
Detailed reference
- Fast lookup card:
../../references/cards/lean-computational-reflection-tables.md - Full handbook:
../../references/handbooks/lean-computational-reflection-handbook.md - Template:
../../templates/core/Template_Section123_Reflection.md
See also
../lean-proof-refactor/SKILL.md-- General proof refactoring andAltProof.Closers../lean-kernel-optimization/SKILL.md-- FullKERNEL-LAW-01..31kernel cost model
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

