Live worklist and Boolean fold for the Chan–He visitor #
The proof state records pending native descriptors and the ordered nodes already consumed. It does not assert a retained pointer table or packed catalogue. Pending arrays, stack, bitmap and frontend prefix remain live below the fresh allocation frontier. The accumulator is the disjunction of the exact mathematical inputs already supplied to the actual solver.
Main definitions #
Cursor: pending entries and the ghost sequence of consumed nodes.Cursor.Invariant: live native readback, allocation budget and exact Boolean fold.Cursor.credit: remaining traversal work plus solver charges for emitted nodes only.
These are proof invariants for the existing native instructions, not runtime node encodings.
Mathematical proof state for the real native worklist; consumed nodes need no retained table.
- pending : List ChanHe.Traversal.Entry
Top-first native records and their exact represented lists.
- consumed : List ThreeSum.ChanHe.Node
Nodes already passed to the solver, including their order and multiplicity.
Remaining native transitions, including empty and zero-fuel entries.
Exact ordered mathematical calls still pending.
Charge traversal work on every entry and solver work only on actual node emissions.
Live readback and the ordered Boolean fold at the actual native loop header.
- bounded : WordRAM.Data.Bounded (w + 2) x
Every actual native word fits, including arbitrary used solver scratch.
Persistent traversal parameters survive.
The actual prime bitmap remains available.
- stack : ChanHe.Traversal.WordStack.Rep (w + 2) a.stack a.capacity (List.flatMap ChanHe.Traversal.Entry.words s.pending) (WordRAM.Data.comap ChanHe.Traversal.registers (WordRAM.Data.comap (preprocessingRegisters r) x))
The actual stack serializes exactly the pending records.
The fixed stack capacity follows from recursion depth.
Current sets satisfy the finite reduction's existing promises.
Every pending source is read back from actual current memory.
Live sources avoid the reserved stack gap.
- ends (e : ChanHe.Traversal.Entry) : e ∈ s.pending → ∀ (j : Fin 3), e.source j + (e.data j).length ≤ x.regs (preprocessingRegisters r ChanHe.Traversal.heap)
All pending source cells precede the fresh allocation.
The allocation frontier stays above the reserved gap.
- heapBudget : x.regs (preprocessingRegisters r ChanHe.Traversal.heap) + s.work * ChanHe.Traversal.allocationSize a.n a.m a.N ≤ a.ceiling
Unfinished native work reserves the remaining heavy/node allocations.
The saved common packed length is actual runtime metadata.
The value envelope was computed from the original input length.
Boolean accumulation uses the actual native constant one.
The accumulator is a raw Boolean.
- verdict : x.regs (controllerRegisters r answer) = 1 ↔ ∃ node ∈ s.consumed, ThreeSum.Convolution (4 * a.N) (node.oneArray a.U)
Exact disjunction of the calls already executed.
Consumed prefix and pending recursion retain the complete original preorder.
Original frontend/source cells survive for every later root.
A live native stack condition requires a nonempty semantic worklist.
Exhausting the actual stack completes the entire ordered fold.