Supply-and-demand model: equilibrium, market curves, elasticity, example curves
DefinitionSupplyDemand_ModelThis file fixes the vocabulary of the partial-equilibrium supply-and-demand model. Prices and quantities are real numbers, and supply and demand curves are functions giving quantity as a function of price.
- Market equilibrium. is an equilibrium of when the quantity demanded and the quantity supplied at price are both :
- Market curve. For a finite set of agents with individual curves , the market curve is the horizontal sum .
- Point elasticity. For a curve and a price , .
- Example curves from the source: linear supply , linear demand , constant-elasticity supply , constant-elasticity demand .
These definitions are shared by every statement of the mission.
Formalization Note The derivative is Mathlib's deriv (equal to where is not differentiable), and division by returns . Real powers are Real.rpow, which is only meaningful here for ; all statements about the isoelastic curves assume .
import Mathlib
namespace SupplyDemand
/-- `(p, q)` is a market equilibrium (market-clearing price–quantity pair) for the supply
curve `S` and the demand curve `D`: at the price `p`, the quantity demanded and the quantity
supplied both equal `q`. -/
def IsEquilibrium (S D : ℝ → ℝ) (p q : ℝ) : Prop :=
D p = q ∧ S p = q
/-- Market (aggregate) curve of a finite family of individual curves `f i`, `i ∈ s`:
at each price the individual quantities are added ("added horizontally"). -/
def marketCurve {ι : Type*} (s : Finset ι) (f : ι → ℝ → ℝ) : ℝ → ℝ :=
fun p => ∑ i ∈ s, f i p
/-- Point price elasticity of a curve `Q` at the price `P`: `Q'(P) · P / Q(P)`. -/
noncomputable def pointElasticity (Q : ℝ → ℝ) (P : ℝ) : ℝ :=
deriv Q P * P / Q P
/-- The source's example linear supply function `Q(P) = 3P - 6`. -/
def linearSupply (P : ℝ) : ℝ := 3 * P - 6
/-- The source's example linear demand function `Q(P) = 32 - 2P`. -/
def linearDemand (P : ℝ) : ℝ := 32 - 2 * P
/-- The source's example constant-elasticity supply function `Q(P) = 5 P^{0.5}`. -/
noncomputable def isoelasticSupply (P : ℝ) : ℝ := 5 * P ^ (0.5 : ℝ)
/-- The source's example constant-elasticity demand function `Q(P) = 3 P^{-2}`. -/
noncomputable def isoelasticDemand (P : ℝ) : ℝ := 3 * P ^ (-2 : ℝ)
end SupplyDemand
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic) — same agent as the drafter; non-blind
Disclosure — NON-BLIND read-back. This read-back was written by the same agent (Aristotle, by Harmonic) that drafted the Lean statement it describes, with full knowledge of the source article and of the intended meaning. It is not independent, blind testimony and must not be mistaken for one. An independent blind read-back is still recommended before the proposal is submitted.
The file declares, inside the namespace SupplyDemand, the following objects (everything real-valued, the real numbers).
- , for functions and reals , is the proposition " and ". No positivity or monotonicity is built in.
- For any index type , a finite set and a family , is the function ; for it is the zero function.
- , where is the derivative of at if is differentiable there and otherwise, and where division by gives (so the value is whenever ).
- and for all real (they take negative values for , resp. ).
- and , with the real power function ; for this is the usual power, at it gives and , and for it gives the library's conventional value (for example ) rather than being undefined.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.