Skip to content

formal(P0): mechanize the OCAP two-stream sequencing against the frozen algebra#239

Merged
hartsock merged 1 commit into
mainfrom
formal/two-stream-sequencing-proof
Jul 17, 2026
Merged

formal(P0): mechanize the OCAP two-stream sequencing against the frozen algebra#239
hartsock merged 1 commit into
mainfrom
formal/two-stream-sequencing-proof

Conversation

@hartsock

Copy link
Copy Markdown
Member

Confirms the two-stream sequencing does not violate the v0.3.1 spec

The OCAP two-stream sequencing decision (brush-first / ceremony-in-parallel, L3-gated brush default, safe-subset fallback) was a prose plan-of-record. This proves it is derivable inside the frozen algebra — no new law, no fourth axis — rather than merely asserting compatibility.

Lean — formal/Ceremony/P0/Boundary.lean

Imports only Authority.lean. lake build → 10 jobs, 0 sorry; formalGate clean.

  • boundaryVerdict_is_attenuation — the L3-gated decision is Effect.meet of the desired allow with the fence's enforceable ceiling. The frozen operation, not a bespoke one. The fence is enforcement strength (ADR 0002 I9 sandbox_kind), deliberately not a fourth Authority axis — it lands on Effect via the existing meet.
  • fallback_is_forced — the safe-subset fallback under advisory is the honest (non-overclaiming) brush verdict. Forced by I9, derived, not a separate policy knob.
  • minted_le_request / minted_le_enforceable — a grant never exceeds the request or what the fence can enforce (I9 "never overclaim"), from meet_le_*.
  • advisory_dynamic_grant_is_deny — containment-needing op with no kernel fence fails closed on Effect (L3/I5), for any ceiling.
  • proj_effect_meetthe convergence proof. Projection to the carrier brush enforces (Caveats) is a meet-homomorphism: Stream A enforces the ⊓-image of what Stream B proves. Layered-parallel converges (ADR 0020 D7 "siblings, not competitors", mechanized), conditional on brush not reinventing Caveats (ADR 0002 I3).

TLA+ — formal/tla/EnforcementGate.tla (+ two .cfg)

The one genuinely-new obligation: a fence can drop between grant and exec. TLC-checked both ways:

  • CheckAtExec = TRUE (re-check at exec, spec I4) → No error found (4 distinct states).
  • CheckAtExec = FALSE (cache grant-time fence) → Inv violated; TOCTOU trace AuthorizeDynamic; FenceDown; ExecDynamicadvisoryDynamicRan = TRUE.

Conclusion: the L3-gated brush default is spec-faithful iff enforcement re-checks the active fence at exec — which names the exact obligation for Stream A (newt#1243 Leg 1): the brush gate must not cache grant-time fence state.

Test plan

  • just check-formallake build (10 jobs) + formalGate, exit 0.
  • TLC both configs (fetched tla2tools locally): PASS with checkAtExec, VIOLATION-with-trace with cacheGrantFence.
  • Full pre-push gate passed on push ([pre-push] OK).

Risk

Low — additive to formal/ + one README row; touches no Rust, no CI/build config, deletes nothing. TLC scratch artifacts gitignored.

Refs: ADR 0002 (Caveats I3/I9/I10), ADR 0020 (Authority product lattice, D7), the DECIDED board note.

…en algebra

The two-stream sequencing decision (brush-first / ceremony-in-parallel, L3-gated
brush default, safe-subset fallback) was a prose plan-of-record. This proves it
does not violate the ratified v0.3.1 spec -- by showing it is DERIVABLE INSIDE
the frozen algebra, adding no new law and no fourth axis.

Ceremony/P0/Boundary.lean (imports only Authority.lean; lake build 10 jobs, 0
sorry, formalGate clean):
  - boundaryVerdict_is_attenuation: the L3-gated decision is Effect.meet of the
    desired allow with the fence's enforceable ceiling -- the frozen meet, not a
    bespoke operation.
  - fallback_is_forced: the safe-subset fallback under `advisory` IS the honest
    (non-overclaiming) brush verdict; it is derived from ADR 0002 I9, not a
    separate policy knob.
  - minted_le_request / minted_le_enforceable: a minted grant never exceeds the
    request or what the fence can enforce (I9 "never overclaim", via meet_le_*).
  - advisory_dynamic_grant_is_deny: a containment-needing op under no kernel
    fence fails closed on Effect (L3/I5), for any request ceiling.
  - proj_effect_meet (+ assurance/scope): projection to the enforced carrier is
    a meet-homomorphism -- the ADR 0020 D7 "siblings, not two competing models"
    claim, mechanized. Stream A (brush/Caveats) enforces the meet-image of what
    Stream B (ceremony/Authority) proves, so layered-parallel CONVERGES.

tla/EnforcementGate.tla (+ two .cfg): the temporal half -- a fence that DROPS
between grant and exec. NoAdvisoryDynamicExec (I9/I5 over time) holds iff the
gate re-checks the fence at exec (spec I4). TLC verified both ways:
  - CheckAtExec=TRUE  -> "No error has been found" (4 distinct states).
  - CheckAtExec=FALSE -> Inv violated; trace AuthorizeDynamic; FenceDown;
    ExecDynamic ends advisoryDynamicRan=TRUE. The design Stream A must NOT ship.

Net: the sequencing is spec-faithful, and it is spec-faithful IFF Stream A
re-checks the active fence at exec -- which names the exact obligation the brush
default carries. Records the confirmation next to the proofs; formal/README
updated; TLC scratch artifacts gitignored.

Refs: knowledge/board/2026-07-16_ocap-two-streams-sequencing-DECIDED.md,
ADR 0002 (Caveats I3/I9/I10), ADR 0020 (Authority product lattice, D7).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hartsock hartsock added the documentation Improvements or additions to documentation label Jul 17, 2026
@hartsock
hartsock merged commit 40f7621 into main Jul 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant