Proof-first for the prefix-reuse cache adopted in concept from strata's
--auto-ckpt (reference proofs/auto_ckpt_pool.lean), adapted to vetta's contiguous
per-pass KV + ShortConv history (single conversation slot, no paged SWA ring).
Part A (correctness core): prefill is a causal fold; restore_equiv proves that
restoring a valid checkpoint and prefilling the suffix is observationally
identical to cold-prefilling prefix++suffix — this is what makes partial prefill
(only the new tokens) exact.
Part B: checkpoint validity is intrinsic and preserved by filter (invalidation)
and append.
Part C: auto-pool eviction — pinned anchors {512,1024} never evicted (I3), size
cap, no duplicate seq_len. Self-contained core lemmas (mem_of_find_some,
nodup_filter, length_filter_ne_lt); no Mathlib.
lean proofs/prefix_cache.lean: 0 errors, 0 sorryAx.
- proofs/inkling_loop.lean: formal model of the Inkling-2-Mini physical forward
schedule (prelude [0,6) + core [6,18) x3 passes + coda [18,24) = 48 visits)
and its AttnRes deep-residual block cadence + multi-pass bank rollback,
extracted from the reference run_visit / core loop. 12 theorems + 5
computational examples, 0 sorryAx, standard axioms only:
* snapshot iff ip % blockSize(6) == 0; prelude snapshots {0}, core {6,12},
coda {18}; full schedule snapshots [0,6,12,18].
* prelude=1 block, core=2/pass, coda=1; final depth = 4 (earlier core passes'
blocks rolled back, not accumulated).
* totalVisits = 48.
* bank rollback restores the prelude depth (idempotent reset).
* controllers (has_msgs) active only on core passes p>0, never pass 0.
- This is the proof-first foundation (Federico's Lean rule for complex state
machines) for implementing the loop runner: the snapshot cadence and rollback
invariant are verified by construction before the implementation is written.
Verified: lean proofs/inkling_loop.lean green (0 sorryAx); all 5 proof files
green (slab_ring_dma, bus_lifecycle, serve_session, arena_plan, inkling_loop).