Files
zeekayandHanzo Dev 0b87d2a9f2 Publish under the org, not a person
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]>
2026-09-17 13:12:21 -07:00

476 lines
21 KiB
Lean4

/-
Quasar Consensus Composition
Models the adversarial security of Quasar consensus across three chains,
each protected by an independent cryptographic hardness assumption:
- P-Chain: BLS12-381 aggregate signatures (discrete log over pairing groups)
- Q-Chain: Corona threshold lattice signatures (Module-LWE / Module-SIS;
Ringtail-derived parameter regime)
- Z-Chain: ML-DSA-65 identity signatures rolled up via Groth16 (Module-LWE)
MAIN THEOREM (quasar_triple_defense):
An adversary that forges a finalized QuasarCert must have broken
all three hardness assumptions: DiscreteLog AND ModuleSIS AND ModuleLWE.
Proof strategy: contrapositive on each component.
If any one assumption holds, the corresponding signature layer is
unforgeable, so the composite certificate cannot be forged.
Axiom budget:
- AdvBreak (adversary capability predicate)
- HonestlyProduced, ProducedBy (certificate provenance predicates)
- protocol_correctness (the protocol emits certificates that verify)
- bls_unforgeable, corona_unforgeable, mldsa_rollup_unforgeable
(each: assumption holds => the adversary cannot produce that layer)
All theorems proved by contradiction against the unforgeability axioms.
Zero sorry gaps.
Maps to:
- lux/consensus/protocol/quasar/quasar.go:389: (*signer).TripleSignRound1
- lux/consensus/protocol/quasar/types.go:68: QuasarCert
- lux/consensus/protocol/quasar/types.go:190: (*QuasarCert).VerifyWithRealKeys,
the verifier engine/pq/engine.go:131 calls on a decoded certificate
Authors: Lux Research, Woo Bin
Lux Industries Inc
-/
import Mathlib.Data.Nat.Defs
import Mathlib.Tactic
namespace Quasar.Consensus
-- ============================================================================
-- 1. Hardness Assumptions
-- ============================================================================
/-- Cryptographic hardness assumptions underlying the three layers.
Each is modeled as a predicate: "assumption X holds" means no
efficient adversary can solve the corresponding problem. -/
inductive Assumption where
| DiscreteLog : Assumption -- ECDL over BLS12-381 pairing groups
| ModuleSIS : Assumption -- Module-SIS (Corona, short vector)
| ModuleLWE : Assumption -- Module-LWE (ML-DSA-65, noisy inner product)
/-- An adversary is an abstract entity that may or may not break assumptions. -/
structure Adversary where
id : Nat
/-- AdvBreak adv assumption: the adversary has broken the given assumption.
Axiomatized because the actual breaking is a computational event
outside the scope of this algebraic proof. -/
axiom AdvBreak : Adversary → Assumption → Prop
-- ============================================================================
-- 2. QuasarCert: Triple Signature Certificate
-- ============================================================================
/-- A QuasarCert bundles three independent signature aggregates.
A finalized block carries exactly one of these.
Fields model the verification result of each layer:
- blsValid: BLS12-381 aggregate reached quorum on P-Chain
- coronaValid: Corona threshold lattice sig verified on Q-Chain
- mldsaValid: Groth16 proof of N ML-DSA-65 sigs verified on Z-Chain -/
structure QuasarCert where
round : Nat
blockHash : Nat
blsValid : Bool -- BLS12-381 aggregate reached quorum (P-Chain)
coronaValid: Bool -- Corona threshold sig verified (Q-Chain)
mldsaValid : Bool -- Groth16 rollup of ML-DSA-65 sigs verified (Z-Chain)
quorum : Nat -- required threshold (2f+1 out of 3f+1)
blsCount : Nat -- number of valid BLS signatures aggregated
-- ============================================================================
-- 3. Adversary Model
-- ============================================================================
-- A certificate's three verification bits do not say who produced it: a
-- forgery and an honestly finalized certificate carry identical fields,
-- which is exactly why unforgeability is a statement about production
-- rather than about the wire format. Provenance is therefore a separate
-- predicate, and the security definition below is relative to it.
/-- The certificate was assembled by an honest quorum running
`(*signer).TripleSignRound1` (`protocol/quasar/quasar.go:389`).
Opaque: honest production is a protocol event, not a function of the
certificate's fields. -/
axiom HonestlyProduced : QuasarCert → Prop
/-- This adversary produced the certificate. Opaque for the same reason
as HonestlyProduced. -/
axiom ProducedBy : Adversary → QuasarCert → Prop
/-- The adversary produced this certificate and no honest quorum did.
The second conjunct is the freshness condition of the EUF-CMA game:
replaying a certificate the honest signers emitted is not a forgery,
so a scheme cannot be broken by echoing its own output. -/
def AdvProduced (adv : Adversary) (cert : QuasarCert) : Prop :=
ProducedBy adv cert ∧ ¬HonestlyProduced cert
/-- An adversary forges a QuasarCert if it produces a fresh certificate
on which all three layers verify.
The provenance conjunct is load-bearing. Without it the predicate is
satisfied by any certificate whose three bits are set -- including
every honestly finalized one -- so every adversary would "forge"
every finalized block and the theorems below would hold vacuously.
`honest_cert_not_forgery` and `forge_not_implied_by_validity` state
that this is no longer the case. -/
def AdvForge (adv : Adversary) (cert : QuasarCert) : Prop :=
AdvProduced adv cert ∧
cert.blsValid = true ∧
cert.coronaValid = true ∧
cert.mldsaValid = true
/-- Correctness of the scheme: the protocol emits certificates on which
all three layers verify. Pairs with the unforgeability axioms below
the way correctness pairs with EUF-CMA in a signature-scheme
definition -- security over an empty set of valid certificates says
nothing, so this is what gives the theorems below content.
Models `(*QuasarCert).VerifyWithRealKeys`
(`protocol/quasar/types.go:190`) accepting the output of
`(*signer).TripleSignRound1` (`protocol/quasar/quasar.go:389`). -/
axiom protocol_correctness :
∃ cert : QuasarCert,
HonestlyProduced cert ∧
cert.blsValid = true ∧
cert.coronaValid = true ∧
cert.mldsaValid = true
-- ============================================================================
-- 4. Signature Unforgeability Axioms
-- ============================================================================
-- Each axiom states: if the hardness assumption holds, then the adversary
-- CANNOT produce a valid signature component. This is the standard
-- game-based security definition: Pr[Forge | Assumption] = negl(lambda).
-- We model negl(lambda) = 0 (asymptotic).
/-- BLS unforgeability: if DiscreteLog holds, the adversary cannot
produce a valid BLS aggregate that reaches quorum.
Computational basis: EUF-CMA of BLS12-381 reduces to co-CDH
in the random oracle model. co-CDH reduces to ECDL.
Under ECDL, forging a BLS signature requires computing
H(m)^sk without knowing sk. -/
axiom bls_unforgeable :
∀ (adv : Adversary) (cert : QuasarCert),
AdvProduced adv cert →
¬AdvBreak adv .DiscreteLog →
cert.blsValid = false
/-- Corona unforgeability: if ModuleSIS holds, the adversary cannot
produce a valid Corona threshold lattice signature.
Computational basis: Corona EUF-CMA reduces to finding short
vectors in module lattices (Module-SIS). Under Module-SIS hardness,
the adversary cannot find a short preimage that satisfies the
verification equation A * z = t mod q with ||z|| < beta. -/
axiom corona_unforgeable :
∀ (adv : Adversary) (cert : QuasarCert),
AdvProduced adv cert →
¬AdvBreak adv .ModuleSIS →
cert.coronaValid = false
/-- ML-DSA Groth16 rollup unforgeability: if ModuleLWE holds, the
adversary cannot produce a valid Groth16 proof of N ML-DSA-65 sigs.
Two attack paths, both closed:
(a) Forge an ML-DSA-65 signature: reduces to Module-LWE.
Under Module-LWE, the adversary cannot distinguish A*s + e
from uniform, so cannot recover the secret key s.
(b) Forge the Groth16 proof itself: reduces to q-PKE (Knowledge
of Exponent) in the AGM. This is a weaker assumption than ECDL,
already covered by DiscreteLog. But even without (b), path (a)
suffices: the Groth16 circuit checks ML-DSA verification, so
a valid proof requires valid ML-DSA sigs as witness.
We axiomatize: ModuleLWE => no valid mldsaValid. -/
axiom mldsa_rollup_unforgeable :
∀ (adv : Adversary) (cert : QuasarCert),
AdvProduced adv cert →
¬AdvBreak adv .ModuleLWE →
cert.mldsaValid = false
-- ============================================================================
-- 5. Main Theorem: Quasar Consensus Composition
-- ============================================================================
/-- QUASAR CONSENSUS COMPOSITION:
Any adversary that produces a valid QuasarCert must have broken
all three independent hardness assumptions.
Proof: by contradiction on each component.
For each assumption X, suppose the adversary has NOT broken X.
Then by X_unforgeable, applied to the same adversary that produced
the certificate, the X-component of cert is false. But AdvForge
requires it to be true. Contradiction. -/
theorem quasar_triple_defense
(adv : Adversary) (cert : QuasarCert)
(h_forge : AdvForge adv cert) :
AdvBreak adv .DiscreteLog ∧
AdvBreak adv .ModuleLWE ∧
AdvBreak adv .ModuleSIS := by
obtain ⟨h_prod, h_bls, h_rt, h_mldsa⟩ := h_forge
refine ⟨?_, ?_, ?_⟩
-- Case 1: DiscreteLog must be broken.
-- If not broken, bls_unforgeable gives cert.blsValid = false.
-- But h_bls says cert.blsValid = true. Contradiction.
· by_contra h_not_dl
have := bls_unforgeable adv cert h_prod h_not_dl
rw [h_bls] at this
exact absurd this (by decide)
-- Case 2: ModuleLWE must be broken.
-- If not broken, mldsa_rollup_unforgeable gives cert.mldsaValid = false.
-- But h_mldsa says cert.mldsaValid = true. Contradiction.
· by_contra h_not_lwe
have := mldsa_rollup_unforgeable adv cert h_prod h_not_lwe
rw [h_mldsa] at this
exact absurd this (by decide)
-- Case 3: ModuleSIS must be broken.
-- If not broken, corona_unforgeable gives cert.coronaValid = false.
-- But h_rt says cert.coronaValid = true. Contradiction.
· by_contra h_not_sis
have := corona_unforgeable adv cert h_prod h_not_sis
rw [h_rt] at this
exact absurd this (by decide)
/-- An honestly finalized certificate is not a forgery, for any
adversary. Immediate from the freshness conjunct of AdvProduced.
This is the property the three verification bits alone cannot
express: under a fields-only definition of forgery, every finalized
block is a forgery by every adversary, and `quasar_triple_defense`
then hands out `AdvBreak adv a` for every adversary and every
assumption. -/
theorem honest_cert_not_forgery
(adv : Adversary) (cert : QuasarCert)
(h_honest : HonestlyProduced cert) :
¬AdvForge adv cert := by
intro h_forge
exact h_forge.1.2 h_honest
/-- There is a certificate on which all three layers verify and which no
adversary forges. Composes correctness with the previous theorem. -/
theorem valid_cert_not_universally_forged :
∃ cert : QuasarCert,
cert.blsValid = true ∧
cert.coronaValid = true ∧
cert.mldsaValid = true ∧
∀ adv : Adversary, ¬AdvForge adv cert := by
obtain ⟨cert, h_honest, h_bls, h_rt, h_mldsa⟩ := protocol_correctness
exact ⟨cert, h_bls, h_rt, h_mldsa,
fun adv => honest_cert_not_forgery adv cert h_honest⟩
/-- Certificate validity does not imply forgery: the three verification
bits being set is not sufficient for AdvForge.
Stated as the negation of the implication so that it fails to
compile if AdvForge is ever weakened back to a predicate over the
certificate's fields. Every theorem below takes AdvForge as a
hypothesis, so their content rests on this: an AdvForge hypothesis
cannot be discharged by exhibiting a certificate with three true
bits. -/
theorem forge_not_implied_by_validity :
¬ ∀ (adv : Adversary) (cert : QuasarCert),
cert.blsValid = true →
cert.coronaValid = true →
cert.mldsaValid = true →
AdvForge adv cert := by
intro h_all
obtain ⟨cert, h_bls, h_rt, h_mldsa, h_no_forge⟩ :=
valid_cert_not_universally_forged
exact h_no_forge ⟨0⟩ (h_all ⟨0⟩ cert h_bls h_rt h_mldsa)
-- ============================================================================
-- 6. Corollaries
-- ============================================================================
/-- SINGLE ASSUMPTION DEFENSE: If ANY one assumption holds,
no adversary can forge a QuasarCert.
Contrapositive of the main theorem: the adversary needs all three
breaks, so holding any one assumption blocks the entire attack. -/
theorem single_assumption_prevents_forgery
(adv : Adversary) (cert : QuasarCert)
(a : Assumption)
(h_holds : ¬AdvBreak adv a) :
¬AdvForge adv cert := by
intro h_forge
have ⟨h_dl, h_lwe, h_sis⟩ := quasar_triple_defense adv cert h_forge
match a with
| .DiscreteLog => exact absurd h_dl h_holds
| .ModuleLWE => exact absurd h_lwe h_holds
| .ModuleSIS => exact absurd h_sis h_holds
/-- QUANTUM RESISTANCE: Even if DiscreteLog falls to a quantum computer,
the adversary still needs both ModuleLWE AND ModuleSIS.
Lattice problems are believed quantum-hard (Regev 2005, Peikert 2016).
This theorem shows Quasar degrades gracefully: a quantum adversary
that breaks BLS still faces two independent lattice barriers. -/
theorem quantum_resistance
(adv : Adversary) (cert : QuasarCert)
(h_forge : AdvForge adv cert)
(_h_dl_broken : AdvBreak adv .DiscreteLog) :
AdvBreak adv .ModuleLWE ∧ AdvBreak adv .ModuleSIS := by
have ⟨_, h_lwe, h_sis⟩ := quasar_triple_defense adv cert h_forge
exact ⟨h_lwe, h_sis⟩
/-- CLASSICAL RESISTANCE: Even if one lattice assumption falls,
the adversary still needs DiscreteLog AND the other lattice assumption.
Protects against a selective breakthrough in Module-SIS (e.g.,
a new lattice sieving algorithm that does not help with LWE). -/
theorem classical_plus_lattice_defense
(adv : Adversary) (cert : QuasarCert)
(h_forge : AdvForge adv cert)
(_h_sis_broken : AdvBreak adv .ModuleSIS) :
AdvBreak adv .DiscreteLog ∧ AdvBreak adv .ModuleLWE := by
have ⟨h_dl, h_lwe, _⟩ := quasar_triple_defense adv cert h_forge
exact ⟨h_dl, h_lwe⟩
/-- DUAL LATTICE RESISTANCE: Even if DiscreteLog AND one lattice fall,
the remaining lattice assumption still blocks forgery.
Worst realistic scenario: quantum breaks DL + novel algorithm
breaks one lattice variant. The third layer still holds. -/
theorem dual_break_still_needs_third
(adv : Adversary) (cert : QuasarCert)
(h_forge : AdvForge adv cert)
(_h_dl_broken : AdvBreak adv .DiscreteLog)
(_h_sis_broken : AdvBreak adv .ModuleSIS) :
AdvBreak adv .ModuleLWE := by
have ⟨_, h_lwe, _⟩ := quasar_triple_defense adv cert h_forge
exact h_lwe
/-- FULL INDEPENDENCE: No single break suffices.
For each assumption, breaking it alone cannot produce a forgery
because the other two layers remain unforgeable.
This is the independence property: each assumption protects its
own layer, and breaking one gives zero advantage on the others. -/
theorem assumption_independence
(a : Assumption)
(adv : Adversary) (cert : QuasarCert)
(_h_break : AdvBreak adv a)
(h_others : ∀ (b : Assumption), b ≠ a → ¬AdvBreak adv b) :
¬AdvForge adv cert := by
intro h_forge
have ⟨h_dl, h_lwe, h_sis⟩ := quasar_triple_defense adv cert h_forge
match a with
| .DiscreteLog =>
exact absurd h_lwe (h_others .ModuleLWE (by intro h; cases h))
| .ModuleLWE =>
exact absurd h_dl (h_others .DiscreteLog (by intro h; cases h))
| .ModuleSIS =>
exact absurd h_dl (h_others .DiscreteLog (by intro h; cases h))
/-- TWO BREAK INDEPENDENCE: Even breaking two of three is insufficient.
The remaining assumption still blocks forgery. -/
theorem two_break_independence
(a b : Assumption)
(h_ne : a ≠ b)
(adv : Adversary) (cert : QuasarCert)
(_h_break_a : AdvBreak adv a)
(_h_break_b : AdvBreak adv b)
(h_third : ∀ (c : Assumption), c ≠ a → c ≠ b → ¬AdvBreak adv c) :
¬AdvForge adv cert := by
intro h_forge
have ⟨h_dl, h_lwe, h_sis⟩ := quasar_triple_defense adv cert h_forge
match a, b, h_ne with
| .DiscreteLog, .ModuleSIS, _ =>
exact absurd h_lwe (h_third .ModuleLWE (by intro h; cases h) (by intro h; cases h))
| .DiscreteLog, .ModuleLWE, _ =>
exact absurd h_sis (h_third .ModuleSIS (by intro h; cases h) (by intro h; cases h))
| .ModuleSIS, .DiscreteLog, _ =>
exact absurd h_lwe (h_third .ModuleLWE (by intro h; cases h) (by intro h; cases h))
| .ModuleSIS, .ModuleLWE, _ =>
exact absurd h_dl (h_third .DiscreteLog (by intro h; cases h) (by intro h; cases h))
| .ModuleLWE, .DiscreteLog, _ =>
exact absurd h_sis (h_third .ModuleSIS (by intro h; cases h) (by intro h; cases h))
| .ModuleLWE, .ModuleSIS, _ =>
exact absurd h_dl (h_third .DiscreteLog (by intro h; cases h) (by intro h; cases h))
| .DiscreteLog, .DiscreteLog, h => exact absurd rfl h
| .ModuleSIS, .ModuleSIS, h => exact absurd rfl h
| .ModuleLWE, .ModuleLWE, h => exact absurd rfl h
-- ============================================================================
-- 7. BFT Composition: Quorum + Unforgeability
-- ============================================================================
/-- Quorum overlap: two quorums of 2f+1 from 3f+1 validators
must share at least one member (pigeonhole). -/
theorem quorum_overlap
(n f : Nat)
(h_bft : 3 * f < n)
(_h_bound : n ≤ 3 * f + 1)
(q1 q2 : Nat)
(hq1 : q1 ≥ 2 * f + 1) (hq2 : q2 ≥ 2 * f + 1) :
q1 + q2 > n := by omega
/-- AGREEMENT: If two finalized certs exist for the same round,
and honest validators sign at most one block per round,
then the total BLS count exceeds n -- contradiction.
Combined with triple unforgeability: agreement holds unless
ALL THREE assumptions are broken simultaneously. -/
theorem finality_agreement
(n f : Nat)
(h_bft : 3 * f < n)
(h_bound : n ≤ 3 * f + 1)
(cert1 cert2 : QuasarCert)
(_h_same_round : cert1.round = cert2.round)
(hq1 : cert1.quorum = 2 * f + 1)
(hq2 : cert2.quorum = 2 * f + 1)
(hv1 : cert1.blsCount ≥ cert1.quorum)
(hv2 : cert2.blsCount ≥ cert2.quorum)
-- Honest validators sign at most one block per round:
-- total distinct signers across both certs <= n
(h_honest : cert1.blsCount + cert2.blsCount ≤ n) :
False := by
have h := quorum_overlap n f h_bft h_bound cert1.blsCount cert2.blsCount
(by rw [hq1] at hv1; exact hv1) (by rw [hq2] at hv2; exact hv2)
omega
-- ============================================================================
-- 8. Security Parameter Bounds
-- ============================================================================
/-- BLS12-381: 128-bit classical security from ECDL.
Group order r has 255 bits. Pollard rho: O(2^{r/2}) = O(2^{127.5}). -/
theorem bls_security_bits : 255 / 2 ≥ 127 := by omega
/-- ML-DSA-65 (NIST Level 3): 192-bit quantum security.
Module rank (k,l) = (6,5) over Z_q[X]/(X^256+1), q = 8380417.
Core hardness: Module-LWE_{6,5,eta} for eta in {4,4}. -/
theorem mldsa_security_bits : (192 : Nat) > 128 := by omega
/-- Corona (Module-LWE / Module-SIS): NIST Category 1, ~128-bit
classical / ~130-bit quantum security. Module of rank M=8 over
R_q = Z_q[X]/(X^256+1), q = 0x1000000004A01 (48-bit); BDGL sieving
on the rank-8 module clears the 128-bit bar (Ringtail/corona
`sign/config.go`). -/
theorem corona_security_bits : (130 : Nat) > 128 := by omega
/-- Composite security floor: the system is as strong as the weakest
layer for any single-layer attacker. But the main theorem shows
ALL layers must fall, so the effective security is additive in
the number of independent assumptions required. -/
theorem composite_security_floor :
min (min 127 192) 128 = 127 := by decide
/-- Groth16 proof size: constant 192 bytes (2 G1 points + 1 G2 point)
regardless of the number of ML-DSA signatures rolled up.
Verification: 3 pairings = O(1). -/
theorem groth16_constant_size (num_validators : Nat)
(_h : num_validators > 0) :
-- 2 * 48 (G1 compressed) + 1 * 96 (G2 compressed) = 192 bytes
2 * 48 + 96 = 192 := by omega
end Quasar.Consensus