Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

(4), p. 23 — the front-runner's profit on a constant product pool is 2x²Y/((X − x)(X − 2x)) > 0

Proved
CPAMMFlaws.Properties.eq_4

by mikedeng1 · Oct 15, 2026 · Mathlib 0df444a (Lean v4.33.1)

automated-market-makingfront-runningp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1

Let a constant product pool hold X>0X>0X>0 units of token AAA and Y>0Y>0Y>0 units of token BBB, and let 0<x<X/20<x<X/20<x<X/2. A front-runner buys xxx units, the trader she front-runs buys xxx units, and the pool is then (X−2x,  Y+y(2x))(X-2x,\;Y+y(2x))(X−2x,Y+y(2x)) with y(2x)=pcmm(2x,X,Y)y(2x)=p^{\mathrm{cmm}}(2x,X,Y)y(2x)=pcmm(2x,X,Y). She sells her xxx units back into that pool. Then:

  1. her sale proceeds are
−pcmm(−x,  X−2x,  Y+y(2x))=xXY(X−x)(X−2x);-p^{\mathrm{cmm}}\bigl(-x,\;X-2x,\;Y+y(2x)\bigr)=\frac{xXY}{(X-x)(X-2x)};−pcmm(−x,X−2x,Y+y(2x))=(X−x)(X−2x)xXY​;
  1. her profit, the proceeds minus her purchase cost pcmm(x,X,Y)p^{\mathrm{cmm}}(x,X,Y)pcmm(x,X,Y), is
−pcmm(−x,  X−2x,  Y+y(2x))−pcmm(x,X,Y)=2x2Y(X−x)(X−2x);-p^{\mathrm{cmm}}\bigl(-x,\;X-2x,\;Y+y(2x)\bigr)-p^{\mathrm{cmm}}(x,X,Y)=\frac{2x^2Y}{(X-x)(X-2x)};−pcmm(−x,X−2x,Y+y(2x))−pcmm(x,X,Y)=(X−x)(X−2x)2x2Y​;
  1. this profit is strictly positive.

This is the computation behind Proposition 3(2): front-running a constant product pool is profitable for every order size.

Formalization Note The paper writes the proceeds as y(−x,X−2x,Y+y(2x))y(-x,X-2x,Y+y(2x))y(−x,X−2x,Y+y(2x)), the amount received; in the sign of (3) a sale has negative cost, so the proceeds are −pcmm(−x,⋅,⋅)-p^{\mathrm{cmm}}(-x,\cdot,\cdot)−pcmm(−x,⋅,⋅) (p. 16: "Negative values of xxx signify a sale and the cost, therefore, indicates revenue earned"). The bound x<X/2x<X/2x<X/2 is the paper's standing restriction for front-running (p. 19); X>0X>0X>0, Y>0Y>0Y>0 are the deposits of §II.C.

Preamble
import Mathlib
import Definitions.Def_CPAMMFlaws_Properties_Setting
Formal statement
namespace CPAMMFlaws.Properties

theorem eq_4 (X Y x : ℝ) (hX : 0 < X) (hY : 0 < Y) (hx : 0 < x) (hx2 : x < X / 2) :
    -pcmm (-x) (X - 2 * x) (Y + pcmm (2 * x) X Y) = x * X * Y / ((X - x) * (X - 2 * x)) ∧
      -pcmm (-x) (X - 2 * x) (Y + pcmm (2 * x) X Y) - pcmm x X Y =
        2 * x ^ 2 * Y / ((X - x) * (X - 2 * x)) ∧
      0 < 2 * x ^ 2 * Y / ((X - x) * (X - 2 * x)) := by sorry

end CPAMMFlaws.Properties
Source
Park, The Conceptual Flaws of Constant Product Automated Market Making, working paper dated June 8, 2021, p. 23, proof of Proposition 3(2), (4)
Human review
  • Endorsed by Shuze Chen · Oct 16, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 16, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me