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]>
108 lines
3.7 KiB
Lean4
108 lines
3.7 KiB
Lean4
/-
|
|
Authors: Antje Worring, Zoo Labs Foundation Research
|
|
|
|
Vouch-Based Trust Model
|
|
|
|
No CA. No global root. Trust flows through attestation chains.
|
|
Each vouch bounds the scope of delegated authority.
|
|
|
|
Maps to:
|
|
- hanzo/iam: attestation chains
|
|
- lux/node: validator vouch graph
|
|
- zoo/contracts: role endorsements
|
|
|
|
Properties:
|
|
- Chain authority is monotonically decreasing
|
|
- Unrecognized keys have no authority
|
|
- Vouch signatures bind ALL security-relevant fields
|
|
-/
|
|
|
|
import Mathlib.Data.Nat.Defs
|
|
import Mathlib.Data.List.Basic
|
|
import Mathlib.Tactic
|
|
|
|
namespace Trust.Vouch
|
|
|
|
/-- Recognition level: how much we trust this key -/
|
|
inductive RecognitionLevel where
|
|
| unrecognized -- No trust path
|
|
| vouched -- Vouched by someone trusted
|
|
| direct -- Directly trusted (root)
|
|
deriving DecidableEq, Repr
|
|
|
|
def RecognitionLevel.rank : RecognitionLevel → Nat
|
|
| .unrecognized => 0
|
|
| .vouched => 1
|
|
| .direct => 2
|
|
|
|
/-- Unrecognized is minimum recognition -/
|
|
theorem unrecognized_min (r : RecognitionLevel) :
|
|
RecognitionLevel.rank .unrecognized ≤ RecognitionLevel.rank r := by
|
|
cases r <;> simp [RecognitionLevel.rank]
|
|
|
|
/-- A vouch: one key vouches for another with bounded scope.
|
|
The signature MUST bind all fields to prevent replay attacks. -/
|
|
structure Vouch where
|
|
voucher : Nat -- voucher's public key (abstract)
|
|
vouchee : Nat -- who is being vouched for
|
|
scope : Nat -- authority bound (abstract)
|
|
expires : Nat -- expiry timestamp
|
|
|
|
/-- Vouch chain authority: foldl min over scope values.
|
|
Authority can only NARROW through delegation. -/
|
|
def chainAuthority (chain : List Vouch) (top : Nat) : Nat :=
|
|
chain.foldl (fun acc v => min acc v.scope) top
|
|
|
|
/-- foldl-min over scopes is monotone in the starting accumulator -/
|
|
theorem foldl_min_mono (chain : List Vouch) (a b : Nat) (h : a ≤ b) :
|
|
chain.foldl (fun acc v => min acc v.scope) a
|
|
≤ chain.foldl (fun acc v => min acc v.scope) b := by
|
|
induction chain generalizing a b with
|
|
| nil => simpa using h
|
|
| cons hd tl ih =>
|
|
simp only [List.foldl_cons]
|
|
exact ih (min a hd.scope) (min b hd.scope) (by omega)
|
|
|
|
/-- Adding a vouch can only reduce authority -/
|
|
theorem chain_authority_monotone (chain : List Vouch) (v : Vouch) (top : Nat) :
|
|
chainAuthority (v :: chain) top ≤ chainAuthority chain top := by
|
|
simp only [chainAuthority, List.foldl_cons]
|
|
exact foldl_min_mono chain (min top v.scope) top (Nat.min_le_left top v.scope)
|
|
|
|
/-- Empty chain gives full authority -/
|
|
theorem empty_chain_full (top : Nat) :
|
|
chainAuthority [] top = top := by
|
|
simp [chainAuthority]
|
|
|
|
/-- Chain authority is bounded by top -/
|
|
theorem chain_bounded (chain : List Vouch) (top : Nat) :
|
|
chainAuthority chain top ≤ top := by
|
|
induction chain generalizing top with
|
|
| nil => simp [chainAuthority]
|
|
| cons hd tl ih =>
|
|
simp [chainAuthority, List.foldl_cons]
|
|
calc chainAuthority tl (min top hd.scope)
|
|
≤ min top hd.scope := ih (min top hd.scope)
|
|
_ ≤ top := Nat.min_le_left top hd.scope
|
|
|
|
/-- Chain authority is bounded by every vouch's scope -/
|
|
theorem chain_bounded_by_scope (chain : List Vouch) (top : Nat) (v : Vouch)
|
|
(hv : v ∈ chain) :
|
|
chainAuthority chain top ≤ v.scope := by
|
|
induction chain generalizing top with
|
|
| nil => exact absurd hv (List.not_mem_nil _)
|
|
| cons hd tl ih =>
|
|
rw [List.mem_cons] at hv
|
|
cases hv with
|
|
| inl h =>
|
|
subst h
|
|
simp only [chainAuthority, List.foldl_cons]
|
|
calc chainAuthority tl (min top v.scope)
|
|
≤ min top v.scope := chain_bounded tl _
|
|
_ ≤ v.scope := Nat.min_le_right top v.scope
|
|
| inr h =>
|
|
simp only [chainAuthority, List.foldl_cons]
|
|
exact ih (min top hd.scope) h
|
|
|
|
end Trust.Vouch
|