Search arXivSearch

arXiv · 2602.00101

A Formal Approach to AMM Fee Mechanisms with Lean 4

Abstract

Decentralized Finance (DeFi) has revolutionized financial markets by enabling complex asset-exchange protocols without trusted intermediaries. Automated Market Makers (AMMs) are a central component of DeFi, providing the core functionality of swapping assets of different types at algorithmically computed exchange rates. Several mainstream AMM implementations are based on the constant-product model, which ensures that swaps preserve the product of the token reserves in the AMM -- up to a \emph{trading fee} used to incentivize liquidity provision. Trading fees substantially complicate the economic properties of AMMs, and for this reason some AMM models abstract them away in order to simplify the analysis. However, trading fees have a non-trivial impact on users' trading strategies, making it crucial to develop refined AMM models that precisely account for their effects. We extend a foundational model of AMMs by introducing a new parameter, the trading fee $ϕ\in(0,1]$, into the swap rate function. Fee amounts increase inversely proportional to $ϕ$. When $ϕ= 1$, no fee is applied and the original model is recovered. We analyze the resulting fee-adjusted model from an economic perspective. We show that several key properties of the swap rate function, including output-boundedness and monotonicity, are preserved. At the same time, other properties - most notably additivity - no longer hold. We precisely characterize this deviation by deriving a generalized form of additivity that captures the effect of swaps in the presence of trading fees. We prove that when $ϕ< 1$, executing a single large swap yields strictly greater profit than splitting the trade into smaller ones. Finally, we derive a closed-form solution to the arbitrage problem in the presence of trading fees and prove its uniqueness. All results are formalized and machine-checked in the Lean 4 proof assistant.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Marco Dessalvi, Massimo Bartoletti, Alberto Lluch-Lafuente. 2026-01-24. A Formal Approach to AMM Fee Mechanisms with Lean 4. https://arxiv.org/abs/2602.00101

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related papers

Fixed-Income Pricing and the Replication of Liabilities

This paper develops a model-free framework for static fixed-income pricing and the replication of liability cash flows. The absence of static arbitrage across a universe of fixed-income instruments is equivalent to the existence of a strictly positive discount curve reproducing all observed prices. Linear programming duality then identifies the least-cost super-replication price with the largest value that any admissible discount curve assigns to the liability, so that the resulting bounds are attained and cannot be improved. Complementary slackness confines over-replication to dates that the optimal discount vector prices at zero, and a least-cost portfolio matches the liability exactly at no fewer dates than the rank of the cash-flow matrix. We also obtain generic uniqueness of that portfolio, an interpolation between quadratic hedging and super-replication, and a static treatment of swap--repo strategies. On US Treasury cross-sections the observed prices violate the law of one price, so that a discount curve must be estimated rather than bootstrapped; the least-cost portfolio then matches an annuity liability at almost every cash-flow date.

q-fin.MF

Gatheral's Conjecture Revisited

We consider the Heston model with perfect negative spot--variance correlation and its one-dimensional local-volatility projection. Let $I_T^{\mathrm H}$ and $I_T^{\mathrm{LV}}$ denote their respective integrated variances over $[0,T]$. We establish the inequality \[ \mathbb{E}\bigl[(I_T^{\mathrm H}-K)^+\bigr] < \mathbb{E}\bigl[(I_T^{\mathrm{LV}}-K)^+\bigr] \] for every maturity $T>0$ and every strike $K>0$. Consequently, Heston integrated variance is strictly smaller in convex order than the integrated variance of the calibrated local-volatility model. This strict ordering gives a Heston-model counterexample to the convex-order inequality conjectured by J. Gatheral.

q-fin.MF

Concave Shape of the Yield Curve and No Arbitrage

In fixed income sector, the yield curve is probably the most observed indicator by the market for trading and fifinancing purposes. A yield curve plots interest rates across different contract maturities from short end to as long as 30 years. For each currency, the corresponding curve shows the relation between the level of the interest rates (or cost of borrowing) and the time to maturity. For example, the U.S. dollar interest rates paid on U.S. Treasury securities for various maturities are plotted as the US treasury curve. For the same currency, if the swap market is used, we could also plot the swap rates across the tenors which would be called the swap curve.Even the yield curve can be at, upward or downward (inverted), however, yield curve is generally concave. There is a lack of explanation of the concavity of the yield curve shape from economics theory. We offer in this article an explanation of the concavity shape of the yield curve from trading perspectives.

q-fin.MF