LEAN 4.36.0 · 32 THEOREMS · 0 SORRY 2 INDEPENDENT AUDITS · ACCEPT SHOCKGUARD v0.1.0 · MIT 7/7 CRISES VETOED · 9 LIVE PROTOCOLS ORCID 0009-0001-1223-2170

ShockGuard: Formally Verified DeFi Solvency & Liquidation Risk Auditor

Author: Fabien Pierret (Independent Researcher). Machine-checked Lean 4.36.0 proofs establishing exact necessary-and-sufficient solvency conditions under coupled oracle latency and AMM execution impact, Morpho/Aave fixed-spread liquidator freeze boundaries, Uniswap v2 vs. skimmed-fee price-impact separation, collateralized stablecoin depeg floors, and universal Lp impossibility vs. 4-pillar minimax SIPS∞ veto.

Launch Live DeFi Auditor GitHub Repository (MIT) Download Preprint PDF Lean 4 Proof (0 sorry) llms.txt (AEO)

1. Certified Theorems & Empirical Highlights

Theorem FamilyCore Failure Mode ExposedShockGuard ResultVerification
Theorem 1 (1A–1H)
Coupled Solvency & Morpho Freeze
Seize-all models ignore fixed-spread seizure cap Cseized=θ(1+β)C whenever θ(1+β)2<1Exact IFF frontier; Morpho 91.5% LLTV freezes at η*=2.18% vs 3.13% seize-all (0.942% freeze gap)Lean 4 (1A–1H) + Exp 1
Theorem 2 (2A–2H)
Uniswap v2 vs. Skimmed CPMM
Skimmed-fee formula overestimates post-trade spot, flagging cascading liquidations as safeExact Univ2 LP-retained spot 0.4520 < 0.4545 (cascade) vs skimmed 0.4596 (false safe) at ρ=50%, f=5%Lean 4 (2A–2H) + Exp 2
Theorem 3 (3A–3D)
Stablecoin Solvency & Overshoot
Linear/NAV metrics conflate solvent illiquidity (SVB) with reflexive insolvency (UST)Exact USDe buffer h*=1.619%; USDC SVB liquid floor $0.9241 + DEX panic overshoot $0.8734 (real: $0.877)Lean 4 (3A–3D) + Exp 3
Theorem 4 (4A–4G)
Minimax SIPS∞ & Lp Impossibility
Every finite-p weighted power mean misses 100% single-pillar crises (SVB linear score = 45.6/100)0.0% false-safe & 0.0% false-veto across 2,500 Monte Carlo profiles; 7/7 historical collapses vetoed, 2/2 Oct 2025 survivals passedLean 4 (4A–4G) + Exp 4–6

2. Reproducible 300 DPI Figures

Theorem 1 Coupled Solvency Frontier and Morpho Fixed-Spread Freeze

Figure 1 (Theorem 1A–1H): Coupled oracle-lag and DEX-depth solvency frontier exposing the 0.942% Morpho Blue 91.5% LLTV fixed-spread liquidator freeze band.

Theorem 2 Uniswap v2 vs Skimmed CPMM Cascade Separation

Figure 2 (Theorem 2A–2H): Exact Uniswap v2 LP-retained fee vs. skimmed-fee post-trade spot separation and conservative linear liquidation cascade envelope.

Theorem 3 Stablecoin Solvency and USDC SVB DEX Overshoot

Figure 3 (Theorem 3A–3D): Ethena USDe hedge-loss solvency boundary (h*=1.619%) and USDC SVB March 2023 physical liquid floor ($0.9241) plus DEX panic overshoot ($0.8734).

Theorem 4 Universal Lp Impossibility vs SIPS Minimax Veto

Figure 4 (Theorem 4A–4E): Universal Lp power-mean impossibility threshold vs. SIPS∞ minimax veto across 2,500 Monte Carlo stress profiles (100% vs. 0% single-pillar bypass).

Experiment 5 Historical DeFi Crisis Replay and Live DeFiLlama Audit

Figure 5 (Experiment 5): 7/7 historical DeFi collapses vetoed at 0.0/100 (exposing +45.6 pt SVB linear optimism), 2/2 Oct 2025 survivals passed, and 9 live DeFiLlama protocols audited.

Experiment 6 Lean 4 Kernel Verification and Adversarial Harness

Figure 6 (Experiment 6): Standalone Lean 4.36.0 kernel verification across all 32 public theorems (0 sorry, 0 warnings) and 8/8 adversarial verification bypasses blocked.

3. Quick Reproducibility Commands

git clone https://github.com/fabien-pierret/shockguard-defi.git && cd shockguard-defi
pip install -e ".[dev]"
./lean/verify_lean.sh                 # 32 Lean 4.36.0 theorems, 0 sorry, 0 warnings, standard axioms only
pytest -v                             # 19/19 parity, crisis, CLI & live Lean 4 kernel tests
python3 sim/run_all_experiments.py    # 6 reproducible experiments + live DeFiLlama snapshot + 6 figures
shockguard audit aave --live          # Live 5-second DeFiLlama audit from terminal