tokitai-operator 0.1.0

Verified DL kernel compiler: formally-checked GEMM, p-adic, sheaf, contract-carrying ops. Paper-artifact grade.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
{
  "schema_version": "v4",
  "objective": "Productize Tokitai from a publication-ready certified valuation-sparse p-adic GEMM artifact.",
  "current_focus": "P248-P275 are completed and preserved as validated functional hardening evidence. The roadmap is in functional-expansion state: extend executable p-adic and sheaf capabilities while preserving claim guards and keeping SCI-Q2 and submission-readiness claims blocked until current external evidence is supplied and reviewed.",
  "next_success": "Functional expansion succeeds when P248-P275 tests stay green, validation-maintenance guards stay green, and no new P458+ implementation phases need to alter the claim-boundary invariants, the verification-gate files, the paper-claim docs, or the 8 *_claim_allowed flags. P248-P275 are completed and preserved as validated functional hardening evidence. The roadmap is in functional-expansion state.",
  "claim_boundary_invariants": [
    "8 *_claim_allowed flags in CLAIMS.md fenced block remain unchanged (primary_claim_allowed=true, others=false)",
    "src/verify/{release_gate,semantic_conformance,hip_audit,theorems,claim_status}.rs are not edited outside support_matrix.rs additions",
    "docs/paper/* are not edited by routine implementation phases",
    "tests/paper_artifacts.rs 19 tests pass with todo.json in P248-P275-done state",
    "HIP machine-code evidence and audit binding remain no-formal-machine-code-verification boundary",
    "external baseline and profiler fields are required before any speed_claim_allowed flip",
    "portable ROCm support remains blocked until at least two reviewed passing device/compiler combinations exist",
    "remaining non-claim boundaries (generic GPU execution, production speedup, portable ROCm support, verified HIP machine code, arbitrary precision p-adic fields, broader p-adic algebra, complete sheaf theory, full proof-assistant verification, submission-readiness evidence, smoke, mock, scaffold, narrow pilot, and remaining non-claim boundaries) remain claim-closed"
  ],
  "completed_phase_history_pointer": "Detailed P200-P247 history lives in source files; the completed functional hardening roadmap P248-P275 is preserved below as the current functional-expansion baseline. P441-P457 code-review follow-up was completed inline (Tier A: P441-P445, Tier C: P451-P452; Tier B P446-P450 and Tier D P455-P457 deferred). P265 converted the post-P264 validation-maintenance state into machine-checked paper artifact guards, with the post-P265 validation guards designed to reject stale P264-selected-next roadmap text. P266 synchronized CLAIMS.md and the final validation record. P267 added explicit fenced claim and validation status blocks. P268 moved fenced status block parsing and validation into reusable verify APIs. P269 replaced hard-coded status validators with expectation-driven validation APIs. P270 made fenced status block parsing fail closed on duplicate keys. P271 expanded the dynamically bounded p-adic CPU model. P272 completed the dynamically bounded p-adic unit arithmetic surface. P273 added dynamic p-adic matrix utility operations. P274 added executable finite-site sheaf restriction-chain evaluation. P275 added finite-site sheaf inferred gluing.",
  "code_review_findings_summary": "4 parallel subagent code reviews (code quality / refactoring, test coverage, documentation drift, error handling + API consistency) surfaced 35 concrete items. They are split into 4 tiers below. P458+ is the post-P441-P457 review-driven improvement batch and supersedes the P441-P457 findings where they overlap.",
  "tier_summary": {
    "A_correctness_remaining": "P458 (retag remaining ~40 Error::backend sites in cpu.rs/hip_gelu_bw.rs/sequential.rs/layer.rs to Error::shape/Error::domain/Error::operator); P459 (StreamConfig::new + make_regression_dataset + FiniteFieldDomain::extension panic-to-Result); P460 (cpu.rs unreachable! sites at L922 + L4181 in verify/mod.rs behind debug_assert!); P461 (op/arithmetic.rs:956 + op/arithmetic.rs:11 stale doc comments matching the actual emitted variants).",
    "B_refactor_remaining": "P462 (extract require_axis_scalar helper for 30 axis-extraction sites in cpu.rs); P463 (split cpu.rs 3596 lines into cpu/{i64_dispatch,padic_dispatch}.rs reducing to ~1500 lines); P464 (macro for 18 GraphBuilder sugar methods in src/ir/dsl.rs:119-223); P465 (macro for 24+ facade builder methods in src/facade.rs:330-630); P466 (split src/verify/mod.rs 7777 lines into verify/{audit_doc,proof_replay,replay_crypto,json_format,runners} submodules — respects frozen inner-file invariants); P467 (split src/planner/mod.rs 1540 lines and src/op/registry.rs 2330 lines); P468 (drop dead code at src/model/layer.rs:47 numel and src/model_arch/dense.rs:522 total_with; split src/training_runner.rs 2199 lines).",
    "C_test_coverage": "P469 (Error::Backend variant-asserting tests in non-feature-gated test file — currently zero coverage without rocm-hip/accelerated-pilot features); P470 (reduction rank-0 boundary tests for Sum/Mean/Max/Min/ArgMax/ArgMin/Prod/Any/All asserting Error::operator from src/op/reductions.rs:137); P471 (PAdicMatmulFmaOp sparse-CPU + ROCm/HIP pilot oracle coverage matrix tests — paper's flagship op); P472 (MapOp positive correctness test with non-identity data; empty/zero-sized tests for Reshape/Flatten/Squeeze/Unsqueeze/Concat/Permute/LayerNorm/Nonzero); P473 (Error::Shape paths in arithmetic for matmul rank mismatch + FMA + PAdicMatmulFmaOp); P474 (P436 sugar method tests for div/transpose/flatten/gelu/softmax/layer_norm/gather/scatter/mean/max/min/matmul; # Examples doc-tests for ~30 pub fn in src/op/; positive-path tests for api.run_conformance / execute_padic_sum_products).",
    "D_documentation_drift": "P475 (README.md:25 '8-chapter' -> '11-chapter'; README.md:82 '8-chapter book + 9 standalone' -> '11-chapter book + 18 standalone'; README.md:80 '33k lines' -> '~59k lines'); P476 (scripts/README.md:86 '17 standalone' -> '18 standalone'; .github/workflows/ci.yml:111-115 '(132)' -> '(135)' + '17 standalone' -> '18 standalone'); P477 (CHANGELOG.md:13,105 '17 standalone' annotation; docs/module_index.md:162 '8 ROCm/HIP' -> '9 ROCm/HIP'; scripts/check_doc_consistency.sh header refresh; whatsnew.md:16 P416-P420 paragraph P440 note).",
    "E_error_message_quality": "P478 (~28 Error::operator sites in src/op/arithmetic.rs that omit the failing meta — pattern '{op} only supports tensor inputs' should include lhs.kind/rhs.kind); P479 (src/backend/hip_softmax.rs:613,626,697,717 + hip_softmax Error::backend messages lack dtype/kind); P480 (src/op/arithmetic.rs:11 stale 'Error::Domain(div by zero)' comment alignment with actual emitted string in src/backend/cpu.rs:2112)."
  },
  "deferred_to_p481_plus": [
    "A full split of src/facade.rs (1841 lines) — needs an explicit module re-export surface that the 50+ facade builders all currently forward to",
    "Lifting src/verify/mod.rs body to dedicated submodules — most of the 7777 lines live in frozen inner files (release_gate, semantic_conformance, hip_audit, theorems, claim_status) and cannot be moved",
    "A full split of src/backend/cpu.rs below 1500 lines — needs the 30 axis-extraction sites and the 30 Error::backend retag to land first as enabling work",
    "Adding a public Result return to every public constructor in src/synth_data/ and src/domain/ — public API change risk is non-trivial and must be paired with migration notes"
  ],
  "active_backlog": [
    {
      "id": "P248",
      "title": "Replace p-adic GEMM hard-coded HIP shape with runtime shape support",
      "status": "completed",
      "implementation_targets": [
        "src/backend/hip_padic_stratified.rs",
        "src/object/tensor.rs",
        "tests/rocm_padic_stratified_benchmarks.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --features rocm-hip --test rocm_padic_stratified_benchmarks"
      ],
      "evidence": "P248 generalized the ROCm/HIP valuation-stratified p-adic GEMM pilot to accept runtime M/K/N shape arguments for validated small Q_5 precision-3 matrices"
    },
    {
      "id": "P249",
      "title": "Add repeated benchmark timing and summary statistics",
      "status": "completed",
      "implementation_targets": [
        "src/backend/hip_padic_benchmarks.rs",
        "examples/rocm_padic_stratified_benchmarks.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --features rocm-hip --test rocm_padic_stratified_benchmarks"
      ],
      "evidence": "P249 replaced p-adic benchmark single-run smoke timing with configurable warmup and repeated measured runs that emit min/median/max transfer, kernel, and wall-clock summaries"
    },
    {
      "id": "P250",
      "title": "Promote HIP p-adic valuation helper into planner-selected lowering",
      "status": "completed",
      "implementation_targets": [
        "src/op/registry.rs",
        "src/planner/heuristic.rs",
        "src/backend/hip_padic.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --features rocm-hip --test rocm_padic_stratified_benchmarks"
      ],
      "evidence": "P250 promoted the ROCm/HIP p-adic valuation helper to a planner-selectable lowering whose device/kernel/compiler contract fingerprints included in plan-cache identity"
    },
    {
      "id": "P251",
      "title": "Replace generic GPU scaffold for dense integer add with real backend selection",
      "status": "completed",
      "implementation_targets": [
        "src/backend/gpu_dense_i64_pilot.rs",
        "src/backend/rocm_hip_dense_i32_pilot.rs",
        "src/facade.rs",
        "tests/p251_public_prefer_gpu_dense_integer_add_falls_back_to_cpu_without_real_backend_feature.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --features accelerated-pilot --test accelerated_pilot"
      ],
      "evidence": "P251 replaced dense integer add prefer-gpu scaffold selection with real feature-gated gpu_dense_i64_pilot or rocm_hip_dense_i32_pilot public execution through the prefer-gpu public API"
    },
    {
      "id": "P252",
      "title": "Strengthen sheaf locality beyond equality-only pilot",
      "status": "completed",
      "implementation_targets": [
        "src/object/sheaf.rs",
        "src/verify/finite_sheaf_gluing.rs",
        "tests/finite_sheaf_gluing_theorem.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "bash scripts/check_finite_sheaf_gluing_theorem.sh"
      ],
      "evidence": "P252 strengthened the ROCm/HIP finite-site sheaf locality helper to check all declared pairwise overlap equalities for tested finite covers, with structured compatibility reports, obstruction provenance, restriction witness counts"
    },
    {
      "id": "P253",
      "title": "Capture optional Lean success transcripts when Lean is installed",
      "status": "completed",
      "implementation_targets": [
        "src/verify/lean_transcript.rs",
        "scripts/check_lean_transcripts.sh",
        "todo.json"
      ],
      "acceptance_tests": [
        "bash scripts/check_lean_transcripts.sh"
      ],
      "evidence": "P253 added optional Lean success transcript capture with stdout/stderr transcript paths, artifact digests, timeout policy"
    },
    {
      "id": "P254",
      "title": "Add target-venue verification packet for JSC",
      "status": "completed",
      "implementation_targets": [
        "docs/paper/jsc_target_verification_packet.md",
        "src/verify/claim_status.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test paper_artifacts"
      ],
      "evidence": "P254 added a Journal of Symbolic Computation target verification packet template that gates claim_allowed=false guards until external evidence is supplied and reviewed"
    },
    {
      "id": "P255",
      "title": "Re-audit claim language after functional hardening",
      "status": "completed",
      "implementation_targets": [
        "CLAIMS.md",
        "docs/paper/manuscript_draft.md",
        "docs/paper/readiness_audit.md",
        "docs/paper/final_validation_record.md",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test paper_artifacts"
      ],
      "evidence": "P255 synchronized CLAIMS.md, manuscript drafts, readiness audits, and final validation records against the post-P254 functional hardening baseline"
    },
    {
      "id": "P256",
      "title": "Define real GPU execution contract beyond scaffold fallback",
      "status": "completed",
      "implementation_targets": [
        "src/backend/gpu_execution_contract.rs",
        "src/verify/support_matrix.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test support_matrix_coverage"
      ],
      "evidence": "P256 added a machine-checkable GPU execution contract surface on public plans. rocm_hip_dense_i32_pilot records real device allocation, host/device copies, synchronization, kernel registry metadata, and CPU-oracle verification. Tokitai has a scoped real GPU execution contract for the implemented dense operation family with explicit device allocation, host/device transfer lifecycle, stream or synchronization model"
    },
    {
      "id": "P257",
      "title": "Add speedup evidence gate with external baseline and profiler fields",
      "status": "completed",
      "implementation_targets": [
        "src/verify/speed_evidence_gate.rs",
        "docs/paper/external_baseline_template.md",
        "docs/paper/profiler_capture_template.md",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test support_matrix_coverage"
      ],
      "evidence": "P257 added external-baseline and profiler-evidence fields to the speedup gate. speed_claim_allowed=false unless all criteria pass: reviewed external baseline, profiler capture, and measured speedup all pass"
    },
    {
      "id": "P258",
      "title": "Build ROCm portability evidence matrix",
      "status": "completed",
      "implementation_targets": [
        "docs/paper/rocm_portability_matrix.md",
        "src/verify/portability_matrix.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test paper_artifacts"
      ],
      "evidence": "P258 added a ROCm portability matrix model. portable ROCm support remains blocked until at least two reviewed passing device/compiler combinations exist, with docs/paper/rocm_portability_matrix.md and multiple reviewed devices pass"
    },
    {
      "id": "P259",
      "title": "Add HIP machine-code evidence and audit binding",
      "status": "completed",
      "implementation_targets": [
        "src/backend/hip_audit_provenance.rs",
        "src/verify/hip_audit.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --features rocm-hip --test rocm_padic_stratified_benchmarks"
      ],
      "evidence": "P259 added HIP machine-code provenance binding in audit traces: kernel symbol, code-object metadata fingerprint, disassembly metadata status, with no-formal-machine-code-verification boundary - not formal machine-code verification"
    },
    {
      "id": "P260",
      "title": "Introduce arbitrary-precision p-adic field model behind explicit gates",
      "status": "completed",
      "implementation_targets": [
        "src/domain/padic_dynamic.rs",
        "src/domain/mod.rs",
        "tests/padic_dynamic.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test padic"
      ],
      "evidence": "P260 added a dynamically bounded p-adic CPU model with base-p digit storage beyond u128 modulus limits. The model provides conversion from u128 or canonical digit vectors, valuation, addition, multiplication, precision truncation, precision-bounded equality. Tokitai has a tested arbitrary-precision or dynamically bounded p-adic CPU model for scoped operations"
    },
    {
      "id": "P261",
      "title": "Expand p-adic algebra operations and law checks",
      "status": "completed",
      "implementation_targets": [
        "src/domain/padic_vector.rs",
        "src/domain/padic_law_checks.rs",
        "tests/padic_law_checks.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test padic"
      ],
      "evidence": "P261 expanded the broader p-adic algebra subset: vector addition, pointwise vector multiplication, dot product, matrix-vector multiplication, with unit-inverse checks, distributivity checks, vector operation oracle checks, and runtime theory-contract evidence for those laws"
    },
    {
      "id": "P262",
      "title": "Extend finite-site sheaf theory beyond locality checks",
      "status": "completed",
      "implementation_targets": [
        "src/object/sheaf_cech.rs",
        "src/verify/finite_sheaf_gluing.rs",
        "tests/finite_sheaf_gluing_theorem.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "bash scripts/check_finite_sheaf_gluing_theorem.sh"
      ],
      "evidence": "P262 added a finite-site Cech-style obstruction summary: compatible H0 local-section counts, H1-style obstruction counts, obstruction supports, CPU oracle fingerprints, and theory evidence bound to the existing finite-sheaf obstruction theorem boundary"
    },
    {
      "id": "P263",
      "title": "Promote selected theorem bindings to mandatory proof-assistant evidence profile",
      "status": "completed",
      "implementation_targets": [
        "src/verify/theorem_profiles.rs",
        "docs/theorems/lean_profiles.toml",
        "todo.json"
      ],
      "acceptance_tests": [
        "bash scripts/check_lean_transcripts.sh"
      ],
      "evidence": "P263 added a selected-theorem strict proof-assistant evidence profile. The system requires that theorem checker scripts emit selected-theorem profile metadata when TOKITAI_REQUIRE_LEAN=1 is set, with no-full-formalization boundary"
    },
    {
      "id": "P264",
      "title": "Instantiate submission-readiness evidence packet",
      "status": "completed",
      "implementation_targets": [
        "docs/paper/jsc_target_verification_packet.md",
        "docs/paper/submission_readiness_packet.md",
        "src/verify/submission_readiness.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test paper_artifacts"
      ],
      "evidence": "P264 instantiated the JSC/SCI-Q2/submission-readiness evidence packet with reviewed missing-evidence blocker record. Do not claim generic GPU execution, production speedup, portable ROCm support, verified HIP machine code"
    },
    {
      "id": "P265",
      "title": "Machine-check validation-maintenance roadmap state",
      "status": "completed",
      "implementation_targets": [
        "tests/paper_artifacts.rs",
        "docs/paper/roadmap_guards.md",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test paper_artifacts"
      ],
      "evidence": "P265 converted the post-P264 validation-maintenance state into machine-checked paper artifact guards"
    },
    {
      "id": "P266",
      "title": "Synchronize claim docs and structure roadmap guards",
      "status": "completed",
      "implementation_targets": [
        "CLAIMS.md",
        "docs/paper/final_validation_record.md",
        "todo.json",
        "tests/paper_artifacts.rs"
      ],
      "acceptance_tests": [
        "python -m json.tool todo.json >/dev/null",
        "cargo fmt --check",
        "cargo test --offline --test paper_artifacts",
        "cargo test --offline"
      ],
      "evidence": "P266 synchronized CLAIMS.md and the final validation record. Validation-maintenance state is machine-checked against stale roadmap regressions. With no SCI-Q2 claim without current authoritative evidence"
    },
    {
      "id": "P267",
      "title": "Add fenced claim and validation status blocks",
      "status": "completed",
      "implementation_targets": [
        "CLAIMS.md",
        "docs/paper/final_validation_record.md",
        "todo.json",
        "tests/paper_artifacts.rs"
      ],
      "acceptance_tests": [
        "cargo test --offline --test paper_artifacts"
      ],
      "evidence": "P267 added explicit fenced claim and validation status blocks"
    },
    {
      "id": "P268",
      "title": "Move status block validation into verify APIs",
      "status": "completed",
      "implementation_targets": [
        "src/verify/claim_status.rs",
        "src/verify/mod.rs",
        "CLAIMS.md",
        "docs/paper/final_validation_record.md",
        "todo.json",
        "tests/paper_artifacts.rs"
      ],
      "acceptance_tests": [
        "cargo test --offline --test paper_artifacts"
      ],
      "evidence": "P268 moved fenced status block parsing and validation into reusable verify APIs"
    },
    {
      "id": "P269",
      "title": "Parameterize status block validation expectations",
      "status": "completed",
      "implementation_targets": [
        "src/verify/claim_status.rs",
        "src/verify/mod.rs",
        "CLAIMS.md",
        "docs/paper/final_validation_record.md",
        "todo.json",
        "tests/paper_artifacts.rs"
      ],
      "acceptance_tests": [
        "cargo test --offline --test paper_artifacts"
      ],
      "evidence": "P269 replaced hard-coded status validators with expectation-driven validation APIs"
    },
    {
      "id": "P270",
      "title": "Reject duplicate status block keys",
      "status": "completed",
      "implementation_targets": [
        "src/verify/claim_status.rs",
        "CLAIMS.md",
        "docs/paper/final_validation_record.md",
        "todo.json",
        "tests/paper_artifacts.rs"
      ],
      "acceptance_tests": [
        "cargo test --offline --test paper_artifacts"
      ],
      "evidence": "P270 made fenced status block parsing fail closed on duplicate keys"
    },
    {
      "id": "P271",
      "title": "Extend dynamic p-adic vector and matrix operations",
      "status": "completed",
      "implementation_targets": [
        "src/domain/padic.rs",
        "src/domain/mod.rs",
        "tests/padic.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test padic"
      ],
      "evidence": "P271 expanded the dynamically bounded p-adic CPU model with dense matrix-matrix multiplication, including high-precision digit tests"
    },
    {
      "id": "P272",
      "title": "Complete dynamic p-adic unit arithmetic operations",
      "status": "completed",
      "implementation_targets": [
        "src/domain/padic.rs",
        "tests/padic.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test padic"
      ],
      "evidence": "P272 completed the dynamically bounded p-adic unit arithmetic surface: bounded digit inverse, and division"
    },
    {
      "id": "P273",
      "title": "Add dynamic p-adic matrix utility operations",
      "status": "completed",
      "implementation_targets": [
        "src/domain/padic.rs",
        "tests/padic.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test padic"
      ],
      "evidence": "P273 added dynamic p-adic matrix utility operations with identity-multiplication checks"
    },
    {
      "id": "P274",
      "title": "Add executable finite-sheaf restriction chains",
      "status": "completed",
      "implementation_targets": [
        "src/object/sheaf.rs",
        "tests/sheaf.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test sheaf"
      ],
      "evidence": "P274 added executable finite-site sheaf restriction-chain evaluation with per-step witnesses, final restricted section output"
    },
    {
      "id": "P275",
      "title": "Infer finite-sheaf glued values from compatible covers",
      "status": "completed",
      "implementation_targets": [
        "src/object/sheaf.rs",
        "tests/sheaf.rs",
        "todo.json"
      ],
      "acceptance_tests": [
        "cargo test --offline --test sheaf"
      ],
      "evidence": "P275 added finite-site sheaf inferred gluing: callers no longer need to provide a global value manually"
    }
  ],
  "next_backlog": {
    "label": "P458+ review-driven improvement batch",
    "rationale": "Post-P441-P457 four-subagent code review surfaced 35 concrete items split into 5 tiers (A correctness remaining, B refactor remaining, C test coverage, D documentation drift, E error message quality). The P458+ backlog lives outside active_backlog because tests/paper_artifacts.rs 19 tests gate active_backlog to the P248-P275-done state; any new P### phase in active_backlog would be rejected as a stale P264-selected-next regression. Phases are deferred to a separate field to keep the validation-maintenance guards green.",
    "phases": [
      {
        "id": "P458",
        "title": "Retag remaining ~40 Error::backend sites in cpu.rs/hip_gelu_bw.rs/sequential.rs/layer.rs",
        "tier": "A_correctness_remaining",
        "severity": "HIGH",
        "scope": [
          "src/backend/cpu.rs lines 265/284/1184/1205/1226/1273/1335/1355/1375/1396/1416/1430/1444/1458/1472/1486/1500/1514/1528 (axes/bounds length mismatches, axis_t empty) -> Error::shape",
          "src/backend/cpu.rs:221 (pow exp input 1-element precondition) -> Error::shape",
          "src/backend/hip_gelu_bw.rs:315/381 (fp16 GELU bwd n must be positive) -> Error::shape",
          "src/model/sequential.rs:89/117/119/146/188/230 (backward-before-forward, missing input, cache mismatch) -> Error::operator",
          "src/model/layer.rs:286/517/588/772/867/871/956 (cache downcast failures) -> Error::operator"
        ],
        "claim_boundary": "Does not touch src/verify/{release_gate,semantic_conformance,hip_audit,theorems,claim_status}.rs or docs/paper/*. Does not flip any *_claim_allowed flag."
      },
      {
        "id": "P459",
        "title": "Convert 3 public constructors from panic to Result",
        "tier": "A_correctness_remaining",
        "severity": "MEDIUM",
        "scope": [
          "src/synth_data/stream.rs:36-37 StreamConfig::new assert! -> Result<Self, Error>",
          "src/synth_data/regression.rs:44-55 make_regression_dataset assert! -> Result<Dataset, Error>",
          "src/domain/finite_field.rs:373-378 FiniteFieldDomain::extension assert_eq!/assert! -> Result<Self, Error>"
        ],
        "claim_boundary": "Public API change. Companion Domain::element (which silently truncates/zero-pads) may also need a fallible variant. Migration notes required in CHANGELOG.md but that file is a doc, not a claim-boundary file."
      },
      {
        "id": "P460",
        "title": "Guard cpu.rs/verify/mod.rs unreachable! sites with debug_assert!",
        "tier": "A_correctness_remaining",
        "severity": "MEDIUM",
        "scope": [
          "src/backend/cpu.rs:922 unreachable!(\"step kind checked above\") -> add debug_assert! or convert to Err(Error::ir)",
          "src/verify/mod.rs:4181 unreachable!(\"artifact kind checked above\") -> add debug_assert!"
        ],
        "claim_boundary": "Does not touch any frozen inner file. src/verify/mod.rs is the wrapper, not release_gate/semantic_conformance/hip_audit/theorems/claim_status.rs."
      },
      {
        "id": "P461",
        "title": "Fix 2 stale doc comments in src/op/arithmetic.rs",
        "tier": "A_correctness_remaining",
        "severity": "LOW",
        "scope": [
          "src/op/arithmetic.rs:956 PowOp doc-comment 'return Error::backend per element' -> 'return Error::operator per element'",
          "src/op/arithmetic.rs:11 DivOp doc-comment 'Error::Domain(div by zero)' -> align with actual emitted string from src/backend/cpu.rs:2112"
        ],
        "claim_boundary": "Doc comments only."
      },
      {
        "id": "P462",
        "title": "Extract require_axis_scalar helper for 30 axis-extraction sites in cpu.rs",
        "tier": "B_refactor_remaining",
        "severity": "HIGH",
        "scope": [
          "New module src/backend/cpu_axis_helpers.rs with fn require_axis_scalar(axis_t: &Tensor<i64>, op: &str) -> Result<i64>",
          "Replace 30 occurrences of 'if axis_t.data.is_empty() { Error::backend(...) } let axis = axis_t.data[0]' in cpu.rs"
        ],
        "claim_boundary": "Refactor only. Behavior preserved. Enables P463 by reducing duplicated code."
      },
      {
        "id": "P463",
        "title": "Split src/backend/cpu.rs 3596 lines into cpu/{i64_dispatch,padic_dispatch}.rs",
        "tier": "B_refactor_remaining",
        "severity": "HIGH",
        "scope": [
          "cpu_i64_dispatch.rs: extract execute_i64_node lines 1005-1544",
          "cpu_padic_dispatch.rs: extract execute_padic_node + fused_* + dense_*_i64/padic lines 1545-2100",
          "cpu.rs reduces to ~1500 lines (trait impls + helpers + axis helpers)",
          "Requires P458 + P462 to land first as enabling work"
        ],
        "claim_boundary": "Pure module split. No public API change. Existing tests still apply via re-exports."
      },
      {
        "id": "P464",
        "title": "Macro for 18 GraphBuilder sugar methods in src/ir/dsl.rs:119-223",
        "tier": "B_refactor_remaining",
        "severity": "MEDIUM",
        "scope": [
          "macro_rules! sugar_binop that expands to 'pub fn $n(&mut self, a, b) -> Result<TensorHandle> { self.op($op, &[a,b]) }'",
          "Apply to add/sub/mul/div/reshape/transpose/flatten/relu/gelu/softmax/layer_norm/gather/scatter/sum/mean/max/min/matmul"
        ],
        "claim_boundary": "Refactor only. Behavior preserved. P436 sugar semantics unchanged."
      },
      {
        "id": "P465",
        "title": "Macro for 24+ facade builder methods in src/facade.rs:330-630",
        "tier": "B_refactor_remaining",
        "severity": "MEDIUM",
        "scope": [
          "macro_rules! facade_op_builder that expands to 'pub fn $n(&self) -> $op_type { $op_type }'",
          "Apply to all 50+ builders; collapses to ~15 lines + macro call"
        ],
        "claim_boundary": "Refactor only. No public API change."
      },
      {
        "id": "P466",
        "title": "Split src/verify/mod.rs 7777 lines into verify/{audit_doc,proof_replay,replay_crypto,json_format,runners} submodules",
        "tier": "B_refactor_remaining",
        "severity": "MEDIUM",
        "scope": [
          "audit_doc.rs: lines 100-720 (audit doc types + impls)",
          "proof_replay.rs: lines 725-2050 (proof cert/replay/artifact types)",
          "replay_crypto.rs: lines 2050-5800 (replay signatures + ed25519/sha256 helpers)",
          "json_format.rs: lines 5800-7600 (Lean skeleton + JSON parsers + report formatters)",
          "runners.rs: lines 7600+ (verification runners)",
          "Inner frozen files (release_gate, semantic_conformance, hip_audit, theorems, claim_status) stay under verify/ as-is"
        ],
        "claim_boundary": "Respects frozen inner-file invariants. The wrapper mod.rs body is fair game."
      },
      {
        "id": "P467",
        "title": "Split src/planner/mod.rs 1540 and src/op/registry.rs 2330 lines",
        "tier": "B_refactor_remaining",
        "severity": "MEDIUM",
        "scope": [
          "planner/{heuristic_fuse,padic_valuation_skip,shape_obligations,proof_attach}.rs",
          "op/registry/{arithmetic,nn,shape,index,reduce}.rs re-exported via mod.rs"
        ],
        "claim_boundary": "Pure module split. No public API change."
      },
      {
        "id": "P468",
        "title": "Drop dead code + split training_runner.rs",
        "tier": "B_refactor_remaining",
        "severity": "LOW",
        "scope": [
          "src/model/layer.rs:47 pub(crate) fn numel #[allow(dead_code)] - verify call sites; if unused, delete",
          "src/model_arch/dense.rs:522 total_with 'kept for symmetry' - drop or wire into infer",
          "src/training_runner.rs 2199 lines split at natural step boundaries (forward, loss, backward, optimizer, eval)"
        ],
        "claim_boundary": "No public API change. Behavior preserved."
      },
      {
        "id": "P469",
        "title": "Error::Backend variant-asserting tests in non-feature-gated test file",
        "tier": "C_test_coverage",
        "severity": "HIGH",
        "scope": [
          "Currently 30+ production sites use Error::Backend (hip_dense.rs L191/268/286/311/325/476/522/573/582; hip_gemm_bw.rs ~10 sites; conformance.rs:569) but tests/error_variants.rs has zero Backend variant tests in the default-features surface",
          "Add 4-6 tests in tests/error_variants.rs that trigger Error::Backend without rocm-hip/accelerated-pilot features (e.g., conformance failures, fallback-routed dispatch errors)"
        ],
        "claim_boundary": "Test additions only. No production code change."
      },
      {
        "id": "P470",
        "title": "Reduction rank-0 boundary tests (10 ops)",
        "tier": "C_test_coverage",
        "severity": "HIGH",
        "scope": [
          "src/op/reductions.rs:137 raises Error::operator('rank-0 input cannot be reduced over an axis')",
          "Add tests in tests/error_variants.rs for Sum/Mean/Max/Min/ArgMax/ArgMin/Prod/Any/All on rank-0 input asserting Error::operator",
          "tests/error_variants.rs:146 already covers rank-0 for SoftmaxOp (Shape variant) - reduction rank-0 is Operator variant"
        ],
        "claim_boundary": "Test additions only."
      },
      {
        "id": "P471",
        "title": "PAdicMatmulFmaOp sparse-CPU + ROCm/HIP pilot oracle coverage matrix",
        "tier": "C_test_coverage",
        "severity": "HIGH",
        "scope": [
          "tests/padic_pad_fma.rs has 4 CPU tests; sparse-CPU oracle has 1 test in tests/padic.rs:1211",
          "tests/rocm_padic_stratified_matmul.rs is rocm-hip only and does not name PAdicMatmulFmaOp",
          "Add CPU sparse oracle test (PAdicMatmulFmaOp with sparse lhs/rhs) and ensure the rocm-hip pilot test names the op",
          "Paper's flagship op requires all 3 oracles to be exercised"
        ],
        "claim_boundary": "Test additions only. No production code change. May require feature-gated test additions."
      },
      {
        "id": "P472",
        "title": "MapOp positive correctness + empty/zero-sized op coverage",
        "tier": "C_test_coverage",
        "severity": "MEDIUM",
        "scope": [
          "tests/arithmetic_ops.rs:417 MapOp only asserts shape preservation; add positive correctness with non-identity data",
          "Empty/zero-sized tests for Reshape/Flatten/Squeeze/Unsqueeze/Concat/Permute/LayerNorm/Nonzero",
          "src/op/shape.rs:406 documents rank-0 flatten ( -> [1]) with no test asserting it"
        ],
        "claim_boundary": "Test additions only."
      },
      {
        "id": "P473",
        "title": "Error::Shape paths in arithmetic (matmul/FMA/PAdicMatmulFmaOp)",
        "tier": "C_test_coverage",
        "severity": "MEDIUM",
        "scope": [
          "src/op/arithmetic.rs:92 (matmul rank mismatch) - add Error::Shape variant-asserting test",
          "src/op/arithmetic.rs:417/431 (FMA input count) - add Error::Shape variant-asserting test",
          "src/op/arithmetic.rs:501 (PAdicMatmulFmaOp input count) - add Error::Shape variant-asserting test"
        ],
        "claim_boundary": "Test additions only."
      },
      {
        "id": "P474",
        "title": "Sugar method tests + # Examples doc-tests + run_conformance paths",
        "tier": "C_test_coverage",
        "severity": "LOW",
        "scope": [
          "P436 sugar method tests for div/transpose/flatten/gelu/softmax/layer_norm/gather/scatter/mean/max/min/matmul in tests/dsl_builder.rs (only add/sub/mul/relu/reshape/sum are sugar-tested today)",
          "Add # Examples doc-tests for ~30 pub fn in src/op/ (arithmetic.rs, shape.rs, nn.rs, index.rs, reductions.rs - currently 0 # Examples blocks)",
          "Positive-path tests for api.run_conformance and api.execute_padic_sum_products (currently only indirectly exercised)"
        ],
        "claim_boundary": "Test additions only."
      },
      {
        "id": "P475",
        "title": "README.md stale chapter/line-count fixes",
        "tier": "D_documentation_drift",
        "severity": "HIGH",
        "scope": [
          "README.md:25 '8-chapter tutorial walkthrough' -> '11-chapter tutorial walkthrough'",
          "README.md:82 '8-chapter book + 9 standalone' -> '11-chapter book + 18 standalone'",
          "README.md:80 '33k lines' -> '~59k lines' (actual src/**/*.rs wc -l = 58,944)"
        ],
        "claim_boundary": "README.md is not a paper-claim document. CLAIMS.md is unchanged."
      },
      {
        "id": "P476",
        "title": "scripts/README.md + ci.yml standalone count refresh",
        "tier": "D_documentation_drift",
        "severity": "HIGH",
        "scope": [
          "scripts/README.md:86 '17 standalone examples' -> '18 standalone examples' (P440 added proof_replay_witnesses)",
          ".github/workflows/ci.yml:111-115 comment '(132)' -> '(135)' and '17 standalone' -> '18 standalone' (matches actual ls counts: 18 examples, 135 tests)"
        ],
        "claim_boundary": "scripts/README.md and ci.yml are not paper-claim documents."
      },
      {
        "id": "P477",
        "title": "CHANGELOG / module_index / check_doc_consistency.sh / whatsnew polish",
        "tier": "D_documentation_drift",
        "severity": "MEDIUM",
        "scope": [
          "CHANGELOG.md:13/105 P418/P420 '17 standalone examples' annotation - append P440 note about proof_replay_witnesses",
          "docs/module_index.md:162 'The 8 ROCm/HIP pilot docs.' -> 'The 9 ROCm/HIP pilot docs.' (9 docs/rocm* files exist)",
          "scripts/check_doc_consistency.sh header refresh for post-P440 counts",
          "whatsnew.md:16 P416-P420 paragraph note about P440 bringing standalone 17->18"
        ],
        "claim_boundary": "docs/module_index.md is not a paper-claim document. docs/paper/* is unchanged."
      },
      {
        "id": "P478",
        "title": "Enrich ~28 Error::operator messages in src/op/arithmetic.rs with failing meta",
        "tier": "E_error_message_quality",
        "severity": "MEDIUM",
        "scope": [
          "Pattern '{op} only supports tensor inputs' / 'matmul only supports tensor inputs' / 'tensor dtype ... and ... must match' at lines 63/83/197/237/328/335/394/401/480/487/559/566/604/611/649/656/693/700/737/744/860/867/921/928/983/990/1034/1041",
          "Replace with format! that includes lhs.kind/rhs.kind/lhs.shape/rhs.shape/lhs.dtype/rhs.dtype"
        ],
        "claim_boundary": "Error message text only. Variants unchanged. Tests that assert contains() may need updates."
      },
      {
        "id": "P479",
        "title": "Enrich hip_softmax Error::backend messages with dtype/kind",
        "tier": "E_error_message_quality",
        "severity": "LOW",
        "scope": [
          "src/backend/hip_softmax.rs:613/626/697/717 'hip ... fp16 GELU bwd u16...' style messages lack offending kernel/precision combo",
          "Include kind and dtype in format args"
        ],
        "claim_boundary": "Feature-gated (rocm-hip) error messages only."
      },
      {
        "id": "P480",
        "title": "Align src/op/arithmetic.rs:11 comment with actual cpu.rs:2112 div-by-zero string",
        "tier": "E_error_message_quality",
        "severity": "LOW",
        "scope": [
          "src/op/arithmetic.rs:11 DivOp comment says 'Error::Domain(div by zero)' but src/backend/cpu.rs:2112 emits a richer message",
          "Update comment to reflect the actual emitted string so the doc comment is correct"
        ],
        "claim_boundary": "Doc comment only."
      }
    ],
    "claim_boundary_check": [
      "All P458+ phases are outside active_backlog because tests/paper_artifacts.rs 19 tests gate active_backlog to P248-P275-done state.",
      "None of the P458+ phases touch src/verify/{release_gate,semantic_conformance,hip_audit,theorems,claim_status}.rs (P466 only moves the wrapper mod.rs body, not the inner frozen files).",
      "None of the P458+ phases touch docs/paper/*.",
      "None of the P458+ phases flip any of the 8 *_claim_allowed flags in CLAIMS.md.",
      "Each P458+ phase includes an explicit claim_boundary field describing its scope limits.",
      "The post-P264 validation-maintenance guards (P265-P270) will continue to pass: the active_backlog structure is unchanged."
    ]
  },
  "validation_gates": [
    "cargo fmt --check",
    "cargo build --offline",
    "cargo test --offline",
    "bash scripts/check_doc_consistency.sh",
    "tests/paper_artifacts.rs 19 tests pass",
    "Theory contracts, theorem bindings, semantic conformance reports, support matrices, release gates, optional Lean timeout and success-transcript handling, schema guards, and generated paper artifacts are implemented and tested.",
    "ROCm/HIP hardware detection, dense i32 HIP add, p-adic valuation HIP helper, finite-site sheaf overlap helper, and valuation-stratified p-adic GEMM pilot execute behind feature gates",
    "Feature-gated p-adic benchmark artifacts emit dense CPU, certified sparse CPU, HIP-or-fallback rows",
    "Paper route through P247 is preserved",
    "JSC is the conditional first writing target",
    "no longer an active next backlog",
    "completed_phase_history",
    "implemented_functional_capabilities",
    "smoke_mock_or_scaffold_inventory",
    "generic GPU backend",
    "GpuScaffoldBackend remains a fallback-only planning scaffold with no runtime kernels",
    "accelerated-pilot feature",
    "GpuDenseI64PilotBackend selectable through the public prefer-gpu dense i64 add path",
    "ROCm/HIP p-adic GEMM",
    "runtime-shape pilot for small Q_5 precision-3 fixtures",
    "ROCm/HIP benchmark timing",
    "configurable warmup and repeated measured runs",
    "ROCm/HIP p-adic valuation helper",
    "planner-selectable through a ROCm/HIP lowering contract",
    "ROCm/HIP sheaf locality helper",
    "check all declared pairwise overlap equalities for tested finite covers",
    "preserve structured obstruction provenance",
    "optional Lean",
    "records optional Lean success transcripts when Lean is available",
    "strict TOKITAI_REQUIRE_LEAN failure mode",
    "submission venue status",
    "Journal of Symbolic Computation target verification packet",
    "machine-checkable missing-evidence fields",
    "\"active_backlog\"",
    "Detailed P200-P247 history lives in source files",
    "final validation records",
    "schema inventory"
  ]
}