Skip to content

lexlean fmt renumbers core nodes but not the bare node numbers of eqn_info #552

Open

Description

@afflom

lexlean fmt renumbers the @N node labels of a core module written in the authoring notation, but leaves the bare node numbers in a declaration's eqn_info (type: N, value: N) as they were. A renumber therefore silently points the record at other nodes. The decoder in backend/core.rs does remap these numbers (remapped_root); the formatter does not.

This happened on #437. b209368 renumbered language/runtime-1.2/library/src/Portable.lex.tex from node 3600 upward by +2. LexLeanRuntime.listIndex's eqn_info was left at type: 4316, value: 4354; the correct nodes are 4318 and 4356. Lean then failed to make listIndex.eq_1 in the certification library's Tail (GC-09, run 43713178304: "could not find .brecOn application", followed by a loose-bvar PANIC). fmt --check reported the file as canonical. #437 fixes the data only.

Expected: either fmt remaps eqn_info's node references along with the labels, or the notation writes them as @N labels so the existing renumbering covers them. In addition, the check should refuse an eqn_info whose nodes do not match its declaration.

Activity

  1. added this to the LexLean v0.5 milestone on Nov 15, 2026
  2. afflom commented on Nov 15, 2026

    @afflom
    MemberAuthor

    Bounded source triage at release8a8e3018 and #437986e confirms stale in-range equation metadata, but narrows the proposed cause and repair.

    The current formatter path passes the checked original notation through CORE parse/print (api.rs1134–1262 → fmt.rs1049 → surface/module.rs141). The parser appends nodes and rejects mismatched numeric labels; the printer traverses original indices and only inlines contiguous backwards children. I did not find a reachable pass that shifts existing numeric DAG IDs there. backend/core.rs remapped_root belongs to decoder reachability compaction, not formatter renumbering. Please retain the exact b209 edit/renumber provenance so a formatter defect can be distinguished from a source-edit defect; no reproduction was executed here.

    The stale data itself is visible: Portable's listIndex has declaration type4318/value4332 but eqn_info type4316/value4354. Also, a blanket check equating equation value with declaration value would reject valid data: the intended equation body4356 legitimately differs from declaration4332. Current validation checks definition/range/names, so it can accept stale in-range metadata; a semantic rejection rule must follow the pinned Lean EqnInfo contract.

    Keep the #437 data repair with its existing owner. Before a separate generic fix, establish the exact edit/roundtrip cause and choose the structural validation invariant; then use the smallest focused regression in that agreed scope. No blind +2 mapping, notation redesign, competing patch, new identity wave or automatic test run is warranted by this source-only review. Update 2026-11-15: the retained log for gate43713178304/job132810212223 now independently confirms conformance_gc_09 failing at Tail.lean661 on listIndex.eq_1 equational generation, followed by Lean's loose-bvar panic. Checkout is exactly986e. This verifies the symptom, not formatter-renumber attribution. Log SHAd38a6228f3b2c4344a8f90bbc9da0db03a0f907c647bbd0fb656f89a50f5b990; diagnostic receiptf6d159596e91804d07aeb0f5e6f071791058311dc6cf8da50a6be0682d29249a. No reproduction or repeat was run. Receiptb92fa57ed7a7c05cbf4574e4d49425322b4c3927652f4041dd321be309531f26.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions