Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Ricardian model: countries, autarky and trade sets, competitive output

Definition
ComparativeAdvantage_Model

by Lucas · Oct 9, 2026 · Mathlib 0df444a (Lean v4.33.1)

comparative-advantageeconomicsinternational-trade

This file fixes the vocabulary of the two-country, two-good (cloth and wine) Ricardian model with labour as the only factor of production.

  1. Country. A country is given by its labour force LLL, the labour aLCa_{LC}aLC​ needed to produce one unit of cloth, and the labour aLWa_{LW}aLW​ needed to produce one unit of wine, all strictly positive. Foreign's data are written L′L'L′, aLC′a'_{LC}aLC′​, aLW′a'_{LW}aLW′​.
  2. Comparative advantage in cloth. Home has a comparative advantage in cloth relative to Foreign when
aLCaLW<aLC′aLW′.\frac{a_{LC}}{a_{LW}}<\frac{a'_{LC}}{a'_{LW}}.aLW​aLC​​<aLW′​aLC′​​.
  1. Autarky set. The bundles (QC,QW)(Q_C,Q_W)(QC​,QW​) with QC,QW≥0Q_C,Q_W\ge0QC​,QW​≥0 and aLCQC+aLWQW≤La_{LC}Q_C+a_{LW}Q_W\le LaLC​QC​+aLW​QW​≤L.
  2. Trade set, cloth specialization. At world prices PC,PWP_C,P_WPC​,PW​: the bundles with QC,QW≥0Q_C,Q_W\ge0QC​,QW​≥0 and aLCQC+aLCPWPCQW≤La_{LC}Q_C+a_{LC}\frac{P_W}{P_C}Q_W\le LaLC​QC​+aLC​PC​PW​​QW​≤L.
  3. Trade set, wine specialization. The bundles with QC,QW≥0Q_C,Q_W\ge0QC​,QW​≥0 and aLWPCPWQC+aLWQW≤La_{LW}\frac{P_C}{P_W}Q_C+a_{LW}Q_W\le LaLW​PW​PC​​QC​+aLW​QW​≤L.
  4. Competitive output. A bundle (QC,QW)(Q_C,Q_W)(QC​,QW​) with QC,QW≥0Q_C,Q_W\ge0QC​,QW​≥0 and full employment aLCQC+aLWQW=La_{LC}Q_C+a_{LW}Q_W=LaLC​QC​+aLW​QW​=L, such that cloth is produced (QC>0Q_C>0QC​>0) only if PW/aLW≤PC/aLCP_W/a_{LW}\le P_C/a_{LC}PW​/aLW​≤PC​/aLC​, and wine is produced (QW>0Q_W>0QW​>0) only if PC/aLC≤PW/aLWP_C/a_{LC}\le P_W/a_{LW}PC​/aLC​≤PW​/aLW​: labour works only in a sector paying the highest wage.
  5. Ricardo's countries. England: L=220L=220L=220, aLC=100a_{LC}=100aLC​=100, aLW=120a_{LW}=120aLW​=120. Portugal: L=170L=170L=170, aLC=90a_{LC}=90aLC​=90, aLW=80a_{LW}=80aLW​=80 (hours of work).

Every statement of the mission is phrased in these terms.

Formalization Note Positivity of LLL, aLCa_{LC}aLC​, aLWa_{LW}aLW​ is stored inside the structure. Prices are not part of the structure; theorems that divide by prices assume them positive. Division by zero in Lean returns 000, so the trade sets are only meaningful for positive prices.

Definition code
import Mathlib

namespace ComparativeAdvantage

/-- A country of the two-good (cloth, wine) one-factor Ricardian model.
`L` is its labour force, `aLC` the amount of labour required to produce one unit of cloth,
`aLW` the amount of labour required to produce one unit of wine. All three are positive. -/
structure Country where
  L : ℝ
  aLC : ℝ
  aLW : ℝ
  L_pos : 0 < L
  aLC_pos : 0 < aLC
  aLW_pos : 0 < aLW

/-- `h` has a comparative advantage in cloth relative to `f`: its opportunity cost of cloth in
terms of wine is lower, `aLC / aLW < a'LC / a'LW`. -/
def HasComparativeAdvantageInCloth (h f : Country) : Prop :=
  h.aLC / h.aLW < f.aLC / f.aLW

/-- Autarky production (= consumption) possibilities of `c`: the bundles `(QC, QW)` of cloth
and wine with `QC, QW ≥ 0` and `aLC * QC + aLW * QW ≤ L`. -/
def autarkySet (c : Country) : Set (ℝ × ℝ) :=
  {q | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ c.aLC * q.1 + c.aLW * q.2 ≤ c.L}

/-- Consumption possibilities of `c` under free trade at world prices `PC` (cloth) and `PW`
(wine) when `c` produces cloth exclusively and trades cloth for wine:
`QC, QW ≥ 0` and `aLC * QC + aLC * (PW / PC) * QW ≤ L`. -/
def tradeSetCloth (c : Country) (PC PW : ℝ) : Set (ℝ × ℝ) :=
  {q | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ c.aLC * q.1 + c.aLC * (PW / PC) * q.2 ≤ c.L}

/-- Consumption possibilities of `c` under free trade at world prices `PC`, `PW` when `c`
produces wine exclusively and trades wine for cloth:
`QC, QW ≥ 0` and `aLW * (PC / PW) * QC + aLW * QW ≤ L`. -/
def tradeSetWine (c : Country) (PC PW : ℝ) : Set (ℝ × ℝ) :=
  {q | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ c.aLW * (PC / PW) * q.1 + c.aLW * q.2 ≤ c.L}

/-- `q = (QC, QW)` is a competitive output of `c` at prices `PC`, `PW`: labour is fully
employed (`aLC * QC + aLW * QW = L`, `QC, QW ≥ 0`), and labour works in a sector only if that
sector's wage (`PC / aLC` in cloth, `PW / aLW` in wine) is at least the other sector's wage. -/
def IsCompetitiveOutput (c : Country) (PC PW : ℝ) (q : ℝ × ℝ) : Prop :=
  0 ≤ q.1 ∧ 0 ≤ q.2 ∧ c.aLC * q.1 + c.aLW * q.2 = c.L ∧
    (0 < q.1 → PW / c.aLW ≤ PC / c.aLC) ∧ (0 < q.2 → PC / c.aLC ≤ PW / c.aLW)

/-- England in Ricardo's example: 220 hours of labour, 100 hours per unit of cloth,
120 hours per unit of wine. -/
noncomputable def england : Country where
  L := 220
  aLC := 100
  aLW := 120
  L_pos := by norm_num
  aLC_pos := by norm_num
  aLW_pos := by norm_num

/-- Portugal in Ricardo's example: 170 hours of labour, 90 hours per unit of cloth,
80 hours per unit of wine. -/
noncomputable def portugal : Country where
  L := 170
  aLC := 90
  aLW := 80
  L_pos := by norm_num
  aLC_pos := by norm_num
  aLW_pos := by norm_num

end ComparativeAdvantage
Source
Wikipedia, "Comparative advantage" (PDF export supplied with the request); https://en.wikipedia.org/wiki/Comparative_advantage, section "Ricardian model" (and "Ricardo's example" for England/Portugal)
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 ComparativeAdvantage:

  • a structure Country with three real fields LLL, aLCa_{LC}aLC​, aLWa_{LW}aLW​ and three proof fields asserting 0<L0<L0<L, 0<aLC0<a_{LC}0<aLC​, 0<aLW0<a_{LW}0<aLW​; no other constraint;
  • for countries h,fh,fh,f, the proposition HasComparativeAdvantageInCloth h fh\,fhf, which is exactly
aLChaLWh<aLCfaLWf\frac{a^h_{LC}}{a^h_{LW}}<\frac{a^f_{LC}}{a^f_{LW}}aLWh​aLCh​​<aLWf​aLCf​​

(real division; all denominators are positive by the structure);

  • for a country ccc, the set autarkySet c⊆R2c\subseteq\mathbb R^2c⊆R2 of pairs (x,y)(x,y)(x,y) with 0≤x0\le x0≤x, 0≤y0\le y0≤y and aLCx+aLWy≤La_{LC}x+a_{LW}y\le LaLC​x+aLW​y≤L;
  • for a country ccc and arbitrary reals PC,PWP_C,P_WPC​,PW​ (no sign assumption), tradeSetCloth c PC PWc\,P_C\,P_WcPC​PW​, the pairs (x,y)(x,y)(x,y) with 0≤x0\le x0≤x, 0≤y0\le y0≤y and aLCx+aLC⋅(PW/PC)⋅y≤La_{LC}x+a_{LC}\cdot(P_W/P_C)\cdot y\le LaLC​x+aLC​⋅(PW​/PC​)⋅y≤L; if PC=0P_C=0PC​=0 then PW/PCP_W/P_CPW​/PC​ is 000 by Lean's convention and the condition becomes aLCx≤La_{LC}x\le LaLC​x≤L;
  • tradeSetWine c PC PWc\,P_C\,P_WcPC​PW​, the pairs (x,y)(x,y)(x,y) with 0≤x0\le x0≤x, 0≤y0\le y0≤y and aLW⋅(PC/PW)⋅x+aLWy≤La_{LW}\cdot(P_C/P_W)\cdot x+a_{LW}y\le LaLW​⋅(PC​/PW​)⋅x+aLW​y≤L (again PC/PW=0P_C/P_W=0PC​/PW​=0 if PW=0P_W=0PW​=0);
  • the predicate IsCompetitiveOutput c PC PW (x,y)c\,P_C\,P_W\,(x,y)cPC​PW​(x,y): 0≤x0\le x0≤x, 0≤y0\le y0≤y, aLCx+aLWy=La_{LC}x+a_{LW}y=LaLC​x+aLW​y=L, and (x>0⇒PW/aLW≤PC/aLCx>0\Rightarrow P_W/a_{LW}\le P_C/a_{LC}x>0⇒PW​/aLW​≤PC​/aLC​) and (y>0⇒PC/aLC≤PW/aLWy>0\Rightarrow P_C/a_{LC}\le P_W/a_{LW}y>0⇒PC​/aLC​≤PW​/aLW​); prices are arbitrary reals here;
  • two specific countries: england with (L,aLC,aLW)=(220,100,120)(L,a_{LC},a_{LW})=(220,100,120)(L,aLC​,aLW​)=(220,100,120) and portugal with (170,90,80)(170,90,80)(170,90,80).

There are no lemmas or axioms in the file.

Human review
  • Endorsed by Shuze Chen · Oct 10, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Lucas · Oct 10, 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 paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me