Skip to content

DF-19: structural recursion through nested inductive families - #284

Merged
afflom merged 11 commits into
release/v0.4from
claude/issue-278-df19-family
Nov 4, 2026
Merged

afflom merged 11 commits into
release/v0.4from
claude/issue-278-df19-family

Conversation

@afflom

@afflom afflom commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Structural recursion can now decrease through the recursive family of a nested inductive type, including List, Option, Result and product applications. One argument-aware family discovery implementation preserves Lean 4.32.1 constructor order and rejects unrelated types or nondecreasing calls. Nested induction remains separate #292/#429 work.

The DF-19 fixture verifies mutual size/leaves groups and their sample theorems. Its conformance case checks rendering plus four LLT4001 refusal/no-output plants; three unit tests cover family order and membership. The implementation, fixture and lock remain byte-identical to reviewed preparation ca5d375. Original9d089 and current release5393 ancestry are retained, with the landed same-run honesty CI integration.

This PR also fixes the demonstrated #436 runner-disk failure: generated bootstrap differential workspaces now use the repository's existing [profile.dev] debug = "line-tables-only" policy. They previously formed separate Cargo workspaces with default full debug information and exhausted disk while building BS-15 harnesses. Corpus membership, inputs, chunking, assertions, plants, optimization/overflow settings and stack observations are unchanged. No new identity or generated-oracle changes are introduced.

Validation and limits:

  • Reviewed preparation passed fmt, model (470 IDs/86 codes), spec links, five BDD meta tests and three family-order units. The real pinned-Lean DF-19 case, including all four refusal plants, passed in 3.56s.
  • The earlier README family-range correction now passes hosted RP-11. At177c, rest and ARM Linux conformance passed284/284 and470/470; bootstrap-package job126352276702 instead failed with explicit ENOSPC while building a generated harness. That failed run is not acceptance.
  • Independent source review of the two-file BS-15 generated differential workspace exhausts hosted runner disk #436 correction found only the generated dev-debug setting and truthful VERIFICATION record. Static parsing of the actual generated manifest confirms its profile equals root Cargo's policy and its members/resolver are unchanged; whitespace checks pass. No local runtime pass or measured disk/runtime saving is claimed.
  • The changed-head hosted BS-15 job and complete CI are authoritative final validation. No duplicate local heavy case or full gate is being run while the Host writer holds the shared phase lock. Merge requires the complete passing final-head gate and actual merged-tree equality.

Head: 708f86dea06194070b59fae57cbb83aaf8c81f00.
Tree: 91ee90356d81cc83f16f1977f7b7fbd7e40ae1d6.

Closes #428.
Closes #436.
Parent #278 remains open until SM-37 is accepted.

