Repository navigation
SM-35 (#280): term_cases decides constructor disjointness and injectivity - #299
Conversation
…vity (row, scenario, failing case) The amended SM-35 states the extended fixed rule set of the term_cases lowering: Lean's no-confusion simplification procedure reduceCtorEq, the injectivity lemma of every constructor with a field of Option, Result (Except), List, and each inductive type the module declares, and imp_self, and_true, true_and. SPEC §17.10 states the new lowering; the §31 table, the scenario, and CONFORMANCE.md follow the register. conformance_sm_35 now also builds and verifies the issue's module, an Option disjointness, and the injectivity of a constructor of two fields, and requires Lean to reject a false variant. It fails on the unchanged lowering at the generated rule list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lowering of term_cases is now
cases llCase : <term> <;> simp (config := {decide := true}) only
[<definitions>, llCase, ite_true, ite_false, reduceCtorEq,
false_implies, imp_self, and_true, true_and, Option.some.injEq,
Except.error.injEq, Except.ok.injEq, List.cons.injEq, <injectivity>]
where <injectivity> is T.c.injEq for every constructor c with a field of
every inductive type T the module declares, in declaration order. Every
rule is named; none comes from simp's default set.
The first cut lacked false_implies: the two-field case of conformance_sm_35
left `False → 0 = p` open (the antecedent refuted, the consequent not), so
the rule and the SM-35 text name it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reproduction, the four projects of the case, five plants with the Lean output of each, what is not exercised (the Except and List injectivity lemmas), the other committed term_cases uses checked by verify-examples, and what was not verified locally (uor-atlas, SP-22). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…280-term-cases-constructors
…280-term-cases-constructors
|
Merged RP-14: the failing assertion ( Not run locally: SP-22 and the Atlas (CI carries both). |
|
Maintainer review of What checked out, for the record: the rule set stays fixed and closed (every rule written in the script, Where it goes: Generated by Claude Code |
…280-term-cases-constructors CHANGELOG.md: both entries kept, the line's first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged Branch is MERGEABLE and ci is re-running on the new head. The previous head (bfb9409) was green, |
|
Generated by Claude Code |
|
Generated by Claude Code |
…es refutes constructor equations (SM-35) #299 gave term_cases reduceCtorEq, so the planted theorem's goal '= ROutcome.stuck' is rewritten to False and the case's expected text no longer occurs; the plant is still refused, at refines_length_list. The case now names the hypothesis that stays open, and VERIFICATION quotes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3QZQru5a9Beo3r4Rfa
…Nat (#317) The register row SM-38, its scenario, the conformance_sm_38 case and the section 17.11 text. The audit-clean classification of the PR's code moves into SemanticPrimitive::nat_bitwise and nat_bitwise_function (RP-15, section 17.13), so the eligibility walk names no IR enum by equality. SM-35's text, which #299 edited in the generated SPEC.md and model/ids.toml, is ported into spec/src. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3QZQru5a9Beo3r4Rfa
release/v0.5 green again: SM-35 in spec/src, and SP-29's plant after #299
Fixes #280 on the v0.4 line.
term_casesandSM-35exist only onrelease/v0.4(release/v0.5stops atSM-34and has had no forward merge since 9989278), so this targetsrelease/v0.4; say if you want it on another line.term_casescould not close a case that equates two constructors over a variable. Itssimp onlyset decided closed propositions only. It now names Lean's no-confusion procedure, the injectivity lemmas, and the propositional units those leave. The set stays fixed and closed: every rule is written in the script, and none comes fromsimp's default set.The lowering (SPEC §17.10,
SM-35)Before:
After:
Here
<injectivity>is<T>.<c>.injEqfor every constructorcwith at least one field of every inductive typeTthe module declares, in declaration order.The rules do this:
reduceCtorEqrewrites an equation between two different constructors toFalse.injEqlemma rewrites an equation between two applications of one constructor to the equations of their fields. Lean generates one for every constructor with a field.false_implies,imp_self,and_trueandtrue_andclose the implication and the conjunction those rewrites leave.The backend change is in
crates/lexlean/src/backend/semantic.rs. It adds the fixedTERM_CASES_RULESand givesRenderthe module's constructors that have a field.Register (R3)
There is no new row.
SM-35is amended inmodel/ids.toml, the SPEC §31 table, the scenario, and CONFORMANCE.md, which is regenerated. The amended statement:The register count is unchanged, so README needs no edit for RP-11. Forward merge: the amended
SM-35text, the §17.10 paragraph, and the backend change must be carried intorelease/v0.5withterm_casesitself on the next forward merge.The commits are in order:
release/v0.4902d7de.The case
conformance_sm_35keeps its existing project and builds four more from the issue's module:check n = bad p → report n = some pVerdictandOption[propext]report n = none → check n = goodOptiondisjointness in the hypothesis[propext]check n = bad p → paired n = Pair.mk 0 ptrue_and[propext]check n = bad p → report n = none, which is falseLLV7002,⊢ x✝ = p → FalseThe first cut lacked
false_implies. The two-field project then left⊢ False → 0 = popen, so the rule and the text now name it.Plants (VERIFICATION.md)
Each plant was one edit, restored by
git checkout. Each turnsconformance_sm_35red. Each was also run throughlexlean verifyon the four projects, and the real Lean output is in the record.reduceCtorEqremoved. All three positive projects fail on their disjointness case.injEqlemma removed. The issue's project and the two-field project fail. TheOptionproject needs only disjointness and still verifies.false_impliesremoved. The two-field project fails with⊢ False → 0 = p.Not exercised:
Except.error.injEq,Except.ok.injEqandList.cons.injEq. No project equates twoResultor twoListconstructors, so removing one of these alone leaves the case green. The record says so.Identity
No compiler-semantics identity moves. The IDs are digests of
language/andschemas/, and this change touches neither. No lock or expected record is regenerated. The other committed uses ofterm_caseswere rerun with the new lowering:RuntimeKeys*modules ofcompiler/RuntimeSupportandRustRuntime, also underlanguage/rust-runtime-1.2/cargo xtask verify-examplesreports that the normalized records equalexpected/verifyfor:compiler,stdlib,std-models,std-reasoningandbootstrap, on the merged headuor-atlas, on 1282b38 before the mergeRun locally (WSL, Linux x86-64, Lean 4.32.1)
conformance_sm_35,_sm_36,_sp_25,_rb_16,_rb_17,_rp_07and_rp_11pass.validate-model,validate-spec-links,check-test-inventory,cargo fmt --check, clippy onlexleanandrepo-conformancewith-D warnings,cargo test -p lexlean --lib, and thebddmeta-gate pass.Not verified locally
uor-atlas. CI's Atlas shards are the evidence.conformance_sp_22, the runtime refinements. The kernel's OOM killer stopped it inside a 10 GB memory scope both with this lowering and on the unchangedrelease/v0.4head f057b83. The limit is the host, not this change, and CI'sbdd-preservation-runtimejob is the evidence.just vv.🤖 Generated with Claude Code