Aux-recursor block reconstruction gap for fresh-aux nested inductives #465

Description

@arthurpaulino

Summary

Aiur's kernel rejects Lean-generated aux recursors (X.rec_N) whose underlying nested-aux inductive is a fresh, solo, Lean-synthesised ind rather than an existing external one (like Array / List). The gap surfaces on nested-inductive shapes that Ix's mutual compile path splits into separate blocks rather than one shared block.

Root cause is out-of-circuit: Ixon's canonical Recursor main-data type does not carry Lean's RecursorVal.all field, so Aiur cannot reconstruct the block-member set the aux rec was generated over. The Rust kernel exhibits the same failure on the same fixture — this is not an Aiur-specific bug, it is an out-of-circuit modelling gap that both kernels inherit from Ixon.

Minimal repro fixture

namespace IxVMInd
mutualinductiveAuxDedupA : Type where
| mk : List AuxDedupB → List AuxDedupC → AuxDedupA
inductiveAuxDedupB : Type where
| leaf : AuxDedupB
inductiveAuxDedupC : Type where
| leaf : AuxDedupC
endend IxVMInd

Ix compiles A, B, C into three separate Ixon blocks (Rust kernel probe confirms n_block_members=1 per const, nested=2 on A/B/C).

Failure

$ ix check --interp bytecode IxVMInd.AuxDedupA.rec_1
IxVMInd.AuxDedupA.rec_1: IxVM-native Aiur execution error: execute (bytecode): assert_eq mismatch: 0 != 1

Fires at check_recursor_member line 1825, assert_eq!(ty_eq, 1) — Aiur's canonical rec type differs from the declared one on k_is_def_eq. Same shape for AuxDedupA.rec_2. The primary AuxDedupA.rec and the inductives themselves have their own separate failures documented in the H1 block-collective / num_nested notes at the bottom of this issue.

Diagnosis

Instrumented check_recursor_member on AuxDedupA.rec_1:

probevalueinterpretation
n_p / n_mot / n_min / n_i0 / 5 / 7 / 0Lean declares a 5-member block
total_foralls in ty13matches n_p + n_mot + n_min + n_i + 1; peel count correct
self_major (peel-derived)3idx of a fresh solo aux ind, not A/B/C
self_ind (idx 3): n_params / n_ctors / is_rec / nested1 / 2 / 1 / 0List-clone shape (nil + cons), nested = 0
self_ind block_addrnon-zero, uniqueno other Induct in top shares it
rec_block scan1 rec found (rec_1 itself)no siblings in same rec block
rule 0ctor_idx=4, owning_ind=3, n_fields=0aux ind's nil
rule 1ctor_idx=5, owning_ind=3, n_fields=2aux ind's cons
resolve_primary_ind_for_rec3 (aux itself)scans rec_block for a rec whose major has ne > 0; finds none → falls back to self_major
derive_block_member_idxs(3)[3]block_addr solo → 1 member
queue-based build_flat_block([3])[3]aux's cons field spine head = self (BVar / Const → aux), no external block members reachable
canonical n_motives1vs declared 5 → mismatch → assert fires

Cons ctor field types were also dumped:

  • field 0: head_kind = BVar(0) — the α param.
  • field 1: head_kind = Const(3) applied to 1 arg — self-recursive tail (aux α).

The aux ind is structurally a plain solo parametric List α clone whose ctors carry no reference to A / B / C in their field types. There is no in-top breadcrumb Aiur can follow from the aux ind back to the original mutual block.

Root cause

Lean's Lean.RecursorVal (see src/lean/Lean/Declaration.lean) carries all : List Name — the canonical list of every inductive in the mutual declaration the recursor was generated over. For nested-aux recs, all names the primary + all peers + all synthesised aux inds (5 names for AuxDedupA.rec_1).

Ix/CompileM.lean:compileRecursor (line 1013+) reads r.all, but writes it into Ixon.ConstantMeta.recr (metadata side channel), not into Ixon.Recursor (canonical main data):

let allAddrs := r.all.map (·.getHash)
...
let constMeta := Ixon.ConstantMeta.recr nameAddr lvlAddrs ruleAddrs allAddrs ctxAddrs arena typeRoot ruleRoots

Aiur's KConstantInfo.Rec (10 fields, Ix/IxVM/KernelTypes.lean:146) mirrors the canonical Ixon.Recursor:

Rec(G, KExpr, G, G, G, G, List‹KRecRule›, G, G, Addr)
lvls, ty, n_p, n_i, n_m, n_min, rules, k_flag, is_unsafe, rec_block

No all field. Aiur has no way to see Lean's canonical block membership.

For Lean.Syntax.rec_1 this doesn't bite because its aux ind IS the external Array — already in top with its own well-formed block, and resolve_primary_ind_for_rec walks rec_block (which contains rec, rec_1, rec_2 — 3 recs sharing a block) and picks Syntax (ne = 2) as primary. The queue-based flat build (from the shard 53 fix) then correctly reconstructs [Syntax, Array, List] from Syntax's ctor field occurrences. AuxDedupA breaks this: no external ind to reuse, no shared rec_block sibling to pivot off of.

Proposed principled fix (cross-cutting, out-of-circuit)

