Skip to content

P2 (AArch64): the fl4-sync gate and locks refine the gate model, with the CDT and IPC-buffer history (DESIGN §9 item 4) - #149

Merged
losfair merged 1 commit into
losfair:mainfrom
CommaBot:pr/p2-gate
Dec 1, 2026

Conversation

@CommaBot

@CommaBot CommaBot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

DESIGN §9 item 4, both halves, for AArch64. One commit on main @ c98a08b1c (after #146 and #147): 34 files, +9216 / −199. No Rust changes (nothing under crates/). No x86 statement changes.

Half 1 (the history along an execution). A replay record InvR beside InvH; P1's MDB tree facts hold of the replayed history (MdbSH) along every execution of the local-path family, every slot's edit being one of P1's (SlotWireP). The top family is fl4LocPBL (DelLkA): the Delete-with-PTE start needs the CDT facts only at its own locked slots (CdtAtL), discharged from the history, so the all-slot MdbLk / NullLk [J] is gone. The IPC-buffer words are gate-owned, so BufSH is kept along an execution and gives the PTE slots' bufU. Boot corollaries at w0/w1 (w0_serial_mdbL, w1_serial_mdbL).

Half 2 (the gate and the locks themselves). proofs/Fl4P2Base/GateImpl.lean hand-transcribes fl4-sync's gate (try_enter_local, leave_local, acquire, the serial body, release) and fl4-store's lock table (try_lock_object, unlock_held), plus hardware writes, as ICfg / IStepG / IStepL / IStepHw (listed in TRUSTED with its modelling choices). impl_sim matches every runtime step by zero or one gate-model step (StepR: a Serial.Step, or a racy speculative read returning another value; on gate- or core-class words a value of the current class), keeping Rel and the lock invariant LkInv; hardware writes during a pending serial body are deferred and replayed after the model's serial at the release's decisive store. Racy reads are covered by weak safety SafeW from the same per-path certificates. impl_execPA / serializable_implPA (GateExecA): every runtime execution from boot is an FL4 execution, and where no local path runs and no body is pending its memory is the serial run of the completed entries; w0_serializable_impl / w1_serializable_impl (GateBootA) at the boot witnesses for fl4LocPBL.

Premises and hypotheses.

  • Named premises added: [P] MM-SB, MM-DRF, MM-RACY, IPI (the transcription's step granularity, stated in GateImpl's docstring; no Lean hypothesis carries them). IHwPA is HwStepPA's existing [P] moved to the runtime. No [W].
  • Theorem hypotheses left to the serial-kernel side: hSer / hSerB (serial entries keep MdbSH / BufSH; AArch64 P1 / S1A) and BufSH at w0/w1 (S1A / Boot).
  • Not yet proved: the Half 1 history facts along the weak executions ExecPAR (proved along ExecPA).

Merge with #146. Text conflicts only: proofs/Fl4ProofsA64.lean (union of imports, no duplicates) and DESIGN.md §9 status (main's w1_sysL kept; this PR's item-4 bullets added; the "Not yet proved" bullet reconciled: SysL at w1 is no longer listed). No proof conflicts. Existing declarations: 0 statement changes against the pre-rebase branch.

Checks.

  • Fl4ProofsA64 root build on this tree: 0 errors, 0 sorry, "Build completed successfully (5755 jobs)". Module builds of every changed module and its users (the gate files, the A64 P2 files of this PR, and the x86 Fl4Proofs.P2 re-export modules): 0 errors, 0 sorry (5548 jobs).
  • Axioms: sweep of all 18882 constants under Fl4ProofsA64.P2 and Fl4Proofs.P2 (Fl4P2Base): 0 outside propext / Classical.choice / Quot.sound; plus 109 #print axioms on the gate files' and GateBootA's theorems: 68 [propext, Classical.choice, Quot.sound], 21 [propext], 3 [propext, Quot.sound], 17 none, 0 sorryAx.
  • No sorry / admit / native_decide / bv_decide / axiom / maxHeartbeats in the diff; every new module is imported from Fl4ProofsA64.
  • python3 xtask/scripts/port_p2_a64.py --check proofs: exit 0.
  • No x86 root build: the x86 users of Fl4P2Base are the unchanged re-export modules Fl4Proofs.P2.Serial / SerialHw / SafeCert / SerialSafe, built as modules. proofs/Fl4Proofs.lean adds four imports, Fl4P2Base.SerialW / GateImpl / GateLock / SafeW (all built in the module and A64 builds; no name collision with x86 Fl4Proofs.P2.GlueAdeq).

🤖 Generated with Claude Code

… the CDT and IPC-buffer history (DESIGN §9 item 4)

DESIGN §9 item 4, both halves, for AArch64. One commit on `main` @ `c98a08b1c` (after losfair#146 and losfair#147): 34 files, +9216 / −199. No Rust changes (nothing under `crates/`). No x86 statement changes.

**Half 1 (the history along an execution).** A replay record `InvR` beside `InvH`; P1's MDB tree facts hold of the replayed history (`MdbSH`) along every execution of the local-path family, every slot's edit being one of P1's (`SlotWireP`). The top family is `fl4LocPBL` (`DelLkA`): the Delete-with-PTE start needs the CDT facts only at its own locked slots (`CdtAtL`), discharged from the history, so the all-slot `MdbLk` / `NullLk` [J] is gone. The IPC-buffer words are gate-owned, so `BufSH` is kept along an execution and gives the PTE slots' `bufU`. Boot corollaries at w0/w1 (`w0_serial_mdbL`, `w1_serial_mdbL`).

**Half 2 (the gate and the locks themselves).** `proofs/Fl4P2Base/GateImpl.lean` hand-transcribes fl4-sync's gate (`try_enter_local`, `leave_local`, `acquire`, the serial body, `release`) and fl4-store's lock table (`try_lock_object`, `unlock_held`), plus hardware writes, as `ICfg` / `IStepG` / `IStepL` / `IStepHw` (listed in `TRUSTED` with its modelling choices). `impl_sim` matches every runtime step by zero or one gate-model step (`StepR`: a `Serial.Step`, or a racy speculative read returning another value; on gate- or core-class words a value of the current class), keeping `Rel` and the lock invariant `LkInv`; hardware writes during a pending serial body are deferred and replayed after the model's `serial` at the release's decisive store. Racy reads are covered by weak safety `SafeW` from the same per-path certificates. `impl_execPA` / `serializable_implPA` (`GateExecA`): every runtime execution from boot is an FL4 execution, and where no local path runs and no body is pending its memory is the serial run of the completed entries; `w0_serializable_impl` / `w1_serializable_impl` (`GateBootA`) at the boot witnesses for `fl4LocPBL`.

**Premises and hypotheses.**
- Named premises added: [P] MM-SB, MM-DRF, MM-RACY, IPI (the transcription's step granularity, stated in `GateImpl`'s docstring; no Lean hypothesis carries them). `IHwPA` is `HwStepPA`'s existing [P] moved to the runtime. No [W].
- Theorem hypotheses left to the serial-kernel side: `hSer` / `hSerB` (serial entries keep `MdbSH` / `BufSH`; AArch64 P1 / S1A) and `BufSH` at w0/w1 (S1A / Boot).
- Not yet proved: the Half 1 history facts along the weak executions `ExecPAR` (proved along `ExecPA`).

**Merge with losfair#146.** Text conflicts only: `proofs/Fl4ProofsA64.lean` (union of imports, no duplicates) and `DESIGN.md` §9 status (main's `w1_sysL` kept; this PR's item-4 bullets added; the "Not yet proved" bullet reconciled: `SysL` at w1 is no longer listed). No proof conflicts. Existing declarations: 0 statement changes against the pre-rebase branch.

**Checks.**
- `Fl4ProofsA64` root build on this tree: 0 errors, 0 sorry, "Build completed successfully (5755 jobs)". Module builds of every changed module and its users (the gate files, the A64 P2 files of this PR, and the x86 `Fl4Proofs.P2` re-export modules): 0 errors, 0 sorry (5548 jobs).
- Axioms: sweep of all 18882 constants under `Fl4ProofsA64.P2` and `Fl4Proofs.P2` (`Fl4P2Base`): 0 outside propext / Classical.choice / Quot.sound; plus 109 `#print axioms` on the gate files' and `GateBootA`'s theorems: 68 `[propext, Classical.choice, Quot.sound]`, 21 `[propext]`, 3 `[propext, Quot.sound]`, 17 none, 0 `sorryAx`.
- No sorry / admit / native_decide / bv_decide / axiom / maxHeartbeats in the diff; every new module is imported from `Fl4ProofsA64`.
- `python3 xtask/scripts/port_p2_a64.py --check proofs`: exit 0.
- No x86 root build: the x86 users of `Fl4P2Base` are the unchanged re-export modules `Fl4Proofs.P2.Serial` / `SerialHw` / `SafeCert` / `SerialSafe`, built as modules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@losfair
losfair merged commit c16cc0a into losfair:main Dec 1, 2026
1 check failed
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.

2 participants