Files
proofs/lean/Trust/Revocation.lean
2d7e2a6309 proofs: drive Lean library to 0 errors, eliminate native_decide
The lean/ library (112 files) had ~110 type-check errors across 52 files (the
prior "green" status was a grep artifact). It now verifies at 0 errors under
the project's strict setting: `lake env lean -D autoImplicit=false`, all 112
files.

Fixed:
- Quasar/Consensus: replaced `by native_decide` with `by decide` (kernel-checked
  rather than compiler-trusted).
- Vault/KeyIsolation, Bridge/{YieldVault,OmnichainRouter,FillIntegrity},
  Storage/{ZapDB,Replicate}: PRF/string-encoding lemmas, division-bound vault
  accounting, renamed/removed deprecated List lemmas, noncomputable.
- Crypto (Pulsar/Magnetar/Corona/CGGMP21/MLKEM/FROST/FHE/P3Q): missing local
  dependency oleans compiled in dependency order; theorem→noncomputable def for
  Type-valued re-exports; deriving Inhabited for opaque artifact types; dead
  Mathlib imports removed.
- DeFi (AMM/staking/fees/flashloan/HFT/router) + Protocol + GPU + Warp + Trust +
  Compute + Network + Build: Nat-division/AMM-invariant proofs via
  Nat.div_le_of_le_mul / Nat.div_mul_le_self; omega in-scope invariants;
  record-projection opacity; dead tactics; stale Nat.Basic import → Nat.Defs;
  BFT quorum theorems tightened to n=3f+1.

Integrity: no sorry/admit/native_decide remaining (verified); no
proof-by-assumption axiom cheats. Statement changes only tightened false draft
theorems to true invariants. Remaining axioms are trusted-base only (opaque
crypto groups/pairings, RLWE/MLWE/MSIS hardness, FIPS 203/204/205 correctness,
VSS/Paillier, protocol modeling).

Co-authored-by: Hanzo Dev <[email protected]>
2026-06-10 22:34:27 -07:00

77 lines
2.6 KiB
Lean4

/-
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 [isRevoked, validRevocations, List.any_eq_true, List.mem_filter] at *
obtain ⟨r, hr_mem, hr_match⟩ := h
exact ⟨r, hr_mem, hr_match.1.1, hr_match⟩
end Trust.Revocation