After 6.5 million lines of Lean: the held-out spec gate is the part of AlphaProof Code worth copying

The most valuable thing in those 6.5 million lines is the spec the AI was not allowed to edit. On 2026-11-10 Google DeepMind released AlphaProof Code: five people, four weeks, AI agents writing roughly 6.5 million lines of machine-checked Lean proofs over the compiled machine code of Signal's core implementation (per unite.ai and mlq.ai, 2026-11-10; Jiqizhixin, 36Kr and 21Jingji covered it on 2026-11-11 alongside the general availability of Gemini 4 Carbon). For scale: the seL4 microkernel verification took about twenty person-years.

The number is easy to remember and the mechanism is easy to miss. If the takeaway is "AI can now write formal proofs", almost nothing was learned.

How AlphaProof Code gets proofs down to AArch64 machine code

It did not verify a protocol diagram, and it did not stop at source. The team compiled unmodified libsignal v0.105.4 and the spqr v1.6.0 crate with stock rustc into a statically linked AArch64 Linux executable, wrapped it in a small CLI harness, and loaded that binary into Lean alongside a formal model of the AArch64 instruction set. Coverage is roughly 140,000 instructions. The trusted base underneath is about 18,000 lines of specification plus 8,000 lines of AArch64 semantics (another accounting puts the combined figure near 26,000 lines). What matters is the target: the bytes that actually run on a device, not the algorithm as described in a paper.

The properties cover one-to-one sessions over the PQXDH handshake and the Triple Ratchet: forward secrecy, authentication, post-compromise security, and handshake secrecy. A typical campaign ran 40 to 80 agents on one machine for 24 to 72 hours, with orchestrator, team lead, architect and integrator roles maintaining a shared proof base. Specs were drafted and cross-reviewed by Gemini 4 Carbon and Claude Opus 5.5 -- deliberately from different model families -- and approved one by one by humans. All proof code came from the Carbon agent teams; none of the five authors wrote a line of it (per unite.ai, 2026-11-10).

The step in formal verification everyone skips: the held-out spec gate

Let a model write proofs and the nastiest failure mode is not a wrong proof. It is a quietly simplified exam. Leave the theorem name alone, loosen one low-level definition -- say, change "attacker learns the state at time t" into "attacker learns nothing" -- then prove it again. Lean's kernel still accepts, and on paper you still have 6.5 million lines of "proof". This is not hypothetical: the paper lists it explicitly as a known risk of agent-generated proofs, that a specification can be weakened indirectly through one of its definitions.

DeepMind's gatekeeper therefore requires two conditions in series, and accepts nothing missing either:

  • Kernel check: Lean's trusted kernel actually type-checks the proof, using only Lean's standard axioms.
  • Comparator: a held-out, human-approved copy of the spec is compared against every transitive definition the proof relies on, including definitions referenced by other definitions. Everything must match.

Agents may propose small amendments when a proof exposes a spec problem, but changing trusted assumptions needs human approval or an explicit user-set policy, and every change is logged with a justification. About one percent of the codebase ended up flagged for extra human attention.

None of this structure is new -- it is the same engineering rule as "tests must not be generated by the code under test". What is new is applying it to AI-generated artifacts, and applying it thoroughly: the generator has no write access to the spec, and the comparator removes even the option of glancing at the copy and casually aligning with it.

Negative tests: reintroduce two old bugs

A passing proof only tells you the spec is not broken. So the team ran it backwards: they reverse-applied the fixes for two long-repaired libsignal bugs -- weak state, and a missing small-subgroup check in the PQXDH responder -- recompiled, and asked the system to show the security theorem fails. Both runs produced machine-checked counter-proof that the binaries violate the theorem (per unite.ai and mlq.ai, 2026-11-10). Writing the specs also surfaced 15 gaps or bugs in a published computational analysis of the Double Ratchet. The study reports no new vulnerabilities in libsignal.

Being able to falsify matters more than being able to prove. A verification pipeline that only ever prints ACCEPT is barely distinguishable from no verification; stable REJECT against known-bad samples is evidence the spec actually constrains something. That holds for any gate over AI-generated code, Lean or not.

Boundaries: machine-checked does not mean Signal is secure

Stating its own limits clearly is more professional than the headline number. What was verified is one-to-one sessions in the libsignal-cli build running as a fresh process: group messaging is future work, key generation was not verified, side channels and multi-device state are out of scope; low-level cryptographic primitives and selected library routines are represented by trusted contracts; the symbolic proof assumes perfect cryptography; the computational proof covers classical attackers only and does not establish the post-quantum healing SPQR is designed to add; at sufficiently large message and session scales the computational model becomes vacuous. The trusted base still includes Lean's kernel, the crypto contracts, the AArch64 semantics and that human-approved spec. Every layer has to be trusted.

Two other stories from the same 24 hours read well through this lens. Aiera reported on 11-11 that NVIDIA's OpenShell entered the CNCF Sandbox, under the headline that prompt-level defenses are no longer enough: kernel-isolated sandboxes, declarative YAML policies over filesystem, network, process and credentials, credentials injected only into requests bound for approved endpoints -- and, neatly, formal verification rehearsing what new access a policy change would grant before it is approved (per NVIDIA Blog and unite.ai, 2026-11-10). The Decoder reported on 11-10 that eight countries plus OpenAI, Anthropic, Microsoft and Mistral signed a Paris declaration committing to shutdown mechanisms, independent audits and disclosure of known risks, without binding sanctions. Three different layers, one shift: trust in AI-generated artifacts is moving from "have another model take a look" to criteria that are independent, checkable, and immutable by the generator.

Hands-on: move the held-out gate into your own CI

No Lean required, and no forty agents. The stdlib-only script below reproduces the gatekeeper pattern: freeze the spec into a separate file and hash it, compare every definition with a comparator, verify the property with a real assertion in kernel_check, then hand it a deliberately weakened proof and see whether the gate catches it. Run python gatekeeper.py.

# gatekeeper.py - stdlib only. Run: python gatekeeper.py
import hashlib, json

# The frozen, human-approved spec. The generator never gets write access.
SPEC = {
    "theorem": "forward_secrecy_toy",
    "defs": {
        "compromised": "attacker knows state at time t",
        "past_secret": "message key deleted after use",
        "secure": "attacker cannot read messages before t",
    },
}
with open("spec.frozen.json", "w") as f:
    f.write(json.dumps(SPEC, sort_keys=True, indent=2))

def digest(obj):
    return hashlib.sha256(
        json.dumps(obj, sort_keys=True).encode("utf-8")
    ).hexdigest()

FROZEN = digest(SPEC)

def comparator(proof_defs):
    # Compare EVERY definition, not just the theorem name.
    if set(proof_defs) != set(SPEC["defs"]):
        return False, "definition set changed"
    for k in SPEC["defs"]:
        if proof_defs[k] != SPEC["defs"][k]:
            return False, "definition drift: " + k
    return True, "ok"

def kernel_check(proof):
    # Stand-in for Lean: evaluate the property against a real trace.
    past_key = "K0"
    current_state = {"key": "K1", "history_keys": []}
    leaked = past_key in current_state["history_keys"]
    return (not leaked) and proof["theorem"] == SPEC["theorem"]

def gate(proof):
    ok, why = comparator(proof["defs"])
    if not ok:
        return "REJECT", why
    if proof["theorem"] != SPEC["theorem"]:
        return "REJECT", "theorem swapped"
    if not kernel_check(proof):
        return "REJECT", "kernel check failed"
    return "ACCEPT", "kernel ok + spec matches " + FROZEN[:12]

honest = {"theorem": "forward_secrecy_toy",
          "defs": dict(SPEC["defs"])}
cheat = {"theorem": "forward_secrecy_toy",
         "defs": dict(SPEC["defs"])}
cheat["defs"]["secure"] = "attacker cannot read messages (assumed true)"

for name, proof in [("honest", honest), ("weakened-def", cheat)]:
    print(name, "->", gate(proof))

Expect honest -> ('ACCEPT', 'kernel ok + spec matches ...') on the first line and weakened-def -> ('REJECT', 'definition drift: secure') on the second. Note the cheat never touched the theorem name and would have passed the kernel check; the comparator is the only thing that stopped it. That is the entire reason the held-out copy exists.

Wiring it into a pipeline, add two hard constraints: a changed frozen spec fails the build instead of auto-passing, and any REJECT in the gate log counts as failure.

# In CI: a changed frozen spec needs human approval, not a green build.
git diff --exit-code -- spec.frozen.json || { echo "spec change needs review"; exit 1; }
python gatekeeper.py > gate.log
! grep -q "REJECT" gate.log && grep -q "ACCEPT" gate.log

Mapping this onto everyday work is direct: let an agent change a schema, edit a permission policy or write a migration script, but keep the acceptance cases somewhere it cannot write, compare them one by one, and keep a few known-failing negative samples. OpenShell rehearsing newly granted access before approving a policy change is the same idea in a different layer.

6.5 million lines is a handsome number; the 26,000 lines of spec are the center of gravity. Taking the spec away from the generator is the one step in this pipeline you cannot skip -- you do not need Lean and you do not need dozens of agents, you only need the proof writer and the exam writer to be different processes.

Further reading

Feedback

Diese Seite ist rein front-end: kein Backend, keine Konten. Feedback geht an GitHub Issues, Discussions oder E-Mail.

Füge dies in das Issue oder die E-Mail ein, um mir zu helfen, das Problem zu finden – es enthält nichts von dem, was du eingegeben hast

Auch:Vorhandenes Feedback ansehen · Feedback per E-Mail (ohne GitHub-Konto):278975598@qq.com