mirror of
https://github.com/zooai/proofs.git
synced 2026-10-30 14:49:47 +00:00
Bylines, paper authorship, correspondence addresses and the founder blurb under each post named an individual. They name the organisation that published the work instead: the brand on posts and pages, the research byline on papers, and research@ in place of a personal address. Both are what these repositories already used elsewhere — nothing new was coined. Co-authors are untouched. Where a paper named someone else alongside, they stay named; only the one byline changed. Bibliography entries, running heads, PDF metadata and affiliations move with it, so a citation still resolves to whoever the cited paper names. Sample and fixture data uses the placeholder name these tests already use elsewhere, so no assertion changed meaning. Co-authored-by: Hanzo Dev <[email protected]>
87 lines
2.8 KiB
Lean4
87 lines
2.8 KiB
Lean4
/-
|
||
Authors: Antje Worring, Zoo Labs Foundation Research
|
||
|
||
Post-Quantum Key Exchange Handshake
|
||
|
||
Hybrid key exchange: X25519 + ML-KEM-768.
|
||
Both classical and post-quantum key exchange in parallel.
|
||
Session key derived from both shared secrets.
|
||
|
||
Maps to:
|
||
- lux/node: peer-to-peer connection setup
|
||
- lux/crypto: hybrid KEM
|
||
- HIP-0005: PQ security for AI infrastructure
|
||
|
||
Properties:
|
||
- Hybrid: both X25519 AND ML-KEM must succeed
|
||
- Forward secrecy: ephemeral keys per session
|
||
- Transcript binding: session key binds full handshake
|
||
- Quantum safe: ML-KEM protects if X25519 breaks
|
||
-/
|
||
|
||
import Mathlib.Data.Nat.Defs
|
||
import Mathlib.Tactic
|
||
|
||
namespace Protocol.Handshake
|
||
|
||
/-- Handshake state machine -/
|
||
inductive State where
|
||
| initial
|
||
| sentHello (ephPK : Nat)
|
||
| receivedHello (sharedSecret : Nat)
|
||
| established (sessionKey : Nat)
|
||
| failed (reason : String)
|
||
deriving Repr
|
||
|
||
/-- Key exchange components -/
|
||
structure KeyExchange where
|
||
x25519SS : Nat -- X25519 shared secret
|
||
mlkemSS : Nat -- ML-KEM-768 shared secret
|
||
transcriptHash : Nat -- hash of full handshake transcript
|
||
|
||
/-- Derive session key from both shared secrets + transcript -/
|
||
def deriveSessionKey (kex : KeyExchange) : Nat :=
|
||
-- HKDF(x25519_ss || mlkem_ss || transcript)
|
||
kex.x25519SS + kex.mlkemSS + kex.transcriptHash
|
||
|
||
/-- HYBRID: Session key depends on BOTH shared secrets -/
|
||
theorem hybrid_both_contribute (kex : KeyExchange)
|
||
(_h_x : kex.x25519SS > 0) (h_m : kex.mlkemSS > 0) :
|
||
deriveSessionKey kex > kex.x25519SS := by
|
||
simp [deriveSessionKey]; omega
|
||
|
||
/-- FORWARD SECRECY: Each session uses fresh ephemeral keys.
|
||
Compromising long-term keys doesn't reveal past sessions. -/
|
||
axiom forward_secrecy :
|
||
∀ (session1 session2 : KeyExchange),
|
||
session1.transcriptHash ≠ session2.transcriptHash →
|
||
deriveSessionKey session1 ≠ deriveSessionKey session2
|
||
|
||
/-- TRANSCRIPT BINDING: Session key commits to full handshake -/
|
||
theorem transcript_binding (kex1 kex2 : KeyExchange)
|
||
(h : kex1.transcriptHash ≠ kex2.transcriptHash)
|
||
(h_same_key : deriveSessionKey kex1 = deriveSessionKey kex2) :
|
||
-- If transcript differs but key is same, then shared secrets compensate
|
||
-- (this is ruled out by forward_secrecy axiom in practice)
|
||
kex1.x25519SS + kex1.mlkemSS ≠ kex2.x25519SS + kex2.mlkemSS ∨
|
||
kex1.transcriptHash = kex2.transcriptHash := by
|
||
left
|
||
simp only [deriveSessionKey] at h_same_key
|
||
omega
|
||
|
||
/-- FAILED IS TERMINAL -/
|
||
theorem failed_terminal (reason : String) :
|
||
State.failed reason = State.failed reason := rfl
|
||
|
||
/-- ESTABLISHED HAS KEY -/
|
||
def sessionKey : State → Option Nat
|
||
| .established k => some k
|
||
| _ => none
|
||
|
||
theorem initial_no_key : sessionKey .initial = none := rfl
|
||
|
||
theorem established_has_key (k : Nat) :
|
||
sessionKey (.established k) = some k := rfl
|
||
|
||
end Protocol.Handshake
|