afflom and others added 2 commits October 22, 2026 11:43
…ested inductive type (#278, R3: row, scenario, named test)

R3: the register row, the SPEC.md section 31 row, the scenario, and the
failing named test conformance_df_19. No implementation. The count moves
445 to 446.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F4DJnZorC2Jd4MJfN9DbZk
…ver nested inductive types (DF-19, #278)

A mutual definition group may now decrease on any member of the recursive
family of an inductive group: the group's members, then each maximal List,
Option, Result or product application holding a member, discovered in the
order of the pinned Lean 4.32.1 recursor's motives. A pattern binder is
structurally smaller exactly when its type is a family member, so size and
leaves over all four members of Json now recurse through
object (List (String * Json)).

TypeInfo keeps the constructor declaration order, which the name-sorted
constructor_types does not. The SPEC 17.12 recursion rule, the VERIFICATION
record, the DF-19 scenario and the committed tests/nested-family project are
updated. No file of the 21.2 identity digest changes. SM-37 is not included.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F4DJnZorC2Jd4MJfN9DbZk
@afflom
afflom force-pushed the claude/issue-278-df19-family branch from e7c29cf to d961726 Compare October 22, 2026 18:28
@afflom afflom changed the title DF-19: structural recursion over the recursive family of a nested inductive type (#278, PR 1) DF-19: structural recursion over the recursive family of a nested inductive type (#278, draft) Oct 22, 2026
@afflom
afflom changed the base branch from claude/issue-278-nested-induction to release/v0.4 October 22, 2026 18:29

afflom commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Maintainer review of d9617269b (read from the diff, nothing built). Accepted after one small round; nothing in DF-19 mis-accepts, the one fix is in the computation SM-37 is meant to reuse.

Should fix

  1. ir/semantic.rs:5304-5311, mentions_family_group ignores type arguments, so a group instantiated at one of its own types gets a family Lean does not have. For Rose Item | node : Item -> List (Rose Item) at Rose (Rose Nat) it yields [Rose (Rose Nat), Rose Nat, List (Rose (Rose Nat)), List (Rose Nat)], while Rose.rec has two motives at any instantiation. DF-19 cannot mis-accept through it (a group mixing the two families fails "different recursive families" at :5695), but the §17.12 sentence "these are the motives of the recursor" and the unit tests' claim are false for that case, and SM-37's motive count would inherit it. Pass arguments and count only Named { member, arguments: a } with keys.contains(..) && a == arguments, recursing into children otherwise; add the Rose (Rose Nat) case to the unit tests.
  2. Count sites at the landing: release/v0.4 is at 447 and #91 stage 4, H1: RuntimeSyntax grows by the heap constructs — the probe module (RB-19) #255 takes it to 448, so this PR's merged size is 449 in README.md:150, the SPEC §31 total, cases/repository.rs:763, xtask/src/spec_links.rs:64-65 and CHANGELOG.md:25 (which auto-merges and goes stale silently). The merge conflicts on exactly the four count files and nothing else.

Nits: semantic.rs:5272-5276, the constructor_order.is_empty() fallback is reachable only for structures, which group_key_of and positivity already exclude; drop it or say why it stays. semantic.rs:6898, if let Ok(fields) = branch_binder_types(..) swallows a mismatch; harmless (the binder is then not smaller and the call is refused LLT4001), a comment would help.

What checked out: family_members is a breadth-first scan in constructor order, each maximal List/Option/Result/product field mentioning the group, deduplicated at first occurrence, which is the kernel's nested-inductive elimination order; the smaller binders are exactly the family-typed fields of a top-level match on the decreasing argument, every recursive call must pass one in the callee's decreasing position, and all members share one IndGroupInst in declaration order. No non-terminating path is accepted; the check is strictly more conservative than Lean. §17.12's enumeration is complete for declarable types since classify_occurrence refuses Set/Map/Function. R5: every new failure is LLT4001, no unwrap or index on user data. R3: row, §31 and scenario byte-equal after trimming, conformance_df_19 with four refusals and verify_ok_backed, both VERIFICATION plants reach the new rule. R4 clean. Identity: nothing embedded touched; tests/nested-family/lexlean.lock pins 30c5829b, current now, and I regenerate it at each identity landing ahead (it is on the landing list); tests/* projects carry no expected/ records, so none is needed.

Landing: identity-neutral, so it goes in the first identity-neutral slot after the #91 heap half and the bootstrap trio, with #261. SM-37 (#292) stays an identity wave after the heap half, as agreed on #278.


Generated by Claude Code

afflom and others added 2 commits October 22, 2026 20:01
…ents (DF-19, #278 review)

mentions_family_group ignored type arguments, so a group used at one of its own
types got a family the recursor does not have: `Rose Item | node : Item ->
List (Rose Item)` at `Rose (Rose Nat)` yielded four members, while `Rose.rec`
has two motives at any instantiation. It now takes the family's arguments and
counts a named type of the group only at those arguments, searching the
arguments of any other application.

Also drops the unreachable constructor_order.is_empty() fallback of
family_constructor_fields (with the reason) and comments why a branch whose
binder types cannot be taken is harmless in the recursion check.

Unit test a_group_instantiated_at_its_own_type_has_two_motives; SPEC §17.12
recursion rule 2 and VERIFICATION.md state the rule and the plant.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F4DJnZorC2Jd4MJfN9DbZk
…ly test (DF-19, #278)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F4DJnZorC2Jd4MJfN9DbZk

afflom commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Thanks. All of it is done, pushed to this branch as 91551e95a (the fix) and 9d0896b18 (a clippy lint in the new test; head is 9d0896b18). release/v0.4 is not merged in.

1. mentions_family_group ignored type arguments (fixed).

  • It now takes the family's arguments and counts a Named { member, arguments: a } only when keys.contains(..) and a == arguments; otherwise it recurses into the children, so Rose Nat inside Rose (Rose Nat) joins nothing but a member nested in its arguments is still found. Rose (Rose Nat) now has the two members Rose (Rose Nat) and List (Rose (Rose Nat)); Rose Nat has Rose Nat and List (Rose Nat).
  • Unit test a_group_instantiated_at_its_own_type_has_two_motives covers both instantiations and family_of on each member, and on List (Rose Nat), which belongs to the other family. With the comparison replaced by true it fails (recorded in VERIFICATION.md with the output).
  • SPEC §17.12 recursion rule 2 now says a member is the group at those arguments, with this example, so the "motives of the recursor" sentence is true for the case.
  • SM-37 (SM-37: nested_induction, induction over a nested inductive type through its recursor (#278) #292) is rebased onto this head and inherits it through family_members. Its conformance case has a Rose (Rose Nat) theorem proved by nested_induction with the single member List (Rose (Rose Nat)): it lowers to induction rose using Rose.rec (motive_2 := ...) with no motive_3, verifies under the pinned Lean, and a plant naming List (Rose Nat) is refused. With the arguments ignored again that case fails with nested_induction is missing the member Rose (Nat) of the recursive family of Rose (Rose (Nat)).

2. Counts. Left alone as you said. The PR body now states that the merged size is 449 (447 on release/v0.4, 448 with #255, plus DF-19) and lists the count sites: README.md:150, the SPEC §31 total, cases/repository.rs:763, xtask/src/spec_links.rs:64-65, and the "The register is 446 IDs." sentence of the CHANGELOG.md entry, which auto-merges and goes stale. #292's body says 450 for its merged size.

3. Nits.

  • The unreachable constructor_order.is_empty() fallback of family_constructor_fields is dropped, with a comment that every family member is a document inductive (a structure is in no group, group_key_of). In SM-37: nested_induction, induction over a nested inductive type through its recursor (#278) #292 the same fallback in family_constructors is dropped the same way.
  • semantic.rs (the branch_binder_types call in the recursion check) has a comment saying why the swallowed mismatch is harmless: no binder is marked smaller, a call that needed it is refused LLT4001 as not decreasing, and the match check reports the mismatch itself.

Re-run on 9d0896b18, under the heavy lock: cargo test -p lexlean --lib 213 passed (21.8 s); conformance_df_13 and conformance_df_19 passed; cargo fmt --all --check and cargo clippy --workspace --all-targets --all-features -- -D warnings clean. On #292's head 1ee15eff6: conformance_sm_37 passed (41.0 s), lib 213 passed, clippy and fmt clean, and df_13/df_19 pass with the two stale fixture locks regenerated locally (not committed).

🤖 Generated with Claude Code

https://claude.ai/code/session_01F4DJnZorC2Jd4MJfN9DbZk


Generated by Claude Code

afflom commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Maintainer: the round at 9d0896b18 is accepted. mentions_family_group takes the family's arguments and counts a member only at those arguments, recursing otherwise (ir/semantic.rs:5300-5311, call site :5374); Rose (Rose Nat) has exactly two members and Rose Nat its own two, pinned by a_group_instantiated_at_its_own_type_has_two_motives; §17.12 now states the member as the group at these arguments, so the motives sentence is true; the plant is recorded (VERIFICATION.md:842-856). The constructor_order fallback is gone with the reason, and the swallowed branch_binder_types mismatch is explained. The diff is SPEC, VERIFICATION and semantic.rs only; nothing identity-bound.

DF-19 lands in the first identity-neutral slot after the #91 heap half and the bootstrap trio. At the landing I merge release/v0.4 into this branch: the four count sites conflict on the count line alone and go to the merged register size (449 on today's line, more if rows land before), and the CHANGELOG line follows. Leave the branch as it is; no base merge needed from you.


Generated by Claude Code

afflom commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Maintainer queue refresh at unchanged 9d0896b18: the accepted argument-aware DF-19 review still stands, and this head is not contained in either live release line. No workflow run was found on this exact head. Keep the branch draft and preserve the prior instruction that the maintainer owns its release-line refresh; no contributor base merge or duplicate implementation is requested.

Integration order is DF-19 first, then stacked SM-37 (#292). At the identity-neutral DF-19 landing, reconcile the actual merged register/count/CHANGELOG, refresh the legitimately stale nested-family fixture lock, review the integration, run relevant DF cases and require the complete final-head gate with merge-tree evidence. SM-37's schema/identity wave remains separate. Scoped delivery is #428; #278 stays open until both deliveries have final acceptance.

Alexander Flom added 3 commits November 3, 2026 14:31
Resolve register totals to 470 and retain both changelog histories. Nested-family fixture lock remains historical pending official relock; no identity input or renderer source changes.

afflom commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Reviewed integration is available on integration/df19-after-maintenance: commit 4eb5d9b, tree 3362710db35a863d52a04bb34a2f4884b4a9b28c. This preserves the accepted 9d0896b head, landed BS-20 release commit 0a01df6, and the prepared #403 successor 215a9d5. The existing PR branch stays unchanged until that maintenance integration lands; no duplicate PR or full gate was started.

Independent review confirms the argument-aware family implementation and regression source are retained. No embedded identity input or renderer source changes against the maintenance parent. The official writer changed only the new nested-family fixture's stale compiler-semantics lock pin; model projection produced no further changes.

Formatting, model/spec audits (470 IDs/86 codes), all five BDD meta-tests and three family-order units pass. The frozen CLI directly checks, builds and verifies the fixture under pinned Lean 4.32.1; all 12 declarations have empty observed axiom sets. Evidence is recorded in VERIFICATION.md. This direct CLI result is not the unrun full DF-19 harness or its four refusal plants, and no full gate/inventory pass is claimed.

After #403 lands, refresh final ancestry and move this reviewed preparation into the existing PR, then require complete final-head CI and matching merge-tree evidence before closing scoped #428. Parent #278 remains open; #292's nested-induction identity wave follows DF-19.

afflom commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

New focused evidence closes the local harness gap: official elan registration now exposes the existing pinned toolchain in this user's standard elan home. HOME, the host helper, all assertions and repository code are unchanged; Lean/Lake/leanchecker are the same physical installed files.

The previously unrun exact conformance_df_19 now passes on prepared source 4eb5d9b: one passed, zero failed or ignored, 3.56 seconds. On this Linux x86-64 host the unchanged helper enters real Lean verification; the case includes the fixture and all four existing LLT4001 refusal/no-output plants. The earlier direct-only record remains historical and was not rewritten.

The review branch advanced by a documentation-only evidence commit ca5d375bd, tree 19567bce8a92208ec4c8f5c5692e58e247b634e2. Full final-head CI and the #403 landing/integration order remain required; #428 stays open.

@afflom afflom changed the title DF-19: structural recursion over the recursive family of a nested inductive type (#278, draft) DF-19: structural recursion through nested inductive families Nov 4, 2026
@afflom
afflom marked this pull request as ready for review November 4, 2026 01:24

@afflom afflom left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent final integration review is clear for full CI. Tree4b4cfbd03a70a03fb666a0ac85bf859734c2c48e retains original9d089, reviewed/tested preparationca5d375 and live release5393 ancestry. The only delta from the preparation is the sixteen landed CI-integration paths; DF-19 source/tests/fixture/lock remain byte-identical. Six CI implementations, workflow/plan and repository scenarios match5393, preserving same-run honesty and complete partition coverage. No identity inputs move. Prior focused DF-19 plus four refusal plants remains applicable; no duplicate local gate was run. Published through this existing PR and marked ready to request complete final-head CI. This is a COMMENT source review, not self-approval or a passing gate claim. Merge/#428 closure require complete final-head and actual merged-tree evidence; #278 remains open for #292/#429.

@afflom
afflom marked this pull request as draft November 4, 2026 02:30

afflom commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Final-head CI found a narrow documentation failure: RP-11 rejects README's whole-family range DF-01…DF-18 because DF-19 is now registered. Windows and ARM Linux each passed 469 conformance cases and failed only RP-11; the rest partition passed 283 and failed only RP-11. Exact failing jobs are 126326526519, 126326526543 and 126326527233 in run41753808309 at9f3ca0006.

I restored draft status and am correcting this existing PR's range to include DF-19, preserving the coverage check and the implementation. The current run remains available to collect the remaining evidence; no unchanged-head rerun or duplicate patch/PR is being created. After the correction is reviewed and its targeted check passes, the changed head still requires complete final CI. #428 remains open; #278 remains the parent.

@afflom afflom left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent correction review clear at177c499a1/tree0b67f72445664cb0a77f0ced2aa98e08338d495e. The two-file delta extends README's DF family range to exactly the nineteen registered IDs and records the observed RP-11-only failures; all implementation, fixture, model and identity inputs are unchanged. Exact Windows/ARM/rest logs independently corroborate the record. No local test pass is claimed, and the wrong-root shared harness was not run. Changed-head hosted RP-11 plus the complete gate are authoritative; no extra local build or gate is needed for these two prose files. Ready to request that full run. This is a self-authored COMMENT, not self-approval or merge clearance. #428 remains open until an accepted merge; #278 remains for SM-37.

@afflom
afflom marked this pull request as ready for review November 4, 2026 02:35
@afflom
afflom marked this pull request as draft November 4, 2026 04:34

afflom commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Restored draft after a concrete new gate failure, tracked as #436. Run41761755141/job126352276702 fails BS-15 while compiling its generated differential workspace: Cargo explicitly reports No space left on device (os error 28) and a concurrent linker then fails. The generated workspace omits the repository's existing debug = "line-tables-only" dev profile, so its hundreds of harness binaries use Cargo's default full debug information. This setup is unchanged from the release base; it is not a DF-19 proof or RP-11 regression.

A narrow source correction is being prepared in this existing PR. Corpus membership, expected outputs, assertions, plants, optimization/overflow settings and stack observations will remain unchanged. The current Intel leg may finish collecting evidence; no cancellation or unchanged-head rerun is requested. The changed head will still need the complete gate, including the previously failed BS-15 job. No unmeasured disk/runtime saving is claimed. Scope is now #428 plus #436; parent #278 stays open.

@afflom afflom left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Published the independently reviewed two-file #436 correction at708f86dea06194070b59fae57cbb83aaf8c81f00, tree91ee90356d81cc83f16f1977f7b7fbd7e40ae1d6, parent177c499a1. The generated differential workspace now uses the repository's existing dev debug="line-tables-only" policy. Root independently reviewed the exact patch; static parsing of the actual generated manifest confirms matching profile and unchanged members/resolver, and whitespace checks pass. Corpus membership, inputs, chunking, expected results, assertions, plants, optimization/overflow settings and stack observations are unchanged. No local runtime pass or measured disk/runtime saving is claimed.

The old full run41761755141 is terminal:43 successful jobs and only BS-15 package126352276702 failed with explicit ENOSPC; Intel completed successfully. This source-only correction requires changed-head hosted BS-15 and the complete final gate. No duplicate local heavy case, unchanged-head rerun or concurrent writer was performed. This COMMENT records review, not self-approval or acceptance. Marking ready requests complete changed-head CI; merge and closure of #428/#436 remain blocked on final passing CI and actual merged-tree evidence. Parent #278 stays open.

@afflom
afflom marked this pull request as ready for review November 4, 2026 05:34

@afflom afflom left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final acceptance review is complete at708f86dea06194070b59fae57cbb83aaf8c81f00. Live CI41780038830 is terminal success with all44 jobs successful (all pages checked), including same-run honesty, all host legs and the previously failing BS-15 package job126410288468. The actual BS-15 log reports1 passed/0 failed,6370.90s with real Lean; this resolves the demonstrated ENOSPC failure without claiming an unmeasured speedup. Repro41780015136 also passed at the exact head.

Live release base remains5393f552. Reviewed head and tested synthetic merge62e026d5 both have tree91ee90356d81cc83f16f1977f7b7fbd7e40ae1d6; synthetic parents are5393+708. Latest discussion/reviews contain no new blocking source finding; independent implementation and narrow profile-fix reviews remain applicable. This self-authored COMMENT records the final review, not self-approval. Proceeding with a guarded merge, then verifying the actual tree before explicit closure of only #428 and #436. Parent #278 stays open.

@afflom
afflom merged commit 1a690b5 into release/v0.4 Nov 4, 2026
45 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant