Not launch-ready. No live AMM program yet. A real AMM on SPL tokens needs token-transfer calls (CPI), and the bytecode prover does not cover CPI yet (Lean AMM assumes those calls; we will prove them). Until an AMM program meets the same bar as Airdrop and p-token (one theorem over its exact ELF), this page stays a simulation of the Lean model. Programs (devnet): Airdrop · p-token.
Interactive front end for the Lean model in Poc/Amm.lean.
Honesty banner. This page is an interactive front end for the Lean model in
Poc/Amm.lean. The Lean binary is the source of truth: the four
safety properties below are proven there — in Lean, checked by lake build,
with no sorry. The JavaScript on this page mirrors the same Nat arithmetic but is
not itself verified. Nothing here touches a wallet, signs anything, or talks to any
network or mainnet — it is a local model you can poke.
Proven in Lean (Poc/Amm.lean)
swap_k_nondecreasing — after any swap, r0′·r1′ ≥ r0·r1: fees and rounding only ever grow k.
swap_out_lt_reserve — a swap can never pay out the whole output reserve: the pool can't be drained.
removeLiq_le_reserves — liquidity removal never pays out more than the reserves.
addLiq_shares_positive — a positive first deposit mints a positive number of shares.
Pool state
Reserve token0 (r0)
0
Reserve token1 (r1)
0
LP shares
0
Fee
30 bps
k = r0 · r1
0
k history (swaps only — k only ever grows)
no swaps yet
x · y = k curve
Axes are the reserves. The curve is the hyperbola for the current k; the dot is the current (r0, r1). After a swap, the pre-swap point is shown ghosted.
Add liquidity
Swap (exact-in)
Quote: you receive 0token1
Remove liquidity
Lean demo replay
Demo sequence: addLiq 1000000/1000000 → addLiq 100000/100000 → swap 10000 token0 in → swap 5000 token1 in → swap 50000 token0 in → removeLiq 100000 shares. Note: k after the two deposits is 1.210e12, and each swap grows it further — the withheld fees accrue to LPs.