Skip to content

P3 (x86): one refinement theorem over the nine VM entries (VM Stage 3) - #153

Merged
losfair merged 1 commit into
losfair:mainfrom
CommaBot:p3-x86-vm-stage3
Dec 4, 2026
Merged

losfair merged 1 commit into
losfair:mainfrom
CommaBot:p3-x86-vm-stage3

Conversation

@CommaBot

@CommaBot CommaBot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

x86 VM Stage 3 of the P3 refinement. 251 files (194 added, 57 modified), +91,384 / −529, all under proofs/ except README.md and DESIGN.md. No crates/ or AArch64 changes.

What is proved

VEAnyX.outerS3 (P3/VmEntryS3Outer) is one theorem over the nine concrete x86 core entries (S3Ev):

  1. native system call
  2. VMEnter (VMX and SVM)
  3. ordinary unknown syscall
  4. trapped syscall
  5. host interrupt
  6. user exception
  7. VM fault
  8. stalled VCPU exit
  9. unstalled VCPU exit

Each entry starts from the joint VM state VEAnyX and that event's premises S3Pre, returns a related extended-spec outcome (S3Ev.Out), and ends in VEAnyX again, so the joint state chains VEAnyX → VEAnyX.

The syscall case (VmEptState.kernel_entryS3) proves the native-capability dispatcher cases, the invocation, receive and yield arms and the finish, which Stage 2 (VmEptState.kernel_entry) took as premises (KEntryArmsV, VDispNativeAt, EventFinishVE, VcpuExitFinishVE). The Stage 2 theorems are kept.

Premises

[J] facts about the entry's spec state

  • The joint state VEAnyX.
  • Native syscall, record StartS3: SInvXV (the native carried bundle without NativeScopeS), current thread not idle, SpecIoPorts, SpecUtZ, DevRangeS, GpmOutV, UtInv'', RV, IdleVtS. SInvXV is an entry [J] premise, as SInvX was before. It has no preservation theorem yet.
  • Other events: S3Fault and the scheduler, domain, FPU-owner, idle and clock facts of each event (see S3Pre).

[P] platform and hardware

  • The platform arguments of outerS3 (arch interface, agreement, timer, interrupt and store laws, including FpuImplDet, FpuWriteDet, StoreExt).
  • numDomains = 1.
  • The arch's virtualization code agrees with the spec's virtKind; retypeFanOutLimit = 256; resetChunkBits = 16.
  • StartS3.air (ArchIrqRel at each dispatch pair) and the hardware arguments of each event.

[S] scope

  • Serial core entry after the gate, one scheduling domain, single-core IRQ view.
  • Fresh and saved host vectors exclude the cross-core IPIs 126 and 127.
  • SelectedCoreScope for the invoked cap on the executing core: a SchedControl cap must name that core; an Untyped cap is covered only on core 0.
  • Native syscall numbers −11 through −1 with the trap flag clear. VMEnter (−23) needs a clear trap flag, an agreed enabled backend and a bound VCPU. The ordinary unknown and trapped syscall guards are as in Stage 2.

Assembly, hardware guest execution and the capture of the VCPU image and vector stay at the trusted boundary.

Non-vacuity

  • JBootQ.VWit.witness_schedControl and witness_untyped (P3/VmWitS3) give a concrete store, arch and spec state satisfying VEAnyX ∧ S3Pre: a runningVM guest with its VCPU, for SysCall on a SchedControl cap and SysNBSendWait on an Untyped cap.
  • A dispatch pair exists there (w_dispatch), and the invoked cap's core restriction is exercised at it (w_core_exercised), so the quantified fields air and core are not vacuous.
  • outer_schedControl and outer_untyped (P3/VmWitOuter) instantiate outerS3 at the witness with every platform argument about the arch and store discharged.
  • Left as [P] there, all about opaque Fl4Spec constants: OpaqueWK (one domain, maxTicksToUs, kernel WCET and timer unit, period bound, setDeadlineImpl determinism, a port-read value), virtKind = .vmx ∨ .svm, retypeFanOutLimit, resetChunkBits, FpuImplDet, FpuWriteDet.
  • The witness state is not shown to be reached from boot.

What remains open

  • No S3Pre preservation across entries, so no run of several entries is proved.
  • No VEAnyX state is produced from boot.
  • No non-vacuity witness for the non-syscall events' S3Pre.

Merged-statement audit (against main at 03ec12c9a)

A header check and a full-text definition-body check over the 54 modified .lean files. The remaining differences are:

  • FrameBatch (extended spec). performFrameBatch, fbRun, fbEntry and fbDelete become instances of new …With versions parameterized by the cap deletion. fl4PerformInvocationV / fl4PerformInvocationVF now route FrameBatch to capDeleteV / capDeleteVF, and PerformSubst includes that route. Native behaviour is unchanged.
  • performEptInvocation. The tableUnmap and frameUnmap arms no longer use an early return inside the match; the skipped setCap is now explicit. PORTING.md records the rule.
  • private removed from VmEptState.vcpuEnterJ, vmEnterEventGuard and VmEptState.faultIPEntry; statements unchanged.
  • Moved: vkeyF and NewOK from VmCnodeVtx to DeriveVt; text unchanged.

The scripts also flag DomPostA, IoCPost, domLabelOf, fbRun_supX, fbRun_subX, fk_fbRun and ik_fbRun. These are parsing artefacts: their text or statements are identical when compared directly.

Gate on the exact commit

On 3f052080d, afkprover:

  • Full root lake build: 10881 jobs, 0 errors, 0 sorry (seeded from an earlier Lake cache of the same line; 361 s, peak single lean RSS 5.2 GB). Source hashes checked before and after the build.
  • Axiom check: 39 of 39 listed names depend only on propext, Classical.choice, Quot.sound.

No sorry, admit, native_decide, bv_decide or new axiom.

🤖 Generated with Claude Code

`VEAnyX.outerS3` covers native syscalls, VMEnter on VMX and SVM, ordinary
unknown and trapped syscalls, host interrupts, user exceptions, VM faults,
and stalled and unstalled VCPU exits. Each entry takes the joint VM state
`VEAnyX` and the event's premises `S3Pre`, and returns a related
extended-spec outcome at `VEAnyX`.

The syscall case (`VmEptState.kernel_entryS3`) proves the dispatcher,
invocation, receive, yield and finish arms that Stage 2 took as premises.
The extended spec's FrameBatch is parameterized by the cap deletion it
uses, and the VM-aware step uses `capDeleteVF`.

A concrete state with a running guest and its VCPU satisfies `VEAnyX` and
`S3Pre` for a SchedControl and an Untyped invocation, and `outerS3` applies
there up to premises on opaque spec constants.

Open: the post does not re-establish `S3Pre`, no `VEAnyX` state is produced
from boot, and the other events' `S3Pre` have no witness. Premises are
listed in DESIGN.md section 9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@losfair
losfair merged commit 736611d into losfair:main Dec 4, 2026
1 check failed
CommaBot added a commit to CommaBot/FL4 that referenced this pull request Dec 4, 2026
…/a64-p3-entry

DESIGN.md keeps both bullets (the A64 delete-hook [S] scope and the x86 Stage 3 notes); the A64 root keeps both import sets.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
CommaBot added a commit to CommaBot/FL4 that referenced this pull request Dec 4, 2026
…losfair#153); only the root import list conflicted

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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