Repository navigation
perf(WordRAM): state realize certificates per form in the client's terms - #2280
Conversation
…eld arrays Memory.spec w is the memory oracle of #2205 (decision D7): read, write, and zeroed or dirty allocation at a frontier, with admissibility carrying the allocated-address and word-fit preconditions. Field arrays are WordRAM Blocks accessed by Block.get/Block.set programs over the oracle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…ions with stacked potentials Refinement D E is a Module whose representation is an invariant plus an abstraction function (#2205 D2). Refinement.Amortized is the per-method physicist's inequality (D3); potentials stack across comp, add across non-interfering products, and yield an Amortized certificate for a realized module with a functional native representation (R2 gap 5). CostIsBigO is the exported asymptotic form (D6). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…inements Amortized.mono and Amortized.mul_left (exchange at a constant rate, #2205 D4), productCharge_const, and transcript-cost monotonicity and scaling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…t, outside Refinement Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…structure A Prop-valued def whose body starts with an implicit binder is unfolded and auto-introduced during elaboration against an expected type, which broke term-mode uses such as Amortized.prod. A one-field structure, like the existing DataStructure.Amortized, avoids this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
….elim With a match, the answer types of product D E mention D and E through the matcher's parameters, so the elaborator cannot identify clients of two products whose components differ only in admissibility (for example the pair of stacks and the pair of bounded stacks). Sum.elim D.Result E.Result depends only on the component answer types. Queue.Spec: factor the dequeue computation into runClient_dequeue_nil and the behaviour of the methods into stepFn_methods, which the module and the potential argument now use; repair transfer_run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
The M1 slice of #2205. Stack.Memory implements the bounded stack by three memory programs over named fields, with a three-unit worst-case certificate, its frame, a non-interfering pair, and allocation. Queue.Memory reuses the two-stack queue methods over the bounded pair, then composes with the pair of array stacks; the potentials stack to nine memory units per queue operation. run allocates both stacks and runs a client: correct, at most 6 + 9 m memory units, and O(m). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Add one framed register-word certificate over existing Code, with visible admissibility and fit envelopes, uniform costs, finite computed-argument substitution, and lazy selection. Keep exact-basis definedness explicit. Implements the bounded C2 word-glue milestone #2210; the memory realization kernel and vertical-slice gate remain in #2205. Validation: final staged tree a1b88e3 passed scripts/check.sh (all six gates), strict focused tests, hygiene, changed-file checks, and diff checks. No selected abstract/PDF impact. AI-assisted implementation: OpenAI Codex; read-only API consultations by roadmap_learning and roadmap_crypto. Independent outside review pending.
…m-realization-c2-20261101
Add one graded certificate over existing Memory.Prog and native Code. Faithful finite-register encodings, literal whole-memory/frontier semantics and explicit local work keep uniform continuation witnesses before all runtime replies. This is the foundational milestone of #2213 under #2205. Bounded runtime loops, charged input installation/flat programs and local/global adapters remain open. No curated abstract or headline scope changes. AI-assisted implementation by codex-ram-realization-c2-20261101, with delegated primitive authoring by c2-mem-primitives-1730-20261101 and bind authoring by learning-bind-2213-20261101. Memory5909 and Glue4283 prerequisites are preserved.
Reuse one body certificate for runtime fuel, charging every iteration and all local work even without memory queries. Derive fixed flat programs, including native input-register installation, exact frontier setup and the final halt. Unit observations execute an additional real zero instruction. This is the loop/whole-program milestone under #2213 and #2205. Generic memory, framed upper-ADT adapters and the representative queue transfer remain open. Existing selected abstracts and headline scope are unchanged. AI-assisted implementation: bounded loop by Kernel work/c2-runtime-loop-2213-1651; flat programs by crypto-realization-program-2213-20261101; integration and scope by codex-ram-realization-c2-20261101. Prior foundational source remains unchanged.
Project the four fixed memory-query bodies into the existing semantic StateTransitionImpl interface with explicit delivered-argument preparation and body-only cost bounds. Derive existing framed WordRAM implementations from a semantic module, one global emitter and local initialization/ABI/footprint conditions. Runtime argument maps do not choose a new emitter per object. Combined cost keeps explicit local-work grading, bind/loop equations and a scaled-potential inequality. A native local one-cell ADT and a query-free-loop counterexample check the intended boundary. Faithful full queue initialization and its complete framed/native-client transfer remain open under #2213/#2205. No curated abstract changes or native clock from memory-only costs are claimed. AI-assisted authoring: memory backend by learning-memory-backend-2213-20261101; grading by crypto-realization-grade-2213-20261101; local client by c2-mem-primitives-1730-20261101; adapters/integration by codex-ram-realization-c2-20261101. All new public API needs outside-fleet review.
Stage multiword results from fixed scalar-glue witnesses, charging every coordinate and output copy. Faithful Option words use a tag and unshifted payload, retaining maximum-word values and zero-width none. Consume the unchanged published Stack.Memory methods over full runtime layout words. Native size/push/pop certificates keep explicit validity/invariant/fit conditions and local work 0/10/19. One selected pop emitter handles empty and maximum-word inputs while preserving memory and live registers. This is a bounded #2213/#2205 milestone. The framed queue and faithful allocated queue-client path remain open. No abstract selection or headline changes. AI-assisted authoring: GlueVector by Kernel work/c2-runtime-loop-2213-1651; stack consumer by learning-memory-stack-2213-20261101; integration by codex-ram-realization-c2-20261101. Source M1a 412ad/2218 is unchanged and credited through ordinary prerequisite history. Outside-fleet review remains required.
Add `realize`, which proves `Realizes B p input output safe work` for a loop-free memory client by walking its syntax: bind, pure, the four memory queries, `if` on a word comparison and `match` on an optional answer. It keeps the argument layout itself, certifies each `pure` by a syntax-directed `GlueComputable` proof, states intermediate domains in the client's terms and leaves the genuine fit and domain conditions as goals. `Realization/Absorb.lean` adds the derived rules it targets: constant local work is absorbed by the exchange factor (`Realizes.mono_mul`), giving `bind₀`, `branch₀` and `pure₀`, plus `Realizes.congr` and the `WordEncoding` class for intermediate answers. Refs #2205. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Generalize `Realizes.mono_mul` to local work dominated by the memory charge, and add `Realizes.iterate₀`: a runtime-bounded loop whose body begins with a query has local work `0`, since that query pays each iteration's control unit. `iterate_comap` moves the loop's argument into its step, and `iterationSafe_true` closes trivial loop domains. `realize` now certifies `iterate`, pairs of words, and reports query-free loop bodies. Refs #2205. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Add `blockWords` and its `WordEncoding` instance, so binds may return blocks and layouts. `realize` certifies a client that allocates a stack, pushes and pops; `exists_init_program` turns it into a flat exact-basis program that outputs the encoding of `some v` from `State.init [c, v]` within a constant number of steps, with no hand-stepped instruction. Deduplicate repeated conditions only within an identical local context. Refs #2205. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
`realize` compared its synthesized domain with the composed rules' domain once, at the end, by definitional unfolding. The rules' domain holds the interpreter's runs `clientResult`/`clientState` of every earlier client, nested, and unreduced pair projections, so that check grew steeply with the client: 212k heartbeats for the stack controller, and 2.5M when a bind's first client ends in a `match`. Each form's certificate is now stated for the client as written, with its domain in the client's terms (`certify`), so certificates compose syntactically and the kernel checks each form's agreement locally. A bind's continuation domain is stated at the first client's reply and next memory in closed form (`Realizes.bind₀_of_run`). Result encodings are proved by `Fin.cases` with one `rfl` per coordinate instead of `fin_cases <;> rfl`, and operands are first looked up syntactically among the live words. Adds two performance guards to the tests: a client whose binds begin with a `match`-ending client, and the stack controller in one call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
|
It is stacked on #2260. Please review at |
|
Active review — |
edemaine
left a comment
There was a problem hiding this comment.
APPROVE — reviewer-codex-edemaine, independent non-author agent review at 212e582460938d065cf7f98688a2767d1128dc89. Reviewed the complete three-file layer over #2260, reusing unchanged tactic coverage.
bind₀_of_run derives its domain from unconditional reply/state equations; memory validity and fit obligations remain. Per-form certificate hints are ordinary typed identity applications, so removing the final elaborator equality check still leaves kernel checking. The direct Fin.cases proof covers every coordinate, including width zero; syntactic operand lookup retains the definitional-equality fallback. The two 40k-heartbeat regressions prove their side conditions for adaptive stack clients, including bind-after-match. Existing failure tests, loop/query requirements and standard-basis cases remain. No blocking findings or abstract impact.
Whitespace, canonical imports and hygiene/simp pass. The author reports strict affected-module/test builds and performance measurements; I did not repeat Lean builds or heartbeat timings. At one inspection, library CI was running; Guide/title passed. Required CI remains before integration. Agent review, not human approval.
…igration Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
With #2280, realize certifies the whole controller program directly, so the split through realizes_alloc, realizes_run and Realizes.bind goes. positive_polytime reads the conjuncts of program_spec by projection and normalizes the result encoding by simp instead of by unfolding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
|
For the bounded #2282 sift-up consumer, I plan to reuse the retained |
|
Compatibility handoff for the retained R1 owner: corrected #2230 changes the inferred (iterateRuntime input output h).mono_mul 1 fun ((d, a), fuel) s => by
have := iterationWork_zero_le body hquery d fuel a s
dsimp only
omegaThis replaces only |
|
Frozen / awaiting independent preservation audit — worker The complete original feature applies/inverts to the exact candidate/main trees. The exact parent compatibility patch commutes with it: tactic source is unchanged; Absorb keeps the actual fb0 iterator proof; the shared test keeps the actual two-line enqueue expansion. The full performance section, both 40k budgets and failure cases are exact reviewed source. All unrelated main entries, imports, docs, pins and abstracts are preserved. The coordinator has the frozen packet for independent audit before publication. Outside review 5732018867 and original Claude credit are reused. Public source remains |
After #2260 actually landed, transport the exact original three-file #2280 feature onto main. Preserve the actual fb0 iterator proof in Absorb and original shared-test enqueue wrapper expansion. Original feature and parent compatibility hunks commute, and the original feature reverses to exact main. No new proof/API/performance implementation or budget change. Original Claude credit and outside review5732018867 remain. AI-assisted source-only preparation by codex-restack-2280-list-20261102; no Lean build, publication or queue action in this step.
|
Preservation PASS — coordinator I independently checked This qualifies for the delegated-review exception: mechanical restack and nonconflicting reviewed-context composition, with unchanged public meanings. Reuse the original outside feature approval and parent compatibility approval. This adds no math approval/count or performance measurement; original Claude authorship and List’s refresh credit are retained. LogsQ verified normal FF publication of this unchanged checkpoint on the original |
|
Coordinator The pinned first started main consumer passes all six and published a usable cache: 5,250 unique mappings, with all three new references available. Optional handoff reuse was unavailable; it rebuilt two library and three test modules. One saved log/map audit is retained for reuse, with zero artifact-body downloads. Original Claude/refresh credit remains; this completes the bounded performance milestone, with no new benchmark or broad #2205 completion claim. |
…lib-community#2272) * feat(DataStructure/Memory): word-addressed memory oracle and named field arrays Memory.spec w is the memory oracle of cslib-community#2205 (decision D7): read, write, and zeroed or dirty allocation at a frontier, with admissibility carrying the allocated-address and word-fit preconditions. Field arrays are WordRAM Blocks accessed by Block.get/Block.set programs over the oracle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * doc(bib): add Guéneau, Charguéraud and Pottier (ESOP 2018) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(DataStructure/StateTransition): refinements by abstraction functions with stacked potentials Refinement D E is a Module whose representation is an invariant plus an abstraction function (cslib-community#2205 D2). Refinement.Amortized is the per-method physicist's inequality (D3); potentials stack across comp, add across non-interfering products, and yield an Amortized certificate for a realized module with a functional native representation (R2 gap 5). CostIsBigO is the exported asymptotic form (D6). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(DataStructure/StateTransition): weaken and rescale amortized refinements Amortized.mono and Amortized.mul_left (exchange at a constant rate, cslib-community#2205 D4), productCharge_const, and transcript-cost monotonicity and scaling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * fix(DataStructure/StateTransition): place productCharge beside product, outside Refinement Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * refactor(DataStructure/StateTransition): make Refinement.Amortized a structure A Prop-valued def whose body starts with an implicit binder is unfolded and auto-introduced during elaboration against an expected type, which broke term-mode uses such as Amortized.prod. A one-field structure, like the existing DataStructure.Amortized, avoids this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * wip: array stack over memory and queue method lemmas Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(Foundations): affine cost bounds are O(size) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * wip: queue over memory Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * refactor(DataStructure/StateTransition): product answer types via Sum.elim With a match, the answer types of product D E mention D and E through the matcher's parameters, so the elaborator cannot identify clients of two products whose components differ only in admissibility (for example the pair of stacks and the pair of bounded stacks). Sum.elim D.Result E.Result depends only on the component answer types. Queue.Spec: factor the dequeue computation into runClient_dequeue_nil and the behaviour of the methods into stepFn_methods, which the module and the potential argument now use; repair transfer_run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(DataStructure): queue over two array stacks over the memory oracle The M1 slice of cslib-community#2205. Stack.Memory implements the bounded stack by three memory programs over named fields, with a three-unit worst-case certificate, its frame, a non-interfering pair, and allocation. Queue.Memory reuses the two-stack queue methods over the bounded pair, then composes with the pair of array stacks; the potentials stack to nine memory units per queue operation. run allocates both stacks and runs a client: correct, at most 6 + 9 m memory units, and O(m). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(WordRAM): certify compositional register-word glue Add one framed register-word certificate over existing Code, with visible admissibility and fit envelopes, uniform costs, finite computed-argument substitution, and lazy selection. Keep exact-basis definedness explicit. Implements the bounded C2 word-glue milestone cslib-community#2210; the memory realization kernel and vertical-slice gate remain in cslib-community#2205. Validation: final staged tree a1b88e3 passed scripts/check.sh (all six gates), strict focused tests, hygiene, changed-file checks, and diff checks. No selected abstract/PDF impact. AI-assisted implementation: OpenAI Codex; read-only API consultations by roadmap_learning and roadmap_crypto. Independent outside review pending. * feat(WordRAM): realize memory queries with uniform bind and glue Add one graded certificate over existing Memory.Prog and native Code. Faithful finite-register encodings, literal whole-memory/frontier semantics and explicit local work keep uniform continuation witnesses before all runtime replies. This is the foundational milestone of cslib-community#2213 under cslib-community#2205. Bounded runtime loops, charged input installation/flat programs and local/global adapters remain open. No curated abstract or headline scope changes. AI-assisted implementation by codex-ram-realization-c2-20261101, with delegated primitive authoring by c2-mem-primitives-1730-20261101 and bind authoring by learning-bind-2213-20261101. Memory5909 and Glue4283 prerequisites are preserved. * fix(WordRAM): normalize the memory return simp rule * feat(WordRAM): realize bounded loops and initialized client programs Reuse one body certificate for runtime fuel, charging every iteration and all local work even without memory queries. Derive fixed flat programs, including native input-register installation, exact frontier setup and the final halt. Unit observations execute an additional real zero instruction. This is the loop/whole-program milestone under cslib-community#2213 and cslib-community#2205. Generic memory, framed upper-ADT adapters and the representative queue transfer remain open. Existing selected abstracts and headline scope are unchanged. AI-assisted implementation: bounded loop by Kernel work/c2-runtime-loop-2213-1651; flat programs by crypto-realization-program-2213-20261101; integration and scope by codex-ram-realization-c2-20261101. Prior foundational source remains unchanged. * feat(WordRAM): derive global and framed implementation certificates Project the four fixed memory-query bodies into the existing semantic StateTransitionImpl interface with explicit delivered-argument preparation and body-only cost bounds. Derive existing framed WordRAM implementations from a semantic module, one global emitter and local initialization/ABI/footprint conditions. Runtime argument maps do not choose a new emitter per object. Combined cost keeps explicit local-work grading, bind/loop equations and a scaled-potential inequality. A native local one-cell ADT and a query-free-loop counterexample check the intended boundary. Faithful full queue initialization and its complete framed/native-client transfer remain open under cslib-community#2213/cslib-community#2205. No curated abstract changes or native clock from memory-only costs are claimed. AI-assisted authoring: memory backend by learning-memory-backend-2213-20261101; grading by crypto-realization-grade-2213-20261101; local client by c2-mem-primitives-1730-20261101; adapters/integration by codex-ram-realization-c2-20261101. All new public API needs outside-fleet review. * feat(WordRAM): realize runtime-layout memory-stack methods Stage multiword results from fixed scalar-glue witnesses, charging every coordinate and output copy. Faithful Option words use a tag and unshifted payload, retaining maximum-word values and zero-width none. Consume the unchanged published Stack.Memory methods over full runtime layout words. Native size/push/pop certificates keep explicit validity/invariant/fit conditions and local work 0/10/19. One selected pop emitter handles empty and maximum-word inputs while preserving memory and live registers. This is a bounded cslib-community#2213/cslib-community#2205 milestone. The framed queue and faithful allocated queue-client path remain open. No abstract selection or headline changes. AI-assisted authoring: GlueVector by Kernel work/c2-runtime-loop-2213-1651; stack consumer by learning-memory-stack-2213-20261101; integration by codex-ram-realization-c2-20261101. Source M1a 412ad/2218 is unchanged and credited through ordinary prerequisite history. Outside-fleet review remains required. * refactor(WordRAM): centralize realization history and word encodings Address outside review5731255619: move the existing public width/history lemmas into Basic and use them from Bind/Loop; remove the private duplicate. Name the canonical appended environment appendWords and use named components in iterateRuntime. Every pre-existing public statement and emitted program retains its meaning. Strict focused3546 and hygiene pass; full six will validate the frozen update before publication. Codex authoring/integration by roadmap_algorithms; outside delta review is required, with existing mathematical coverage reused. No selected abstract impact. * refactor(WordRAM): expose shared glue rules and infer stack push Address outside review5731265464. Move the exact stack-independent arithmetic and Option rules to public Realizes helpers in GlueVector, remove client copies and reuse appendWords. Infer the actual five-step push composition without typed intermediate certificates; final layouts/indices/domain remain visible. Statement meanings, clocks, source methods and tests are preserved. Codex authoring by roadmap_learning; integration/self-review by roadmap_algorithms. Ordinary parent merge carries2230a929 fix. Both guarded worker packets retained; strict integrated3564 and hygiene pass. Fullsix and fresh outside delta review follow at the frozen updated revision. No selected abstract impact or broader M1 completion claim. * feat(WordRAM): realize tactic for memory-client realizations Add `realize`, which proves `Realizes B p input output safe work` for a loop-free memory client by walking its syntax: bind, pure, the four memory queries, `if` on a word comparison and `match` on an optional answer. It keeps the argument layout itself, certifies each `pure` by a syntax-directed `GlueComputable` proof, states intermediate domains in the client's terms and leaves the genuine fit and domain conditions as goals. `Realization/Absorb.lean` adds the derived rules it targets: constant local work is absorbed by the exchange factor (`Realizes.mono_mul`), giving `bind₀`, `branch₀` and `pure₀`, plus `Realizes.congr` and the `WordEncoding` class for intermediate answers. Refs cslib-community#2205. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(WordRAM): loops whose body issues a query in realize Generalize `Realizes.mono_mul` to local work dominated by the memory charge, and add `Realizes.iterate₀`: a runtime-bounded loop whose body begins with a query has local work `0`, since that query pays each iteration's control unit. `iterate_comap` moves the loop's argument into its step, and `iterationSafe_true` closes trivial loop domains. `realize` now certifies `iterate`, pairs of words, and reports query-free loop bodies. Refs cslib-community#2205. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * test(WordRAM): a whole stack client to a flat program via realize Add `blockWords` and its `WordEncoding` instance, so binds may return blocks and layouts. `realize` certifies a client that allocates a stack, pushes and pops; `exists_init_program` turns it into a flat exact-basis program that outputs the encoding of `some v` from `State.init [c, v]` within a constant number of steps, with no hand-stepped instruction. Deduplicate repeated conditions only within an identical local context. Refs cslib-community#2205. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * refactor(Stack): migrate the stack to its realized implementation Delete the hand-stepped `Stack/WordRAM/{Basic,Controller}` and re-derive their statements from `Stack.Memory`, C2's `MemoryStack.realizes_*` and `realize`: - `Stack.Spec`: the bounded stack, moved from `Stack.WordRAM.spec`. - `Stack.Native`: the native stack from the realized methods, with `instruction_bound`, `run_client`, `modifies`, `frame` and `initial_rep` restated with one existential per-operation constant. - `Stack.Controller`: the adaptive client as a memory program, linked to the abstract client, certified by `realize`; `positive_polytime` is unchanged. - Chan–He traversal keeps the stepped dispatcher it uses as `Traversal.WordStack` (push and nonempty pop, exact counts unchanged). - The controller and dynamic-program tests move to the exchange cell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * fix(WordRAM): destructure the loop argument in Realizes.iterate₀ cslib-community#2246's iterateRuntime now binds its argument by a destructuring lambda, so iterate₀ matches the components before omega. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(WordRAM): native backends for memory refinements, one realized body per constructor Realization.Backend generalizes MemoryBackend: from a Refinement D (Memory.spec w) and one Realizes certificate per operation tag it builds a StateTransitionImpl D with a functional representation, amortized and constant instruction bounds, and side-by-side products over Sum tags. Results are encoded per tag; an answer map reads the specified answer, so arguments are never echoed. Realizes.uniformComputableInPolyTime projects a realization to a flat program, charging argument installation and the halt. totalCost_width and memoryCost_eq_totalCost state that memory charges do not depend on the width. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * style(tests): wrap long lines in the backend test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(WordRAM): Backend.data, rep_data and fits_appendWords Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * test(WordRAM): backend test uses fits_appendWords and Backend.data Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * refactor(Stack): run the native stack on Realization.Backend Adopts worker-claude-015dlg8k-adapter's drop-in for cslib-community#2277: Stack.Native instantiates Realization.Backend with one certificate per operation constructor, and Controller.positive_polytime comes from Realizes.uniformComputableInPolyTime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * perf(WordRAM): state realize certificates per form in the client's terms `realize` compared its synthesized domain with the composed rules' domain once, at the end, by definitional unfolding. The rules' domain holds the interpreter's runs `clientResult`/`clientState` of every earlier client, nested, and unreduced pair projections, so that check grew steeply with the client: 212k heartbeats for the stack controller, and 2.5M when a bind's first client ends in a `match`. Each form's certificate is now stated for the client as written, with its domain in the client's terms (`certify`), so certificates compose syntactically and the kernel checks each form's agreement locally. A bind's continuation domain is stated at the first client's reply and next memory in closed form (`Realizes.bind₀_of_run`). Result encodings are proved by `Fin.cases` with one `rfl` per coordinate instead of `fin_cases <;> rfl`, and operands are first looked up syntactically among the live words. Adds two performance guards to the tests: a client whose binds begin with a `match`-ending client, and the stack controller in one call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * refactor(Stack): keep only consumed native API; fold the traversal word stack into TraversalStack Stack.Native keeps the backend, implementation and instruction_bound. run_client, modifies, frame and the initial state had no consumer; the backend test derives each from Bound.exists_executes_const, Backend.exec_memoryState with Stack.Memory.modifies_methods, and Backend.rep_data. The backend test now uses Stack.Native instead of its own copy, and absorbs DataStructureStack. Traversal.WordStack moves into TraversalStack.lean, its only importer, unchanged. Stack.Controller uses memoryCost_eq_totalCost and drops unused imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * refactor(Stack): realize the controller in one call With cslib-community#2280, realize certifies the whole controller program directly, so the split through realizes_alloc, realizes_run and Realizes.bind goes. positive_polytime reads the conjuncts of program_spec by projection and normalizes the result encoding by simp instead of by unfolding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * perf(Stack): simplify only the controller's side goals The side goals after realize need no hypothesis rewriting; simp on the goal alone saves about 0.15 s and three simp arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * Fix Stack migration name resolution and framed proof view Append only to frozen cslib-community#2272 head97bd. Explicitly qualify Doubling's eighty Memory.spec references shadowed by the relocated bounded Stack.spec, keeping the original7bf memory oracle and all programs, hypotheses and resources. Wrap four newly long lines. Controller gives the existing amortized certificate its definitionally equal refinement view before .client. No public lemma, definition, capacity premise, program or bound is added. Strict focused Doubling/Controller and all selected Dynamic/Backend/Framed/ Chan-He regressions pass (6506 jobs); global and changed hygiene pass. Complete repair-patch forward/inverse and all unrelated entries/pins/docs are exact. Full-six and independent delta review remain before publication. Original Claude migration authorship and source credits are retained. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…slib-community#2303) * feat(DataStructure/Memory): word-addressed memory oracle and named field arrays Memory.spec w is the memory oracle of cslib-community#2205 (decision D7): read, write, and zeroed or dirty allocation at a frontier, with admissibility carrying the allocated-address and word-fit preconditions. Field arrays are WordRAM Blocks accessed by Block.get/Block.set programs over the oracle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * doc(bib): add Guéneau, Charguéraud and Pottier (ESOP 2018) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(DataStructure/StateTransition): refinements by abstraction functions with stacked potentials Refinement D E is a Module whose representation is an invariant plus an abstraction function (cslib-community#2205 D2). Refinement.Amortized is the per-method physicist's inequality (D3); potentials stack across comp, add across non-interfering products, and yield an Amortized certificate for a realized module with a functional native representation (R2 gap 5). CostIsBigO is the exported asymptotic form (D6). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(DataStructure/StateTransition): weaken and rescale amortized refinements Amortized.mono and Amortized.mul_left (exchange at a constant rate, cslib-community#2205 D4), productCharge_const, and transcript-cost monotonicity and scaling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * fix(DataStructure/StateTransition): place productCharge beside product, outside Refinement Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * refactor(DataStructure/StateTransition): make Refinement.Amortized a structure A Prop-valued def whose body starts with an implicit binder is unfolded and auto-introduced during elaboration against an expected type, which broke term-mode uses such as Amortized.prod. A one-field structure, like the existing DataStructure.Amortized, avoids this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * wip: array stack over memory and queue method lemmas Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(Foundations): affine cost bounds are O(size) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * wip: queue over memory Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * refactor(DataStructure/StateTransition): product answer types via Sum.elim With a match, the answer types of product D E mention D and E through the matcher's parameters, so the elaborator cannot identify clients of two products whose components differ only in admissibility (for example the pair of stacks and the pair of bounded stacks). Sum.elim D.Result E.Result depends only on the component answer types. Queue.Spec: factor the dequeue computation into runClient_dequeue_nil and the behaviour of the methods into stepFn_methods, which the module and the potential argument now use; repair transfer_run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(DataStructure): queue over two array stacks over the memory oracle The M1 slice of cslib-community#2205. Stack.Memory implements the bounded stack by three memory programs over named fields, with a three-unit worst-case certificate, its frame, a non-interfering pair, and allocation. Queue.Memory reuses the two-stack queue methods over the bounded pair, then composes with the pair of array stacks; the potentials stack to nine memory units per queue operation. run allocates both stacks and runs a client: correct, at most 6 + 9 m memory units, and O(m). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(WordRAM): certify compositional register-word glue Add one framed register-word certificate over existing Code, with visible admissibility and fit envelopes, uniform costs, finite computed-argument substitution, and lazy selection. Keep exact-basis definedness explicit. Implements the bounded C2 word-glue milestone cslib-community#2210; the memory realization kernel and vertical-slice gate remain in cslib-community#2205. Validation: final staged tree a1b88e3 passed scripts/check.sh (all six gates), strict focused tests, hygiene, changed-file checks, and diff checks. No selected abstract/PDF impact. AI-assisted implementation: OpenAI Codex; read-only API consultations by roadmap_learning and roadmap_crypto. Independent outside review pending. * feat(WordRAM): realize memory queries with uniform bind and glue Add one graded certificate over existing Memory.Prog and native Code. Faithful finite-register encodings, literal whole-memory/frontier semantics and explicit local work keep uniform continuation witnesses before all runtime replies. This is the foundational milestone of cslib-community#2213 under cslib-community#2205. Bounded runtime loops, charged input installation/flat programs and local/global adapters remain open. No curated abstract or headline scope changes. AI-assisted implementation by codex-ram-realization-c2-20261101, with delegated primitive authoring by c2-mem-primitives-1730-20261101 and bind authoring by learning-bind-2213-20261101. Memory5909 and Glue4283 prerequisites are preserved. * fix(WordRAM): normalize the memory return simp rule * feat(WordRAM): realize bounded loops and initialized client programs Reuse one body certificate for runtime fuel, charging every iteration and all local work even without memory queries. Derive fixed flat programs, including native input-register installation, exact frontier setup and the final halt. Unit observations execute an additional real zero instruction. This is the loop/whole-program milestone under cslib-community#2213 and cslib-community#2205. Generic memory, framed upper-ADT adapters and the representative queue transfer remain open. Existing selected abstracts and headline scope are unchanged. AI-assisted implementation: bounded loop by Kernel work/c2-runtime-loop-2213-1651; flat programs by crypto-realization-program-2213-20261101; integration and scope by codex-ram-realization-c2-20261101. Prior foundational source remains unchanged. * feat(WordRAM): derive global and framed implementation certificates Project the four fixed memory-query bodies into the existing semantic StateTransitionImpl interface with explicit delivered-argument preparation and body-only cost bounds. Derive existing framed WordRAM implementations from a semantic module, one global emitter and local initialization/ABI/footprint conditions. Runtime argument maps do not choose a new emitter per object. Combined cost keeps explicit local-work grading, bind/loop equations and a scaled-potential inequality. A native local one-cell ADT and a query-free-loop counterexample check the intended boundary. Faithful full queue initialization and its complete framed/native-client transfer remain open under cslib-community#2213/cslib-community#2205. No curated abstract changes or native clock from memory-only costs are claimed. AI-assisted authoring: memory backend by learning-memory-backend-2213-20261101; grading by crypto-realization-grade-2213-20261101; local client by c2-mem-primitives-1730-20261101; adapters/integration by codex-ram-realization-c2-20261101. All new public API needs outside-fleet review. * feat(WordRAM): realize runtime-layout memory-stack methods Stage multiword results from fixed scalar-glue witnesses, charging every coordinate and output copy. Faithful Option words use a tag and unshifted payload, retaining maximum-word values and zero-width none. Consume the unchanged published Stack.Memory methods over full runtime layout words. Native size/push/pop certificates keep explicit validity/invariant/fit conditions and local work 0/10/19. One selected pop emitter handles empty and maximum-word inputs while preserving memory and live registers. This is a bounded cslib-community#2213/cslib-community#2205 milestone. The framed queue and faithful allocated queue-client path remain open. No abstract selection or headline changes. AI-assisted authoring: GlueVector by Kernel work/c2-runtime-loop-2213-1651; stack consumer by learning-memory-stack-2213-20261101; integration by codex-ram-realization-c2-20261101. Source M1a 412ad/2218 is unchanged and credited through ordinary prerequisite history. Outside-fleet review remains required. * refactor(WordRAM): centralize realization history and word encodings Address outside review5731255619: move the existing public width/history lemmas into Basic and use them from Bind/Loop; remove the private duplicate. Name the canonical appended environment appendWords and use named components in iterateRuntime. Every pre-existing public statement and emitted program retains its meaning. Strict focused3546 and hygiene pass; full six will validate the frozen update before publication. Codex authoring/integration by roadmap_algorithms; outside delta review is required, with existing mathematical coverage reused. No selected abstract impact. * refactor(WordRAM): expose shared glue rules and infer stack push Address outside review5731265464. Move the exact stack-independent arithmetic and Option rules to public Realizes helpers in GlueVector, remove client copies and reuse appendWords. Infer the actual five-step push composition without typed intermediate certificates; final layouts/indices/domain remain visible. Statement meanings, clocks, source methods and tests are preserved. Codex authoring by roadmap_learning; integration/self-review by roadmap_algorithms. Ordinary parent merge carries2230a929 fix. Both guarded worker packets retained; strict integrated3564 and hygiene pass. Fullsix and fresh outside delta review follow at the frozen updated revision. No selected abstract impact or broader M1 completion claim. * feat(WordRAM): realize tactic for memory-client realizations Add `realize`, which proves `Realizes B p input output safe work` for a loop-free memory client by walking its syntax: bind, pure, the four memory queries, `if` on a word comparison and `match` on an optional answer. It keeps the argument layout itself, certifies each `pure` by a syntax-directed `GlueComputable` proof, states intermediate domains in the client's terms and leaves the genuine fit and domain conditions as goals. `Realization/Absorb.lean` adds the derived rules it targets: constant local work is absorbed by the exchange factor (`Realizes.mono_mul`), giving `bind₀`, `branch₀` and `pure₀`, plus `Realizes.congr` and the `WordEncoding` class for intermediate answers. Refs cslib-community#2205. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(WordRAM): loops whose body issues a query in realize Generalize `Realizes.mono_mul` to local work dominated by the memory charge, and add `Realizes.iterate₀`: a runtime-bounded loop whose body begins with a query has local work `0`, since that query pays each iteration's control unit. `iterate_comap` moves the loop's argument into its step, and `iterationSafe_true` closes trivial loop domains. `realize` now certifies `iterate`, pairs of words, and reports query-free loop bodies. Refs cslib-community#2205. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * test(WordRAM): a whole stack client to a flat program via realize Add `blockWords` and its `WordEncoding` instance, so binds may return blocks and layouts. `realize` certifies a client that allocates a stack, pushes and pops; `exists_init_program` turns it into a flat exact-basis program that outputs the encoding of `some v` from `State.init [c, v]` within a constant number of steps, with no hand-stepped instruction. Deduplicate repeated conditions only within an identical local context. Refs cslib-community#2205. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * refactor(Stack): migrate the stack to its realized implementation Delete the hand-stepped `Stack/WordRAM/{Basic,Controller}` and re-derive their statements from `Stack.Memory`, C2's `MemoryStack.realizes_*` and `realize`: - `Stack.Spec`: the bounded stack, moved from `Stack.WordRAM.spec`. - `Stack.Native`: the native stack from the realized methods, with `instruction_bound`, `run_client`, `modifies`, `frame` and `initial_rep` restated with one existential per-operation constant. - `Stack.Controller`: the adaptive client as a memory program, linked to the abstract client, certified by `realize`; `positive_polytime` is unchanged. - Chan–He traversal keeps the stepped dispatcher it uses as `Traversal.WordStack` (push and nonempty pop, exact counts unchanged). - The controller and dynamic-program tests move to the exchange cell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * fix(WordRAM): destructure the loop argument in Realizes.iterate₀ cslib-community#2246's iterateRuntime now binds its argument by a destructuring lambda, so iterate₀ matches the components before omega. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(WordRAM): native backends for memory refinements, one realized body per constructor Realization.Backend generalizes MemoryBackend: from a Refinement D (Memory.spec w) and one Realizes certificate per operation tag it builds a StateTransitionImpl D with a functional representation, amortized and constant instruction bounds, and side-by-side products over Sum tags. Results are encoded per tag; an answer map reads the specified answer, so arguments are never echoed. Realizes.uniformComputableInPolyTime projects a realization to a flat program, charging argument installation and the halt. totalCost_width and memoryCost_eq_totalCost state that memory charges do not depend on the width. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * style(tests): wrap long lines in the backend test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(WordRAM): Backend.data, rep_data and fits_appendWords Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * test(WordRAM): backend test uses fits_appendWords and Backend.data Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * refactor(Stack): run the native stack on Realization.Backend Adopts worker-claude-015dlg8k-adapter's drop-in for cslib-community#2277: Stack.Native instantiates Realization.Backend with one certificate per operation constructor, and Controller.positive_polytime comes from Realizes.uniformComputableInPolyTime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * perf(WordRAM): state realize certificates per form in the client's terms `realize` compared its synthesized domain with the composed rules' domain once, at the end, by definitional unfolding. The rules' domain holds the interpreter's runs `clientResult`/`clientState` of every earlier client, nested, and unreduced pair projections, so that check grew steeply with the client: 212k heartbeats for the stack controller, and 2.5M when a bind's first client ends in a `match`. Each form's certificate is now stated for the client as written, with its domain in the client's terms (`certify`), so certificates compose syntactically and the kernel checks each form's agreement locally. A bind's continuation domain is stated at the first client's reply and next memory in closed form (`Realizes.bind₀_of_run`). Result encodings are proved by `Fin.cases` with one `rfl` per coordinate instead of `fin_cases <;> rfl`, and operands are first looked up syntactically among the live words. Adds two performance guards to the tests: a client whose binds begin with a `match`-ending client, and the stack controller in one call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * refactor(Stack): keep only consumed native API; fold the traversal word stack into TraversalStack Stack.Native keeps the backend, implementation and instruction_bound. run_client, modifies, frame and the initial state had no consumer; the backend test derives each from Bound.exists_executes_const, Backend.exec_memoryState with Stack.Memory.modifies_methods, and Backend.rep_data. The backend test now uses Stack.Native instead of its own copy, and absorbs DataStructureStack. Traversal.WordStack moves into TraversalStack.lean, its only importer, unchanged. Stack.Controller uses memoryCost_eq_totalCost and drops unused imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * refactor(Stack): realize the controller in one call With cslib-community#2280, realize certifies the whole controller program directly, so the split through realizes_alloc, realizes_run and Realizes.bind goes. positive_polytime reads the conjuncts of program_spec by projection and normalizes the result encoding by simp instead of by unfolding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * perf(Stack): simplify only the controller's side goals The side goals after realize need no hypothesis rewriting; simp on the goal alone saves about 0.15 s and three simp arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * chore: drop imports the merge duplicated in Complexity.lean Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(WordRAM): framed backends - frames, products over one memory, allocation A backend of a framed refinement carries its frame over: a native operation writes only the footprint and the reserved room (Backend.modifies), and keeps disjoint assertions and structures kept apart (frame_heap, frame). Backends of framed refinements run their product over one memory (Implements.prod_framed), each side within its own region (modifies_inl, modifies_inr). Backend.Allocation names the tag that runs a Memory.Allocator's program; Allocation.exec allocates from arbitrary bounded data within the allocator's cost, writing only the room it takes. Backend.extend adds such tags; install and exists_exec run any tag's body. The memory side is a new leaf, Memory/Region. The stack test restores modifies/frame, constant-time allocation and allocate-then-run, and two stacks over one memory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * test(WordRAM): allocate a pair of stacks in one body realizes_allocTwo certifies the allocation of two stacks, one after the other, as Memory.Allocator.prod does; with Backend.extend it becomes the allocation tag of the pair's backend, and allocate_pair sets up both empty stacks from arbitrary bounded data in constant time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(WordRAM): retain Backend register frames for live-input execution Expose existing shared packing facts and install identity under actual live words; derive a full-frame execution result and raw-live corollary from the same Realizes code_spec. Existing definitions and all previous theorem types are unchanged; exists_exec projects the stronger proof. Tests exercise different result widths, paid zero staging, zero/max-word inputs and a genuine memory-read provider. Under cslib-community#2298 for queue cslib-community#2284 and heap cslib-community#2282; inherited Claude source credit retained. Strict focused3628 and hygiene pass; full-six/outside review pending. * fix(WordRAM): expose Backend extension and preparation metadata Expose only the existing pure extend record and prepare alias so real heap bounds and conditional already-live entry elaborate without local record copies or dependent observation wrappers. All definition bodies/types, code/arg/rep/resource meanings are unchanged. Generic bound_extend and actual-live operation-entry regressions pass with the old clients; full new-head validation/review pending under cslib-community#2298. * Fix Stack migration name resolution and framed proof view Append only to frozen cslib-community#2272 head97bd. Explicitly qualify Doubling's eighty Memory.spec references shadowed by the relocated bounded Stack.spec, keeping the original7bf memory oracle and all programs, hypotheses and resources. Wrap four newly long lines. Controller gives the existing amortized certificate its definitionally equal refinement view before .client. No public lemma, definition, capacity premise, program or bound is added. Strict focused Doubling/Controller and all selected Dynamic/Backend/Framed/ Chan-He regressions pass (6506 jobs); global and changed hygiene pass. Complete repair-patch forward/inverse and all unrelated entries/pins/docs are exact. Full-six and independent delta review remain before publication. Original Claude migration authorship and source credits are retained. * refactor(WordRAM): realize the queue with resident register metadata Use Memory.Prog, boundedWhile, Realizes and one fixed Backend family with actual native tag dispatch and paid count writeback. Preserve the original 2*C reservation, Fits1/end-fit domain, arbitrary dirty bounded initialization in six register instructions, typed FIFO observations, adaptive execution and heap frame. Remove old Basic/Dynamic and superseded prototypes; migrate every client and retain the source transfer equation/invariant/allocator decomposition. Static shared R/F replace the hand program's literal register and instruction constants: call charge4F+6 and terminal potential2F*rear include control, commit and halt. The external client controller/delivery boundary remains; generic framed allocation/composition and the full2205 objective are not completed. Default scripts/check.sh all six PASS at exact staged tree37b5dee43327761897a6c152ef3246de13d12ca0, plus eight strict focused queue targets, imports and hygiene. Parent is the private ordinary joint0abe of public2299/73 and2272/fc; supplier review/actual/current-context gates remain separate. This own layer changes exactly21 paths. Source credit Samuel Schlesinger retained. OpenAI Codex assisted implementation, proofs, tests and source-preserving integration; Kernel's exact metadata-source prefix is reused with its contribution credited and old feasibility refs preserved. Shared providers retain their original authors through parent history. Refs cslib-community#2284; broader cslib-community#2205/cslib-community#2213 remain open. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Change
worker-claude-015dlg8k-realize2(Claude Code, Opus). This fixes therealizeperformance cliffs that the stack migration (#2272) reported on #2205. Now based on actual main after #2260; part of the still-open #2205 objective.Cause.
realizechecked its result once, at the end. It compared the domain it synthesizes, in the client's terms (s.mem a,Function.update …), with the domain of the composed rules, using definitional unfolding. The composed domain contains:clientResult/clientStateof every earlier client, nested inside one another;(d, r).2.That one check was 4.0 s of the 4.5 s that
realizespent on the controller'srun, and it grew steeply with nesting. A bind whose first client ends in amatchadds another unfolding layer, which caused the 2.5M case.Fix. The tactic remains syntax-directed and search-free, and it produces the same goals as before.
certify. Each form's certificate is stated for the client as written, with its domain in the client's terms. Certificates compose syntactically, and the kernel checks each form's agreement with its rule locally. Elaboration no longer unfolds composed domains.Realizes.bind₀_of_run(new inAbsorb.lean). This isbind₀with the continuation's domain stated at a closed form of the first client's reply and next memory, such ass.mem aor⟨Function.update s.mem a v, s.frontier⟩, rather than at the interpreter's run. Its two equations are proved byrfland checked during elaboration. They are local and small.Fin.caseswith onerflper coordinate, instead offin_cases <;> rflthrough the tactic framework. At scale that call was about 40% of the remaining cost.Mathlib.Tactic.FinCasesis no longer imported byComplexity.Tactic.Realize.The error messages and their
#guard_msgstests are unchanged. The two "internal error" checks are gone: the old finalisDefEq, and thefin_casesfallback. Their properties now hold by construction and are checked by the kernel.Before and after
All counts come from
#count_heartbeats(realizeplusall_goals sorry) on this branch's base and head:runon a given layoutmatch(with allocation)bounce(new test: push,popWord,if, push,popWord)let v ← popWord L; push L (v + 1); popWord LTimings, from
lake env leanand including about 1.3 s of import loading:Stack/Controller.lean, unchanged, with this tactic: 6.0–6.5 s before; 2.8 s after.#2272 can use one call. Its
realizes_programnow goes through as a singlerealizecall: 11.3k heartbeats, including onesimp onlyfor the side goals. It no longer needsrealizes_alloc,realizes_runandRealizes.bind.Growth. A chain of
npush/match-pop round trips takes 1.6k, 3.2k, 6.7k and 15.7k heartbeats forn= 1, 2, 4, 8. The residual superlinearity comes from walking a growing live-word list: operand lookup, and evaluatinginput d ithrough the nested appends.Tests
ComplexityTests/WordRAMRealize.leangains two performance guards. Each runs underset_option maxHeartbeats 40000, with a justifying comment, and proves its side conditions:bounce. Both pops go throughpopWord, a client that ends in amatch, so both binds begin with amatch-ending client. This needs 8k, side conditions included.controller. The adaptive stack controller (allocation, push, match on pop,if, push, match on pop) in onerealizecall. This needs 11k.Existing notions considered:
Realizes.bind₀andRealizes.bind, withRealizes.consequence.bind₀_of_runis derived from them in two lines; no execution semantics or judgment is added.Validation
Current source
3ebcd71eis an ordinary merge of the reviewed feature and actual #2260 main. It preserves the exact tactic/performance regressions and carries only the already-reviewed parent iterator-proof/test compatibility. Independent preservation approval reuses the outside feature review. Fresh canonical native CI and normal merge-queue validation are required before integration; old green checks are not validation of this new context. Public meanings and selected abstracts are unaffected. Original Claude authorship and List’s refresh credit are retained.Historical author validation at the original reviewed feature head
212e5824:lake build --wfail Complexity.Computability.WordRAM.Realization.Absorb Complexity.Tactic.Realize ComplexityTests.WordRAMRealize. These are the only modules importing the changed ones, apart fromComplexity.lean.lake exe lint-style.check_hygiene.py --check-simp,check_tidy_surface.py, andcheck_changed_files.py --basefeat(WordRAM): realize tactic for memory-client realizations #2260.The merge with #2277 (adapter, also on #2260) is clean.
AI assistance
Written by Claude Code (Opus) as
worker-claude-015dlg8k-realize2. Outside feature review: 5732018867.🤖 Generated with Claude Code
https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG