Skip to content

refactor(proofs): remove codegen fiction, name the scheduling-math source (#321 foundation) - #334

Merged
avrabe merged 3 commits into
mainfrom
feat/single-source-rta-321
Jul 21, 2026
Merged

refactor(proofs): remove codegen fiction, name the scheduling-math source (#321 foundation)#334
avrabe merged 3 commits into
mainfrom
feat/single-source-rta-321

Conversation

@avrabe

@avrabe avrabe commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Foundation toward #321 — does NOT close it. REQ-PROOF-SCHED-SPEC-SOURCE-001 (verified). The real generator that closes #321 is filed as REQ-PROOF-SCHED-CODEGEN-001 (proposed); #321 stays OPEN.

What the investigation found

A reflection probe (lake env lean over the elaborated Exprs) established that true generation is blocked this cycle:

  • ceilDiv/interference/rtaStep reflect cleanly (flat arithmetic Expr trees).
  • totalInterference compiles to List.brecOn/List.below — not a naive Expr walk.
  • the driver compute_response_time is a hand-written loop, not a syntactic image of iterN.

And critically: the existing Codegen.lean emits hardcoded Rust strings, so a byte-diff gate over it would only enforce .rs == Codegen-strings (both hand-written, neither read from the proofs) — theory↔code drift stays representable. That's generation cosplay; shipping it as #321 progress would be a #294/#331-class over-claim. Not done.

What this PR does (honest, verifiable)

  1. Corrects a false verification claim (claim-verification skill). scheduling_verified.rs claimed "generated by lake exe codegen — DO NOT EDIT" while its own top lines documented a hand-edit (div_ceil) and the generator only ever emitted 5 of the 12 functions it ships. The header now states the truth: hand-written to mirror the Lean defs, bound to them by the named property tests (ceil_div_matches_lean_definition, compute_response_time_matches_lean_spec, the jittered/blocking spec tests) that run in the CI Test gate — the executed oracle for the Rust↔Lean correspondence.
  2. Removes the footgun. Deletes proofs/Codegen.lean + its codegen lakefile exe. The documented lake exe codegen > scheduling_verified.rs would have silently deleted the 7 hand-added jittered/blocking/ISR functions.
  3. Keeps RTACore.lean — the combinational defs as a mathlib-free named single source the future generator will consume; RTA.lean proves the theorems over it.
  4. rivet: two REQs (foundation verified + generator proposed); fixes REQ-PROOF-SCHED-002's now-stale "existing RTA extraction" reference.

Verification

  • scheduling_verified property tests: 15/15 (the Rust↔Lean binding oracle) — logic unchanged, header is doc-only.
  • RTACore.lean builds mathlib-free locally (357ms). The full RTA.lean proof re-verify (theorems now typecheck against the relocated RTACore defs) is the CI lake build gate — the key thing to watch, since the def relocation is mechanical but only CI has mathlib.

Scope honesty

This removes a live footgun and a false "generated" claim, and names the spec source. It does not make the Rust generated from the proofs — #321's actual ask — which stays open as REQ-PROOF-SCHED-CODEGEN-001.

🤖 Generated with Claude Code

avrabe and others added 3 commits July 17, 2026 16:15
…abler, #321)

WIP toward #321. Splits the combinational RTA defs (Task, ceilDiv,
interference, totalInterference, rtaStep) out of RTA.lean (which imports
Mathlib.Tactic) into a mathlib-free RTACore.lean, so Codegen.lean can
import and reflect over the REAL definitions while staying mathlib-free
(the `lake exe codegen` exe builds in <1s, no mathlib). RTA.lean imports
RTACore and proves the theorems about those same defs.

RTACore.lean verified to build mathlib-free locally (lake build
Proofs.Scheduling.RTACore, 285ms). RTA.lean proof re-verification is
CI-gated (needs mathlib; not locally buildable here).

Not yet wired into Codegen.lean — the generator completion + byte-diff
drift gate follow. No Rust changes yet.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…urce (#321)

Honest foundation toward #321 (does NOT close it — see
REQ-PROOF-SCHED-CODEGEN-001). A reflection probe (lake env lean over the
elaborated Exprs) confirmed true generation is blocked this cycle: the
arithmetic defs reflect cleanly but `totalInterference` compiles to
List.brecOn and the driver loop is a template, not a syntactic image. And
a byte-diff gate over a *string* generator would only enforce
`.rs == Codegen-strings` (both hand-written) — it never checks the
strings against the proofs, so theory↔code drift stays representable.
That's generation cosplay; not shipped as #321 progress.

What this does instead:
- Corrects a false claim (claim-verification): scheduling_verified.rs
  read "generated by `lake exe codegen` — DO NOT EDIT" while its own top
  lines documented a hand-edit, and the generator only ever emitted 5 of
  the 12 functions it ships. Header now states the truth — hand-written
  to mirror the Lean defs, bound to them by the named property tests
  (ceil_div_matches_lean_definition, compute_response_time_matches_lean_spec,
  the jittered/blocking spec tests) that run in CI.
- Removes the footgun: deletes proofs/Codegen.lean + its lakefile exe.
  The documented `lake exe codegen > scheduling_verified.rs` would have
  silently deleted the 7 hand-added jittered/blocking/ISR functions.
- Keeps RTACore.lean: the combinational defs (Task, ceilDiv, interference,
  totalInterference, rtaStep) as a mathlib-free named single source that
  the future reflection generator will consume; RTA.lean proves the
  theorems over it.
- rivet: REQ-PROOF-SCHED-SPEC-SOURCE-001 (this, verified, v0.29.0) +
  REQ-PROOF-SCHED-CODEGEN-001 (the real generator, closes #321, proposed).
  Fixes REQ-PROOF-SCHED-002's now-stale "existing RTA extraction" ref.

scheduling_verified property tests: 15/15 (the Rust↔Lean binding oracle).
RTACore builds mathlib-free locally; RTA.lean proof re-verify is CI-gated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…n line (#321)

Clean-room caught a lingering false claim in a draft design-plan: it told
readers to "Generate Rust via lake exe codegen (existing infrastructure)"
— the infrastructure this release just removed as fiction. Annotated as
superseded, pointing at REQ-PROOF-SCHED-SPEC-SOURCE-001 (removal) and
REQ-PROOF-SCHED-CODEGEN-001 (the real generator, OPEN). Doc-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Rivet verification gate

20/20 passed

count
Passed 20
Failed 0
Skipped (no steps) 0

Filter: (and (= type "feature") (or (has-tag "v093") (has-tag "v0100")))

Failed artifacts

(none)

Updated automatically by tools/post_verification_comment.py. Source of truth: artifacts/verification.yaml.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe
avrabe merged commit c8c0450 into main Jul 21, 2026
19 checks passed
@avrabe
avrabe deleted the feat/single-source-rta-321 branch July 21, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

approach: single-source the scheduling math so the Lean proofs and the Rust analysis are generated, not manually extracted

1 participant