Files
proofs/lean/Trust/Revocation.lean
zooqueenandHanzo Dev d3bff5e2dc proofs: drive Lean library to 0 errors, eliminate proof-by-assumption axioms
The lean/ proof library (88 files) had ~180 type-check errors across ~45 files
plus 31 proof-by-assumption axiom cheats. It now type-checks cleanly under
Lean 4.14.0 + Mathlib, with every theorem genuinely proven from definitions.

Errors fixed:
- Stale Mathlib imports: Data.Nat.Basic / Data.Int.Basic were removed this rev
  -> Data.Nat.Defs / Data.Int.Defs (57 files).
- Shared AI/Agent/Governance/Contract/DeFi/Ecology draft files: same proof-rot
  as the zoo-labs sibling library (now reconciled): omega missing in-scope
  bounds, dead tactics after simp, simp over-reduction, doc-comment placement,
  reserved-word binders, deriving Repr on Finset-bearing structs, noncomputable
  defs over opaque primitives.
- Consensus/Liveness: collapsed a 74-error cascade (undefined shared state model
  inlined from Safety.lean; the |>. pipe-projection vs comparison parse trap on
  14 lines rewritten to explicit dot projection).
- Crypto (BLS/FROST/Corona/Hybrid/threshold/FHE), Consensus, Protocol, Warp,
  Trust, GPU, Compute, Network, DeFi: brought structure invariants into scope
  for omega, Nat-division bounds via Nat.div_le_of_le_mul / Nat.div_mul_le_self,
  noncomputable over opaque crypto ops, deriving Inhabited for index access.

Integrity:
- Removed all 31 `theorem X := X_ax` cheats (axiom asserting the identical
  statement) and proved each from definitions; removed the UNSOUND
  content_addressed axiom (hash-injectivity over a struct with free fields).
- Quorum-intersection theorems (BFT/Quasar/Flare/Warp/BLS/GPU/Bridge): the draft
  hypothesis 3f<n is insufficient (n unbounded above makes them false); tightened
  to the optimal-resilience invariant n=3f+1 / 2t>n. Statement intent preserved.
- Net axiom change: -35 / +1 (the one addition, honesty_static, is a
  fixed-validator-set modeling assumption matching sibling files).
- Remaining axioms are trusted-base only: opaque crypto primitives (groups,
  pairings, hardness, hashes, FHE encrypt/decrypt, BLS soundness, forward
  secrecy, Fisher-Yates uniformity) and protocol modeling assumptions. No
  sorry/admit/native_decide. Verified all theorems trace to
  [propext, Classical.choice, Quot.sound] plus those primitives.

Co-authored-by: Hanzo Dev <[email protected]>
2026-06-02 05:54:28 -07:00

80 lines
2.7 KiB
Lean4

/-
Authors: Antje Worring, Zach Kelling
Revocation Model
Revocations cancel vouches. A revocation must be cryptographically
signed by the revoker — otherwise anyone could DoS the trust graph.
Maps to:
- hanzo/iam: token revocation lists
- lux/node: validator key rotation and revocation
Properties:
- Revocations are signature-verified
- Revocation is monotone (adding revocations only removes trust paths)
- Revoked vouches have no authority
-/
import Mathlib.Data.Nat.Defs
import Mathlib.Data.List.Basic
import Mathlib.Tactic
namespace Trust.Revocation
/-- A revocation record -/
structure Revocation where
revoker : Nat -- who is revoking
revoked : Nat -- whose vouch is being revoked
timestamp : Nat -- when
sigValid : Bool -- has the signature been verified?
/-- A vouch reference (simplified) -/
structure VouchRef where
voucher : Nat
vouchee : Nat
/-- Check if a vouch is revoked -/
def isRevoked (revocations : List Revocation) (v : VouchRef) : Bool :=
revocations.any fun r =>
r.sigValid && r.revoker == v.voucher && r.revoked == v.vouchee
/-- Unsigned revocations are ignored -/
theorem unsigned_revocation_ignored (r : Revocation) (v : VouchRef)
(h : r.sigValid = false) :
¬(r.sigValid && r.revoker == v.voucher && r.revoked == v.vouchee) = true := by
simp [h]
/-- Adding a revocation can only increase the revoked set (monotone) -/
theorem revocation_monotone (revocations : List Revocation) (r : Revocation) (v : VouchRef)
(h : isRevoked revocations v = true) :
isRevoked (r :: revocations) v = true := by
simp [isRevoked, List.any_cons] at *
exact Or.inr h
/-- Empty revocation list revokes nothing -/
theorem empty_revokes_nothing (v : VouchRef) :
isRevoked [] v = false := rfl
/-- A valid revocation for the exact vouch works -/
theorem valid_revocation_works (revoker revoked ts : Nat) (v : VouchRef)
(h_revoker : (revoker == v.voucher) = true)
(h_revoked : (revoked == v.vouchee) = true) :
isRevoked [⟨revoker, revoked, ts, true⟩] v = true := by
simp [isRevoked, List.any_cons, List.any_nil, h_revoker, h_revoked]
/-- Filter: only valid (signed) revocations matter -/
def validRevocations (revocations : List Revocation) : List Revocation :=
revocations.filter (·.sigValid)
/-- Filtering preserves revocation status -/
theorem valid_filter_preserves (revocations : List Revocation) (v : VouchRef)
(h : isRevoked revocations v = true) :
isRevoked (validRevocations revocations) v = true := by
simp only [isRevoked, validRevocations, List.any_eq_true, List.mem_filter,
Bool.and_eq_true] at *
obtain ⟨r, hr_mem, hr_match⟩ := h
exact ⟨r, ⟨hr_mem, hr_match.1.1⟩, hr_match⟩
end Trust.Revocation