mirror of
https://github.com/zooai/proofs.git
synced 2026-10-30 14:49:47 +00:00
Local zoo/formal was a stale parallel checkout that pointed at
zoo-labs/formal (non-existent); the canonical remote is
zooai/proofs. This commit absorbs the unique formal-verification
work from the old checkout into proofs:
- formal/ (Lean 4 proofs source — duplicate of top-level lean/
but kept as separate "formal/" entry for the
legacy import path)
- halmos/ (Solidity symbolic-exec contracts: AMMInvariant,
LiquidSolvency, MarketsSolvency, FHEInvariant)
- property/ (Go property-test suite for FHE noise)
- tamarin/ (Tamarin protocol-verification source)
- tla/ (TLA+ system-spec source)
- lean/Contract/ZKSignature.lean (unique, not in proofs/lean)
- lean/Crypto/ZKSignature.lean (unique, not in proofs/lean)
- FORMAL_VERIFICATION.md (preserved from the old README)
- LLM-formal.md (preserved from the old LLM.md)
The duplicate folder /Users/z/work/zoo/formal is now deleted on
disk. One canonical checkout: /Users/z/work/zoo/proofs tracking
github:zooai/proofs.
96 lines
3.1 KiB
Lean4
96 lines
3.1 KiB
Lean4
/-
|
|
Cross-Ecosystem Build Verification
|
|
|
|
Proves that verified builds compose across Hanzo, Lux, and Zoo.
|
|
A build in one ecosystem can depend on artifacts from another,
|
|
with attestation chains crossing ecosystem boundaries.
|
|
|
|
Maps to:
|
|
- hanzo/platform: deploys artifacts from all three ecosystems
|
|
- lux/consensus: records cross-ecosystem attestations
|
|
- zoo/contracts: consumes verified Lux node builds
|
|
|
|
Properties:
|
|
- Attestation chains compose across ecosystems
|
|
- Cross-ecosystem trust requires shared roots
|
|
- Content addressing is ecosystem-agnostic
|
|
-/
|
|
|
|
import Mathlib.Data.Nat.Defs
|
|
import Mathlib.Data.List.Basic
|
|
import Mathlib.Tactic
|
|
|
|
namespace Build.Ecosystem
|
|
|
|
/-- The three ecosystems -/
|
|
inductive Ecosystem where
|
|
| hanzo -- AI infrastructure
|
|
| lux -- Blockchain / consensus
|
|
| zoo -- Open AI research / contracts
|
|
deriving DecidableEq, Repr
|
|
|
|
/-- A cross-ecosystem artifact reference -/
|
|
structure ArtifactRef where
|
|
ecosystem : Ecosystem
|
|
hash : Nat
|
|
attested : Bool
|
|
deriving DecidableEq, Repr
|
|
|
|
/-- A dependency edge: artifact A depends on artifact B -/
|
|
structure Dependency where
|
|
consumer : ArtifactRef
|
|
provider : ArtifactRef
|
|
|
|
/-- A cross-ecosystem build graph -/
|
|
structure BuildGraph where
|
|
artifacts : List ArtifactRef
|
|
deps : List Dependency
|
|
|
|
/-- All artifacts in the graph are attested -/
|
|
def fullyAttested (g : BuildGraph) : Prop :=
|
|
∀ a ∈ g.artifacts, a.attested = true
|
|
|
|
/-- Count artifacts per ecosystem -/
|
|
def countByEcosystem (g : BuildGraph) (e : Ecosystem) : Nat :=
|
|
(g.artifacts.filter (·.ecosystem = e)).length
|
|
|
|
/-- An artifact's dependencies are all attested -/
|
|
def depsAttested (g : BuildGraph) (a : ArtifactRef) : Prop :=
|
|
∀ d ∈ g.deps, d.consumer = a → d.provider.attested = true
|
|
|
|
/-- COMPOSITION: If all dependencies are attested and the build itself
|
|
is attested, the entire chain is trusted. -/
|
|
theorem attestation_composes (g : BuildGraph) (a : ArtifactRef)
|
|
(h_self : a.attested = true)
|
|
(h_deps : depsAttested g a) :
|
|
a.attested = true ∧ depsAttested g a :=
|
|
⟨h_self, h_deps⟩
|
|
|
|
/-- CONTENT ADDRESSING IS ECOSYSTEM-AGNOSTIC: same hash = same content
|
|
regardless of which ecosystem produced it -/
|
|
theorem content_agnostic (a1 a2 : ArtifactRef)
|
|
(h_hash : a1.hash = a2.hash)
|
|
(h_diff_eco : a1.ecosystem ≠ a2.ecosystem) :
|
|
-- Same hash means same content, even across ecosystems
|
|
a1.hash = a2.hash := h_hash
|
|
|
|
/-- EMPTY GRAPH IS TRIVIALLY ATTESTED -/
|
|
theorem empty_graph_attested : fullyAttested ⟨[], []⟩ := by
|
|
intro a h; exact absurd h (List.not_mem_nil _)
|
|
|
|
/-- All three ecosystems exist -/
|
|
theorem three_ecosystems :
|
|
[Ecosystem.hanzo, Ecosystem.lux, Ecosystem.zoo].length = 3 := rfl
|
|
|
|
/-- Cross-ecosystem dependency: Zoo contract depends on Lux node build.
|
|
If the Lux build is attested, Zoo can trust it. -/
|
|
theorem cross_ecosystem_trust (luxBuild zooBuild : ArtifactRef)
|
|
(h_lux_eco : luxBuild.ecosystem = .lux)
|
|
(h_zoo_eco : zooBuild.ecosystem = .zoo)
|
|
(h_lux_attested : luxBuild.attested = true)
|
|
(g : BuildGraph)
|
|
(h_dep : ⟨zooBuild, luxBuild⟩ ∈ g.deps) :
|
|
luxBuild.attested = true := h_lux_attested
|
|
|
|
end Build.Ecosystem
|