docs(lean4): deepen the consolidated simp reference (v4.5.9) - #165
Open
cameronfreer wants to merge 7 commits into
Open
docs(lean4): deepen the consolidated simp reference (v4.5.9)#165cameronfreer wants to merge 7 commits into
cameronfreer wants to merge 7 commits into
Conversation
(cherry picked from commit 56aed72)
(cherry picked from commit d0de709)
… entries simp and simproc authoring are specialized Lean knowledge inside the one host-agnostic lean4 skill, not an independent workflow — the 83-line skill was a digest of the three reference files it linked. Also removes the README entries for eight unrelated skills (borrowed-params, compiler-attrs, compiler-pipeline, ffi-interop, init-runtime, specialization, symbol-linkage, zulip-extract) that were stacked into the original branch and reference files that exist in no PR.
Merges the cherry-picked simp-normal-forms.md, resurrected simproc-patterns.md, and hygiene rewrite into the single consolidated reference (#36's architecture), with the review-round corrections: - two meanings of normal form (library default set vs invocation- relative), defined against the full simplifier context (lemmas, simprocs, config, congruence, local hypotheses, discharger); operational test excludes the proposed lemma and also requires the RHS to reach the intended normal form - evaluator-simproc rule instead of a universal symbolic ban: decline symbolic inputs in evaluator-style procedures; canonical proof-producing symbolic transformations stay legitimate - 9-row mechanism table including rw / simp only / terminal simp / local simp set; .continue removed as a peer mechanism (control result); local-first bias scoped to non-terminal normalization - exact result semantics per pre/post phase; .done documented as a control-flow promise, never a normal-form claim; prefer .visit when unsure; pre/post placement at registration/invocation via ↓ - side conditions alone don't force a simproc (conditional lemmas + discharger first); 'no unbounded or general-purpose proof search' replaces the blanket no-algebraic-search rule; benchmarking scoped to performance-motivated/hot-path procedures - @[simp?] mis-listed as an attribute removed (simp? is a tactic) - the non-compiling placeholder sketch replaced by two verified examples (explicit-data dsimproc with ↓ pre-activation + symbolic decline; proof-producing simproc via mkDecideProof/mkEqTrue), both batch-compiled on Lean v4.32.0 grind-tactic.md keeps only its grind-specific escalation conditions and links to the authoring section (Option A). SKILL.md routes through the one reference again.
…smoke style) CI's release-contract caught ':= ...' in lean fences (smoke ellipsis rule; main's versions of the same snippets used ':= sorry'). Local smoke had passed because smoke_snippets.sh honors LEAN4_PLUGIN_ROOT, which this session's bootstrap points at the installed plugin cache — reran with the env cleared: smoke + lint_docs green on the worktree.
- simpNF: the lint mechanizes only the LHS half (flags lemmas whose LHS other simp lemmas already simplify); RHS destination stays design judgment, no longer attributed to the linter - hygiene example: replace the associativity pair (which labeled one arbitrary direction 'Good' with no stated policy) with a policy-independent one — add_zero rewrites f (x + 0) to f x before the proposed LHS can match - dsimproc: characterized by the definitional-equality obligation, not explicit input data; explicit-data evaluators noted as the common pattern, symbolic (whnf-based) dsimprocs valid - mechanism table: attribute [local simp] (scoped default-set membership) split from register_simp_attr (reusable named set)
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
Supersedes #47. References #47.
Integrates the valuable simp/simproc material from @alok's PR #47 — grounded in the Lean community blog series (Simp made simple, Fantastic Simprocs and How to Write Them, Simprocs for the Working Mathematician) — into the single consolidated
simp-reference.md, rather than reviving the pre-#36 file split (#36 consolidatedsimp-hygiene.md/simproc-patterns.mdfive days before #47 was opened) or adding a standalone skill.History structure (same pattern as #163): Alok's two commits are cherry-picked onto current main with
-xprovenance and authorship intact, followed by rework commits. Conflict-resolution policy for the cherry-picks: his edits to the deleted split files were landed by taking his content (git's rename detection mapped the hygiene rewrite ontosimp-reference.md;simproc-patterns.mdwas temporarily resurrected as his version), and the README hunks were reduced to this PR's own entries — the original branch had eight unrelated stacked skill entries (borrowed-params, compiler-attrs, compiler-pipeline, ffi-interop, init-runtime, specialization, symbol-linkage, zulip-extract) referencing files that exist in no PR; those were dropped.What the deepened reference now covers (with review-round corrections applied)
rw/simp only/ terminalsimp/ local simp set /@[simp]/dsimproc/simproc/ leave-unchanged / hand-off..continueis not a peer row (it's a control result); the local-first bias is scoped to non-terminal normalization.revRangelesson as an evaluator-simproc rule (decline symbolic inputs in evaluator-style procedures; canonical proof-producing symbolic transformations stay legitimate);simpNFrelationship.simp?→ minimize → trace); escalation triggers with the correction that side conditions alone don't force a simproc (conditional lemmas + discharger first). Fixed in passing:@[simp?]was listed as an attribute (simp?is a tactic).dsimprocvssimprocwith a working default; pre/post placement at registration/invocation via↓(post is the default); exact per-phase result semantics —.doneis a control-flow promise ("stop visiting"), never a normal-form claim; prefer.visitwhen unsure; performance discipline with "no unbounded or general-purpose proof search" (deterministic domain computation is legitimate) and benchmarking scoped to hot-path procedures.<construct …>placeholder: an explicit-datadsimproc(demonstrating↓pre-activation and symbolic decline) and a proof-producingsimproc(mkDecideProof/mkEqTrue). Both batch-compiled on Leanv4.32.0via the Lean LSP (lean_run_code), recorded in the file's version-metadata block. (Dual-toolchain verification wasn't feasible locally; the repo pins no snippet floor — the metadata block records the verified version per house convention.)grind-tactic.md(Option A) keeps only its grind-specific escalation conditions + a link — single ownership of simproc mechanics.Not carried forward: the standalone skill, the separate
simp-normal-forms.md, the split-file resurrection, the placeholder sketch, the stacked README entries.Testing
tools/lint_docs.sh— all checks pass (incl. Check 23 at 4.5.9 and the reference version-metadata block checks).tools/test_contracts.sh— 31 passed, 0 failed.tools/smoke_snippets.sh— passed.lean_run_codeon Leanv4.32.0.simp-hygiene.md/simproc-patterns.md/simp-normal-forms.md/lean4-simp-simprocs) over active docs — clean (MIGRATION.md's historical mention and CHANGELOG attribution are intentional).Credit
Co-authored-by: Alok Singh alokbeniwal@gmail.com