Files
proofs/lean/Build/Attestation.lean
zeekayandHanzo Dev 638fba4c90 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-01 08:58:14 -07:00

103 lines
3.3 KiB
Lean4

/-
Authors: Antje Worring, Zoo Labs Foundation Research
Content-Addressed Build Attestation
Every build artifact is content-addressed via uor.foundation URIs.
Discharge proofs attest what happened during a build.
Signatures bind ALL security-relevant fields.
Address scheme: uor.foundation/{hash}/{name}
Maps to:
- hanzo/attest: attestation service (Go)
- hanzo/kms: signing keys
- lux/mpc: threshold signing for attestations
- lux/consensus: on-chain attestation recording
Properties:
- Content addressing is injective (modulo hash axiom)
- Attestation signatures are unforgeable
- Reproducible builds have no time/random accesses
-/
import Mathlib.Data.Nat.Defs
import Mathlib.Tactic
namespace Build.Attestation
/-- Content-addressed store path: uor.foundation/{hash}/{name} -/
structure StorePath where
hash : Nat -- SHA-256 of content
name : String -- Human-readable name
deriving DecidableEq, Repr
/-- Hash function (axiomatized) -/
axiom contentHash : Nat → Nat
/-- Random oracle: hash is injective (strongest axiom) -/
axiom hash_injective : ∀ a b : Nat, contentHash a = contentHash b → a = b
/-- Build derivation: recipe for producing artifacts -/
structure Derivation where
inputs : List StorePath
builder : StorePath
args : List String
deriving DecidableEq, Repr
/-- Derivation hash covers ALL fields -/
axiom derivationHash : Derivation → Nat
/-- Discharge proof: evidence of what a build did -/
structure DischargeProof where
derivation : Nat -- hash of derivation
outputHashes : List Nat -- hashes of outputs
builder : Nat -- builder's public key
startTime : Nat -- build start
endTime : Nat -- build end
hasTimeAccess : Bool -- did it read the clock?
hasRandomAccess : Bool -- did it use entropy?
/-- Proof message binds ALL fields (prevents replay) -/
def proofMessage (p : DischargeProof) : Nat :=
-- In practice: hash of (derivation, outputs, builder, times)
p.derivation + p.outputHashes.length + p.builder + p.startTime + p.endTime
/-- Signature verification (axiomatized) -/
axiom sigVerify : Nat → Nat → Nat → Bool
/-- A proof is reproducible iff no time or random access -/
def DischargeProof.isReproducible (p : DischargeProof) : Bool :=
!p.hasTimeAccess && !p.hasRandomAccess
/-- Reproducible proofs have no time access -/
theorem reproducible_no_time (p : DischargeProof)
(h : p.isReproducible = true) :
p.hasTimeAccess = false := by
simp [DischargeProof.isReproducible, Bool.and_eq_true, Bool.not_eq_true'] at h
exact h.1
/-- Reproducible proofs have no random access -/
theorem reproducible_no_random (p : DischargeProof)
(h : p.isReproducible = true) :
p.hasRandomAccess = false := by
simp [DischargeProof.isReproducible, Bool.and_eq_true, Bool.not_eq_true'] at h
exact h.2
/-- Same content → same hash → same store path -/
theorem content_determines_path (a b : Nat)
(h : contentHash a = contentHash b) : a = b :=
hash_injective a b h
/-- uor.foundation URI construction -/
def toURI (sp : StorePath) : String :=
s!"uor.foundation/{sp.hash}/{sp.name}"
/-- Two store paths with same hash and name produce same URI -/
theorem same_path_same_uri (a b : StorePath)
(hh : a.hash = b.hash) (hn : a.name = b.name) :
toURI a = toURI b := by
simp [toURI, hh, hn]
end Build.Attestation