Skip to content

proofs: add standalone AArch64 Fl4SpecA64 ↔ l4v ASpec equivalence suite - #157

Open
CommaBot wants to merge 1 commit into
losfair:mainfrom
CommaBot:spec-equiv-a64
Open

CommaBot wants to merge 1 commit into
losfair:mainfrom
CommaBot:spec-equiv-a64

Conversation

@CommaBot

@CommaBot CommaBot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a standalone, machine-checked Lean 4 equivalence suite under proofs/Fl4SpecEquivA64/ proving single-step equivalence (conditional on CallKernelSafe) between FL4's AArch64 MCS abstract specification (proofs/Fl4SpecA64/, frozen at losfair/FL4@ed6b92799) and upstream Isabelle/HOL seL4/l4v AArch64 MCS ASpec (seL4/l4v@f44de69e426184f5edff14aeb8d8e03385f33c01, seL4@c98d70ad), plus a concise PORTING.md note documenting the init_kheap high-IRQ CNode difference.

Zero changes to proofs/Fl4SpecA64/*.lean, proofs/Fl4Proofs.lean, proofs/Fl4ProofsA64.lean, crates/, or xtask/. Not imported by Fl4Proofs.lean or Fl4ProofsA64.lean, so existing P0–P3 builds and CI are completely unaffected.

What is included (98 files, +38,884)

  • proofs/Fl4SpecEquivA64/L4vRefA64/** (92 Lean 4 files, 36,446 lines, 1,308 public theorems, 0 errors, 0 warnings, 0 sorry):
    • Prim.lean + Spec/*.lean + Spec.lean (63 frozen modules): read-only Isabelle/HOL ASpec reference mechanically emitted by tools/emit_l4v_ref.py from Isabelle2025-2 kernel export aspec-full.jsonl (SHA-256 5b45f4611d1987a6a6f5257530805dc1f3cbbe8efd02d8e1aedbb7b16a245665, verified 0-diff idempotent).
    • Rel/ (3 modules) + Patched.lean (1 module): explicit state/monad/embedding relations and minimal divergence overlay isolating only the 6 documented PORTING.md behavioral deltas.
    • Equiv/*.lean (24 modules): full-stack equivalence from Machine/Types/Structures through KHeap, CSpace, VCPU, VSpace, Arch, Retype, SchedContext, Schedule, Tcb, Ipc, Interrupt, Decode, Init, and Syscall (patched_callKernel_equiv), plus:
      • 7/7 blind-validation fix proofs directly against unmodified L4vRefA64.Spec (confirming all 7 do-block early-return return () bugs caught on 82371d59 are fixed on ed6b92799: disableVirtTimer, vcpuDisable, vcpuInvalidateActive, associateVcpuTcb, prepareThreadDelete, performPgInvUnmap, performPtInvUnmap);
      • 15 explicit *_delta divergence theorems directly against unmodified L4vRefA64.Spec covering all 6 documented PORTING.md deltas (ntfnBits 5 vs 6, lookup_ipc_buffer slot 4 vs 2, make_arch_fault_msg +1 label offset, tcb_cnode_map 5 vs 7 slots, end_timeslice .RunningVM, user_vtop 2^44-1 vs 2^47-1 / decodeVsInvFlush) plus the 1 Bucket A finding (init_kheap 512 BitVec 9 vs 8,192 BitVec 13 IRQ CNodes, 7,680 extra empty CNodes at 512 ≤ irq < 8192);
      • Equiv/Witness.lean (11 mechanized non-vacuity witness theorems): directly instantiating patched_callKernel_equiv on both .SyscallEvent .SysYield and .Interrupt, plus schedule_equiv, performPgInvUnmap_equiv_direct, performPtInvUnmap_equiv_direct, invokeTcb, invokeIrqControl, invokeIrqHandler (SetIRQHandler), archPerformInvocation (MakePool + PageUnmap), and doReplyTransfer (conditional only on ConfigRel — consistent with opaque kernelConfig in Fl4SpecA64/Machine.lean:198 — and OpaqueRel RestRel).
    • Manifest.lean: #print axioms audit across 65 top-level, blind-validation, delta, subsystem, and non-vacuity witness theorems.
  • proofs/Fl4SpecEquivA64/tools/ (3 files): ExportASpec.ML (Isabelle2025-2 typed HOL kernel exporter), emit_l4v_ref.py (deterministic Lean 4 emitter), and build.py (parallel incremental builder + enforced zero-warning and ≥65 standard-axiom gate).
  • proofs/Fl4SpecEquivA64/{README.md,REPORT.md}: reproduction guide, TCB disclosure (ExportASpec.ML, emit_l4v_ref.py, Prim.lean), and complete audit report.
  • proofs/Fl4SpecA64/PORTING.md (+17): documents the init_kheap high-IRQ CNode difference and links to proofs/Fl4SpecEquivA64/REPORT.md.

Verification

  • Build & enforced axiom/warning gate (tools/build.py on afkprover, Lean 4.36):
    • Full authored rebuild + in-repo layout verification: 92/92 modules green, 0 errors, WARNINGS=0, AXIOM_AUDIT PASS: 65/65 theorems strictly standard (⊆ {propext, Classical.choice, Quot.sound}; 63 standard, 2 zero-axiom; 0 sorryAx, 0 custom axioms).
    • Negative gate self-tests verified: sorryAx, custom axioms, compiler warnings, and <65 audited theorems are all rejected with non-zero exit code.
  • Proof hygiene (all 92 .lean files): 0 sorry, 0 admit, 0 bv_decide, 0 native_decide, 0 axiom, 0 unsafe, 0 implemented_by, 0 @[extern, 0 unconstrained state quantifiers in *Safe predicates.
  • Independent reviews: Passed independent Architect static/non-vacuity audit and independent Fable (claude-fable-5-2) static review (APPROVE, 0 P0, 0 P1).

Add standalone machine-checked equivalence suite under proofs/Fl4SpecEquivA64/
proving single-step equivalence, conditional on CallKernelSafe, between
Fl4SpecA64 (losfair/FL4@ed6b92799) and upstream Isabelle/HOL seL4/l4v AArch64
MCS ASpec (f44de69e426184f5edff14aeb8d8e03385f33c01):

- proofs/Fl4SpecEquivA64/L4vRefA64/** (92 Lean 4 files, 36,447 lines, 1,308
  public theorems, 0 errors, 0 warnings, 0 sorry):
  - 63 frozen emitted Spec + Prim modules mechanically generated from Isabelle
    ASpec export (verified 0-diff idempotent)
  - Rel/ + Patched.lean + 24 Equiv/ modules including top-level
    patched_callKernel_equiv, all 7 blind-validation fix theorems, all 15
    explicit divergence (*_delta) theorems, and 11 concrete non-vacuity
    witnesses in Equiv/Witness.lean (conditional on ConfigRel & OpaqueRel)
  - Manifest.lean auditing #print axioms across 65 theorems strictly within
    {propext, Classical.choice, Quot.sound}
- proofs/Fl4SpecEquivA64/tools/ (ExportASpec.ML, emit_l4v_ref.py, build.py):
  build.py enforces 0 warnings on non-frozen modules and audits all >=65
  Manifest #print axioms entries (rejecting sorryAx / custom axioms)
- proofs/Fl4SpecEquivA64/{README.md,REPORT.md}
- proofs/Fl4SpecA64/PORTING.md: document init_kheap high-IRQ CNode difference
  (512 BitVec 9 vs 8,192 BitVec 13; 7,680 extra empty CNodes at 512 <= irq < 8192)

Not imported from Fl4Proofs.lean or Fl4ProofsA64.lean; zero impact on existing
P0-P3 builds or CI.
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.

1 participant