Promote all from Ixon.ConstantMeta.recr metadata to Ixon.Recursor canonical main data:

  1. Ixon type (Ix.Ixon): add all : Array Address (or List Address) to Ixon.Recursor.
  2. Ixon serialize / deserialize (Anon codec): extend to write and read the new field.
  3. Ix/CompileM.lean:compileRecursor: write allAddrs into the Ixon.Recursor main data, not (only) into ConstantMeta.recr.
  4. Aiur type (Ix/IxVM/KernelTypes.lean): extend KConstantInfo.Rec with all_idxs : List‹G›.
  5. Ixon → KConstantInfo ingest (Ix/IxVM/Convert.lean or equivalent): translate all addresses to positional idxs in top.
  6. Aiur kernel logic:
    • derive_block_members_for_rec(rec_ci) := rec.all_idxs — replaces the current derive_block_member_idxs(primary_ind_idx) in check_recursor_member when checking a Rec.
    • resolve_primary_ind_for_rec picks the primary as the first all_idxs member whose Induct has ne > 0 (falls back to all_idxs[0] if none — matches Lean's block ordering convention).
    • Queue-based build_flat_block seeds from all_idxs instead of derive_block_member_idxs(primary); for AuxDedupA.rec_1 this seeds [A, B, C, aux_1, aux_2], then the queue-scan proceeds as it does today.

Side effects to expect

  • Every existing pinned FFT cost in Tests/Ix/IxVM.lean:kernelCheckEntries bumps once (Ixon Recursor changes → new content addresses → different arena → different circuit widths). All ~50 pins need re-pin.
  • Codegen kernel (crates/ix/src/aiur_ixvm.rs) regenerates.
  • Ixon on-disk format shifts — any pre-serialised .ixe becomes stale (mitigated by content-addressing; ix compile from source regenerates).

Narrower alternate: metadata-side channel

Keep Ixon.Recursor untouched; extend Aiur's Ixon deserialiser to also load ConstantMeta.recr.allAddrs into a parallel table Aiur can query by rec position. Still out-of-circuit (ingest + Aiur Ixon reader changes), but no Ixon spec churn and existing pinned costs stay stable except where the new path fires.

Trade-off: metadata is not part of the security-critical canonical form. Trusting it changes the trust boundary; either accept that or bind allAddrs into the Recursor's content address via a hash commitment.

Non-fix alternates (unsound)

  • Cross-scan top for Inducts that appear as spec_params of any nested aux and treat them as a virtual block. Fragile (misses members whose ctors don't yet appear in the current closure), order-dependent, and cannot recover Lean's block ordering (breaks BVar depth math).
  • num_nested > 0 ⟹ is_rec = 1 as an H1 shortcut. Fixes the is_rec mismatch that surfaces on the ind check, but doesn't touch the check_recursor_member failure and diverges from the Rust kernel's H1 policy. Not landable on its own.

Pinned fixture status

The fixture lives in Ix/Cli/CheckCmd.lean (visible to both the ix check CLI and the test-suite Lean env). Tests/Ix/IxVM.lean:kernelCheckEntries holds six placeholder pins with cost 0:

  • IxVMInd.AuxDedupA
  • IxVMInd.AuxDedupB
  • IxVMInd.AuxDedupC
  • IxVMInd.AuxDedupA.rec
  • IxVMInd.AuxDedupA.rec_1
  • IxVMInd.AuxDedupA.rec_2

All six fail today; they become PASS + re-pinnable once the fix above lands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      , 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
       blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
      }
      } catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
      })();
      (function(){
      try {
      var __m = "github.com";
      var __re = new RegExp('^' + "github\\.com" + '
      
      Skip to content

      Aux-recursor block reconstruction gap for fresh-aux nested inductives #465

      Description

      @arthurpaulino

      Summary

      Aiur's kernel rejects Lean-generated aux recursors (X.rec_N) whose underlying nested-aux inductive is a fresh, solo, Lean-synthesised ind rather than an existing external one (like Array / List). The gap surfaces on nested-inductive shapes that Ix's mutual compile path splits into separate blocks rather than one shared block.

      Root cause is out-of-circuit: Ixon's canonical Recursor main-data type does not carry Lean's RecursorVal.all field, so Aiur cannot reconstruct the block-member set the aux rec was generated over. The Rust kernel exhibits the same failure on the same fixture — this is not an Aiur-specific bug, it is an out-of-circuit modelling gap that both kernels inherit from Ixon.

      Minimal repro fixture

      namespace IxVMInd
      mutualinductiveAuxDedupA : Type where
      | mk : List AuxDedupB → List AuxDedupC → AuxDedupA
      inductiveAuxDedupB : Type where
      | leaf : AuxDedupB
      inductiveAuxDedupC : Type where
      | leaf : AuxDedupC
      endend IxVMInd

      Ix compiles A, B, C into three separate Ixon blocks (Rust kernel probe confirms n_block_members=1 per const, nested=2 on A/B/C).

      Failure

      $ ix check --interp bytecode IxVMInd.AuxDedupA.rec_1
      IxVMInd.AuxDedupA.rec_1: IxVM-native Aiur execution error: execute (bytecode): assert_eq mismatch: 0 != 1
      

      Fires at check_recursor_member line 1825, assert_eq!(ty_eq, 1) — Aiur's canonical rec type differs from the declared one on k_is_def_eq. Same shape for AuxDedupA.rec_2. The primary AuxDedupA.rec and the inductives themselves have their own separate failures documented in the H1 block-collective / num_nested notes at the bottom of this issue.

      Diagnosis

      Instrumented check_recursor_member on AuxDedupA.rec_1:

      probevalueinterpretation
      n_p / n_mot / n_min / n_i0 / 5 / 7 / 0Lean declares a 5-member block
      total_foralls in ty13matches n_p + n_mot + n_min + n_i + 1; peel count correct
      self_major (peel-derived)3idx of a fresh solo aux ind, not A/B/C
      self_ind (idx 3): n_params / n_ctors / is_rec / nested1 / 2 / 1 / 0List-clone shape (nil + cons), nested = 0
      self_ind block_addrnon-zero, uniqueno other Induct in top shares it
      rec_block scan1 rec found (rec_1 itself)no siblings in same rec block
      rule 0ctor_idx=4, owning_ind=3, n_fields=0aux ind's nil
      rule 1ctor_idx=5, owning_ind=3, n_fields=2aux ind's cons
      resolve_primary_ind_for_rec3 (aux itself)scans rec_block for a rec whose major has ne > 0; finds none → falls back to self_major
      derive_block_member_idxs(3)[3]block_addr solo → 1 member
      queue-based build_flat_block([3])[3]aux's cons field spine head = self (BVar / Const → aux), no external block members reachable
      canonical n_motives1vs declared 5 → mismatch → assert fires

      Cons ctor field types were also dumped:

      • field 0: head_kind = BVar(0) — the α param.
      • field 1: head_kind = Const(3) applied to 1 arg — self-recursive tail (aux α).

      The aux ind is structurally a plain solo parametric List α clone whose ctors carry no reference to A / B / C in their field types. There is no in-top breadcrumb Aiur can follow from the aux ind back to the original mutual block.

      Root cause

      Lean's Lean.RecursorVal (see src/lean/Lean/Declaration.lean) carries all : List Name — the canonical list of every inductive in the mutual declaration the recursor was generated over. For nested-aux recs, all names the primary + all peers + all synthesised aux inds (5 names for AuxDedupA.rec_1).

      Ix/CompileM.lean:compileRecursor (line 1013+) reads r.all, but writes it into Ixon.ConstantMeta.recr (metadata side channel), not into Ixon.Recursor (canonical main data):

      let allAddrs := r.all.map (·.getHash)
      ...
      let constMeta := Ixon.ConstantMeta.recr nameAddr lvlAddrs ruleAddrs allAddrs ctxAddrs arena typeRoot ruleRoots

      Aiur's KConstantInfo.Rec (10 fields, Ix/IxVM/KernelTypes.lean:146) mirrors the canonical Ixon.Recursor:

      Rec(G, KExpr, G, G, G, G, List‹KRecRule›, G, G, Addr)
      lvls, ty, n_p, n_i, n_m, n_min, rules, k_flag, is_unsafe, rec_block
      

      No all field. Aiur has no way to see Lean's canonical block membership.

      For Lean.Syntax.rec_1 this doesn't bite because its aux ind IS the external Array — already in top with its own well-formed block, and resolve_primary_ind_for_rec walks rec_block (which contains rec, rec_1, rec_2 — 3 recs sharing a block) and picks Syntax (ne = 2) as primary. The queue-based flat build (from the shard 53 fix) then correctly reconstructs [Syntax, Array, List] from Syntax's ctor field occurrences. AuxDedupA breaks this: no external ind to reuse, no shared rec_block sibling to pivot off of.

      Proposed principled fix (cross-cutting, out-of-circuit)

      Promote all from Ixon.ConstantMeta.recr metadata to Ixon.Recursor canonical main data:

      1. Ixon type (Ix.Ixon): add all : Array Address (or List Address) to Ixon.Recursor.
      2. Ixon serialize / deserialize (Anon codec): extend to write and read the new field.
      3. Ix/CompileM.lean:compileRecursor: write allAddrs into the Ixon.Recursor main data, not (only) into ConstantMeta.recr.
      4. Aiur type (Ix/IxVM/KernelTypes.lean): extend KConstantInfo.Rec with all_idxs : List‹G›.
      5. Ixon → KConstantInfo ingest (Ix/IxVM/Convert.lean or equivalent): translate all addresses to positional idxs in top.
      6. Aiur kernel logic:
        • derive_block_members_for_rec(rec_ci) := rec.all_idxs — replaces the current derive_block_member_idxs(primary_ind_idx) in check_recursor_member when checking a Rec.
        • resolve_primary_ind_for_rec picks the primary as the first all_idxs member whose Induct has ne > 0 (falls back to all_idxs[0] if none — matches Lean's block ordering convention).
        • Queue-based build_flat_block seeds from all_idxs instead of derive_block_member_idxs(primary); for AuxDedupA.rec_1 this seeds [A, B, C, aux_1, aux_2], then the queue-scan proceeds as it does today.

      Side effects to expect

      • Every existing pinned FFT cost in Tests/Ix/IxVM.lean:kernelCheckEntries bumps once (Ixon Recursor changes → new content addresses → different arena → different circuit widths). All ~50 pins need re-pin.
      • Codegen kernel (crates/ix/src/aiur_ixvm.rs) regenerates.
      • Ixon on-disk format shifts — any pre-serialised .ixe becomes stale (mitigated by content-addressing; ix compile from source regenerates).

      Narrower alternate: metadata-side channel

      Keep Ixon.Recursor untouched; extend Aiur's Ixon deserialiser to also load ConstantMeta.recr.allAddrs into a parallel table Aiur can query by rec position. Still out-of-circuit (ingest + Aiur Ixon reader changes), but no Ixon spec churn and existing pinned costs stay stable except where the new path fires.

      Trade-off: metadata is not part of the security-critical canonical form. Trusting it changes the trust boundary; either accept that or bind allAddrs into the Recursor's content address via a hash commitment.

      Non-fix alternates (unsound)

      • Cross-scan top for Inducts that appear as spec_params of any nested aux and treat them as a virtual block. Fragile (misses members whose ctors don't yet appear in the current closure), order-dependent, and cannot recover Lean's block ordering (breaks BVar depth math).
      • num_nested > 0 ⟹ is_rec = 1 as an H1 shortcut. Fixes the is_rec mismatch that surfaces on the ind check, but doesn't touch the check_recursor_member failure and diverges from the Rust kernel's H1 policy. Not landable on its own.

      Pinned fixture status

      The fixture lives in Ix/Cli/CheckCmd.lean (visible to both the ix check CLI and the test-suite Lean env). Tests/Ix/IxVM.lean:kernelCheckEntries holds six placeholder pins with cost 0:

      • IxVMInd.AuxDedupA
      • IxVMInd.AuxDedupB
      • IxVMInd.AuxDedupC
      • IxVMInd.AuxDedupA.rec
      • IxVMInd.AuxDedupA.rec_1
      • IxVMInd.AuxDedupA.rec_2

      All six fail today; they become PASS + re-pinnable once the fix above lands.

      Metadata

      Metadata

      Assignees

      No one assigned

        Labels

        No labels
        No labels

        Type

        No type

        Projects

        No projects

          Milestone

          No milestone

          Relationships

          None yet

          Development

          No branches or pull requests

          Issue actions

          , 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
          Skip to content

          Aux-recursor block reconstruction gap for fresh-aux nested inductives #465

          Description

          @arthurpaulino

          Summary

          Aiur's kernel rejects Lean-generated aux recursors (X.rec_N) whose underlying nested-aux inductive is a fresh, solo, Lean-synthesised ind rather than an existing external one (like Array / List). The gap surfaces on nested-inductive shapes that Ix's mutual compile path splits into separate blocks rather than one shared block.

          Root cause is out-of-circuit: Ixon's canonical Recursor main-data type does not carry Lean's RecursorVal.all field, so Aiur cannot reconstruct the block-member set the aux rec was generated over. The Rust kernel exhibits the same failure on the same fixture — this is not an Aiur-specific bug, it is an out-of-circuit modelling gap that both kernels inherit from Ixon.

          Minimal repro fixture

          namespace IxVMInd
          mutualinductiveAuxDedupA : Type where
          | mk : List AuxDedupB → List AuxDedupC → AuxDedupA
          inductiveAuxDedupB : Type where
          | leaf : AuxDedupB
          inductiveAuxDedupC : Type where
          | leaf : AuxDedupC
          endend IxVMInd

          Ix compiles A, B, C into three separate Ixon blocks (Rust kernel probe confirms n_block_members=1 per const, nested=2 on A/B/C).

          Failure

          $ ix check --interp bytecode IxVMInd.AuxDedupA.rec_1
          IxVMInd.AuxDedupA.rec_1: IxVM-native Aiur execution error: execute (bytecode): assert_eq mismatch: 0 != 1
          

          Fires at check_recursor_member line 1825, assert_eq!(ty_eq, 1) — Aiur's canonical rec type differs from the declared one on k_is_def_eq. Same shape for AuxDedupA.rec_2. The primary AuxDedupA.rec and the inductives themselves have their own separate failures documented in the H1 block-collective / num_nested notes at the bottom of this issue.

          Diagnosis

          Instrumented check_recursor_member on AuxDedupA.rec_1:

          probevalueinterpretation
          n_p / n_mot / n_min / n_i0 / 5 / 7 / 0Lean declares a 5-member block
          total_foralls in ty13matches n_p + n_mot + n_min + n_i + 1; peel count correct
          self_major (peel-derived)3idx of a fresh solo aux ind, not A/B/C
          self_ind (idx 3): n_params / n_ctors / is_rec / nested1 / 2 / 1 / 0List-clone shape (nil + cons), nested = 0
          self_ind block_addrnon-zero, uniqueno other Induct in top shares it
          rec_block scan1 rec found (rec_1 itself)no siblings in same rec block
          rule 0ctor_idx=4, owning_ind=3, n_fields=0aux ind's nil
          rule 1ctor_idx=5, owning_ind=3, n_fields=2aux ind's cons
          resolve_primary_ind_for_rec3 (aux itself)scans rec_block for a rec whose major has ne > 0; finds none → falls back to self_major
          derive_block_member_idxs(3)[3]block_addr solo → 1 member
          queue-based build_flat_block([3])[3]aux's cons field spine head = self (BVar / Const → aux), no external block members reachable
          canonical n_motives1vs declared 5 → mismatch → assert fires

          Cons ctor field types were also dumped:

          • field 0: head_kind = BVar(0) — the α param.
          • field 1: head_kind = Const(3) applied to 1 arg — self-recursive tail (aux α).

          The aux ind is structurally a plain solo parametric List α clone whose ctors carry no reference to A / B / C in their field types. There is no in-top breadcrumb Aiur can follow from the aux ind back to the original mutual block.

          Root cause

          Lean's Lean.RecursorVal (see src/lean/Lean/Declaration.lean) carries all : List Name — the canonical list of every inductive in the mutual declaration the recursor was generated over. For nested-aux recs, all names the primary + all peers + all synthesised aux inds (5 names for AuxDedupA.rec_1).

          Ix/CompileM.lean:compileRecursor (line 1013+) reads r.all, but writes it into Ixon.ConstantMeta.recr (metadata side channel), not into Ixon.Recursor (canonical main data):

          let allAddrs := r.all.map (·.getHash)
          ...
          let constMeta := Ixon.ConstantMeta.recr nameAddr lvlAddrs ruleAddrs allAddrs ctxAddrs arena typeRoot ruleRoots

          Aiur's KConstantInfo.Rec (10 fields, Ix/IxVM/KernelTypes.lean:146) mirrors the canonical Ixon.Recursor:

          Rec(G, KExpr, G, G, G, G, List‹KRecRule›, G, G, Addr)
          lvls, ty, n_p, n_i, n_m, n_min, rules, k_flag, is_unsafe, rec_block
          

          No all field. Aiur has no way to see Lean's canonical block membership.

          For Lean.Syntax.rec_1 this doesn't bite because its aux ind IS the external Array — already in top with its own well-formed block, and resolve_primary_ind_for_rec walks rec_block (which contains rec, rec_1, rec_2 — 3 recs sharing a block) and picks Syntax (ne = 2) as primary. The queue-based flat build (from the shard 53 fix) then correctly reconstructs [Syntax, Array, List] from Syntax's ctor field occurrences. AuxDedupA breaks this: no external ind to reuse, no shared rec_block sibling to pivot off of.

          Proposed principled fix (cross-cutting, out-of-circuit)

          Promote all from Ixon.ConstantMeta.recr metadata to Ixon.Recursor canonical main data:

          1. Ixon type (Ix.Ixon): add all : Array Address (or List Address) to Ixon.Recursor.
          2. Ixon serialize / deserialize (Anon codec): extend to write and read the new field.
          3. Ix/CompileM.lean:compileRecursor: write allAddrs into the Ixon.Recursor main data, not (only) into ConstantMeta.recr.
          4. Aiur type (Ix/IxVM/KernelTypes.lean): extend KConstantInfo.Rec with all_idxs : List‹G›.
          5. Ixon → KConstantInfo ingest (Ix/IxVM/Convert.lean or equivalent): translate all addresses to positional idxs in top.
          6. Aiur kernel logic:
            • derive_block_members_for_rec(rec_ci) := rec.all_idxs — replaces the current derive_block_member_idxs(primary_ind_idx) in check_recursor_member when checking a Rec.
            • resolve_primary_ind_for_rec picks the primary as the first all_idxs member whose Induct has ne > 0 (falls back to all_idxs[0] if none — matches Lean's block ordering convention).
            • Queue-based build_flat_block seeds from all_idxs instead of derive_block_member_idxs(primary); for AuxDedupA.rec_1 this seeds [A, B, C, aux_1, aux_2], then the queue-scan proceeds as it does today.

          Side effects to expect

          • Every existing pinned FFT cost in Tests/Ix/IxVM.lean:kernelCheckEntries bumps once (Ixon Recursor changes → new content addresses → different arena → different circuit widths). All ~50 pins need re-pin.
          • Codegen kernel (crates/ix/src/aiur_ixvm.rs) regenerates.
          • Ixon on-disk format shifts — any pre-serialised .ixe becomes stale (mitigated by content-addressing; ix compile from source regenerates).

          Narrower alternate: metadata-side channel

          Keep Ixon.Recursor untouched; extend Aiur's Ixon deserialiser to also load ConstantMeta.recr.allAddrs into a parallel table Aiur can query by rec position. Still out-of-circuit (ingest + Aiur Ixon reader changes), but no Ixon spec churn and existing pinned costs stay stable except where the new path fires.

          Trade-off: metadata is not part of the security-critical canonical form. Trusting it changes the trust boundary; either accept that or bind allAddrs into the Recursor's content address via a hash commitment.

          Non-fix alternates (unsound)

          • Cross-scan top for Inducts that appear as spec_params of any nested aux and treat them as a virtual block. Fragile (misses members whose ctors don't yet appear in the current closure), order-dependent, and cannot recover Lean's block ordering (breaks BVar depth math).
          • num_nested > 0 ⟹ is_rec = 1 as an H1 shortcut. Fixes the is_rec mismatch that surfaces on the ind check, but doesn't touch the check_recursor_member failure and diverges from the Rust kernel's H1 policy. Not landable on its own.

          Pinned fixture status

          The fixture lives in Ix/Cli/CheckCmd.lean (visible to both the ix check CLI and the test-suite Lean env). Tests/Ix/IxVM.lean:kernelCheckEntries holds six placeholder pins with cost 0:

          • IxVMInd.AuxDedupA
          • IxVMInd.AuxDedupB
          • IxVMInd.AuxDedupC
          • IxVMInd.AuxDedupA.rec
          • IxVMInd.AuxDedupA.rec_1
          • IxVMInd.AuxDedupA.rec_2

          All six fail today; they become PASS + re-pinnable once the fix above lands.

          Metadata

          Metadata

          Assignees

          No one assigned

            Labels

            No labels
            No labels

            Type

            No type

            Projects

            No projects

              Milestone

              No milestone

              Relationships

              None yet

              Development

              No branches or pull requests

              Issue actions

              , 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
              Skip to content

              Aux-recursor block reconstruction gap for fresh-aux nested inductives #465

              Description

              @arthurpaulino

              Summary

              Aiur's kernel rejects Lean-generated aux recursors (X.rec_N) whose underlying nested-aux inductive is a fresh, solo, Lean-synthesised ind rather than an existing external one (like Array / List). The gap surfaces on nested-inductive shapes that Ix's mutual compile path splits into separate blocks rather than one shared block.

              Root cause is out-of-circuit: Ixon's canonical Recursor main-data type does not carry Lean's RecursorVal.all field, so Aiur cannot reconstruct the block-member set the aux rec was generated over. The Rust kernel exhibits the same failure on the same fixture — this is not an Aiur-specific bug, it is an out-of-circuit modelling gap that both kernels inherit from Ixon.

              Minimal repro fixture

              namespace IxVMInd
              mutualinductiveAuxDedupA : Type where
              | mk : List AuxDedupB → List AuxDedupC → AuxDedupA
              inductiveAuxDedupB : Type where
              | leaf : AuxDedupB
              inductiveAuxDedupC : Type where
              | leaf : AuxDedupC
              endend IxVMInd

              Ix compiles A, B, C into three separate Ixon blocks (Rust kernel probe confirms n_block_members=1 per const, nested=2 on A/B/C).

              Failure

              $ ix check --interp bytecode IxVMInd.AuxDedupA.rec_1
              IxVMInd.AuxDedupA.rec_1: IxVM-native Aiur execution error: execute (bytecode): assert_eq mismatch: 0 != 1
              

              Fires at check_recursor_member line 1825, assert_eq!(ty_eq, 1) — Aiur's canonical rec type differs from the declared one on k_is_def_eq. Same shape for AuxDedupA.rec_2. The primary AuxDedupA.rec and the inductives themselves have their own separate failures documented in the H1 block-collective / num_nested notes at the bottom of this issue.

              Diagnosis

              Instrumented check_recursor_member on AuxDedupA.rec_1:

              probevalueinterpretation
              n_p / n_mot / n_min / n_i0 / 5 / 7 / 0Lean declares a 5-member block
              total_foralls in ty13matches n_p + n_mot + n_min + n_i + 1; peel count correct
              self_major (peel-derived)3idx of a fresh solo aux ind, not A/B/C
              self_ind (idx 3): n_params / n_ctors / is_rec / nested1 / 2 / 1 / 0List-clone shape (nil + cons), nested = 0
              self_ind block_addrnon-zero, uniqueno other Induct in top shares it
              rec_block scan1 rec found (rec_1 itself)no siblings in same rec block
              rule 0ctor_idx=4, owning_ind=3, n_fields=0aux ind's nil
              rule 1ctor_idx=5, owning_ind=3, n_fields=2aux ind's cons
              resolve_primary_ind_for_rec3 (aux itself)scans rec_block for a rec whose major has ne > 0; finds none → falls back to self_major
              derive_block_member_idxs(3)[3]block_addr solo → 1 member
              queue-based build_flat_block([3])[3]aux's cons field spine head = self (BVar / Const → aux), no external block members reachable
              canonical n_motives1vs declared 5 → mismatch → assert fires

              Cons ctor field types were also dumped:

              • field 0: head_kind = BVar(0) — the α param.
              • field 1: head_kind = Const(3) applied to 1 arg — self-recursive tail (aux α).

              The aux ind is structurally a plain solo parametric List α clone whose ctors carry no reference to A / B / C in their field types. There is no in-top breadcrumb Aiur can follow from the aux ind back to the original mutual block.

              Root cause

              Lean's Lean.RecursorVal (see src/lean/Lean/Declaration.lean) carries all : List Name — the canonical list of every inductive in the mutual declaration the recursor was generated over. For nested-aux recs, all names the primary + all peers + all synthesised aux inds (5 names for AuxDedupA.rec_1).

              Ix/CompileM.lean:compileRecursor (line 1013+) reads r.all, but writes it into Ixon.ConstantMeta.recr (metadata side channel), not into Ixon.Recursor (canonical main data):

              let allAddrs := r.all.map (·.getHash)
              ...
              let constMeta := Ixon.ConstantMeta.recr nameAddr lvlAddrs ruleAddrs allAddrs ctxAddrs arena typeRoot ruleRoots

              Aiur's KConstantInfo.Rec (10 fields, Ix/IxVM/KernelTypes.lean:146) mirrors the canonical Ixon.Recursor:

              Rec(G, KExpr, G, G, G, G, List‹KRecRule›, G, G, Addr)
              lvls, ty, n_p, n_i, n_m, n_min, rules, k_flag, is_unsafe, rec_block
              

              No all field. Aiur has no way to see Lean's canonical block membership.

              For Lean.Syntax.rec_1 this doesn't bite because its aux ind IS the external Array — already in top with its own well-formed block, and resolve_primary_ind_for_rec walks rec_block (which contains rec, rec_1, rec_2 — 3 recs sharing a block) and picks Syntax (ne = 2) as primary. The queue-based flat build (from the shard 53 fix) then correctly reconstructs [Syntax, Array, List] from Syntax's ctor field occurrences. AuxDedupA breaks this: no external ind to reuse, no shared rec_block sibling to pivot off of.

              Proposed principled fix (cross-cutting, out-of-circuit)

              Promote all from Ixon.ConstantMeta.recr metadata to Ixon.Recursor canonical main data:

              1. Ixon type (Ix.Ixon): add all : Array Address (or List Address) to Ixon.Recursor.
              2. Ixon serialize / deserialize (Anon codec): extend to write and read the new field.
              3. Ix/CompileM.lean:compileRecursor: write allAddrs into the Ixon.Recursor main data, not (only) into ConstantMeta.recr.
              4. Aiur type (Ix/IxVM/KernelTypes.lean): extend KConstantInfo.Rec with all_idxs : List‹G›.
              5. Ixon → KConstantInfo ingest (Ix/IxVM/Convert.lean or equivalent): translate all addresses to positional idxs in top.
              6. Aiur kernel logic:
                • derive_block_members_for_rec(rec_ci) := rec.all_idxs — replaces the current derive_block_member_idxs(primary_ind_idx) in check_recursor_member when checking a Rec.
                • resolve_primary_ind_for_rec picks the primary as the first all_idxs member whose Induct has ne > 0 (falls back to all_idxs[0] if none — matches Lean's block ordering convention).
                • Queue-based build_flat_block seeds from all_idxs instead of derive_block_member_idxs(primary); for AuxDedupA.rec_1 this seeds [A, B, C, aux_1, aux_2], then the queue-scan proceeds as it does today.

              Side effects to expect

              • Every existing pinned FFT cost in Tests/Ix/IxVM.lean:kernelCheckEntries bumps once (Ixon Recursor changes → new content addresses → different arena → different circuit widths). All ~50 pins need re-pin.
              • Codegen kernel (crates/ix/src/aiur_ixvm.rs) regenerates.
              • Ixon on-disk format shifts — any pre-serialised .ixe becomes stale (mitigated by content-addressing; ix compile from source regenerates).

              Narrower alternate: metadata-side channel

              Keep Ixon.Recursor untouched; extend Aiur's Ixon deserialiser to also load ConstantMeta.recr.allAddrs into a parallel table Aiur can query by rec position. Still out-of-circuit (ingest + Aiur Ixon reader changes), but no Ixon spec churn and existing pinned costs stay stable except where the new path fires.

              Trade-off: metadata is not part of the security-critical canonical form. Trusting it changes the trust boundary; either accept that or bind allAddrs into the Recursor's content address via a hash commitment.

              Non-fix alternates (unsound)

              • Cross-scan top for Inducts that appear as spec_params of any nested aux and treat them as a virtual block. Fragile (misses members whose ctors don't yet appear in the current closure), order-dependent, and cannot recover Lean's block ordering (breaks BVar depth math).
              • num_nested > 0 ⟹ is_rec = 1 as an H1 shortcut. Fixes the is_rec mismatch that surfaces on the ind check, but doesn't touch the check_recursor_member failure and diverges from the Rust kernel's H1 policy. Not landable on its own.

              Pinned fixture status

              The fixture lives in Ix/Cli/CheckCmd.lean (visible to both the ix check CLI and the test-suite Lean env). Tests/Ix/IxVM.lean:kernelCheckEntries holds six placeholder pins with cost 0:

              • IxVMInd.AuxDedupA
              • IxVMInd.AuxDedupB
              • IxVMInd.AuxDedupC
              • IxVMInd.AuxDedupA.rec
              • IxVMInd.AuxDedupA.rec_1
              • IxVMInd.AuxDedupA.rec_2

              All six fail today; they become PASS + re-pinnable once the fix above lands.

              Metadata

              Metadata

              Assignees

              No one assigned

                Labels

                No labels
                No labels

                Type

                No type

                Projects

                No projects

                  Milestone

                  No milestone

                  Relationships

                  None yet

                  Development

                  No branches or pull requests

                  Issue actions

                  , 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
                  Skip to content

                  Aux-recursor block reconstruction gap for fresh-aux nested inductives #465

                  Description

                  @arthurpaulino

                  Summary

                  Aiur's kernel rejects Lean-generated aux recursors (X.rec_N) whose underlying nested-aux inductive is a fresh, solo, Lean-synthesised ind rather than an existing external one (like Array / List). The gap surfaces on nested-inductive shapes that Ix's mutual compile path splits into separate blocks rather than one shared block.

                  Root cause is out-of-circuit: Ixon's canonical Recursor main-data type does not carry Lean's RecursorVal.all field, so Aiur cannot reconstruct the block-member set the aux rec was generated over. The Rust kernel exhibits the same failure on the same fixture — this is not an Aiur-specific bug, it is an out-of-circuit modelling gap that both kernels inherit from Ixon.

                  Minimal repro fixture

                  namespace IxVMInd
                  mutualinductiveAuxDedupA : Type where
                  | mk : List AuxDedupB → List AuxDedupC → AuxDedupA
                  inductiveAuxDedupB : Type where
                  | leaf : AuxDedupB
                  inductiveAuxDedupC : Type where
                  | leaf : AuxDedupC
                  endend IxVMInd

                  Ix compiles A, B, C into three separate Ixon blocks (Rust kernel probe confirms n_block_members=1 per const, nested=2 on A/B/C).

                  Failure

                  $ ix check --interp bytecode IxVMInd.AuxDedupA.rec_1
                  IxVMInd.AuxDedupA.rec_1: IxVM-native Aiur execution error: execute (bytecode): assert_eq mismatch: 0 != 1
                  

                  Fires at check_recursor_member line 1825, assert_eq!(ty_eq, 1) — Aiur's canonical rec type differs from the declared one on k_is_def_eq. Same shape for AuxDedupA.rec_2. The primary AuxDedupA.rec and the inductives themselves have their own separate failures documented in the H1 block-collective / num_nested notes at the bottom of this issue.

                  Diagnosis

                  Instrumented check_recursor_member on AuxDedupA.rec_1:

                  probevalueinterpretation
                  n_p / n_mot / n_min / n_i0 / 5 / 7 / 0Lean declares a 5-member block
                  total_foralls in ty13matches n_p + n_mot + n_min + n_i + 1; peel count correct
                  self_major (peel-derived)3idx of a fresh solo aux ind, not A/B/C
                  self_ind (idx 3): n_params / n_ctors / is_rec / nested1 / 2 / 1 / 0List-clone shape (nil + cons), nested = 0
                  self_ind block_addrnon-zero, uniqueno other Induct in top shares it
                  rec_block scan1 rec found (rec_1 itself)no siblings in same rec block
                  rule 0ctor_idx=4, owning_ind=3, n_fields=0aux ind's nil
                  rule 1ctor_idx=5, owning_ind=3, n_fields=2aux ind's cons
                  resolve_primary_ind_for_rec3 (aux itself)scans rec_block for a rec whose major has ne > 0; finds none → falls back to self_major
                  derive_block_member_idxs(3)[3]block_addr solo → 1 member
                  queue-based build_flat_block([3])[3]aux's cons field spine head = self (BVar / Const → aux), no external block members reachable
                  canonical n_motives1vs declared 5 → mismatch → assert fires

                  Cons ctor field types were also dumped:

                  • field 0: head_kind = BVar(0) — the α param.
                  • field 1: head_kind = Const(3) applied to 1 arg — self-recursive tail (aux α).

                  The aux ind is structurally a plain solo parametric List α clone whose ctors carry no reference to A / B / C in their field types. There is no in-top breadcrumb Aiur can follow from the aux ind back to the original mutual block.

                  Root cause

                  Lean's Lean.RecursorVal (see src/lean/Lean/Declaration.lean) carries all : List Name — the canonical list of every inductive in the mutual declaration the recursor was generated over. For nested-aux recs, all names the primary + all peers + all synthesised aux inds (5 names for AuxDedupA.rec_1).

                  Ix/CompileM.lean:compileRecursor (line 1013+) reads r.all, but writes it into Ixon.ConstantMeta.recr (metadata side channel), not into Ixon.Recursor (canonical main data):

                  let allAddrs := r.all.map (·.getHash)
                  ...
                  let constMeta := Ixon.ConstantMeta.recr nameAddr lvlAddrs ruleAddrs allAddrs ctxAddrs arena typeRoot ruleRoots

                  Aiur's KConstantInfo.Rec (10 fields, Ix/IxVM/KernelTypes.lean:146) mirrors the canonical Ixon.Recursor:

                  Rec(G, KExpr, G, G, G, G, List‹KRecRule›, G, G, Addr)
                  lvls, ty, n_p, n_i, n_m, n_min, rules, k_flag, is_unsafe, rec_block
                  

                  No all field. Aiur has no way to see Lean's canonical block membership.

                  For Lean.Syntax.rec_1 this doesn't bite because its aux ind IS the external Array — already in top with its own well-formed block, and resolve_primary_ind_for_rec walks rec_block (which contains rec, rec_1, rec_2 — 3 recs sharing a block) and picks Syntax (ne = 2) as primary. The queue-based flat build (from the shard 53 fix) then correctly reconstructs [Syntax, Array, List] from Syntax's ctor field occurrences. AuxDedupA breaks this: no external ind to reuse, no shared rec_block sibling to pivot off of.

                  Proposed principled fix (cross-cutting, out-of-circuit)

                  Promote all from Ixon.ConstantMeta.recr metadata to Ixon.Recursor canonical main data:

                  1. Ixon type (Ix.Ixon): add all : Array Address (or List Address) to Ixon.Recursor.
                  2. Ixon serialize / deserialize (Anon codec): extend to write and read the new field.
                  3. Ix/CompileM.lean:compileRecursor: write allAddrs into the Ixon.Recursor main data, not (only) into ConstantMeta.recr.
                  4. Aiur type (Ix/IxVM/KernelTypes.lean): extend KConstantInfo.Rec with all_idxs : List‹G›.
                  5. Ixon → KConstantInfo ingest (Ix/IxVM/Convert.lean or equivalent): translate all addresses to positional idxs in top.
                  6. Aiur kernel logic:
                    • derive_block_members_for_rec(rec_ci) := rec.all_idxs — replaces the current derive_block_member_idxs(primary_ind_idx) in check_recursor_member when checking a Rec.
                    • resolve_primary_ind_for_rec picks the primary as the first all_idxs member whose Induct has ne > 0 (falls back to all_idxs[0] if none — matches Lean's block ordering convention).
                    • Queue-based build_flat_block seeds from all_idxs instead of derive_block_member_idxs(primary); for AuxDedupA.rec_1 this seeds [A, B, C, aux_1, aux_2], then the queue-scan proceeds as it does today.

                  Side effects to expect

                  • Every existing pinned FFT cost in Tests/Ix/IxVM.lean:kernelCheckEntries bumps once (Ixon Recursor changes → new content addresses → different arena → different circuit widths). All ~50 pins need re-pin.
                  • Codegen kernel (crates/ix/src/aiur_ixvm.rs) regenerates.
                  • Ixon on-disk format shifts — any pre-serialised .ixe becomes stale (mitigated by content-addressing; ix compile from source regenerates).

                  Narrower alternate: metadata-side channel

                  Keep Ixon.Recursor untouched; extend Aiur's Ixon deserialiser to also load ConstantMeta.recr.allAddrs into a parallel table Aiur can query by rec position. Still out-of-circuit (ingest + Aiur Ixon reader changes), but no Ixon spec churn and existing pinned costs stay stable except where the new path fires.

                  Trade-off: metadata is not part of the security-critical canonical form. Trusting it changes the trust boundary; either accept that or bind allAddrs into the Recursor's content address via a hash commitment.

                  Non-fix alternates (unsound)

                  • Cross-scan top for Inducts that appear as spec_params of any nested aux and treat them as a virtual block. Fragile (misses members whose ctors don't yet appear in the current closure), order-dependent, and cannot recover Lean's block ordering (breaks BVar depth math).
                  • num_nested > 0 ⟹ is_rec = 1 as an H1 shortcut. Fixes the is_rec mismatch that surfaces on the ind check, but doesn't touch the check_recursor_member failure and diverges from the Rust kernel's H1 policy. Not landable on its own.

                  Pinned fixture status

                  The fixture lives in Ix/Cli/CheckCmd.lean (visible to both the ix check CLI and the test-suite Lean env). Tests/Ix/IxVM.lean:kernelCheckEntries holds six placeholder pins with cost 0:

                  • IxVMInd.AuxDedupA
                  • IxVMInd.AuxDedupB
                  • IxVMInd.AuxDedupC
                  • IxVMInd.AuxDedupA.rec
                  • IxVMInd.AuxDedupA.rec_1
                  • IxVMInd.AuxDedupA.rec_2

                  All six fail today; they become PASS + re-pinnable once the fix above lands.

                  Metadata

                  Metadata

                  Assignees

                  No one assigned

                    Labels

                    No labels
                    No labels

                    Type

                    No type

                    Projects

                    No projects

                      Milestone

                      No milestone

                      Relationships

                      None yet

                      Development

                      No branches or pull requests

                      Issue actions

                      , 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
                      Skip to content

                      Aux-recursor block reconstruction gap for fresh-aux nested inductives #465

                      Description

                      @arthurpaulino

                      Summary

                      Aiur's kernel rejects Lean-generated aux recursors (X.rec_N) whose underlying nested-aux inductive is a fresh, solo, Lean-synthesised ind rather than an existing external one (like Array / List). The gap surfaces on nested-inductive shapes that Ix's mutual compile path splits into separate blocks rather than one shared block.

                      Root cause is out-of-circuit: Ixon's canonical Recursor main-data type does not carry Lean's RecursorVal.all field, so Aiur cannot reconstruct the block-member set the aux rec was generated over. The Rust kernel exhibits the same failure on the same fixture — this is not an Aiur-specific bug, it is an out-of-circuit modelling gap that both kernels inherit from Ixon.

                      Minimal repro fixture

                      namespace IxVMInd
                      mutualinductiveAuxDedupA : Type where
                      | mk : List AuxDedupB → List AuxDedupC → AuxDedupA
                      inductiveAuxDedupB : Type where
                      | leaf : AuxDedupB
                      inductiveAuxDedupC : Type where
                      | leaf : AuxDedupC
                      endend IxVMInd

                      Ix compiles A, B, C into three separate Ixon blocks (Rust kernel probe confirms n_block_members=1 per const, nested=2 on A/B/C).

                      Failure

                      $ ix check --interp bytecode IxVMInd.AuxDedupA.rec_1
                      IxVMInd.AuxDedupA.rec_1: IxVM-native Aiur execution error: execute (bytecode): assert_eq mismatch: 0 != 1
                      

                      Fires at check_recursor_member line 1825, assert_eq!(ty_eq, 1) — Aiur's canonical rec type differs from the declared one on k_is_def_eq. Same shape for AuxDedupA.rec_2. The primary AuxDedupA.rec and the inductives themselves have their own separate failures documented in the H1 block-collective / num_nested notes at the bottom of this issue.

                      Diagnosis

                      Instrumented check_recursor_member on AuxDedupA.rec_1:

                      probevalueinterpretation
                      n_p / n_mot / n_min / n_i0 / 5 / 7 / 0Lean declares a 5-member block
                      total_foralls in ty13matches n_p + n_mot + n_min + n_i + 1; peel count correct
                      self_major (peel-derived)3idx of a fresh solo aux ind, not A/B/C
                      self_ind (idx 3): n_params / n_ctors / is_rec / nested1 / 2 / 1 / 0List-clone shape (nil + cons), nested = 0
                      self_ind block_addrnon-zero, uniqueno other Induct in top shares it
                      rec_block scan1 rec found (rec_1 itself)no siblings in same rec block
                      rule 0ctor_idx=4, owning_ind=3, n_fields=0aux ind's nil
                      rule 1ctor_idx=5, owning_ind=3, n_fields=2aux ind's cons
                      resolve_primary_ind_for_rec3 (aux itself)scans rec_block for a rec whose major has ne > 0; finds none → falls back to self_major
                      derive_block_member_idxs(3)[3]block_addr solo → 1 member
                      queue-based build_flat_block([3])[3]aux's cons field spine head = self (BVar / Const → aux), no external block members reachable
                      canonical n_motives1vs declared 5 → mismatch → assert fires

                      Cons ctor field types were also dumped:

                      • field 0: head_kind = BVar(0) — the α param.
                      • field 1: head_kind = Const(3) applied to 1 arg — self-recursive tail (aux α).

                      The aux ind is structurally a plain solo parametric List α clone whose ctors carry no reference to A / B / C in their field types. There is no in-top breadcrumb Aiur can follow from the aux ind back to the original mutual block.

                      Root cause

                      Lean's Lean.RecursorVal (see src/lean/Lean/Declaration.lean) carries all : List Name — the canonical list of every inductive in the mutual declaration the recursor was generated over. For nested-aux recs, all names the primary + all peers + all synthesised aux inds (5 names for AuxDedupA.rec_1).

                      Ix/CompileM.lean:compileRecursor (line 1013+) reads r.all, but writes it into Ixon.ConstantMeta.recr (metadata side channel), not into Ixon.Recursor (canonical main data):

                      let allAddrs := r.all.map (·.getHash)
                      ...
                      let constMeta := Ixon.ConstantMeta.recr nameAddr lvlAddrs ruleAddrs allAddrs ctxAddrs arena typeRoot ruleRoots

                      Aiur's KConstantInfo.Rec (10 fields, Ix/IxVM/KernelTypes.lean:146) mirrors the canonical Ixon.Recursor:

                      Rec(G, KExpr, G, G, G, G, List‹KRecRule›, G, G, Addr)
                      lvls, ty, n_p, n_i, n_m, n_min, rules, k_flag, is_unsafe, rec_block
                      

                      No all field. Aiur has no way to see Lean's canonical block membership.

                      For Lean.Syntax.rec_1 this doesn't bite because its aux ind IS the external Array — already in top with its own well-formed block, and resolve_primary_ind_for_rec walks rec_block (which contains rec, rec_1, rec_2 — 3 recs sharing a block) and picks Syntax (ne = 2) as primary. The queue-based flat build (from the shard 53 fix) then correctly reconstructs [Syntax, Array, List] from Syntax's ctor field occurrences. AuxDedupA breaks this: no external ind to reuse, no shared rec_block sibling to pivot off of.

                      Proposed principled fix (cross-cutting, out-of-circuit)

                      Promote all from Ixon.ConstantMeta.recr metadata to Ixon.Recursor canonical main data:

                      1. Ixon type (Ix.Ixon): add all : Array Address (or List Address) to Ixon.Recursor.
                      2. Ixon serialize / deserialize (Anon codec): extend to write and read the new field.
                      3. Ix/CompileM.lean:compileRecursor: write allAddrs into the Ixon.Recursor main data, not (only) into ConstantMeta.recr.
                      4. Aiur type (Ix/IxVM/KernelTypes.lean): extend KConstantInfo.Rec with all_idxs : List‹G›.
                      5. Ixon → KConstantInfo ingest (Ix/IxVM/Convert.lean or equivalent): translate all addresses to positional idxs in top.
                      6. Aiur kernel logic:
                        • derive_block_members_for_rec(rec_ci) := rec.all_idxs — replaces the current derive_block_member_idxs(primary_ind_idx) in check_recursor_member when checking a Rec.
                        • resolve_primary_ind_for_rec picks the primary as the first all_idxs member whose Induct has ne > 0 (falls back to all_idxs[0] if none — matches Lean's block ordering convention).
                        • Queue-based build_flat_block seeds from all_idxs instead of derive_block_member_idxs(primary); for AuxDedupA.rec_1 this seeds [A, B, C, aux_1, aux_2], then the queue-scan proceeds as it does today.

                      Side effects to expect

                      • Every existing pinned FFT cost in Tests/Ix/IxVM.lean:kernelCheckEntries bumps once (Ixon Recursor changes → new content addresses → different arena → different circuit widths). All ~50 pins need re-pin.
                      • Codegen kernel (crates/ix/src/aiur_ixvm.rs) regenerates.
                      • Ixon on-disk format shifts — any pre-serialised .ixe becomes stale (mitigated by content-addressing; ix compile from source regenerates).

                      Narrower alternate: metadata-side channel

                      Keep Ixon.Recursor untouched; extend Aiur's Ixon deserialiser to also load ConstantMeta.recr.allAddrs into a parallel table Aiur can query by rec position. Still out-of-circuit (ingest + Aiur Ixon reader changes), but no Ixon spec churn and existing pinned costs stay stable except where the new path fires.

                      Trade-off: metadata is not part of the security-critical canonical form. Trusting it changes the trust boundary; either accept that or bind allAddrs into the Recursor's content address via a hash commitment.

                      Non-fix alternates (unsound)

                      • Cross-scan top for Inducts that appear as spec_params of any nested aux and treat them as a virtual block. Fragile (misses members whose ctors don't yet appear in the current closure), order-dependent, and cannot recover Lean's block ordering (breaks BVar depth math).
                      • num_nested > 0 ⟹ is_rec = 1 as an H1 shortcut. Fixes the is_rec mismatch that surfaces on the ind check, but doesn't touch the check_recursor_member failure and diverges from the Rust kernel's H1 policy. Not landable on its own.

                      Pinned fixture status

                      The fixture lives in Ix/Cli/CheckCmd.lean (visible to both the ix check CLI and the test-suite Lean env). Tests/Ix/IxVM.lean:kernelCheckEntries holds six placeholder pins with cost 0:

                      • IxVMInd.AuxDedupA
                      • IxVMInd.AuxDedupB
                      • IxVMInd.AuxDedupC
                      • IxVMInd.AuxDedupA.rec
                      • IxVMInd.AuxDedupA.rec_1
                      • IxVMInd.AuxDedupA.rec_2

                      All six fail today; they become PASS + re-pinnable once the fix above lands.

                      Metadata

                      Metadata

                      Assignees

                      No one assigned

                        Labels

                        No labels
                        No labels

                        Type

                        No type

                        Projects

                        No projects

                          Milestone

                          No milestone

                          Relationships

                          None yet

                          Development

                          No branches or pull requests

                          Issue actions

                          , 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
                          Skip to content

                          Aux-recursor block reconstruction gap for fresh-aux nested inductives #465

                          Description

                          @arthurpaulino

                          Summary

                          Aiur's kernel rejects Lean-generated aux recursors (X.rec_N) whose underlying nested-aux inductive is a fresh, solo, Lean-synthesised ind rather than an existing external one (like Array / List). The gap surfaces on nested-inductive shapes that Ix's mutual compile path splits into separate blocks rather than one shared block.

                          Root cause is out-of-circuit: Ixon's canonical Recursor main-data type does not carry Lean's RecursorVal.all field, so Aiur cannot reconstruct the block-member set the aux rec was generated over. The Rust kernel exhibits the same failure on the same fixture — this is not an Aiur-specific bug, it is an out-of-circuit modelling gap that both kernels inherit from Ixon.

                          Minimal repro fixture

                          namespace IxVMInd
                          mutualinductiveAuxDedupA : Type where
                          | mk : List AuxDedupB → List AuxDedupC → AuxDedupA
                          inductiveAuxDedupB : Type where
                          | leaf : AuxDedupB
                          inductiveAuxDedupC : Type where
                          | leaf : AuxDedupC
                          endend IxVMInd

                          Ix compiles A, B, C into three separate Ixon blocks (Rust kernel probe confirms n_block_members=1 per const, nested=2 on A/B/C).

                          Failure

                          $ ix check --interp bytecode IxVMInd.AuxDedupA.rec_1
                          IxVMInd.AuxDedupA.rec_1: IxVM-native Aiur execution error: execute (bytecode): assert_eq mismatch: 0 != 1
                          

                          Fires at check_recursor_member line 1825, assert_eq!(ty_eq, 1) — Aiur's canonical rec type differs from the declared one on k_is_def_eq. Same shape for AuxDedupA.rec_2. The primary AuxDedupA.rec and the inductives themselves have their own separate failures documented in the H1 block-collective / num_nested notes at the bottom of this issue.

                          Diagnosis

                          Instrumented check_recursor_member on AuxDedupA.rec_1:

                          probevalueinterpretation
                          n_p / n_mot / n_min / n_i0 / 5 / 7 / 0Lean declares a 5-member block
                          total_foralls in ty13matches n_p + n_mot + n_min + n_i + 1; peel count correct
                          self_major (peel-derived)3idx of a fresh solo aux ind, not A/B/C
                          self_ind (idx 3): n_params / n_ctors / is_rec / nested1 / 2 / 1 / 0List-clone shape (nil + cons), nested = 0
                          self_ind block_addrnon-zero, uniqueno other Induct in top shares it
                          rec_block scan1 rec found (rec_1 itself)no siblings in same rec block
                          rule 0ctor_idx=4, owning_ind=3, n_fields=0aux ind's nil
                          rule 1ctor_idx=5, owning_ind=3, n_fields=2aux ind's cons
                          resolve_primary_ind_for_rec3 (aux itself)scans rec_block for a rec whose major has ne > 0; finds none → falls back to self_major
                          derive_block_member_idxs(3)[3]block_addr solo → 1 member
                          queue-based build_flat_block([3])[3]aux's cons field spine head = self (BVar / Const → aux), no external block members reachable
                          canonical n_motives1vs declared 5 → mismatch → assert fires

                          Cons ctor field types were also dumped:

                          • field 0: head_kind = BVar(0) — the α param.
                          • field 1: head_kind = Const(3) applied to 1 arg — self-recursive tail (aux α).

                          The aux ind is structurally a plain solo parametric List α clone whose ctors carry no reference to A / B / C in their field types. There is no in-top breadcrumb Aiur can follow from the aux ind back to the original mutual block.

                          Root cause

                          Lean's Lean.RecursorVal (see src/lean/Lean/Declaration.lean) carries all : List Name — the canonical list of every inductive in the mutual declaration the recursor was generated over. For nested-aux recs, all names the primary + all peers + all synthesised aux inds (5 names for AuxDedupA.rec_1).

                          Ix/CompileM.lean:compileRecursor (line 1013+) reads r.all, but writes it into Ixon.ConstantMeta.recr (metadata side channel), not into Ixon.Recursor (canonical main data):

                          let allAddrs := r.all.map (·.getHash)
                          ...
                          let constMeta := Ixon.ConstantMeta.recr nameAddr lvlAddrs ruleAddrs allAddrs ctxAddrs arena typeRoot ruleRoots

                          Aiur's KConstantInfo.Rec (10 fields, Ix/IxVM/KernelTypes.lean:146) mirrors the canonical Ixon.Recursor:

                          Rec(G, KExpr, G, G, G, G, List‹KRecRule›, G, G, Addr)
                          lvls, ty, n_p, n_i, n_m, n_min, rules, k_flag, is_unsafe, rec_block
                          

                          No all field. Aiur has no way to see Lean's canonical block membership.

                          For Lean.Syntax.rec_1 this doesn't bite because its aux ind IS the external Array — already in top with its own well-formed block, and resolve_primary_ind_for_rec walks rec_block (which contains rec, rec_1, rec_2 — 3 recs sharing a block) and picks Syntax (ne = 2) as primary. The queue-based flat build (from the shard 53 fix) then correctly reconstructs [Syntax, Array, List] from Syntax's ctor field occurrences. AuxDedupA breaks this: no external ind to reuse, no shared rec_block sibling to pivot off of.

                          Proposed principled fix (cross-cutting, out-of-circuit)

                          Promote all from Ixon.ConstantMeta.recr metadata to Ixon.Recursor canonical main data:

                          1. Ixon type (Ix.Ixon): add all : Array Address (or List Address) to Ixon.Recursor.
                          2. Ixon serialize / deserialize (Anon codec): extend to write and read the new field.
                          3. Ix/CompileM.lean:compileRecursor: write allAddrs into the Ixon.Recursor main data, not (only) into ConstantMeta.recr.
                          4. Aiur type (Ix/IxVM/KernelTypes.lean): extend KConstantInfo.Rec with all_idxs : List‹G›.
                          5. Ixon → KConstantInfo ingest (Ix/IxVM/Convert.lean or equivalent): translate all addresses to positional idxs in top.
                          6. Aiur kernel logic:
                            • derive_block_members_for_rec(rec_ci) := rec.all_idxs — replaces the current derive_block_member_idxs(primary_ind_idx) in check_recursor_member when checking a Rec.
                            • resolve_primary_ind_for_rec picks the primary as the first all_idxs member whose Induct has ne > 0 (falls back to all_idxs[0] if none — matches Lean's block ordering convention).
                            • Queue-based build_flat_block seeds from all_idxs instead of derive_block_member_idxs(primary); for AuxDedupA.rec_1 this seeds [A, B, C, aux_1, aux_2], then the queue-scan proceeds as it does today.

                          Side effects to expect

                          • Every existing pinned FFT cost in Tests/Ix/IxVM.lean:kernelCheckEntries bumps once (Ixon Recursor changes → new content addresses → different arena → different circuit widths). All ~50 pins need re-pin.
                          • Codegen kernel (crates/ix/src/aiur_ixvm.rs) regenerates.
                          • Ixon on-disk format shifts — any pre-serialised .ixe becomes stale (mitigated by content-addressing; ix compile from source regenerates).

                          Narrower alternate: metadata-side channel

                          Keep Ixon.Recursor untouched; extend Aiur's Ixon deserialiser to also load ConstantMeta.recr.allAddrs into a parallel table Aiur can query by rec position. Still out-of-circuit (ingest + Aiur Ixon reader changes), but no Ixon spec churn and existing pinned costs stay stable except where the new path fires.

                          Trade-off: metadata is not part of the security-critical canonical form. Trusting it changes the trust boundary; either accept that or bind allAddrs into the Recursor's content address via a hash commitment.

                          Non-fix alternates (unsound)

                          • Cross-scan top for Inducts that appear as spec_params of any nested aux and treat them as a virtual block. Fragile (misses members whose ctors don't yet appear in the current closure), order-dependent, and cannot recover Lean's block ordering (breaks BVar depth math).
                          • num_nested > 0 ⟹ is_rec = 1 as an H1 shortcut. Fixes the is_rec mismatch that surfaces on the ind check, but doesn't touch the check_recursor_member failure and diverges from the Rust kernel's H1 policy. Not landable on its own.

                          Pinned fixture status

                          The fixture lives in Ix/Cli/CheckCmd.lean (visible to both the ix check CLI and the test-suite Lean env). Tests/Ix/IxVM.lean:kernelCheckEntries holds six placeholder pins with cost 0:

                          • IxVMInd.AuxDedupA
                          • IxVMInd.AuxDedupB
                          • IxVMInd.AuxDedupC
                          • IxVMInd.AuxDedupA.rec
                          • IxVMInd.AuxDedupA.rec_1
                          • IxVMInd.AuxDedupA.rec_2

                          All six fail today; they become PASS + re-pinnable once the fix above lands.

                          Metadata

                          Metadata

                          Assignees

                          No one assigned

                            Labels

                            No labels
                            No labels

                            Type

                            No type

                            Projects

                            No projects

                              Milestone

                              No milestone

                              Relationships

                              None yet

                              Development

                              No branches or pull requests

                              Issue actions

                              , 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
                              Skip to content

                              Aux-recursor block reconstruction gap for fresh-aux nested inductives #465

                              Description

                              @arthurpaulino

                              Summary

                              Aiur's kernel rejects Lean-generated aux recursors (X.rec_N) whose underlying nested-aux inductive is a fresh, solo, Lean-synthesised ind rather than an existing external one (like Array / List). The gap surfaces on nested-inductive shapes that Ix's mutual compile path splits into separate blocks rather than one shared block.

                              Root cause is out-of-circuit: Ixon's canonical Recursor main-data type does not carry Lean's RecursorVal.all field, so Aiur cannot reconstruct the block-member set the aux rec was generated over. The Rust kernel exhibits the same failure on the same fixture — this is not an Aiur-specific bug, it is an out-of-circuit modelling gap that both kernels inherit from Ixon.

                              Minimal repro fixture

                              namespace IxVMInd
                              mutualinductiveAuxDedupA : Type where
                              | mk : List AuxDedupB → List AuxDedupC → AuxDedupA
                              inductiveAuxDedupB : Type where
                              | leaf : AuxDedupB
                              inductiveAuxDedupC : Type where
                              | leaf : AuxDedupC
                              endend IxVMInd

                              Ix compiles A, B, C into three separate Ixon blocks (Rust kernel probe confirms n_block_members=1 per const, nested=2 on A/B/C).

                              Failure

                              $ ix check --interp bytecode IxVMInd.AuxDedupA.rec_1
                              IxVMInd.AuxDedupA.rec_1: IxVM-native Aiur execution error: execute (bytecode): assert_eq mismatch: 0 != 1
                              

                              Fires at check_recursor_member line 1825, assert_eq!(ty_eq, 1) — Aiur's canonical rec type differs from the declared one on k_is_def_eq. Same shape for AuxDedupA.rec_2. The primary AuxDedupA.rec and the inductives themselves have their own separate failures documented in the H1 block-collective / num_nested notes at the bottom of this issue.

                              Diagnosis

                              Instrumented check_recursor_member on AuxDedupA.rec_1:

                              probevalueinterpretation
                              n_p / n_mot / n_min / n_i0 / 5 / 7 / 0Lean declares a 5-member block
                              total_foralls in ty13matches n_p + n_mot + n_min + n_i + 1; peel count correct
                              self_major (peel-derived)3idx of a fresh solo aux ind, not A/B/C
                              self_ind (idx 3): n_params / n_ctors / is_rec / nested1 / 2 / 1 / 0List-clone shape (nil + cons), nested = 0
                              self_ind block_addrnon-zero, uniqueno other Induct in top shares it
                              rec_block scan1 rec found (rec_1 itself)no siblings in same rec block
                              rule 0ctor_idx=4, owning_ind=3, n_fields=0aux ind's nil
                              rule 1ctor_idx=5, owning_ind=3, n_fields=2aux ind's cons
                              resolve_primary_ind_for_rec3 (aux itself)scans rec_block for a rec whose major has ne > 0; finds none → falls back to self_major
                              derive_block_member_idxs(3)[3]block_addr solo → 1 member
                              queue-based build_flat_block([3])[3]aux's cons field spine head = self (BVar / Const → aux), no external block members reachable
                              canonical n_motives1vs declared 5 → mismatch → assert fires

                              Cons ctor field types were also dumped:

                              • field 0: head_kind = BVar(0) — the α param.
                              • field 1: head_kind = Const(3) applied to 1 arg — self-recursive tail (aux α).

                              The aux ind is structurally a plain solo parametric List α clone whose ctors carry no reference to A / B / C in their field types. There is no in-top breadcrumb Aiur can follow from the aux ind back to the original mutual block.

                              Root cause

                              Lean's Lean.RecursorVal (see src/lean/Lean/Declaration.lean) carries all : List Name — the canonical list of every inductive in the mutual declaration the recursor was generated over. For nested-aux recs, all names the primary + all peers + all synthesised aux inds (5 names for AuxDedupA.rec_1).

                              Ix/CompileM.lean:compileRecursor (line 1013+) reads r.all, but writes it into Ixon.ConstantMeta.recr (metadata side channel), not into Ixon.Recursor (canonical main data):

                              let allAddrs := r.all.map (·.getHash)
                              ...
                              let constMeta := Ixon.ConstantMeta.recr nameAddr lvlAddrs ruleAddrs allAddrs ctxAddrs arena typeRoot ruleRoots

                              Aiur's KConstantInfo.Rec (10 fields, Ix/IxVM/KernelTypes.lean:146) mirrors the canonical Ixon.Recursor:

                              Rec(G, KExpr, G, G, G, G, List‹KRecRule›, G, G, Addr)
                              lvls, ty, n_p, n_i, n_m, n_min, rules, k_flag, is_unsafe, rec_block
                              

                              No all field. Aiur has no way to see Lean's canonical block membership.

                              For Lean.Syntax.rec_1 this doesn't bite because its aux ind IS the external Array — already in top with its own well-formed block, and resolve_primary_ind_for_rec walks rec_block (which contains rec, rec_1, rec_2 — 3 recs sharing a block) and picks Syntax (ne = 2) as primary. The queue-based flat build (from the shard 53 fix) then correctly reconstructs [Syntax, Array, List] from Syntax's ctor field occurrences. AuxDedupA breaks this: no external ind to reuse, no shared rec_block sibling to pivot off of.

                              Proposed principled fix (cross-cutting, out-of-circuit)

                              Promote all from Ixon.ConstantMeta.recr metadata to Ixon.Recursor canonical main data:

                              1. Ixon type (Ix.Ixon): add all : Array Address (or List Address) to Ixon.Recursor.
                              2. Ixon serialize / deserialize (Anon codec): extend to write and read the new field.
                              3. Ix/CompileM.lean:compileRecursor: write allAddrs into the Ixon.Recursor main data, not (only) into ConstantMeta.recr.
                              4. Aiur type (Ix/IxVM/KernelTypes.lean): extend KConstantInfo.Rec with all_idxs : List‹G›.
                              5. Ixon → KConstantInfo ingest (Ix/IxVM/Convert.lean or equivalent): translate all addresses to positional idxs in top.
                              6. Aiur kernel logic:
                                • derive_block_members_for_rec(rec_ci) := rec.all_idxs — replaces the current derive_block_member_idxs(primary_ind_idx) in check_recursor_member when checking a Rec.
                                • resolve_primary_ind_for_rec picks the primary as the first all_idxs member whose Induct has ne > 0 (falls back to all_idxs[0] if none — matches Lean's block ordering convention).
                                • Queue-based build_flat_block seeds from all_idxs instead of derive_block_member_idxs(primary); for AuxDedupA.rec_1 this seeds [A, B, C, aux_1, aux_2], then the queue-scan proceeds as it does today.

                              Side effects to expect

                              • Every existing pinned FFT cost in Tests/Ix/IxVM.lean:kernelCheckEntries bumps once (Ixon Recursor changes → new content addresses → different arena → different circuit widths). All ~50 pins need re-pin.
                              • Codegen kernel (crates/ix/src/aiur_ixvm.rs) regenerates.
                              • Ixon on-disk format shifts — any pre-serialised .ixe becomes stale (mitigated by content-addressing; ix compile from source regenerates).

                              Narrower alternate: metadata-side channel

                              Keep Ixon.Recursor untouched; extend Aiur's Ixon deserialiser to also load ConstantMeta.recr.allAddrs into a parallel table Aiur can query by rec position. Still out-of-circuit (ingest + Aiur Ixon reader changes), but no Ixon spec churn and existing pinned costs stay stable except where the new path fires.

                              Trade-off: metadata is not part of the security-critical canonical form. Trusting it changes the trust boundary; either accept that or bind allAddrs into the Recursor's content address via a hash commitment.

                              Non-fix alternates (unsound)

                              • Cross-scan top for Inducts that appear as spec_params of any nested aux and treat them as a virtual block. Fragile (misses members whose ctors don't yet appear in the current closure), order-dependent, and cannot recover Lean's block ordering (breaks BVar depth math).
                              • num_nested > 0 ⟹ is_rec = 1 as an H1 shortcut. Fixes the is_rec mismatch that surfaces on the ind check, but doesn't touch the check_recursor_member failure and diverges from the Rust kernel's H1 policy. Not landable on its own.

                              Pinned fixture status

                              The fixture lives in Ix/Cli/CheckCmd.lean (visible to both the ix check CLI and the test-suite Lean env). Tests/Ix/IxVM.lean:kernelCheckEntries holds six placeholder pins with cost 0:

                              • IxVMInd.AuxDedupA
                              • IxVMInd.AuxDedupB
                              • IxVMInd.AuxDedupC
                              • IxVMInd.AuxDedupA.rec
                              • IxVMInd.AuxDedupA.rec_1
                              • IxVMInd.AuxDedupA.rec_2

                              All six fail today; they become PASS + re-pinnable once the fix above lands.

                              Metadata

                              Metadata

                              Assignees

                              No one assigned

                                Labels

                                No labels
                                No labels

                                Type

                                No type

                                Projects

                                No projects

                                  Milestone

                                  No milestone

                                  Relationships

                                  None yet

                                  Development

                                  No branches or pull requests

                                  Issue actions