Repository navigation
docs(lean,#9568): document the Decidable-instance non-propagation pitfall - #9788
Merged
Merged
Conversation
…fall New FR-first doc `docs/lean/decidable_instance_propagation.md` capturing the Lean 4 gotcha hit while delivering Livrable B (PR #9780): a `def foo : Prop := Bar x` wrapper does NOT inherit the `Decidable (Bar x)` instance, so `by native_decide`/`by decide` on `foo witness` fails with `failed to synthesize Decidable (foo witness)` even though the underlying instance exists. Lean does not reduce a non-reducible def during instance synthesis. Documented the 3 fixes (companion instance — canonical codebase pattern, e.g. BoxAssezGrandN at HashlifeCorrectness L227 — / abbrev / reducible def), the founding incident (#9780 supportInMargin), and the diagnostic tell. Requested by ai-01 (DM msg-ngg5o3): the lesson deserved to live outside a DM — typically the kind of knowledge that gets lost. Was only in machine memory (lean-decidable-instance-not-propagated-through-def-prop, c.939); now in repo docs/ for cross-machine/cross-session visibility. FR-first (readme-french-first mandate). §E docs audit: new file, internally coherent, codebase references (L227, PR #9780, issue #9568) verified firsthand. Catalogue byte-identical (doc-only, no .lean/.ipynb touched). See #9568. Co-Authored-By: Claude <noreply@anthropic.com>
jsboige
added a commit
that referenced
this pull request
Aug 9, 2026
…ry) (#10132) Create docs/lean/README.md — thematic index (pièges tactiques · prover & LLM · i18n FR/EN · toolchain) wiring the 9 reference docs that were orphaned (no pointer linked them, incl. the #9568 Decidable-instance non-propagation pitfall from #9788). Found via check_docs_links.py --orphans. French-first per readme-french-first. See #7422. Grain: LIGHT/docs — lane myia-po-2024:CoursIA — prev: MED/docs #10125 Co-authored-by: Claude-Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Grain : MED/docs — nouveau doc
docs/lean/decidable_instance_propagation.md(FR-first) capturant le piège Lean 4 rencontré en livrant le Livrable B #9780 : unedef foo : Prop := Bar xwrapper n'hérite pas de l'instanceDecidable (Bar x), doncby native_decide/by decidesurfoo witnesséchoue avecfailed to synthesize Decidable (foo witness)alors que l'instance sous-jacente existe. Demandé par ai-01 (DM msg-ngg5o3) : la leçon méritait de vivre hors d'un DM — « typiquement ce qui se reperd ».Le piège
Lean ne réduit pas une
defnon-@[reducible]lors de la synthèse d'instance. L'unificateur trouveDecidable (Bar x)pour la têteBar, mais le wrapperfooest opaque — il ne le déplie pas pour découvrir l'instance recouverte. La synthèse échoue au niveau du wrapper, pas de la Prop sous-jacente.Les 3 fixes documentés
inferInstanceAs, exactement commeBoxAssezGrandNdéclare la sienne au-dessus de l'instance native (Conway/Life/HashlifeCorrectness.lean~L227).abbrev—@[reducible]par construction, instance trouvée par réduction.@[reducible] def— même effet, conserve le mot-clédef.Incident fondateur
PR #9780 (Livrable B #9568) : le prédicat
supportInMargin c k := BoxAssezGrandN (c.toGrid (0,0)) (2^k)→ 4 sanity-checksby native_decideéchouaientfailed to synthesize Decidable (supportInMargin ...). Fix appliqué : instance compagnon (option 1), build repassé vert (FR/EN 8500 jobs EXIT 0). Vérifié firsthand WSL v4.31.0-rc1.Diagnostic (le tell)
failed to synthesize Decidable (<votre_def> ...)alors que la Prop sous-jacente a démontrablement une instanceDecidable→ ne pas chercher une instance manquante (elle existe), déclarer l'instance compagnon au niveau du wrapper.Détails
git diff --stat: 2 fichiers (docs/lean/decidable_instance_propagation.mdnouveau +CLAUDE.mdpointeur 1 ligne), +98/-1..lean/.ipynbtouché).origin/main46c52adfb(post-Add(lean,#9568): Livrable B — hashlife_correct_margin (margin-window fragment, Spartan tier 1) #9780 merged).lean-decidable-instance-not-propagated-through-def-prop, c.939) ; maintenant dansdocs/du repo pour visibilité cross-machine/cross-session.See #9568 (Livrable B, PR #9780 où le piège a été rencontré).
🤖 Generated with Claude Code