Paper: arXiv 2602.00101
Authors: Marco Dessalvi, Massimo Bartoletti, Alberto Lluch-Lafuente
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.
Complexity vs Empirical Score
- Math Complexity: 8.0/10
- Empirical Rigor: 2.0/10
- Quadrant: Lab Rats — theoretically deep, empirically untested
Why this score: This paper provides a rigorous formal verification of AMM fee mechanisms using the Lean 4 proof assistant, delivering closed-form solutions for arbitrage maximization. While theoretical and mathematical rigor are outstanding, empirical backtesting against real-world DEX market data is absent.
Research Flowchart
flowchart TD
A[Research Goal: Formally model AMM trading fees & properties in Lean 4] --> B[Input: Extended Constant-Product Model with Fee Parameter φ ∈ 0,1]
B --> C[Methodology: Formalization & Machine-Checked Proofs in Lean 4 Assistant]
C --> D[Economic & Structural Analysis of Swap Rate Function]
C --> E[Arbitrage Optimization with Fees]
D --> F[Outcome 1: Preserved Monotonicity & Boundedness; Lost Additivity]
D --> G[Outcome 2: Proved Single Large Swaps Outperform Split Trades for φ < 1]
E --> H[Outcome 3: Derived & Proved Unique Closed-Form Arbitrage Solution]
Cited References (249)
- A Formal Approach to AMM Fee Mechanisms with Lean 4 — → 2602.00101
- Netting-based Liquidity-saving Automated Market Makers (2025) — link
- A theory of Automated Market Makers in DeFi (2022) — link
- Maximizing Extractable Value from Automated Market Makers (2022) — link
- A Theory of Automated Market Makers in DeFi (2021) — link
- Towards a Theory of Decentralized Finance (2021) — link
- The Lean 4 Theorem Prover and Programming Language (2021) — link
- SoK : Mitigation of Front-running in Decentralized Finance (2021)
and 241 more
- SoK: Decentralized Exchanges (DEX) with Automated Market Maker (AMM) protocols (2022) — link
- Formalising Decentralised Exchanges in Coq (2023) — link
- ConCert: a smart contract certification framework in Coq (2020) — link
- CeFi vs. DeFi - Comparing Centralized to Decentralized Finance (2021) — link
- Certifying optimal MEV strategies with Lean (2025) — link
- Clockwork Finance: Automated Analysis of Economic Security in Smart Contracts (2023) — link
- Formalizing Automated Market Makers in the Lean 4 Theorem Prover (2024) — link
- SoK : Lending Pools in Decentralized Finance (2021) — link
- Automated Market Making and Arbitrage Profits in the Presence of Fees — → 2305.14604
- Automated Market Making and Arbitrage Profits in the Presence of Fees — → 2305.14604
- Automated Market Making and Loss‐Versus‐Rebalancing (2022) — link
- Global Order Routing on Exchange Networks (2021) — link
- Dynamic Curves for Decentralized Autonomous Cryptocurrency Exchanges (2021) — link
- Towards a Theory of Maximal Extractable Value I: Constant Function Market Makers (2022) — link
- Quantifying Blockchain Extractable Value: How dark is the forest? (2021) — link
- SoK: Transparent Dishonesty: Front-Running Attacks on Blockchain (2020) — link
- Flash Boys 2.0: Frontrunning in Decentralized Exchanges, Miner Extractable Value, and Consensus Instability (2020) — link
- Smart Derivatives: On-Chain Forwards for Digital Assets (2020) — link
- SoK : Preventing Transaction Reordering Manipulations in Decentralized Finance (2022) — link
- High-Frequency Trading on Decentralized On-Chain Exchanges (2021) — link
- On the Just-In-Time Discovery of Profit-Generating Transactions in DeFi Protocols (2021) — link
- Attacking the DeFi Ecosystem with Flash Loans for Fun and Profit (2021) — link
- Liquidations: DeFi on a Knife-Edge (2021) — link
- Towards understanding flash loan and its applications in DeFi ecosystem (2020) — link
- SoK : Decentralized Finance ( DeFi ) (2022) — link
- The Decentralized Financial Crisis (2020) — link
- DeFi protocols for loanable funds: Interest rates, liquidity and market efficiency (2020) — link
- An Analysis of the Market Risk to Participants in the Compound Protocol
- Competitive equilibria between staking and on-chain lending (2019) — link
- Why Stake When You Can Borrow? (2020)
- A First Look into DeFi Oracles (2020) — link
- SoK: A Classification Framework for Stablecoin Designs (2020) — link
- Stablecoins 2.0: Economic Foundations and Risk-based Models (2020) — link
- Monetary stabilization in cryptocurrencies–design approaches and open questions (2019) — link
- Empirical measurements on pricing oracles and decentralized governance for stablecoins (2020)
- Optimal Bidding Strategy for Maker Auctions (2020) — link
- What is Stablecoin?: A Survey on Price Stabilization Mechanisms for Decentralized Payment Systems (2019) — link
- Automated Market Makers for Decentralized Finance (DeFi) (2020) — link
- An Analysis of Uniswap markets (2021) — link
- Improved Price Oracles: Constant Function Market Makers (2020) — link
- When does the tail wag the dog? Curvature and market making (2020) — link
- Differential Privacy in Constant Function Market Makers (2022) — link
- Optimal Fees for Geometric Mean Market Makers (2021) — link
- Liquidity provider returns in geometric mean markets (2020) — link
- Formal Specification of Constant Product Market Maker Model & Implementation (2018)
- Compound implementation (2020)
- Compound simplified interest (2020)
- Compound maximum liquidation amount (2020)
- Compound valuation of cTokens (2020)
- Compound comptroller setter (2020)
- Aave v1 simplified interest (2020)
- Aave maximum liquidation amount (2020)
- Aave valuation of aTokens (2020)
- Aave v1 flashloan receiver interface (2020)
- Aave v1 implementation (2020)
- Compound website (2020)
- Compound markets website (2020)
- Aave website (2020)
- Aave markets website (2020)
- MEV -geth (2022)
- Total Value Locked Volatility in DeFi: Empirical Evidence from Market Crashes (2025)
- mStable — Introducing Constant Sum Bonding Curves for Tokenised Assets (2020)
- Uniswap website (2020)
- Uniswap v2 Core (2020)
- Uniswap v3 Core (2021)
- Uniswap token pair implementation (2021)
- Uniswap statistics (2022)
- Uniswap oracle template (2020)
- Uniswap flash loan implementation (2020)
- Uniswap Documentation: Understanding Returns (2020)
- Balancer whitepaper (2019)
- Curve website (2020) — link
- Curve statistics (2022)
- StableSwap - efficient mechanism for Stablecoin (2019)
- Curve token pair implementation (2021)
- Curve computation of invariant constant (2021)
- Curve computation of swap amount (2021)
- Mooniswap implementation (2020)
- Mooniswap whitepaper (2020)
- Improving frontrunning resistance of x*y=k market makers (2018)
- Defi pulse website (2020)
- MakerDAO website (2020)
- bZx Fulcrum website (2020)
- dYdX website (2020)
- Coindesk: Value DeFi attack (2020)
- Harvest Finance flashloan attack post-mortem (2020)
- Origin Dollar attack (2020)
- Akropolis Defi attack (2020)
- Compound oracle attack (2020)
- SushiSwap token pair implementation (2021)
- Tinyman : Official Announcement About the Incidents of 01.01.2022 (2022)
- Documented Timeline of Exchange Hacks (2022)
- CashScript — Writing covenants (2019) — link
- Bitcoin Covenants Unchained (2020) — link
- BitML : a calculus for Bitcoin smart contracts (2018) — link
- Fun with Bitcoin Smart Contracts (2018) — link
- Verifying liquidity of Bitcoin contracts (2019)
- SoK : unraveling Bitcoin smart contracts (2018) — link
- A formal model of Bitcoin transactions (2018) — link
- Developing secure Bitcoin contracts with BitML (2019) — link
- Dissecting Ponzi schemes on Ethereum: Identification, analysis, and impact (2020) — link
- Disentangling Decentralized Finance ( DeFi ) Compositions (2023) — link
- UTxO - vs account-based smart contract blockchain programming paradigms (2020) — link
- IVY (2017)
- BALZaC: Bitcoin Abstract Language, analyZer and Compiler (2018)
- Multi-stage Contracts in the UTXO Model (2019) — link
- SoK: Off The Chain Transactions (2019)
- Resource-Aware Session Types for Digital Contracts (2019)
- Improved Price Oracles: Constant Function Market Makers (2020) — link
- Modeling Bitcoin contracts by timed automata (2014) — link
- The Economics of Automated Market Makers (2022) — link
- The Extended UTXO Model (2020)
- A fair protocol for data trading based on Bitcoin transactions (2017) — link
- Constant-deposit multiparty lotteries on Bitcoin (2017) — link
- An empirical analysis of smart contracts: platforms, applications, and design patterns (2017)
- A Journey into Bitcoin Metadata (2019) — link
- Enhancing Bitcoin transactions with covenants (2017) — link
- Simplicity: A New Language for Blockchains (2017) — link
- Bitcoin covenants (2016) — link
- Fair Two-Party Computations via Bitcoin Deposits (2014) — link
- Secure Multiparty Computations on Bitcoin (2014) — link
- On the Malleability of Bitcoin Transactions (2015) — link
- Secure multiparty computations on Bitcoin (2016) — link
- Hijacking Bitcoin : Routing Attacks on Cryptocurrencies (2017) — link
- Note on fair coin toss via Bitcoin (2013)
- Efficient Zero-Knowledge Contingent Payments in Cryptocurrencies Without Scripts (2016) — link
- Bitcoin as a Transaction Ledger: A Composable Treatment (2017) — link
- How to Use Bitcoin to Design Fair Protocols (2014) — link
- Validation of Decentralised Smart Contracts Through Game Theory and Formal Methods (2015) — link
- Peer-to-peer affine commitment using Bitcoin (2015) — link
- The Bitcoin Backbone Protocol: Analysis and Applications (2015) — link
- Majority Is Not Enough: Bitcoin Mining Is Vulnerable (2014) — link
- Fair and Robust Multi-party Computation Using a Global Transaction Ledger (2016) — link
- How to Use Bitcoin to Incentivize Correct Computations (2014) — link
- How to Use Bitcoin to Play Decentralized Poker (2015) — link
- Improvements to Secure Computation with Penalties (2016) — link
- Amortizing Secure Computation with Penalties (2016) — link
- Zero-Collateral Lotteries in Bitcoin and Ethereum (2017) — link
- A Fast and Scalable Payment Network with Bitcoin Duplex Micropayment Channels (2015) — link
- The Bitcoin Lightning Network : Scalable Off-Chain Instant Payments (2015) — link
- Sprites: Payment Channels that Go Faster than Lightning (2017) — link
- Bitcoin : a peer-to-peer electronic cash system (2008)
- SoK : Research Perspectives and Challenges for Bitcoin and Cryptocurrencies (2015) — link
- Pricing via Processing or Combatting Junk Mail (1993) — link
- On Bitcoin and red balloons (2012) — link
- Two Bitcoins at the Price of One? Double-Spending Attacks on Fast Payments in Bitcoin (2012)
- Misbehavior in Bitcoin : A Study of Double-Spending and Accountability (2015) — link
- Analysis of Hashrate-Based Double Spending (2014) — link
- Liar, Liar, Coins on Fire!: Penalizing Equivocation By Loss of Bitcoins (2015) — link
- Liquid: a Bitcoin Sidechain (2020)
- Bitcoin Covenants: Three Ways to Control the Future (2020)
- Formalizing and Securing Relationships on Public Networks (1997)
- Marlowe: Financial Contracts on Blockchain (2018) — link
- Multi-Currency Ledgers (2020)
- An Abstract Model of UTxO -based Cryptocurrencies with Scripts (2018)
- Sharing Decryption in the Context of Voting or Lotteries (2000) — link
- Publicly Verifiable Lotteries: Applications of Delaying Functions (1998) — link
- Temporarily hidden bit commitment and lottery applications (2010) — link
- Electronic Lottery Tickets as Micropayments (1997) — link
- Weakly Secret Bit Commitment: Applications to Lotteries and Fair Exchange (1998) — link
- Certifying Findel Derivatives for Blockchain (2020) — link
- A Survey of Attacks on Ethereum Smart Contracts (SoK) (2017) — link
- Formal Verification of Smart Contracts (2016)
- Dependent types and multi-monadic effects in F * (2016) — link
- Defining the Ethereum Virtual Machine for Interactive Theorem Provers (2017) — link
- Isabelle/HOL : a proof assistant for higher-order logic (2002) — link
- Demystifying Incentives in the Consensus Computer (2015) — link
- Designing Secure Ethereum Smart Contracts: A Finite State Machine Based Approach (2018)
- Automated Execution of Financial Contracts on Blockchains (2017) — link
- A Semantic Framework for the Security Analysis of Ethereum Smart Contracts (2018) — link
- Foundations and Tools for the Static Analysis of Ethereum Smart Contracts (2018) — link
- Hyperledger Fabric : a distributed operating system for permissioned blockchains (2018) — link
- Ethereum : a next generation smart contract and decentralized application platform (2013)
- Ethereum : a secure decentralised generalised transaction ledger (2014)
- Step by Step Towards Creating a Safe Smart Contract: Lessons and Insights from a Cryptocurrency Lab (2016)
- The Ring of Gyges : Investigating the Future of Criminal Smart Contracts (2016) — link
- Hawk: The Blockchain Model of Cryptography and Privacy-Preserving Smart Contracts (2016) — link
- Scripting smart contracts for distributed ledger technology (2016)
- Making Smart Contracts Smarter (2016) — link
- The Postmodern Ponzi Scheme: Empirical Analysis of High-Yield Investment Programs (2012) — link
- A fistful of Bitcoins : characterizing payments among men with no names (2016) — link
- The promise and perils of digital currencies (2013) — link
- BitIodine: Extracting Intelligence from the Bitcoin Network (2014) — link
- Empirical Analysis of Denial-of-Service Attacks in the Bitcoin Ecosystem (2014) — link
- There’s No Free Lunch, Even Using Bitcoin : Tracking the Popularity and Profits of Virtual Currency Scams (2015) — link
- Segregated Witness (Consensus layer) (2015)
- Securify: Practical Security Analysis of Smart Contracts (2018)
- Scilla: a Smart Contract Intermediate-Level LAnguage (2018)
- Quantitative Analysis of Smart Contracts (2018) — link
- Algorand Developer Docs - Assets (2020)
- EPOBC protocol specification (2020)
- OpenAssets protocol (2020)
- Colu website (2020)
- Counterpary website (2020)
- Reconciling Two Views of Cryptography (The Computational Soundness of Formal Encryption) (2007) — link
- Random Oracles Are Practical: A Paradigm for Designing Efficient Protocols (1993) — link
- Coin Flipping by Telephone (1981)
- Timed Commitments (2000) — link
- A method for obtaining digital signatures and public-key cryptosystems (1978)
- Logical reversibility of computation (1973)
- Software and Reversible Systems: A Survey of Recent Activities (2020) — link
- An Overview and Synthesis on Timed Process Algebras (1991) — link
- Corda : An Introduction (2016)
- From Institutions to Code: towards Automated Generation of Smart Contracts (2016)
- Findel: Secure Derivative Contracts for Ethereum (2017) — link
- Composing contracts: an adventure in financial engineering, functional pearl (2000) — link
- Two Probability Models of Pyramid or Chain Letter Schemes Demonstrating That Their Promotional Claims Are Unreliable (1984)
- Bitcoin: Questions, Answers, and Analysis of Legal Issues (2015)
- A Normalized Levenshtein Distance Metric (2007) — link
- Taking A Bit Out of Crime: Bitcoin and Cross-Border Tax Evasion (2014)
- Bitcoin: A primer for policymakers (2013)
- Understanding the DAO attack (2016)
- Parity Wallet Security Alert (2017)
- A Postmortem on the Parity Multi-Sig Library Self-Destruct (2017)
- Silk Road: eBay for drugs (2012)
- The mathematics of Ponzi schemes (2009) — link
- Ethical issues connected with multi-level marketing schemes (2001)
- Ethtrade Review -– Is Ethtrade a Scam or Legitimate? Read Before You Invest (2016)
- BadBitcoin: the Bad list
- The first successful Zero-Knowledge Contingent Payment (2016)
- Bitcoin wiki - Contracts - Using external state (2012)
- Bitcoin wiki - Contracts - Assurance contracts (2012)
- Bitcoin wiki - Contracts (2012)
- Bitcoin developer guide - Escrow and arbitration (2015)
- Smart Contracts on Bitcoin Blockchain (2015)
- King ot the Ether Throne (2016)
- ERC-20 Token Standard (2015)
- EIP 721 : ERC-721 Non-Fungible Token Standard
- CoinCovenants using SCIP signatures, an amusingly bad idea (2013)
- CHECKTEMPLATEVERIFY (2020)
- Taproot: SegWit version 1 spending rules (2020)
- BIP 0002 (2016)
- Tokens, Types, and Standards: Identification and Utilization in Ethereum (2020) — link
- Detecting Token Systems on Ethereum (2019) — link
- Ethereum token dynanics
- Concave function (n.d.)
- Counter machines and counter languages (1968) — link
- How to Generate and Exchange Secrets (Extended Abstract) (1986) — link
- How to Play any Mental Game or A Completeness Theorem for Protocols with Honest Majority (1987) — link
- Basic notions of trace theory (1988) — link
- cite-lean (2025)
3 of 249 cited works are in the corpus; resolved via arXiv source bundles, Semantic Scholar and OpenAlex. Corpus-wide: 2518 linked papers.