diff --git a/lectures/_static/quant-econ.bib b/lectures/_static/quant-econ.bib
index 3e99001d..eaa1b26a 100644
--- a/lectures/_static/quant-econ.bib
+++ b/lectures/_static/quant-econ.bib
@@ -3734,3 +3734,141 @@ @article{McKayNakamuraSteinsson2016
number = {10},
pages = {3133--3158}
}
+
+@article{BassettoHuoRiosRull2024,
+ author = {Bassetto, Marco and Huo, Zhen and R{\'i}os-Rull, Jos{\'e}-V{\'i}ctor},
+ title = {Institution Building without Commitment},
+ journal = {American Economic Review},
+ volume = {114},
+ number = {11},
+ pages = {3427--3468},
+ year = {2024}
+}
+
+@techreport{BassettoHuoRiosRull2026,
+ author = {Bassetto, Marco and Huo, Zhen and R{\'i}os-Rull, Jos{\'e}-V{\'i}ctor},
+ title = {Gradual Liberalization and Resilient Trade Cooperation},
+ institution = {Rice University, Yale University, and University of Pennsylvania},
+ type = {Working paper},
+ year = {2026}
+}
+
+@article{Strotz1956,
+ author = {Strotz, Robert H.},
+ title = {Myopia and Inconsistency in Dynamic Utility Maximization},
+ journal = {Review of Economic Studies},
+ volume = {23},
+ number = {3},
+ pages = {165--180},
+ year = {1956}
+}
+
+@article{PhelpsPollak1968,
+ author = {Phelps, Edmund S. and Pollak, Robert A.},
+ title = {On Second-Best National Saving and Game-Equilibrium Growth},
+ journal = {Review of Economic Studies},
+ volume = {35},
+ number = {2},
+ pages = {185--199},
+ year = {1968}
+}
+
+@article{Laibson1997,
+ author = {Laibson, David},
+ title = {Golden Eggs and Hyperbolic Discounting},
+ journal = {Quarterly Journal of Economics},
+ volume = {112},
+ number = {2},
+ pages = {443--477},
+ year = {1997}
+}
+
+@article{KrusellSmith2003,
+ author = {Krusell, Per and Smith, Anthony A.},
+ title = {Consumption-Savings Decisions with Quasi-Geometric Discounting},
+ journal = {Econometrica},
+ volume = {71},
+ number = {1},
+ pages = {365--375},
+ year = {2003}
+}
+
+@article{JacksonYariv2014,
+ author = {Jackson, Matthew O. and Yariv, Leeat},
+ title = {Present Bias and Collective Dynamic Choice in the Lab},
+ journal = {American Economic Review},
+ volume = {104},
+ number = {12},
+ pages = {4184--4204},
+ year = {2014}
+}
+
+@article{Kocherlakota1996,
+ author = {Kocherlakota, Narayana R.},
+ title = {Reconsideration-Proofness: A Refinement for Infinite Horizon Time Inconsistency},
+ journal = {Games and Economic Behavior},
+ volume = {15},
+ number = {1},
+ pages = {33--54},
+ year = {1996}
+}
+
+@article{DekleEatonKortum2008,
+ author = {Dekle, Robert and Eaton, Jonathan and Kortum, Samuel},
+ title = {Global Rebalancing with Gravity: Measuring the Burden of Adjustment},
+ journal = {IMF Staff Papers},
+ volume = {55},
+ number = {3},
+ pages = {511--540},
+ year = {2008}
+}
+
+@article{BondPark2002,
+ author = {Bond, Eric W. and Park, Jee-Hyeong},
+ title = {Gradualism in Trade Agreements with Asymmetric Countries},
+ journal = {Review of Economic Studies},
+ volume = {69},
+ number = {2},
+ pages = {379--406},
+ year = {2002}
+}
+
+@article{Bond2009,
+ author = {Bond, Eric W.},
+ title = {Paths of Efficient Self-Enforcing Trade Agreements},
+ journal = {Economic Theory},
+ volume = {41},
+ number = {1},
+ pages = {85--104},
+ year = {2009}
+}
+
+@incollection{Mussa1986trade,
+ author = {Mussa, Michael},
+ title = {The Adjustment Process and the Timing of Trade Liberalization},
+ booktitle = {Economic Liberalization in Developing Countries},
+ editor = {Choksi, Armeane M. and Papageorgiou, Demetris},
+ publisher = {Basil Blackwell},
+ address = {Oxford},
+ year = {1986}
+}
+
+@article{Rustichini1998,
+ author = {Rustichini, Aldo},
+ title = {Dynamic Programming Solution of Incentive Constrained Problems},
+ journal = {Journal of Economic Theory},
+ volume = {78},
+ number = {2},
+ pages = {329--354},
+ year = {1998}
+}
+
+@article{ThomasWorrall1994,
+ author = {Thomas, Jonathan and Worrall, Tim},
+ title = {Foreign Direct Investment and the Risk of Expropriation},
+ journal = {Review of Economic Studies},
+ volume = {61},
+ number = {1},
+ pages = {81--108},
+ year = {1994}
+}
diff --git a/lectures/_toc.yml b/lectures/_toc.yml
index 2af8758c..3c916a06 100644
--- a/lectures/_toc.yml
+++ b/lectures/_toc.yml
@@ -94,6 +94,8 @@ parts:
- file: atkeson_1991
- file: tsyrennikov_2013
- file: dovis_accounting_mf
+ - file: gradual_trade_agreements
+ - file: organizational_equilibrium
- caption: Other
numbered: true
chapters:
diff --git a/lectures/gradual_trade_agreements.md b/lectures/gradual_trade_agreements.md
new file mode 100644
index 00000000..d8f0eaaf
--- /dev/null
+++ b/lectures/gradual_trade_agreements.md
@@ -0,0 +1,973 @@
+---
+jupytext:
+ text_representation:
+ extension: .md
+ format_name: myst
+ format_version: 0.13
+ jupytext_version: 1.17.1
+kernelspec:
+ display_name: Python 3 (ipykernel)
+ language: python
+ name: python3
+---
+
+(gradual_trade_agreements)=
+```{raw} jupyter
+
+```
+
+# Gradualism in Self-Enforcing Trade Agreements
+
+```{contents} Contents
+:depth: 2
+```
+
+## Overview
+
+Free-trade agreements rarely eliminate tariffs at once.
+
+The North American Free Trade Agreement phased out tariffs between the United States and Mexico over
+15 years, the United Kingdom's accession to the European Community eliminated internal tariffs over
+five years, and GATT negotiations lowered tariffs round by round.
+
+If governments could commit to tariffs and if goods and factor markets worked well, immediate free trade
+would be efficient {cite}`Mussa1986trade`.
+
+Governments cannot commit, so trade agreements must be **self-enforcing**: each government must prefer
+to honor the agreement, given that a deviation would trigger a trade war.
+
+This lecture studies two papers that use this requirement to explain gradualism.
+
+* {cite:t}`BondPark2002` show that when two countries differ in size, the efficient self-enforcing
+ agreement can start with a positive tariff and move toward free trade, even though the economic
+ environment never changes.
+* {cite:t}`Bond2009` shows that self-enforcement can make it efficient to add members to an agreement
+ one at a time.
+
+Bond and Park compute the frontier of self-enforcing agreements recursively, with the payoff promised to
+one country as the state variable.
+
+That makes their problem one of **dynamic programming squared**: the value function of the problem
+appears inside its own constraints, as in {doc}`chang_credible`, {doc}`atkeson_1991`, and
+{doc}`tsyrennikov_2013`.
+
+The key force is **backloading**: an agreement relaxes the incentive constraint of the country tempted to
+deviate by promising it more in the future, and a tariff imposed by its partner, which the tempted country
+cannot escape by deviating, serves as a transfer in the meantime.
+
+The next lecture, {doc}`organizational_equilibrium`, studies gradual liberalization with a different
+equilibrium concept, one that does not rely on the threat of a permanent trade war.
+
+We use the following imports.
+
+```{code-cell} ipython3
+import numpy as np
+import matplotlib.pyplot as plt
+from collections import namedtuple
+from scipy.optimize import minimize_scalar
+```
+
+(gta_model)=
+## A two-country trade model
+
+There are two goods and two countries, a small country $S$ and a large country $L$.
+
+In country $S$, demand and supply of good $i$ are
+
+$$
+D_i^S(p) = A - B p , \qquad X_i^S(p) = \alpha_i^S + \beta p ,
+$$
+
+and in country $L$ they are $\lambda$ times as large,
+
+$$
+D_i^L(p) = \lambda (A - B p) , \qquad X_i^L(p) = \lambda (\alpha_i^L + \beta p ) ,
+$$
+
+where $\lambda \ge 1$ measures the relative size of $L$.
+
+Following {cite:t}`BondPark2002`, we set $\alpha_1^L = \alpha_2^S > \alpha_2^L = \alpha_1^S$, so that $S$
+imports good 1 and exports good 2, and the countries are mirror images when $\lambda = 1$.
+
+Each country taxes its imports with a specific tariff: $t_S$ on good 1 imported by $S$, and $t_L$ on good
+2 imported by $L$.
+
+Domestic prices satisfy $p_1^S = p_1^L + t_S$ and $p_2^L = p_2^S + t_L$, and world market clearing for
+each good gives
+
+$$
+p_1^L = \frac{(1 + \lambda) A - \alpha_1^S - \lambda \alpha_1^L - (B + \beta) t_S}{(1 + \lambda)(B + \beta)} ,
+\qquad
+p_2^S = \frac{(1 + \lambda) A - \alpha_2^S - \lambda \alpha_2^L - \lambda (B + \beta) t_L}{(1 + \lambda)(B + \beta)} .
+$$
+
+National welfare $W_j(t_j, t_k)$ is the sum of consumer surplus, producer surplus, and tariff revenue over
+the two goods.
+
+{cite:t}`BondPark2002` show that
+
+* $W_j$ is concave in the country's own tariff and is maximized at
+
+ $$
+ t_L^N = \frac{\lambda (\alpha_2^S - \alpha_2^L)}{(1 + 2\lambda)(\beta + B)} , \qquad
+ t_S^N = \frac{\alpha_1^L - \alpha_1^S}{(2 + \lambda)(\beta + B)} ;
+ $$
+
+* $W_j$ is decreasing and convex in the other country's tariff;
+* world welfare $W_S + W_L$ is maximized at free trade.
+
+Because the welfare of each country is additively separable in the two tariffs, $t_j^N$ is a dominant
+strategy, and the pair $(t_S^N, t_L^N)$ is the Nash equilibrium of the one-shot tariff game.
+
+The game is a prisoner's dilemma: each country gains by taxing imports, which improves its terms of trade,
+but both would be better off at free trade, at least when they are not too different in size.
+
+The large country's Nash tariff rises with $\lambda$, and the small country's falls toward zero, because a
+small country cannot move world prices.
+
+```{code-cell} ipython3
+TradeModel = namedtuple('TradeModel', ('A', 'B', 'β', 'α_hi', 'α_lo', 'λ', 'δ'))
+
+def create_trade_model(A=100.0, B=1.0, β=1.0, α_hi=-40.0, α_lo=-60.0, λ=1.1, δ=0.8):
+ "α_hi = α_1^L = α_2^S and α_lo = α_2^L = α_1^S."
+ return TradeModel(A=A, B=B, β=β, α_hi=α_hi, α_lo=α_lo, λ=λ, δ=δ)
+
+def welfare(t_S, t_L, m):
+ "National welfare (W_S, W_L) when S taxes good 1 at t_S and L taxes good 2 at t_L."
+ A, B, β, α_hi, α_lo, λ = m.A, m.B, m.β, m.α_hi, m.α_lo, m.λ
+ p_1L = ((1 + λ) * A - α_lo - λ * α_hi - (B + β) * t_S) / ((1 + λ) * (B + β))
+ p_2S = ((1 + λ) * A - α_hi - λ * α_lo - λ * (B + β) * t_L) / ((1 + λ) * (B + β))
+ p_1S, p_2L = p_1L + t_S, p_2S + t_L
+ CS = lambda p: (A - B * p)**2 / (2 * B) # consumer surplus
+ PS = lambda p, α: (α + β * p)**2 / (2 * β) # producer surplus
+ imports = lambda p, α: (A - B * p) - (α + β * p)
+ W_S = (CS(p_1S) + PS(p_1S, α_lo) + CS(p_2S) + PS(p_2S, α_hi)
+ + t_S * imports(p_1S, α_lo))
+ W_L = λ * (CS(p_1L) + PS(p_1L, α_hi) + CS(p_2L) + PS(p_2L, α_lo)
+ + t_L * imports(p_2L, α_lo))
+ return W_S, W_L
+
+def nash_tariffs(m):
+ A, B, β, α_hi, α_lo, λ = m.A, m.B, m.β, m.α_hi, m.α_lo, m.λ
+ t_LN = λ * (α_hi - α_lo) / ((1 + 2 * λ) * (β + B))
+ t_SN = (α_hi - α_lo) / ((2 + λ) * (β + B))
+ return t_SN, t_LN
+```
+
+We check the formulas for the Nash tariffs by maximizing each country's welfare numerically.
+
+```{code-cell} ipython3
+m = create_trade_model()
+t_SN, t_LN = nash_tariffs(m)
+best_S = minimize_scalar(lambda t: -welfare(t, 0, m)[0], bounds=(0, 20), method='bounded').x
+best_L = minimize_scalar(lambda t: -welfare(0, t, m)[1], bounds=(0, 20), method='bounded').x
+print(f"Nash tariffs: t_S = {t_SN:.3f} (numerical {best_S:.3f}), t_L = {t_LN:.3f} "
+ f"(numerical {best_L:.3f})")
+print("welfare at free trade:", np.round(welfare(0, 0, m), 1),
+ " at the Nash tariffs:", np.round(welfare(t_SN, t_LN, m), 1))
+```
+
+(gta_self_enforcing)=
+## Self-enforcing agreements
+
+A **trade agreement** is a sequence of tariffs $t_j(i) \ge 0$ and side payments $s_j(i) \ge 0$ that
+country $j$ pays at date $i = 0, 1, \ldots$.
+
+Side payments stand for concessions in side agreements, such as rules on intellectual property or
+foreign investment.
+
+The payoff to country $j$ from date $i$ on is
+
+$$
+V_j(i) = \sum_{n=0}^\infty \delta^n \left[ W_j\big(t_j(i+n), t_k(i+n)\big) + s_k(i+n) - s_j(i+n) \right] .
+$$
+
+If governments could commit, efficient agreements would eliminate tariffs immediately and use side
+payments to divide the gains, so the **first-best frontier** is
+
+$$
+\Omega^*(V_L) = \frac{W_S(0, 0) + W_L(0, 0)}{1 - \delta} - V_L .
+$$
+
+Without commitment, an agreement must be self-enforcing.
+
+Following {cite:t}`BondPark2002`, we assume that a deviation triggers permanent reversion to the Nash
+tariffs without side payments, which gives country $j$ the payoff $V_j^N = W_j(t_j^N, t_k^N) / (1 -
+\delta)$.
+
+A deviating country sets its Nash tariff and stops paying side payments, but it still receives the side
+payment of its partner in the period of deviation.
+
+The **incentive constraint** of country $j$ at each date $i$ is therefore
+
+```{math}
+:label: gta-ic
+V_j(i) \ge W_j\big(t_j^N, t_k(i)\big) + s_k(i) + \delta V_j^N .
+```
+
+### Stationary free-trade agreements
+
+Consider free trade with constant side payments.
+
+The incentive constraint {eq}`gta-ic` becomes $s_j - \delta s_k \le H_j$, where
+
+$$
+H_j = \delta \left[ W_j(0, 0) - W_j(t_j^N, t_k^N) \right] - (1 - \delta) \left[ W_j(t_j^N, 0) - W_j(0, 0) \right]
+$$
+
+weighs the future loss from a trade war against the one-period gain from deviating.
+
+Since only one country pays in an efficient agreement, the largest net side payment that country $j$ is
+willing to make each period is $T_j = H_j$ if $H_j > 0$ and $T_j = H_j / \delta$ if $H_j \le 0$, in which
+case $j$ must be paid at least $-T_j$.
+
+A free-trade agreement with constant side payments is sustainable if and only if $T_S + T_L \ge 0$, and
+then it can give $L$ any payoff in the interval $[V_L^*, V_L^{**}]$, where
+
+$$
+V_L^* = \frac{W_L(0, 0) - T_L}{1 - \delta} , \qquad V_L^{**} = \frac{W_L(0, 0) + T_S}{1 - \delta} .
+$$
+
+Below $V_L^*$, the large country gets too little to stay in a free-trade agreement; above $V_L^{**}$, the
+small country does.
+
+```{code-cell} ipython3
+def stationary_bounds(m):
+ "Nash payoffs, maximal side payments, and the interval [V_L*, V_L**] of sustainable free trade."
+ δ = m.δ
+ t_SN, t_LN = nash_tariffs(m)
+ W_S0, W_L0 = welfare(0, 0, m)
+ W_SN, W_LN = welfare(t_SN, t_LN, m)
+ H_S = δ * (W_S0 - W_SN) - (1 - δ) * (welfare(t_SN, 0, m)[0] - W_S0)
+ H_L = δ * (W_L0 - W_LN) - (1 - δ) * (welfare(0, t_LN, m)[1] - W_L0)
+ T_S = H_S if H_S > 0 else H_S / δ
+ T_L = H_L if H_L > 0 else H_L / δ
+ return dict(V_SN=W_SN / (1 - δ), V_LN=W_LN / (1 - δ), T_S=T_S, T_L=T_L,
+ V_L_low=(W_L0 - T_L) / (1 - δ), V_L_high=(W_L0 + T_S) / (1 - δ))
+
+models = {"λ = 1.1, δ = 0.8": create_trade_model(λ=1.1, δ=0.8),
+ "λ = 1.5, δ = 0.7": create_trade_model(λ=1.5, δ=0.7)}
+for name, m_i in models.items():
+ sb = stationary_bounds(m_i)
+ print(f"{name}: T_S = {sb['T_S']:.2f}, T_L = {sb['T_L']:.2f}; "
+ f"V_L* - V_L^N = {sb['V_L_low'] - sb['V_LN']:.2f}, "
+ f"V_L** - V_L^N = {sb['V_L_high'] - sb['V_LN']:.2f}")
+```
+
+We study two cases.[^fig1a]
+
+When $\lambda = 1.1$ and $\delta = 0.8$, both $T_S$ and $T_L$ are positive: each country would pay
+something to keep free trade.
+
+When $\lambda = 1.5$ and $\delta = 0.7$, $T_L < 0$, so the small country must pay for access to the
+large country's market; the large country also wins the tariff war, in the sense that it does better at
+the Nash equilibrium than at free trade.
+
+(gta_recursive)=
+## A recursive formulation
+
+Outside $[V_L^*, V_L^{**}]$, stationary free-trade agreements are not self-enforcing.
+
+To find the efficient agreements there, {cite:t}`BondPark2002` treat the payoff promised to the large
+country as a state variable.
+
+Let $\tilde \Omega(V_L)$ be the largest payoff that the small country can get from a self-enforcing
+agreement that gives the large country $V_L$.
+
+It satisfies
+
+```{math}
+:label: gta-bellman
+\tilde \Omega(V_L) = \max_{t_L, t_S, s_L, s_S, y} \; W_S(t_S, t_L) + s_L - s_S + \delta \tilde \Omega(y)
+```
+
+subject to
+
+$$
+\begin{aligned}
+W_L(t_L, t_S) + s_S - s_L + \delta y &\ge V_L , \\
+W_L(t_L, t_S) - W_L(t_L^N, t_S) - s_L + \delta y &\ge \delta V_L^N , \\
+W_S(t_S, t_L) - W_S(t_S^N, t_L) - s_S + \delta \tilde \Omega(y) &\ge \delta V_S^N ,
+\end{aligned}
+$$
+
+where $y$ is the payoff promised to $L$ from next period on.
+
+The first constraint delivers the promised payoff to $L$, and the other two are the incentive constraints
+{eq}`gta-ic` of $L$ and $S$.
+
+The unknown function $\tilde \Omega$ appears in the objective and in the small country's incentive
+constraint, which is what makes this dynamic programming squared.
+
+When the promise-keeping constraint binds, the net side payment is $s_S - s_L = V_L - W_L - \delta y$, and
+the objective becomes
+
+$$
+W_S(t_S, t_L) + W_L(t_L, t_S) - V_L + \delta \left[ y + \tilde \Omega(y) \right] ,
+$$
+
+world welfare today plus the discounted world value of the continuation, minus what is promised to $L$.
+
+{cite:t}`BondPark2002` show that $\tilde \Omega$ is the limit of the sequence obtained by applying the
+right side of {eq}`gta-bellman` repeatedly to the first-best frontier, building on {cite:t}`Rustichini1998`.
+
+They also show that a country never imposes a tariff while making a side payment, and their
+characterization implies that at most one country imposes a tariff at a time, so we search over one tariff
+at a time.
+
+```{code-cell} ipython3
+def solve_frontier(m, n_V=601, n_t=161, tol=1e-9, max_iter=100):
+ """
+ Iterate on the Bellman equation for the incentive-constrained frontier, starting
+ from the first-best frontier, on a grid of promised payoffs to L.
+ """
+ δ = m.δ
+ t_SN, t_LN = nash_tariffs(m)
+ sb = stationary_bounds(m)
+ W_S0, W_L0 = welfare(0, 0, m)
+ V_L_max = welfare(0, t_LN, m)[1] - W_L0 + sb['V_L_high'] # see the text
+ V = np.unique(np.r_[np.linspace(sb['V_LN'], V_L_max, n_V), sb['V_L_low'], sb['V_L_high']])
+ # among equally good continuations, prefer free trade in [V_L*, V_L**]
+ tie_break = 1e-7 * ((V >= sb['V_L_low']) & (V <= sb['V_L_high']))
+
+ # candidate tariff pairs: one tariff at a time
+ t_grid = np.linspace(0, 1, n_t)
+ t_S = np.r_[np.zeros(n_t), t_SN * t_grid[1:]]
+ t_L = np.r_[t_LN * t_grid, np.zeros(n_t - 1)]
+ W_S, W_L = welfare(t_S, t_L, m)
+ gain_L = welfare(0, t_L, m)[1] - welfare(0, t_LN, m)[1] # W_L(t_L, ·) - W_L(t_L^N, ·)
+ gain_S = welfare(t_S, 0, m)[0] - welfare(t_SN, 0, m)[0]
+
+ Ω = (W_S0 + W_L0) / (1 - δ) - V # first-best frontier
+ for it in range(max_iter):
+ Ω_new = np.empty_like(Ω)
+ best = np.empty((len(V), 2), dtype=int)
+ for j, v in enumerate(V):
+ net = v - W_L[:, None] - δ * V[None, :] # s_S - s_L, promise kept
+ s_S, s_L = np.maximum(net, 0), np.maximum(-net, 0)
+ feasible = ((gain_L[:, None] - s_L + δ * V[None, :] >= δ * sb['V_LN'] - 1e-9)
+ & (gain_S[:, None] - s_S + δ * Ω[None, :] >= δ * sb['V_SN'] - 1e-9))
+ obj = np.where(feasible, (W_S + W_L)[:, None] - v + δ * (V + Ω)[None, :], -np.inf)
+ k = np.argmax(obj + tie_break[None, :])
+ best[j] = np.unravel_index(k, obj.shape)
+ Ω_new[j] = obj[tuple(best[j])]
+ # L may also be given more than promised: take the best over payoffs V' >= V
+ source = np.empty(len(V), dtype=int)
+ source[-1] = len(V) - 1
+ for j in range(len(V) - 2, -1, -1):
+ source[j] = j if Ω_new[j] >= Ω_new[source[j + 1]] else source[j + 1]
+ Ω_new = Ω_new[source]
+ change = np.max(np.abs(Ω_new - Ω))
+ Ω = Ω_new
+ if change < tol:
+ break
+ i_t, i_y = best[source, 0], best[source, 1]
+ return dict(V=V, Ω=Ω, t_S=t_S[i_t], t_L=t_L[i_t], y=V[i_y], iterations=it + 1, **sb)
+
+solutions = {name: solve_frontier(m_i) for name, m_i in models.items()}
+for name, sol in solutions.items():
+ print(f"{name}: converged after {sol['iterations']} iterations")
+```
+
+The iteration converges after one application of the Bellman operator, followed by a check that a
+second application changes nothing.
+
+The reason is the main result of {cite:t}`BondPark2002`: the continuation $y$ always lies where
+first-best payoffs are attainable, so the continuation value is the first-best one.
+
+Several continuations are then equally good, and the code picks one in $[V_L^*, V_L^{**}]$, where free
+trade with constant side payments is self-enforcing.
+
+For payoffs above $V_L^{**}$, where only the small country's incentive constraint binds,
+{cite:t}`BondPark2002` also give the frontier in closed form, which we use to check the computation.
+
+Along it, the small country's incentive constraint binds, so $\tilde \Omega = W_S(t_S^N, t_L) + \delta V_S^N$,
+and the large country gets $V_L = W_L(t_L, 0) - W_L(0, 0) + V_L^{**}$, for $t_L \in [0, t_L^N]$; the
+largest payoff to $L$, used to set the grid above, is the one with $t_L = t_L^N$.
+
+```{code-cell} ipython3
+for name, m_i in models.items():
+ sol = solutions[name]
+ t_SN, t_LN = nash_tariffs(m_i)
+ t_check = np.linspace(0, t_LN, 9)
+ V_L = welfare(0, t_check, m_i)[1] - welfare(0, 0, m_i)[1] + sol['V_L_high']
+ Ω_closed = welfare(t_SN, t_check, m_i)[0] + m_i.δ * sol['V_SN']
+ gap = np.abs(np.interp(V_L, sol['V'], sol['Ω']) - Ω_closed).max()
+ print(f"{name}: max |computed - closed form| above V_L** = {gap:.3f}")
+```
+
+The small differences come from the grids of tariffs and promised payoffs.
+
+```{code-cell} ipython3
+---
+mystnb:
+ figure:
+ caption: Frontiers of trade agreements
+ name: fig-gta-frontier
+---
+fig, axes = plt.subplots(2, 2, figsize=(12, 8))
+for col, (name, sol) in enumerate(solutions.items()):
+ V, Ω = sol['V'], sol['Ω']
+ W0 = sum(welfare(0, 0, models[name]))
+ ax = axes[0, col]
+ ax.plot(V - sol['V_LN'], W0 / (1 - models[name].δ) - V - sol['V_SN'], 'k--', lw=1,
+ label="first best")
+ ax.plot(V - sol['V_LN'], Ω - sol['V_SN'], 'C0', lw=2, label="self-enforcing")
+ ax.set_title(name)
+ ax.set_xlabel(r"$V_L - V_L^N$")
+ ax.set_ylabel(r"$V_S - V_S^N$")
+ ax = axes[1, col]
+ ax.plot(V - sol['V_LN'], sol['t_S'], 'C1', lw=2, label=r"first-period $t_S$")
+ ax.plot(V - sol['V_LN'], sol['t_L'], 'C2', lw=2, label=r"first-period $t_L$")
+ ax.set_xlabel(r"$V_L - V_L^N$")
+ ax.set_ylabel("tariff")
+ for a in axes[:, col]:
+ for x in [sol['V_L_low'], sol['V_L_high']]:
+ a.axvline(x - sol['V_LN'], color='gray', ls=':', lw=1)
+axes[0, 0].legend()
+axes[1, 0].legend()
+plt.tight_layout()
+plt.show()
+```
+
+The top panels show the two frontiers, measured from the Nash payoffs; the dotted lines mark $V_L^*$ and
+$V_L^{**}$.
+
+Between them, free trade with constant side payments is self-enforcing and the two frontiers coincide.
+
+Above $V_L^{**}$, the small country is asked to pay so much that it would rather deviate.
+
+The efficient agreement then lets the large country tax its imports in the first period: the small
+country can stop a side payment by deviating, but it cannot escape a tariff.
+
+From the second period on, the agreement switches to free trade with a payoff to $L$ in
+$[V_L^*, V_L^{**}]$, so the tariff falls in two steps, from $t_L^N$ to a first-period tariff and then to
+zero.
+
+Below $V_L^*$, the same logic applies with the roles reversed, and the small country imposes the
+first-period tariff.
+
+When $T_L < 0$ (right panels), there is a range below $V_L^*$ in which first-best payoffs can still be
+reached without tariffs, by lowering the small country's first-period side payment.
+
+The constrained frontier is strictly below the first-best frontier wherever a tariff is used, and in
+every case the payoff of the constrained country *rises* over time: the agreement promises it more later
+in exchange for less now.
+
+(gta_smoothing)=
+## Consumption smoothing and many-step liberalization
+
+In the model so far, liberalization takes only two steps.
+
+{cite:t}`BondPark2002` show that it becomes gradual when the small country wants to smooth its
+consumption, for example because it lacks access to international capital markets.
+
+Let $S$ be infinitesimally small, so that it cannot affect world prices, its Nash tariff is zero, and
+$t_S = 0$ in any efficient agreement.
+
+Prices in $S$ are then $p_1^S = p_1^{LA}$ and $p_2^S = p_2^{LA} - t_L$, where $p_i^{LA} = (A -
+\alpha_i^L)/(B + \beta)$ are the large country's autarky prices.
+
+The large country's welfare from the agreement is its tariff revenue, $W_L(t_L) = t_L \big[ X_2^S(p_2^S) -
+D_2^S(p_2^S) \big]$, which is maximized at $t_L^N = (\alpha_2^S - \alpha_2^L) / \big(2 (B + \beta)\big)$.
+
+The small country's payoff in a period is $U\big(W_S(t_L) + s_L - s_S\big)$, with $U$ strictly concave,
+while the large country's payoff stays linear.
+
+### Where the large country's incentive constraint binds
+
+With free trade, the large country's payoff is the side payment it receives, and its incentive
+constraint requires that it receive at least $W_L(t_L^N) / \delta$ per period, so stationary free trade
+is self-enforcing only for $V_L \ge V_L^* = V_L^N / \delta$, where $V_L^N = W_L(t_L^N) / (1 - \delta)$.
+
+{cite:t}`BondPark2002` show that for $V_L \in (V_L^N, V_L^*)$ the large country's incentive constraint
+binds, the small country's does not, and the small country pays a side payment, so $s_L = 0$.
+
+The binding incentive constraint of $L$ and the promise-keeping constraint then pin down
+
+$$
+W_L(t_L) + \delta y = V_L^N , \qquad s_S = V_L - V_L^N ,
+$$
+
+so that the only choice left is the tariff, and the Bellman equation becomes
+
+```{math}
+:label: gta-smoothing-bellman
+\tilde \Omega(V_L) = \max_{0 \le t_L \le t_L^N} \; U\big( W_S(t_L) - (V_L - V_L^N) \big)
++ \delta \tilde \Omega\left( \frac{V_L^N - W_L(t_L)}{\delta} \right) ,
+```
+
+where $\tilde \Omega(y) = U\big(W_S(0) - (1 - \delta) y\big) / (1 - \delta)$ on the first-best region
+$y \in [V_L^*, V_L^{**}]$.
+
+Because $W_L(t_L) \ge 0$, the continuation $y$ never exceeds $V_L^*$, and it reaches $V_L^*$ only when
+$t_L = 0$.
+
+A tariff $t_L > 0$ lowers the payoff $y$ promised to $L$ for the future, so it slows the rise in the small
+country's side payment.
+
+The agreement trades a static distortion, the tariff, against an intertemporal one, an uneven consumption
+path for $S$, and it reduces both gradually.
+
+We use the demand and supply parameters of the previous section, $\delta = 0.9$, and constant relative
+risk aversion, $U(c) = \left[ (c/\bar c)^{1 - \gamma} - 1 \right] / (1 - \gamma)$, with consumption scaled
+by its free-trade level $\bar c = W_S(0)$.
+
+The side payments are small relative to the small country's surplus, less than 4 percent of it, so the
+consumption-smoothing motive matters only when curvature is high, and we show results for
+$\gamma \in \{5, 20, 50\}$.
+
+We start each agreement at $V_L = V_L^N$, the point on the frontier that gives the small country all the
+gains, and check that the small country's incentive constraint is slack along the solution, as
+Proposition 3 of {cite:t}`BondPark2002` asserts.
+
+```{code-cell} ipython3
+SmallCountry = namedtuple('SmallCountry', ('A', 'B', 'β', 'α_hi', 'α_lo', 'δ', 'γ'))
+
+def create_small_country(A=100.0, B=1.0, β=1.0, α_hi=-40.0, α_lo=-60.0, δ=0.9, γ=20.0):
+ return SmallCountry(A=A, B=B, β=β, α_hi=α_hi, α_lo=α_lo, δ=δ, γ=γ)
+
+def small_country_welfare(t_L, sc):
+ "The small country's surplus W_S(t_L) and the large country's tariff revenue W_L(t_L)."
+ A, B, β, α_hi, α_lo = sc.A, sc.B, sc.β, sc.α_hi, sc.α_lo
+ p_1 = (A - α_hi) / (B + β) # L's autarky price of good 1
+ p_2 = (A - α_lo) / (B + β) - t_L # price of good 2 in S
+ W_S = ((A - B * p_1)**2 / (2 * B) + (α_lo + β * p_1)**2 / (2 * β)
+ + (A - B * p_2)**2 / (2 * B) + (α_hi + β * p_2)**2 / (2 * β))
+ W_L = t_L * ((α_hi + β * p_2) - (A - B * p_2))
+ return W_S, W_L
+
+def solve_smoothing(sc, n_V=600, n_t=600, tol=1e-13, max_iter=5000):
+ "Iterate on the Bellman equation where L's incentive constraint binds."
+ δ, γ = sc.δ, sc.γ
+ t_N = (sc.α_hi - sc.α_lo) / (2 * (sc.B + sc.β))
+ W_S0 = small_country_welfare(0.0, sc)[0]
+ if γ == 1:
+ U = lambda c: np.log(c / W_S0)
+ else:
+ U = lambda c: ((c / W_S0)**(1 - γ) - 1) / (1 - γ)
+ V_N = small_country_welfare(t_N, sc)[1] / (1 - δ)
+ V_low = V_N / δ
+ Ω_first_best = lambda y: U(W_S0 - (1 - δ) * y) / (1 - δ)
+
+ V = np.linspace(V_N, V_low, n_V)
+ t = np.linspace(0, t_N, n_t)
+ W_S, W_L = small_country_welfare(t, sc)
+ y = (V_N - W_L) / δ # L's binding incentive constraint
+ Ω = Ω_first_best(V)
+ for it in range(max_iter):
+ Ωy = np.where(y >= V_low, Ω_first_best(y), np.interp(y, V, Ω))
+ obj = U(W_S[None, :] - (V[:, None] - V_N)) + δ * Ωy[None, :]
+ Ω_new = obj.max(axis=1)
+ if np.max(np.abs(Ω_new - Ω)) < tol:
+ Ω = Ω_new
+ break
+ Ω = Ω_new
+
+ def policy(v):
+ "The optimal tariff at promised payoff v, by continuous maximization."
+ def rhs(tt):
+ W_S_t, W_L_t = small_country_welfare(tt, sc)
+ yy = (V_N - W_L_t) / δ
+ Ωy = Ω_first_best(yy) if yy >= V_low else np.interp(yy, V, Ω)
+ return U(W_S_t - (v - V_N)) + δ * Ωy
+ return minimize_scalar(lambda tt: -rhs(tt), bounds=(0, t_N), method='bounded',
+ options={'xatol': 1e-10}).x
+
+ # slack in the small country's incentive constraint along the grid solution
+ k = obj.argmax(axis=1)
+ Ωy_k = np.where(y[k] >= V_low, Ω_first_best(y[k]), np.interp(y[k], V, Ω))
+ V_SN = U(small_country_welfare(t_N, sc)[0]) / (1 - δ)
+ ics_slack = (U(W_S[k] - (V - V_N)) + δ * Ωy_k) - (U(W_S[k]) + δ * V_SN)
+
+ return dict(V=V, Ω=Ω, policy=policy, V_N=V_N, V_low=V_low, t_N=t_N, iterations=it + 1,
+ min_ics_slack=ics_slack.min())
+
+def simulate_agreement(sc, sol, n=30):
+ "Tariffs, side payments, and promised payoffs, starting from V_L = V_L^N."
+ v, path = sol['V_N'], []
+ for i in range(n):
+ if v >= sol['V_low']: # free trade from here on
+ path.append((0.0, v - sol['V_N'], v))
+ continue
+ t_L = sol['policy'](v)
+ path.append((t_L, v - sol['V_N'], v))
+ v = (sol['V_N'] - small_country_welfare(t_L, sc)[1]) / sc.δ
+ return np.array(path)
+
+γ_values = [5, 20, 50]
+paths = {}
+for γ in γ_values:
+ sc = create_small_country(γ=γ)
+ sol = solve_smoothing(sc)
+ paths[γ] = simulate_agreement(sc, sol)
+ print(f"γ = {γ}: converged after {sol['iterations']} iterations; smallest slack in S's "
+ f"incentive constraint {sol['min_ics_slack']:.3f}; first tariffs {np.round(paths[γ][:5, 0], 3)}")
+```
+
+```{code-cell} ipython3
+---
+mystnb:
+ figure:
+ caption: Gradual liberalization with consumption smoothing
+ name: fig-gta-smoothing
+---
+sc = create_small_country()
+sol_ref = solve_smoothing(sc)
+W_S_free = small_country_welfare(0.0, sc)[0]
+fig, axes = plt.subplots(1, 3, figsize=(14, 4))
+for γ in γ_values:
+ t_L, s_S = paths[γ][:, 0], paths[γ][:, 1]
+ consumption = small_country_welfare(t_L, sc)[0] - s_S
+ axes[0].plot(t_L, 'o-', ms=3, lw=2, label=rf"$\gamma = {γ}$")
+ axes[1].plot(s_S, 'o-', ms=3, lw=2)
+ axes[2].plot(100 * (consumption / W_S_free - 1), 'o-', ms=3, lw=2)
+axes[1].axhline(sol_ref['V_low'] - sol_ref['V_N'], color='gray', ls=':', lw=1)
+for ax, title in zip(axes, ["large country's tariff $t_L$",
+ r"side payment $s_S = V_L - V_L^N$",
+ "small country's consumption (% from free trade)"]):
+ ax.set_title(title)
+ ax.set_xlabel("period")
+axes[0].legend()
+plt.tight_layout()
+plt.show()
+```
+
+The agreement starts with a positive tariff by the large country that declines period by period toward
+zero.
+
+The side payment from the small country, which equals $V_L - V_L^N$, rises toward $V_L^* - V_L^N$, the
+dotted line, so the payoff promised to the large country rises toward the region where free trade is
+self-enforcing.
+
+The small country's consumption, its surplus net of the side payment, falls gradually rather than all at
+once.
+
+The more the small country cares about smoothing its consumption, the higher the first tariff and the
+slower the liberalization.
+
+Without curvature, the large country would be compensated entirely by a side payment that jumps after
+the first period, and no tariff would be used in this region; curvature makes a jump in side payments
+costly, so the agreement uses a declining tariff to slow their rise.
+
+(gta_membership)=
+## Gradual expansion of membership
+
+{cite:t}`Bond2009` asks a related question about who belongs to an agreement: when is it efficient to
+form a bilateral agreement first and to add a third country later?
+
+There are three countries and three states: no agreement $N$, a bilateral agreement $B$ between
+countries 1 and 2, and a global agreement $G$.
+
+A country gets the flow payoff $w(N)$, $w(G)$, or, under $B$, $w_m(B)$ as a member and $w_n(B)$ as the
+non-member, and it pays a one-time adjustment cost $k$ when it joins an agreement, for example the cost
+of reallocating workers and of adapting its laws.
+
+### Commitment
+
+If countries could commit to agreements and side payments, an efficient path would maximize world
+welfare, the sum of the countries' payoffs net of adjustment costs.
+
+Let $w^W(a)$ be the sum of the countries' flow payoffs in state $a$, so that $w^W(G) = 3 w(G)$ and $w^W(B) =
+2 w_m(B) + w_n(B)$, and let $C(a', a)$ be the sum of their adjustment costs of moving from $a$ to $a'$.
+
+Starting from $N$, forming $B$ at date 0 and $G$ at date 1 beats forming $G$ at once if the adjustment
+costs it saves exceed the world welfare it forgoes for one period:
+
+$$
+C(G, N) - C(B, N) - \delta C(G, B) > w^W(G) - w^W(B) .
+$$
+
+{cite:t}`Bond2009` assumes that a permanent move to $G$ beats staying in any other state $a$ forever,
+$w^W(G) - (1 - \delta) C(G, a) > w^W(a)$.
+
+When each country pays the same cost $k$ whenever it joins an agreement, the left side of the inequality
+above is $(1 - \delta) k$, and the assumption for $a = B$ says that $(1 - \delta) k < w^W(G) - w^W(B)$, so
+forming $G$ at once maximizes world welfare.
+
+Efficient delay with commitment needs adjustment costs that depend more strongly on the sequence of
+agreements, for example when adding a country costs less once a bilateral agreement is in place.
+
+### Self-enforcement
+
+Without commitment, each member of an agreement must prefer to honor it.
+
+A member that deviates from an agreement $a$ gets $w^D(a)$ for one period, avoids the adjustment cost of
+joining, keeps any side payment it was supposed to pay, still receives any side payment owed to it, and
+then gets a punishment payoff $w^P(a)$ forever.
+
+The **enforcement power** of an agreement for a member, $\Phi(a, \delta)$, is the excess of the member's
+average payoff from the agreement over its average payoff from deviating, before side payments and
+adjustment costs: $\Phi(G, \delta) = w(G) - \left[ (1 - \delta) w^D(G) + \delta w^P(G) \right]$, and
+$\Phi(B, \delta)$ is defined in the same way with the member's flow payoff $w_m(B)$.
+
+{cite:t}`Bond2009` shows that side payments should be *backloaded*: a side payment received at the date a
+country joins does not relax its incentive constraint, because it would receive it even if it deviated, so
+compensation should come in later periods.
+
+A country $i$ that joins with adjustment cost $c_i$ can then be asked to pay at most
+
+$$
+s_i^{\max} = \min\left\{ \Phi(a, \delta), \; \frac{\Phi(a, \delta) - (1 - \delta) c_i}{\delta} \right\}
+$$
+
+per period from the next period on, and the agreement is self-enforcing if and only if the maximal
+payments add up to a nonnegative number.
+
+In an **immediate global agreement**, every country pays $k$, so the agreement is self-enforcing if and
+only if $\Phi(G, \delta) \ge (1 - \delta) k$.
+
+A **two-step agreement** forms $B$ at date 0 and adds country 3 at date 1.
+
+At date 1, countries 1 and 2 are already members, so each can pay up to $\Phi(G, \delta)$ per period from
+date 2 on to subsidize the newcomer, whose maximal payment is $\left[ \Phi(G, \delta) - (1 - \delta) k
+\right] / \delta$.
+
+The second step is therefore self-enforcing if and only if $(1 + 2\delta) \Phi(G, \delta) \ge (1 - \delta)
+k$.[^bond-two-step]
+
+The smallest subsidy that each original member must then pay is $s = \max\left\{0, \left[ (1 - \delta) k -
+\Phi(G, \delta) \right] / (2\delta) \right\}$, so from date 1 on an original member gets the average payoff
+$w(G) - \delta s$.
+
+At date 0, each of countries 1 and 2 pays $k$ and gets $w_m(B)$, so its incentive constraint is
+
+```{math}
+:label: gta-first-step
+\Phi(B, \delta) - (1 - \delta) k + \delta \left[ w(G) - \delta s - w_m(B) \right] \ge 0 .
+```
+
+The original members can subsidize the newcomer out of the slack enforcement power of the global
+agreement, which makes the second step easier to sustain than an immediate global agreement.
+
+They must also be willing to stay in the first step, which is easier when the bilateral agreement has
+more enforcement power than the global one.
+
+We compute the smallest discount factors that sustain each path for an example in which the bilateral
+agreement has more enforcement power, $\Phi(B, \delta) = \Phi(G, \delta) + 1$, because a member of the
+bilateral agreement gains less by deviating and is punished more harshly.
+
+```{code-cell} ipython3
+Membership = namedtuple('Membership', ('w_G', 'w_D_G', 'w_P_G', 'w_mB', 'w_nB', 'w_D_B', 'w_P_B', 'k'))
+
+def create_membership(w_G=12.0, w_D_G=14.0, w_P_G=10.0, w_mB=12.0, w_nB=9.5,
+ w_D_B=13.0, w_P_B=9.0, k=4.0):
+ return Membership(w_G=w_G, w_D_G=w_D_G, w_P_G=w_P_G, w_mB=w_mB, w_nB=w_nB,
+ w_D_B=w_D_B, w_P_B=w_P_B, k=k)
+
+def immediate_slack(δ, mb):
+ Φ_G = mb.w_G - ((1 - δ) * mb.w_D_G + δ * mb.w_P_G)
+ return Φ_G - (1 - δ) * mb.k
+
+def two_step_slack(δ, mb):
+ "The smaller of the slacks in the second-step and first-step constraints."
+ Φ_G = mb.w_G - ((1 - δ) * mb.w_D_G + δ * mb.w_P_G)
+ Φ_B = mb.w_mB - ((1 - δ) * mb.w_D_B + δ * mb.w_P_B)
+ second = (1 + 2 * δ) * Φ_G - (1 - δ) * mb.k
+ s = max(0.0, ((1 - δ) * mb.k - Φ_G) / (2 * δ)) # subsidy per original member
+ first = Φ_B - (1 - δ) * mb.k + δ * (mb.w_G - δ * s - mb.w_mB)
+ return min(second, first, Φ_G)
+
+def min_discount_factor(slack, mb):
+ "The smallest δ on a fine grid at which the slack is nonnegative."
+ grid = np.linspace(0.01, 0.999, 9_000)
+ ok = np.array([slack(δ, mb) >= 0 for δ in grid])
+ return grid[ok.argmax()] if ok.any() else np.nan
+
+mb = create_membership()
+print(f"smallest δ: immediate global agreement {min_discount_factor(immediate_slack, mb):.3f}, "
+ f"two-step agreement {min_discount_factor(two_step_slack, mb):.3f}")
+δ = 0.7
+print(f"at δ = {δ}: average world welfare of the two-step path minus the immediate path = "
+ f"{(1 - δ) * ((1 - δ) * mb.k - (3 * mb.w_G - 2 * mb.w_mB - mb.w_nB)):.3f}")
+```
+
+In this example, the global agreement can be reached in two steps for discount factors at which an
+immediate global agreement would not be self-enforcing, even though, with commitment, the immediate path
+would yield higher world welfare.
+
+The bilateral agreement is a **building bloc**: for discount factors between the two thresholds, without
+it the global agreement would never be reached.
+
+The advantage comes from the bilateral agreement's extra enforcement power: {ref}`gta_ex3` shows that
+with the same enforcement power as the global agreement, the two-step path would need the same discount
+factor as the immediate one.
+
+{cite:t}`Bond2009` shows more generally that whether the two-step path maximizes world welfare is neither
+necessary nor sufficient for it to be easier to sustain, because sustainability depends on deviation
+payoffs as well as on world welfare.
+
+(gta_connections)=
+## Connections to other lectures
+
+* {doc}`organizational_equilibrium` also explains gradual trade liberalization, but with an equilibrium
+ concept that does not rely on the threat of a permanent trade war; here, as in the best plans sustained
+ by Markov reversion in that lecture, a single deviation ends cooperation forever.
+* {doc}`calvo_abreu` and {doc}`chang_credible` study sustainable plans; {cite:t}`BondPark2002` note that
+ replacing Nash reversion with the harshest credible punishments of {cite:t}`Abreu` would enlarge the set
+ of self-enforcing agreements without changing their shape over time.
+* {doc}`atkeson_1991` and {doc}`tsyrennikov_2013` study lending with moral hazard and a risk of
+ repudiation, in which a value function enters the enforcement constraint; the backloading of payments to
+ the party whose incentive constraint binds is the force that {cite:t}`ThomasWorrall1994` found in
+ contracts with a host country that cannot commit not to expropriate.
+* {doc}`repeat_mh` and {doc}`un_insure` use promised utility as the state variable in problems with hidden
+ actions instead of limited commitment.
+
+## Exercises
+
+```{exercise}
+:label: gta_ex1
+
+The relative size $\lambda$ of the large country determines who pays whom in a self-enforcing
+free-trade agreement.
+
+Holding $\delta = 0.8$ and the other parameters fixed, compute $T_S$, $T_L$, and the large country's gain
+from the tariff war, $W_L(t_L^N, t_S^N) - W_L(0, 0)$, for $\lambda$ between 1 and 2.
+
+1. For which $\lambda$ does the large country win the tariff war?
+1. For which $\lambda$ can a free-trade agreement have the large country pay the small one?
+```
+
+```{solution-start} gta_ex1
+:class: dropdown
+```
+
+```{code-cell} ipython3
+λ_grid = np.linspace(1, 2, 101)
+T_S, T_L, war_gain = [], [], []
+for λ_i in λ_grid:
+ m_i = create_trade_model(λ=λ_i, δ=0.8)
+ sb = stationary_bounds(m_i)
+ T_S.append(sb['T_S'])
+ T_L.append(sb['T_L'])
+ war_gain.append(welfare(*nash_tariffs(m_i), m_i)[1] - welfare(0, 0, m_i)[1])
+T_S, T_L, war_gain = map(np.array, (T_S, T_L, war_gain))
+
+fig, ax = plt.subplots()
+ax.plot(λ_grid, T_S, lw=2, label=r"$T_S$")
+ax.plot(λ_grid, T_L, lw=2, label=r"$T_L$")
+ax.plot(λ_grid, war_gain, lw=2, label=r"$W_L^N - W_L(0, 0)$")
+ax.axhline(0, color='k', lw=0.8)
+ax.set_xlabel(r"relative size $\lambda$")
+ax.legend()
+plt.show()
+
+print(f"L wins the tariff war for λ above {λ_grid[np.argmax(war_gain > 0)]:.2f}")
+print(f"T_L > 0 for λ below {λ_grid[np.argmax(T_L < 0)]:.2f}")
+```
+
+The large country wins the tariff war once it is about 38 percent larger than the small country, and
+from then on any free-trade agreement must have the small country pay for access.
+
+The large country is willing to pay for free trade only when the countries are close in size, for
+$\lambda$ below about 1.2 when $\delta = 0.8$; a larger $\lambda$ raises its gain from deviating relative to
+the cost of the trade war.
+
+At $\delta = 0.8$, the small country is willing to pay throughout this range, and more so the larger its
+partner.
+
+```{solution-end}
+```
+
+```{exercise}
+:label: gta_ex2
+
+In {ref}`gta_smoothing`, compute the number of periods it takes for the large country's tariff to fall
+below one percent of its first-period value, for $\gamma \in \{5, 20, 50\}$ and $\delta \in \{0.85, 0.9,
+0.95\}$.
+
+How do the speed of liberalization and the first-period tariff depend on $\gamma$ and $\delta$?
+```
+
+```{solution-start} gta_ex2
+:class: dropdown
+```
+
+```{code-cell} ipython3
+print(" δ γ first tariff periods to fall below 1% of it")
+for δ_i in [0.85, 0.9, 0.95]:
+ for γ in [5, 20, 50]:
+ sc = create_small_country(δ=δ_i, γ=γ)
+ path = simulate_agreement(sc, solve_smoothing(sc), n=200)
+ t_path = path[:, 0]
+ n_below = np.argmax(t_path < 0.01 * t_path[0])
+ print(f"{δ_i:5.2f} {γ:4d} {t_path[0]:11.3f} {n_below:12d}")
+```
+
+More curvature raises the first-period tariff and slows liberalization, because smoothing the small
+country's consumption matters more.
+
+A higher discount factor lowers the first-period tariff and slightly speeds liberalization.
+
+```{solution-end}
+```
+
+```{exercise}
+:label: gta_ex3
+
+In {ref}`gta_membership`, vary the adjustment cost $k$ from 0 to 8 and compute
+
+1. the smallest discount factors that sustain the immediate and the two-step paths, and
+1. at $\delta = 0.8$, whether the two-step path would yield higher world welfare under commitment.
+
+Find values of $k$ at which the two-step path is easier to sustain even though it yields lower world
+welfare, and repeat the calculation with $w^D(B) = 14$ and $w^P(B) = 10$, which give the bilateral
+agreement the same enforcement power as the global one.
+```
+
+```{solution-start} gta_ex3
+:class: dropdown
+```
+
+```{code-cell} ipython3
+def step_slacks(δ, mb):
+ "Slacks in the second-step and first-step constraints of the two-step path."
+ Φ_G = mb.w_G - ((1 - δ) * mb.w_D_G + δ * mb.w_P_G)
+ Φ_B = mb.w_mB - ((1 - δ) * mb.w_D_B + δ * mb.w_P_B)
+ s = max(0.0, ((1 - δ) * mb.k - Φ_G) / (2 * δ))
+ return (1 + 2 * δ) * Φ_G - (1 - δ) * mb.k, Φ_B - (1 - δ) * mb.k + δ * (mb.w_G - δ * s - mb.w_mB)
+
+δ = 0.8
+print(" k smallest δ: immediate two-step (binding step) same enforcement power"
+ " two-step better with commitment")
+for k in [0, 1, 2, 4, 6, 8]:
+ mb_k = create_membership(k=k)
+ mb_same = create_membership(k=k, w_D_B=14.0, w_P_B=10.0)
+ δ_two = min_discount_factor(two_step_slack, mb_k)
+ second, first = step_slacks(δ_two, mb_k)
+ binding = "first" if first < second else "second"
+ better = (1 - δ) * k > 3 * mb_k.w_G - 2 * mb_k.w_mB - mb_k.w_nB
+ print(f"{k:4.0f} {min_discount_factor(immediate_slack, mb_k):19.3f} {δ_two:8.3f}"
+ f" {'(' + binding + ')':<8s} {min_discount_factor(two_step_slack, mb_same):18.3f}"
+ f" {str(better):>14s}")
+```
+
+With these payoffs, the two-step path never yields higher world welfare at $\delta = 0.8$: postponing the
+newcomer's adjustment cost saves $(1 - \delta) k$, less than the 2.5 that the bilateral period loses, which
+is the assumption of {cite:t}`Bond2009` discussed in {ref}`gta_membership` and holds for $k < 12.5$.
+
+Yet for every positive adjustment cost, the two-step path is self-enforcing at lower discount factors
+than the immediate path.
+
+For small $k$, the second step sets the threshold, so the subsidy to the newcomer limits how far below
+the immediate threshold the two-step path can go; for $k \ge 4$, the first step sets it.
+
+In every case, the gain requires slack in the first step, which here comes from the bilateral agreement's
+extra enforcement power: when the bilateral agreement has the same enforcement power as the global one,
+the two-step path needs exactly the same discount factor as the immediate path, whatever $k$.
+
+```{solution-end}
+```
+
+[^bond-two-step]: {cite:t}`Bond2009` states this condition as $3 \Phi(G, \delta) = (1 - \delta) k$;
+ applying his Lemma 1 to the newcomer, whose side payment at the entry date does not relax its
+ constraint, gives the factor $1 + 2\delta$ used here. His statement of the first-step condition
+ coincides with {eq}`gta-first-step` when the newcomer needs a subsidy, $s > 0$.
+
+[^fig1a]: The caption of Figure 1(a) of {cite:t}`BondPark2002` reports $\lambda = 1.1$, $\delta = 0.65$, and
+ $T_L > 0$; with these parameters we find $T_L \approx -1.01$, and $T_L$ becomes positive only for
+ $\delta$ above about 0.7, so we use $\delta = 0.8$.
diff --git a/lectures/organizational_equilibrium.md b/lectures/organizational_equilibrium.md
new file mode 100644
index 00000000..e34079ce
--- /dev/null
+++ b/lectures/organizational_equilibrium.md
@@ -0,0 +1,1191 @@
+---
+jupytext:
+ text_representation:
+ extension: .md
+ format_name: myst
+ format_version: 0.13
+ jupytext_version: 1.17.1
+kernelspec:
+ display_name: Python 3 (ipykernel)
+ language: python
+ name: python3
+---
+
+(organizational_equilibrium)=
+```{raw} jupyter
+
+```
+
+# Institution Building Without Commitment
+
+```{contents} Contents
+:depth: 2
+```
+
+## Overview
+
+Many policies that experts regard as good, such as lower tariffs and taxes on carbon emissions, have been
+adopted slowly, in steps spread over decades.
+
+{cite:t}`BassettoHuoRiosRull2024` attribute the slowness to a problem of time inconsistency.
+
+A fast reform imposes its costs on the current policymaker and delivers its benefits to later ones, so
+each policymaker would like its successors to carry out the reform.
+
+Several lectures in this section study this kind of tension with three equilibrium concepts.
+
+* A **Ramsey planner** chooses a whole sequence of actions once and for all at time $0$, as in
+ {doc}`calvo`, {doc}`dyn_stack`, and {doc}`opt_tax_recur`.
+* A sequence of **Markov** policymakers each choose a current action, taking as given that future
+ actions do not depend on it, as in the Markov perfect governments of {doc}`calvo`.
+* A sequence of policymakers follow a **sustainable plan**, in which expectations of how future
+ policymakers will react to a deviation deter deviations, as in {doc}`calvo_abreu` and
+ {doc}`chang_credible`.
+
+{cite:t}`BassettoHuoRiosRull2024` propose a fourth equilibrium concept, **organizational equilibrium**.
+
+It refines the set of subgame-perfect equilibria of the game among successive policymakers, the game
+behind sustainable plans, with two requirements designed to deny period $0$ the special role that it has in
+a Ramsey plan.
+
+* *No restarting*: no policymaker can do better by pretending to be an earlier policymaker and
+ restarting the plan.
+* *No delay*: the first policymaker cannot do better by sitting out, choosing its best one-period action,
+ and letting the plan start one period later.
+
+Among the equilibria that satisfy these requirements, an organizational equilibrium is the best one.
+
+An organizational equilibrium has three striking features.
+
+* Policy improves *gradually*, as if good institutions had to earn trust over time.
+* Policy converges to the best constant policy, which lies between the Markov and Ramsey policies.
+* No permanent reversion to a bad equilibrium is needed to support it: after an unexpected deviation,
+ policy can resume its gradual improvement from where the deviation left it.
+
+{cite:t}`BassettoHuoRiosRull2026` use the last feature to explain why trade liberalization has survived
+recurrent but temporary episodes of protection.
+
+This lecture
+
+* computes the Ramsey, Markov, and best constant policies in a growth model with present-biased
+ preferences, the motivating example of {cite:t}`BassettoHuoRiosRull2024`,
+* defines an organizational equilibrium and computes it in that model,
+* computes organizational equilibrium tariffs in a two-country model of trade and growth, and compares
+ them with Markov tariffs, Ramsey tariffs, and tariffs sustained by the threat of reverting to the Markov
+ equilibrium, including after a temporary protectionist shock, and
+* describes connections to other lectures in this section.
+
+We use the following imports.
+
+```{code-cell} ipython3
+import numpy as np
+import matplotlib.pyplot as plt
+from collections import namedtuple
+from scipy.optimize import brentq, minimize, minimize_scalar
+```
+
+(oe_growth)=
+## A savings problem with present bias
+
+A planner at each date $t$ chooses consumption $c_t$ and next period's capital $k_{t+1}$ subject to
+
+$$
+c_t + k_{t+1} = k_t^\alpha , \qquad k_0 \text{ given},
+$$
+
+with $0 < \alpha < 1$; capital depreciates fully.
+
+The planner at date $t$ ranks consumption sequences by
+
+$$
+\log c_t + \delta \sum_{j=1}^\infty \beta^j \log c_{t+j} ,
+$$
+
+with $0 < \beta < 1$ and $0 < \delta \le 1$.
+
+When $\delta < 1$, preferences are **quasi-geometric**, or present-biased: the planner at date $t$ discounts
+the next period by $\delta \beta$ but each later period by only $\beta$
+{cite}`Strotz1956,PhelpsPollak1968,Laibson1997,KrusellSmith2003`.
+
+The planner at date $t+1$ discounts date $t+2$ more heavily relative to date $t+1$ than the planner at
+date $t$ wants it to, so the two planners disagree, and the date-$t$ plan is time inconsistent.
+
+{cite:t}`BassettoHuoRiosRull2024` interpret the present bias as the outcome of aggregating
+the preferences of current and future generations, or of parties with different discount factors, as in
+{cite:t}`JacksonYariv2014`.
+
+### Separating the state from the actions
+
+Let $s_t = k_{t+1} / k_t^\alpha$ be the saving rate, so that $c_t = (1 - s_t) k_t^\alpha$.
+
+A sequence of saving rates and $k_0$ determine $\log k_t = \alpha^t \log k_0 + \sum_{j=0}^{t-1}
+\alpha^{t-1-j} \log s_j$.
+
+Substituting into the planner's objective shows that the payoff of the planner at date $t$ is the sum of a
+term that depends only on capital and a term that depends only on current and future saving rates:
+
+```{math}
+:label: oe-separable
+U(k_t, s_t, s_{t+1}, \ldots) = \frac{\alpha (1 - \alpha\beta + \delta\alpha\beta)}{1 - \alpha\beta}
+\log k_t + V(s_t, s_{t+1}, \ldots) ,
+```
+
+where the **action payoff** is
+
+```{math}
+:label: oe-action-payoff
+V(s_t, s_{t+1}, \ldots) = \log(1 - s_t) + \frac{\delta\alpha\beta}{1 - \alpha\beta} \log s_t
++ \delta \sum_{j=1}^\infty \beta^j \left[ \log(1 - s_{t+j}) + \frac{\alpha\beta}{1 - \alpha\beta}
+\log s_{t+j} \right] .
+```
+
+This separability is the key to the analysis.
+
+It implies that every planner ranks sequences of saving rates in the same way whatever capital it
+inherits, and that every sequence of saving rates is feasible from every level of capital.
+
+So we can compare what different planners get from their own and their successors' actions, even when
+they inherit different capital stocks, by comparing action payoffs.
+
+The next function computes the action payoff of a sequence of saving rates that becomes constant after a
+finite number of periods.
+
+```{code-cell} ipython3
+α, β, δ = 0.4, 0.96, 0.9 # the parameter values of Bassetto, Huo, and Ríos-Rull
+
+def action_payoff(s, s_tail, α=α, β=β, δ=δ):
+ """
+ The action payoff V(s_0, s_1, ...) of the saving rates in the list s,
+ followed by s_tail forever.
+ """
+ a = α * β / (1 - α * β)
+ u = lambda x: np.log(1 - x) + a * np.log(x)
+ W = u(s_tail) / (1 - β) # value of the constant tail
+ for x in s[:0:-1]: # s_{n-1}, ..., s_1
+ W = u(x) + β * W
+ return np.log(1 - s[0]) + δ * a * np.log(s[0]) + δ * β * W
+```
+
+### Three benchmarks
+
+A Ramsey planner at date $0$ chooses the whole sequence of saving rates once and for all.
+
+It saves at the rate
+
+$$
+s_0^R = \frac{\alpha\delta\beta}{1 - \alpha\beta + \delta\alpha\beta}
+$$
+
+at date $0$ and at the rate $s^R = \alpha\beta$ at every later date.
+
+Because it discounts date $1$ more heavily than later dates, the date-$0$ planner saves less itself than it
+wants its successors to save.
+
+In a Markov equilibrium, each planner chooses its own saving rate, taking as given that its successors'
+saving rates do not depend on its choice.
+
+Separability makes the best response of each planner independent of what its successors do, so the
+Markov equilibrium has the constant saving rate
+
+```{math}
+:label: oe-sM
+s^M = \frac{\alpha\delta\beta}{1 - \alpha\beta + \delta\alpha\beta} ,
+```
+
+which equals the Ramsey planner's saving rate at date $0$.
+
+A third benchmark is the **best constant saving rate**, the rate that a planner would choose if it had
+to choose one rate for itself and all its successors:
+
+```{math}
+:label: oe-sB
+s^B = \arg\max_s V(s, s, s, \ldots)
+= \frac{\delta\alpha\beta}{(1 - \beta + \delta\beta)(1 - \alpha\beta) + \delta\alpha\beta} .
+```
+
+When $0 < \delta < 1$, $s^M < s^B < s^R$.
+
+We compute the three rates and check two claims numerically: the formula for $s^B$, and the claim that
+the Markov best response does not depend on what successors do.
+
+```{code-cell} ipython3
+def benchmarks(α=α, β=β, δ=δ):
+ "Saving rates in the Markov equilibrium, at the best constant rate, and in the Ramsey plan."
+ s_M = α * δ * β / (1 - α * β + δ * α * β)
+ s_B = δ * α * β / ((1 - β + δ * β) * (1 - α * β) + δ * α * β)
+ return s_M, s_B, α * β
+
+s_M, s_B, s_R = benchmarks()
+print(f"s_M = {s_M:.4f}, s_B = {s_B:.4f}, s_R = {s_R:.4f}")
+
+bounds = (1e-6, 1 - 1e-6)
+best = minimize_scalar(lambda x: -action_payoff([x], x), bounds=bounds, method='bounded',
+ options={'xatol': 1e-12}).x
+print(f"numerical maximizer of V(s, s, ...) = {best:.6f}")
+for s_future in [0.1, 0.3, 0.6]:
+ br = minimize_scalar(lambda x: -action_payoff([x], s_future), bounds=bounds,
+ method='bounded', options={'xatol': 1e-12}).x
+ print(f"best response when successors save {s_future}: {br:.6f}")
+```
+
+(oe_definition)=
+## Organizational equilibrium
+
+### Three properties
+
+Consider the three benchmarks from the point of view of planners who can see what earlier planners got.
+
+In the Ramsey plan, the date-$0$ planner gets the action payoff $V(s^M, s^R, s^R, \ldots)$, while every
+later planner gets $V(s^R, s^R, \ldots)$, which is smaller.
+
+Any later planner would rather be the date-$0$ planner, if it could restart the plan.
+
+The same is true of the best subgame-perfect equilibrium sustained by the threat of reverting to the
+Markov equilibrium after a deviation, which also treats the date-$0$ planner better than its successors.
+
+The best constant saving rate treats all planners alike, but it tempts the date-$0$ planner to sit out:
+$V(s^M, s^B, s^B, \ldots) > V(s^B, s^B, \ldots)$, so the date-$0$ planner would rather save at its
+Markov rate and let the plan start next period.
+
+The Markov equilibrium survives both tests: it treats all planners alike, and a planner who sits out
+chooses $s^M$ and gets exactly its equilibrium payoff.
+
+An organizational equilibrium is a sequence of saving rates $\{s_t^\ast\}$ with three properties.
+
+* **No restarting**: every planner gets the same action payoff,
+
+ ```{math}
+ :label: oe-no-restart
+ V(s_t^\ast, s_{t+1}^\ast, \ldots) = \bar V \quad \text{for all } t .
+ ```
+
+* **Optimality**: no other sequence that satisfies {eq}`oe-no-restart` attains a higher $\bar V$.
+* **No delay**: the first planner does not gain by choosing its best one-period action and letting the
+ sequence start one period later,
+
+ ```{math}
+ :label: oe-no-delay
+ V(s_0^\ast, s_1^\ast, \ldots) \ge \max_s V(s, s_0^\ast, s_1^\ast, \ldots) .
+ ```
+
+Why must the action payoff be constant?
+
+A planner at date $t+1$ that could become the planner at date $t$ would do so if
+$V(s_t^\ast, s_{t+1}^\ast, \ldots) > V(s_{t+1}^\ast, s_{t+2}^\ast, \ldots)$, so action payoffs must be
+weakly increasing over time; if they ever rose, the first planner would do better with the sequence that
+starts where they are higher, contradicting optimality.
+
+### Game-theoretic foundations
+
+{cite:t}`BassettoHuoRiosRull2024` define an organizational equilibrium as the outcome of a
+subgame-perfect equilibrium of the game among the sequence of planners that satisfies three requirements:
+
+1. strategies do not depend on the physical state $k$;
+1. every planner gets the same action payoff after every history, and no other equilibrium with this
+ property gives a higher payoff;
+1. the first planner has no incentive to sit out and let the equilibrium start one period later.
+
+Without a state variable, the second requirement is the **reconsideration-proofness** of
+{cite:t}`Kocherlakota1996`; separability is what lets Bassetto, Huo, and Ríos-Rull extend it to economies
+with capital.
+
+They prove that a sequence with the three properties of the previous subsection is an organizational
+equilibrium, and, under further conditions that hold in the growth model, that
+
+* its action payoff is the highest that a constant action can attain;
+* its payoff lies strictly between those of the best Markov equilibrium and the Ramsey plan whenever the
+ Ramsey plan is not itself a Markov equilibrium;
+* the continuation value of the sequence rises over time and converges to that of the best constant
+ action, but not immediately.
+
+The no-delay requirement can look like an arbitrary refinement.
+
+They show that it is instead a *necessary* property of equilibrium in an alternative game in which no one
+knows when record keeping started and any planner can hide the past and pretend to be the first.
+
+In that game, a planner who faced a sequence that violated no delay would pass the buck: it would play
+its one-shot best response and let its successor believe that the plan was just starting.
+
+The equilibrium can be supported by a strategy that restarts the sequence after a deviation, but a milder
+punishment suffices: after a planner deviates to the action that an earlier planner took, the
+continuation can resume the sequence from that action.
+
+### Constant-value paths
+
+Subtracting $\beta V(s_{t+1}, s_{t+2}, \ldots)$ from {eq}`oe-action-payoff` and imposing
+{eq}`oe-no-restart` gives a first-order difference equation for the saving rate:
+
+```{math}
+:label: oe-q
+\beta (1 - \delta) \log(1 - s_{t+1})
+= \frac{\delta\alpha\beta}{1 - \alpha\beta} \log s_t + \log(1 - s_t) - (1 - \beta) \bar V ,
+```
+
+which we write as $s_{t+1} = q(s_t; \bar V)$.
+
+Many sequences deliver the same action payoff, because a planner who saves more today is compensated by
+more saving by its successors.
+
+{cite:t}`BassettoHuoRiosRull2024` show that the highest constant value that any sequence can attain is
+$V^\ast = V(s^B, s^B, \ldots)$, the value of the best constant saving rate.
+
+With $\bar V = V^\ast$, the map $q$ has $s^B$ as a fixed point, and paths that start between $s^M$ and $s^B$
+rise toward it.
+
+```{code-cell} ipython3
+V_star = action_payoff([s_B], s_B)
+
+def q(s, V_bar, α=α, β=β, δ=δ):
+ "Next period's saving rate on a path whose action payoff is V_bar at every date."
+ a = α * β / (1 - α * β)
+ return 1 - np.exp((-(1 - β) * V_bar + δ * a * np.log(s) + np.log(1 - s)) / (β * (1 - δ)))
+
+s_0 = q(s_M, V_star)
+slope = lambda s: (q(s + 1e-7, V_star) - q(s - 1e-7, V_star)) / 2e-7
+print(f"s_0 = q(s_M; V*) = {s_0:.4f}")
+print(f"slope of q at s_M: {abs(slope(s_M)):.4f}, at s_B: {slope(s_B):.4f}")
+```
+
+```{code-cell} ipython3
+---
+mystnb:
+ figure:
+ caption: Saving rates on constant-payoff paths
+ name: fig-oe-q
+---
+grid = np.linspace(s_M - 0.005, s_B + 0.002, 300)
+fig, ax = plt.subplots()
+ax.plot(grid, q(grid, V_star), 'C3', lw=2, label=r"$q(s; V^*)$")
+for gap in [0.003, 0.006]:
+ ax.plot(grid, q(grid, V_star - gap), 'C0--', lw=1)
+ax.plot(grid, grid, 'k', lw=0.8, label="45-degree line")
+for x, name in [(s_M, r"$s^M$"), (s_0, r"$s_0$"), (s_B, r"$s^B$")]:
+ ax.axvline(x, color='gray', ls=':', lw=1)
+ ax.text(x, ax.get_ylim()[0], name, ha='center', va='bottom')
+ax.set_xlabel(r"$s_t$")
+ax.set_ylabel(r"$s_{t+1}$")
+ax.legend()
+plt.show()
+```
+
+The red curve is $q(s; V^\ast)$, and the dashed curves are $q(s; \bar V)$ for two values of $\bar V$ below
+$V^\ast$.
+
+The red curve is flat at $s^M$ and touches the 45-degree line at $s^B$ with slope one, so convergence slows
+as the saving rate approaches $s^B$.
+
+### Where the path starts
+
+The difference equation {eq}`oe-q` admits a continuum of solutions with value $V^\ast$, one for each
+starting point.
+
+All of them give the first planner the same payoff, but they differ in what they ask of it.
+
+A sequence that starts at $s_0 = s^B$ is constant and, as we saw, violates no delay.
+
+The first planner's best one-period action is $s^M$, whatever its successors do, so the no-delay condition
+{eq}`oe-no-delay` requires the starting point to be low enough that saving at $s^M$ and letting the sequence
+start next period does not pay.
+
+The highest starting point that passes is $s_0 = q(s^M; V^\ast)$: with it, the sequence
+$s^M, s_0, s_1, \ldots$ is itself a constant-value path, so sitting out gives exactly $V^\ast$.
+
+Bassetto, Huo, and Ríos-Rull select this starting point because it leaves the most capital to later
+planners.
+
+The organizational equilibrium therefore starts with a saving rate about halfway from the Markov rate to
+$s^B$ and raises it gradually toward $s^B$, which is below the Ramsey planner's long-run rate $s^R$ for any
+$\delta < 1$.
+
+### Transition paths
+
+We compare the organizational equilibrium with the Ramsey plan and the Markov equilibrium, starting from
+the Markov steady-state capital stock $k^M = (s^M)^{1/(1 - \alpha)}$, as
+{cite:t}`BassettoHuoRiosRull2024` do.
+
+The **total payoff** of the planner at date $t$ is {eq}`oe-separable`, the sum of a capital payoff and
+the action payoff $V_t$.
+
+Along the organizational path, $V_t = V^\ast$ at every date by construction; we confirm it on a long
+computed path, since the saving rate converges slowly.
+
+```{code-cell} ipython3
+n_long, n_plot = 5000, 16
+s_O = [s_0]
+for t in range(n_long):
+ s_O.append(q(s_O[-1], V_star))
+s_O = np.array(s_O)
+
+V_O = np.array([action_payoff(s_O[t:], s_B) for t in range(n_plot)])
+print(f"max |V_t - V*| over {n_plot} periods = {np.abs(V_O - V_star).max():.1e}")
+
+paths = {"organizational equilibrium": s_O[:n_plot],
+ "Ramsey plan": np.r_[s_M, np.full(n_plot - 1, s_R)],
+ "Markov equilibrium": np.full(n_plot, s_M)}
+V_paths = {"organizational equilibrium": V_O,
+ "Ramsey plan": np.r_[action_payoff([s_M], s_R),
+ np.full(n_plot - 1, action_payoff([s_R], s_R))],
+ "Markov equilibrium": np.full(n_plot, action_payoff([s_M], s_M))}
+c_k = α * (1 - α * β + δ * α * β) / (1 - α * β)
+
+def capital_path(s, k_0):
+ k = [k_0]
+ for x in s[:-1]:
+ k.append(x * k[-1]**α)
+ return np.array(k)
+
+k_M = s_M**(1 / (1 - α))
+print("V_t - V* under the Ramsey plan, dates 0 and 1:",
+ np.round(V_paths["Ramsey plan"][:2] - V_star, 6))
+print(f"V_t - V* in the Markov equilibrium: {V_paths['Markov equilibrium'][0] - V_star:.4f}")
+```
+
+```{code-cell} ipython3
+---
+mystnb:
+ figure:
+ caption: Transition paths in three equilibria
+ name: fig-oe-growth-paths
+---
+fig, axes = plt.subplots(2, 2, figsize=(11, 7))
+styles = {"organizational equilibrium": 'C3-', "Ramsey plan": 'C0--',
+ "Markov equilibrium": 'k:'}
+for name, s in paths.items():
+ k = capital_path(s, k_M)
+ axes[0, 0].plot(s, styles[name], lw=2, label=name)
+ axes[0, 1].plot(k, styles[name], lw=2)
+ axes[1, 0].plot(c_k * np.log(k) + V_paths[name], styles[name], lw=2)
+ if name != "Markov equilibrium":
+ axes[1, 1].plot(V_paths[name] - V_star, styles[name], lw=2)
+for ax, title in zip(axes.flat, ["saving rate $s_t$", "capital $k_t$",
+ "total payoff $U_t$", r"action payoff $V_t - V^*$"]):
+ ax.set_title(title)
+ ax.set_xlabel("period")
+axes[0, 0].legend()
+plt.tight_layout()
+plt.show()
+```
+
+In the Markov equilibrium, the saving rate and capital stay at their initial levels.
+
+The Ramsey planner saves at the Markov rate at date $0$ and then imposes the higher rate $s^R$ on all its
+successors.
+
+In the organizational equilibrium, the date-$0$ planner saves more than the Markov rate, so capital at
+date $1$ is higher than under the Ramsey plan, and the saving rate then rises gradually.
+
+The Ramsey plan gives the date-$0$ planner the highest total payoff, as it must.
+
+At date $1$ the comparison reverses: the date-$1$ planner inherits more capital and is asked to save
+less than under the Ramsey plan, so its total payoff is higher.
+
+From date $2$ on, capital is lower than under the Ramsey plan, and so are total payoffs.
+
+The action payoffs, which factor out inherited capital, show the redistribution (the Markov equilibrium's
+action payoff, $0.044$ below $V^\ast$, is left out of the last panel): an organizational equilibrium gives
+the first planner less than the Ramsey plan does and gives every later planner more.
+
+(oe_tariffs)=
+## Tariffs, saving, and growth
+
+We apply these ideas to trade policy, following {cite:t}`BassettoHuoRiosRull2024` and
+{cite:t}`BassettoHuoRiosRull2026`.
+
+In this application a single large player, the government, interacts with a continuum of competitive
+private agents.
+
+Bassetto, Huo, and Ríos-Rull handle this setting by assuming that every sequence of government actions
+induces a unique competitive equilibrium that does not depend on the initial state, and by defining the
+government's preferences over sequences of its own actions as its payoff in that competitive equilibrium;
+the definitions of the previous section then apply unchanged.
+
+Time inconsistency now has a familiar source: private agents' current decisions depend on expected future
+policy, as in {cite:t}`KydlandPrescott1977`, {doc}`calvo`, and {doc}`dyn_stack`.
+
+A tariff protects workers in the import-competing sector and raises revenue that is rebated to workers,
+but it lowers the return to capital, and thereby saving and growth.
+
+A policymaker who cares about workers therefore wants high tariffs now and low tariffs later: low future
+tariffs encourage saving today, while today's tariff cannot affect saving that has already been done.
+
+### A two-country economy
+
+There are two symmetric countries, home and foreign, and two goods.
+
+Home is more productive at producing good 1, foreign at producing good 2.
+
+In each country, a measure one of workers is attached to each sector, and capital moves freely between
+the two sectors.
+
+At home, sector $i$ produces
+
+$$
+Y_{it} = A_i \, k_t^{1 - \alpha} \ell_{it}^{1 - \alpha} k_{it}^\alpha , \qquad \ell_{it} = 1, \quad
+A_1 = A > 1, \quad A_2 = 1 ,
+$$
+
+where $\ell_{it}$ is labor and $k_{it}$ capital used in sector $i$, and the country's aggregate capital
+stock $k_t = k_{1t} + k_{2t}$ raises productivity in both sectors, an externality that makes output
+proportional to $k_t$, as in an $AK$ model.
+
+Foreign is the mirror image of home, and the two countries start with the same capital stock.
+
+Each government taxes imports at the rate $\tau_t \ge 0$, and, following {cite:t}`BassettoHuoRiosRull2026`,
+we assume that the foreign government matches the home tariff, so that home effectively chooses a common
+tariff.
+
+Let good 2 be the numeraire at home.
+
+Home imports good 2, so its world price is $1/(1 + \tau_t)$, and by symmetry the world and home prices of
+good 1, which home exports, are also $p_{1t} = 1/(1 + \tau_t)$.
+
+The tariff lowers the relative price of home's export good below its free-trade value of one.
+
+#### Static equilibrium
+
+Equating the returns to capital in the two sectors gives the share $\phi_t$ of capital in sector 2,
+
+$$
+\phi_t = \left[ 1 + \left( \frac{A}{1 + \tau_t} \right)^{1/(1 - \alpha)} \right]^{-1} ,
+$$
+
+so that a higher tariff shifts capital into the import-competing sector.
+
+Wages and the rental rate, in units of good 2, are
+
+$$
+w_{1t} = (1 - \alpha) \frac{A (1 - \phi_t)^\alpha}{1 + \tau_t} k_t , \qquad
+w_{2t} = (1 - \alpha) \phi_t^\alpha k_t , \qquad
+r_t = \alpha \phi_t^{\alpha - 1} .
+$$
+
+A final good used for consumption and investment combines the two goods with a CES aggregator with
+equal weights and elasticity of substitution $\varepsilon$, and its price is
+
+$$
+P_t = \left[ \tfrac12 p_{1t}^{1 - \varepsilon} + \tfrac12 \right]^{1/(1 - \varepsilon)} .
+$$
+
+Home uses the goods in the ratio $m_{1t} / m_{2t} = (1 + \tau_t)^{\varepsilon}$.
+
+Because world prices of the two goods are equal, balanced trade requires home's exports of good 1,
+$Y_{1t} - m_{1t}$, to equal its imports of good 2, $m_{2t} - Y_{2t}$.
+
+Home collects tariff revenue $T_t = \tau_t (m_{2t} - Y_{2t}) / (1 + \tau_t)$, which it rebates equally to the
+two groups of workers.
+
+Workers do not save, so a worker in sector $i$ consumes
+
+$$
+c_{it} = \frac{w_{it} + T_t / 2}{P_t} = \psi_i(\tau_t) \, k_t ,
+$$
+
+where $\psi_i(\tau)$ depends only on the tariff.
+
+#### Capitalists
+
+Capitalists own the capital stock and rent it to firms; their consumption and investment satisfy
+
+$$
+c^K_t + k_{t+1} = G(\tau_t) \, k_t , \qquad G(\tau) = \frac{r(\tau)}{P(\tau)} + 1 - \delta_k ,
+$$
+
+where $\delta_k$ is the depreciation rate, and they maximize $\sum_t \beta^t (c^K_t)^{1 - \sigma} / (1 -
+\sigma)$.
+
+With saving rate $s_t = k_{t+1} / (G(\tau_t) k_t)$, the Euler equation is
+
+```{math}
+:label: oe-euler
+\left( \frac{1 - s_t}{s_t} \right)^{-\sigma} = \beta \, G(\tau_{t+1})^{1 - \sigma} (1 - s_{t+1})^{-\sigma} .
+```
+
+Iterating {eq}`oe-euler` forward shows that $s_t$ depends only on *future* tariffs.
+
+When $\sigma < 1$, a higher expected return raises saving, so expected future tariffs lower saving today.
+
+When tariffs are constant, $s(\tau) = \left[ \beta G(\tau)^{1 - \sigma} \right]^{1/\sigma}$.
+
+Within each period, the government sets the tariff first and capitalists then decide how much to save, so
+capitalists respond in the same period to any change in expected policy.
+
+#### The policymaker
+
+The home policymaker maximizes the welfare of the average worker,
+$\sum_{j \ge 0} \beta^j \tfrac12 (\log c_{1,t+j} + \log c_{2,t+j})$.
+
+Since $\tfrac12 (\log c_{1t} + \log c_{2t}) = \log k_t + \chi(\tau_t)$, with $\chi(\tau) = \tfrac12 [\log
+\psi_1(\tau) + \log \psi_2(\tau)]$, and $\log k_{t+1} = \log k_t + \log s_t + \log G(\tau_t)$, the
+policymaker's payoff separates into a capital payoff and an action payoff:
+
+```{math}
+:label: oe-tariff-payoff
+U_t = \frac{\log k_t}{1 - \beta} + \sum_{j=0}^\infty \beta^j H(\tau_{t+j}, s_{t+j}) , \qquad
+H(\tau, s) = \chi(\tau) + \frac{\beta}{1 - \beta} \left[ \log s + \log G(\tau) \right] .
+```
+
+Two functions of the tariff alone, worker welfare $\chi(\tau)$ and the gross return $G(\tau)$, summarize
+everything that the static equilibrium contributes to the dynamic policy problem.
+
+We use the parameter values of {cite:t}`BassettoHuoRiosRull2024`, with a model period of seven years,
+and set $\sigma = 0.5$, the value used by {cite:t}`BassettoHuoRiosRull2026`.
+
+```{code-cell} ipython3
+TariffModel = namedtuple('TariffModel', ('α', 'β', 'δ_k', 'ε', 'A', 'σ'))
+
+def create_tariff_model(α=0.33, β=0.7, δ_k=0.65, ε=1.1, A=3.5, σ=0.5):
+ return TariffModel(α=α, β=β, δ_k=δ_k, ε=ε, A=A, σ=σ)
+
+def static(τ, model):
+ """
+ Worker welfare χ(τ), the gross return G(τ), and the consumption of the two
+ groups of workers per unit of capital, ψ_1(τ) and ψ_2(τ).
+ """
+ α, β, δ_k, ε, A, σ = model
+ ϕ = 1 / (1 + (A / (1 + τ))**(1 / (1 - α)))
+ p_1 = 1 / (1 + τ)
+ Y_1, Y_2 = A * (1 - ϕ)**α, ϕ**α
+ P = (0.5 * p_1**(1 - ε) + 0.5)**(1 / (1 - ε))
+ m_2 = (Y_1 + Y_2) / (1 + (1 + τ)**ε) # balanced trade
+ revenue = τ / (1 + τ) * (m_2 - Y_2)
+ ψ_1 = ((1 - α) * p_1 * Y_1 + revenue / 2) / P
+ ψ_2 = ((1 - α) * Y_2 + revenue / 2) / P
+ χ = 0.5 * (np.log(ψ_1) + np.log(ψ_2))
+ G = α * ϕ**(α - 1) / P + 1 - δ_k
+ return χ, G, ψ_1, ψ_2
+
+def χ(τ, model):
+ return static(τ, model)[0]
+
+def G(τ, model):
+ return static(τ, model)[1]
+
+def H(τ, s, model):
+ β = model.β
+ return χ(τ, model) + β / (1 - β) * (np.log(s) + np.log(G(τ, model)))
+
+def s_const(τ, model):
+ "The saving rate when the tariff is τ forever."
+ return (model.β * G(τ, model)**(1 - model.σ))**(1 / model.σ)
+
+model = create_tariff_model()
+```
+
+### Markov and best constant tariffs
+
+From {eq}`oe-euler`, today's saving rate depends only on future tariffs.
+
+A Markov policymaker, who takes future tariffs as given, therefore takes today's saving rate as given and
+chooses
+
+$$
+\tau^M = \arg\max_{\tau \ge 0} \; \chi(\tau) + \frac{\beta}{1 - \beta} \log G(\tau) .
+$$
+
+The best constant tariff instead takes into account that a permanently lower tariff raises the saving
+rate $s(\tau)$; substituting $s(\tau)$ into $H$ gives, up to a constant,
+
+$$
+\tau^B = \arg\max_{\tau \ge 0} \; \chi(\tau) + \frac{\beta}{\sigma (1 - \beta)} \log G(\tau) ,
+$$
+
+which puts $1/\sigma$ times as much weight on the return to capital.
+
+```{code-cell} ipython3
+def argmax(f, lo=0.0, hi=1.0):
+ return minimize_scalar(lambda τ: -f(τ), bounds=(lo, hi), method='bounded',
+ options={'xatol': 1e-10}).x
+
+def markov_tariff(model):
+ β = model.β
+ return argmax(lambda τ: χ(τ, model) + β / (1 - β) * np.log(G(τ, model)))
+
+def best_constant_tariff(model):
+ β, σ = model.β, model.σ
+ return argmax(lambda τ: χ(τ, model) + β / (σ * (1 - β)) * np.log(G(τ, model)))
+
+τ_M, τ_B = markov_tariff(model), best_constant_tariff(model)
+H_B = H(τ_B, s_const(τ_B, model), model)
+V_markov = H(τ_M, s_const(τ_M, model), model) / (1 - model.β)
+V_best = H_B / (1 - model.β)
+print(f"Markov tariff {100 * τ_M:.1f} percent, best constant tariff {100 * τ_B:.1f} percent")
+
+ψ_free, ψ_markov = static(0.0, model)[2:], static(τ_M, model)[2:]
+print("consumption at the Markov tariff relative to free trade: export-sector workers "
+ f"{ψ_markov[0] / ψ_free[0]:.3f}, import-sector workers {ψ_markov[1] / ψ_free[1]:.3f}")
+```
+
+```{code-cell} ipython3
+---
+mystnb:
+ figure:
+ caption: Worker welfare and capital returns
+ name: fig-oe-chi-G
+---
+τ_grid = np.linspace(0, 0.5, 200)
+fig, axes = plt.subplots(1, 2, figsize=(11, 4))
+axes[0].plot(100 * τ_grid, [χ(x, model) - χ(0, model) for x in τ_grid], lw=2)
+axes[0].set_title(r"worker welfare $\chi(\tau) - \chi(0)$")
+axes[1].plot(100 * τ_grid, [G(x, model) for x in τ_grid], lw=2)
+axes[1].set_title(r"gross return to capital $G(\tau)$")
+for ax in axes:
+ ax.axvline(100 * τ_B, color='C2', ls='--', lw=1, label=r"best constant tariff $\tau^B$")
+ ax.axvline(100 * τ_M, color='C3', ls=':', lw=1.5, label=r"Markov tariff $\tau^M$")
+ ax.set_xlabel("tariff (percent)")
+axes[0].legend()
+plt.tight_layout()
+plt.show()
+```
+
+The tariff raises worker welfare over the whole range shown.
+
+It raises the consumption of the lower-paid workers in the import-competing sector, through their wage
+and the rebated revenue, by much more in proportion than it lowers the consumption of workers in the
+export sector: at the Markov tariff, by 58 percent against 6 percent.
+
+It lowers the return to capital throughout.
+
+The Markov policymaker, who ignores how expected tariffs affect saving, chooses a high tariff; the best
+constant tariff is close to free trade.
+
+### Ramsey plan and plans sustained by Markov reversion
+
+A Ramsey planner at date $0$ chooses the whole sequence of tariffs, taking into account the Euler
+equations {eq}`oe-euler`.
+
+Saving at date $t$ depends only on tariffs after date $t$, so the date-$0$ tariff affects no saving rate,
+and the planner chooses $\tau_0 = \tau^M$; from date $1$ on, it lowers tariffs to encourage saving at
+earlier dates.
+
+We compute the Ramsey plan by optimizing over tariffs for $N$ periods, after which the tariff is constant.
+
+Given a tariff sequence, we compute saving rates backward from the steady state using {eq}`oe-euler`, and
+action payoffs $V_t = \sum_{j \ge 0} \beta^j H(\tau_{t+j}, s_{t+j})$ backward from the constant tail.
+
+```{code-cell} ipython3
+def saving_rates(τ, model):
+ "Saving rates for tariffs τ_0, ..., τ_N, with τ_N kept forever."
+ β, σ = model.β, model.σ
+ s = np.empty(len(τ))
+ s[-1] = s_const(τ[-1], model)
+ for t in range(len(τ) - 2, -1, -1):
+ ratio = (β * G(τ[t + 1], model)**(1 - σ))**(-1 / σ) * (1 - s[t + 1]) # (1 - s_t) / s_t
+ s[t] = 1 / (1 + ratio)
+ return s
+
+def action_payoffs(τ, model):
+ "Action payoffs V_0, ..., V_N for tariffs τ_0, ..., τ_N, with τ_N kept forever."
+ β = model.β
+ s = saving_rates(τ, model)
+ V = np.empty(len(τ))
+ V[-1] = H(τ[-1], s[-1], model) / (1 - β)
+ for t in range(len(τ) - 2, -1, -1):
+ V[t] = H(τ[t], s[t], model) + β * V[t + 1]
+ return V
+
+N = 25
+res = minimize(lambda τ: -action_payoffs(τ, model)[0], np.full(N + 1, 0.1),
+ bounds=[(0, 1)] * (N + 1), method='L-BFGS-B')
+τ_R = res.x
+V_R = action_payoffs(τ_R, model)
+print("Ramsey tariffs (percent):", np.round(100 * τ_R[:6], 1))
+print(f"action payoffs: V_0 = {V_R[0]:.4f}, V_1 = {V_R[1]:.4f}, V_N = {V_R[-1]:.4f}; "
+ f"V* = {V_best:.4f}, V_M = {V_markov:.4f}")
+print(f"smallest V_t - V_M along the Ramsey plan: {(V_R - V_markov).min():.4f}")
+```
+
+The Ramsey plan starts at the Markov tariff and reaches free trade within a few periods.
+
+Free trade is a corner: we restrict tariffs to be nonnegative, as {cite:t}`BassettoHuoRiosRull2026` do,
+and without that restriction the Ramsey plan would subsidize imports from period 4 on.
+
+The plan gives the date-$0$ policymaker a higher action payoff than any later one, so it violates no
+restarting.
+
+A sustainable plan in the sense of {cite:t}`chari1990sustainable`, the subject of {doc}`calvo_abreu`, can be
+supported by the threat that any deviation triggers permanent reversion to the Markov equilibrium.
+
+After a deviation, capitalists expect Markov tariffs from the next period on and save at the Markov rate,
+so the best deviation yields exactly the Markov action payoff $V^M$.
+
+A tariff path can therefore be sustained by Markov reversion if and only if $V_t \ge V^M$ at every date,
+and the best such path maximizes $V_0$ subject to these constraints.
+
+Every Ramsey continuation is worth more than the Markov equilibrium, as the last line printed above shows,
+so the constraints are slack and the best path sustained by Markov reversion is the Ramsey plan.
+
+The best sustainable plan in the sense of {doc}`calvo_abreu`, which uses the worst subgame-perfect
+equilibrium as the punishment, is therefore also the Ramsey plan.
+
+### Organizational equilibrium tariffs
+
+Along an organizational equilibrium, the action payoff is the same at every date.
+
+We take that value to be $V^\ast = H(\tau^B, s^B)/(1 - \beta)$, the value of the best constant tariff, as
+{cite:t}`BassettoHuoRiosRull2026` do.
+
+With a competitive private sector, the general results that make $V^\ast$ the highest constant value in the
+growth model do not apply directly, so this choice must be checked in each application; here a numerical
+search over tariff paths that repeat every two, three, or four periods finds none that gives every
+policymaker more than $V^\ast$.
+
+A constant action payoff requires $H(\tau_t, s_t) = H^B \equiv H(\tau^B, s^B)$ at every date.
+
+Solving this equation for the saving rate gives the saving rate that a tariff $\tau$ must induce,
+
+$$
+s^O(\tau) = \exp\left\{ \frac{1 - \beta}{\beta} \left[ H^B - \chi(\tau) \right] - \log G(\tau) \right\} ,
+$$
+
+and the Euler equation {eq}`oe-euler` then links successive tariffs:
+
+$$
+\left( \frac{1 - s^O(\tau_t)}{s^O(\tau_t)} \right)^{-\sigma}
+= \beta \, G(\tau_{t+1})^{1 - \sigma} \left[ 1 - s^O(\tau_{t+1}) \right]^{-\sigma} .
+$$
+
+For a given $\tau_t$, this equation has a root $\tau_{t+1}$ between $\tau^B$ and $\tau_t$ and another at a
+much higher tariff; the first defines the transition map $\tau_{t+1} = \mathcal{T}(\tau_t)$, which has the
+fixed point $\tau^B$.
+
+A high tariff today must be followed by a tariff low enough tomorrow to induce the saving rate that keeps
+$H(\tau_t, s_t) = H^B$.
+
+The no-delay condition requires $\tau_0 \ge \mathcal{T}(\tau^M)$: a policymaker who sat out would choose
+$\tau^M$, and sitting out pays if the path starts with a lower tariff.
+
+As in the growth model, we select the lowest tariff that satisfies it, $\tau_0 = \mathcal{T}(\tau^M)$, as
+{cite:t}`BassettoHuoRiosRull2026` do; with it, the sequence $\tau^M, \tau_0, \tau_1, \ldots$ is itself a
+path of constant action payoff, so sitting out gains nothing.
+
+```{code-cell} ipython3
+def s_org(τ, H_B, model):
+ "The saving rate that keeps H(τ, s) equal to H_B."
+ β = model.β
+ return np.exp((1 - β) / β * (H_B - χ(τ, model)) - np.log(G(τ, model)))
+
+def transition(τ, τ_B, H_B, model):
+ "Next period's tariff on a path whose action payoff is constant at H_B / (1 - β)."
+ if τ <= τ_B + 1e-8:
+ return τ_B
+ β, σ = model.β, model.σ
+ s = s_org(τ, H_B, model)
+ lhs = ((1 - s) / s)**(-σ)
+ f = lambda τ_next: (β * G(τ_next, model)**(1 - σ)
+ * (1 - s_org(τ_next, H_B, model))**(-σ) - lhs)
+ return brentq(f, τ_B, τ) # the root between τ_B and τ
+
+𝒯 = lambda τ: transition(τ, τ_B, H_B, model)
+
+τ_O = [𝒯(τ_M)]
+for t in range(400):
+ τ_O.append(𝒯(τ_O[-1]))
+τ_O = np.array(τ_O)
+V_org = action_payoffs(τ_O, model)
+print("organizational tariffs (percent):", np.round(100 * τ_O[:6], 1))
+print(f"max |V_t - V*| over the first 25 periods = {np.abs(V_org[:25] - V_best).max():.1e}")
+
+ratio = ((model.β * G(τ_O[0], model)**(1 - model.σ))**(-1 / model.σ)
+ * (1 - s_org(τ_O[0], H_B, model)))
+s_minus = 1 / (1 + ratio) # saving at date -1 if the path starts one period later
+print(f"gain from sitting out at date 0: H(τ_M, s_-1) - H_B = {H(τ_M, s_minus, model) - H_B:.1e}")
+print(f"slope of the transition map at τ_M: {(𝒯(τ_M) - 𝒯(τ_M - 1e-6)) / 1e-6:.4f}, "
+ f"near τ_B: {(𝒯(τ_B + 2e-3) - 𝒯(τ_B + 1e-3)) / 1e-3:.4f}")
+print(f"tariff after 20 periods {100 * τ_O[20]:.1f} percent, after 100 periods "
+ f"{100 * τ_O[100]:.1f} percent")
+```
+
+The action payoff is constant along the path, and the first policymaker is exactly indifferent between
+starting the organizational path and sitting out.
+
+Like $q$ in the growth model, the transition map is flat at the Markov policy and has slope one at the
+best constant policy, so liberalization is fast at first and then very slow: with seven-year periods, the
+tariff is still 3.8 percent after 140 years.
+
+```{code-cell} ipython3
+---
+mystnb:
+ figure:
+ caption: Tariff transition map and tariff paths
+ name: fig-oe-tariff-paths
+---
+n_plot = 20
+fig, axes = plt.subplots(1, 2, figsize=(12, 4.5))
+grid_τ = np.linspace(τ_B, τ_M, 100)
+axes[0].plot(100 * grid_τ, [100 * 𝒯(x) for x in grid_τ], 'C3', lw=2,
+ label=r"$\mathcal{T}(\tau)$")
+axes[0].plot(100 * grid_τ, 100 * grid_τ, 'k', lw=0.8, label="45-degree line")
+axes[0].set_xlabel(r"current tariff $\tau_t$ (percent)")
+axes[0].set_ylabel(r"next tariff $\tau_{t+1}$ (percent)")
+axes[0].legend()
+axes[1].plot(100 * τ_O[:n_plot], 'C3-o', ms=4, lw=2, label="organizational equilibrium")
+axes[1].plot(100 * τ_R[:n_plot], 'C0--s', ms=4, lw=2,
+ label="Ramsey plan = best plan sustained by Markov reversion")
+axes[1].plot(np.full(n_plot, 100 * τ_M), 'k:', lw=2, label="Markov equilibrium")
+axes[1].axhline(100 * τ_B, color='gray', lw=0.8)
+axes[1].set_xlabel("period (seven years)")
+axes[1].set_ylabel("tariff (percent)")
+axes[1].legend()
+plt.tight_layout()
+plt.show()
+```
+
+The transition map lies below the 45-degree line, so tariffs fall at every date, by a lot when they are
+high and by little near $\tau^B$.
+
+The organizational equilibrium starts well below the Markov tariff and liberalizes gradually, a pattern
+that {cite:t}`BassettoHuoRiosRull2024` compare with the decline of the world average tariff after 1950.
+
+The Ramsey plan liberalizes much faster, but only because its first policymaker can commit its
+successors.
+
+### Temporary protectionist shocks
+
+The off-path behavior of the two cooperative equilibria differs sharply.
+
+Suppose that at date 10 an unexpected shock sets the tariff to 10 percent, as in an example of
+{cite:t}`BassettoHuoRiosRull2026`.
+
+The Ramsey plan, sustained by the threat of permanent reversion, then switches to $\tau^M$ forever.
+
+In the organizational equilibrium, the transition map still applies: the next tariff is
+$\mathcal{T}(0.1)$, and liberalization resumes from there.
+
+```{code-cell} ipython3
+---
+mystnb:
+ figure:
+ caption: Tariffs after a protectionist shock
+ name: fig-oe-shock
+---
+t_shock, τ_shock, n_plot = 10, 0.1, 30
+τ_O_shock = list(τ_O[:t_shock]) + [τ_shock]
+while len(τ_O_shock) < n_plot:
+ τ_O_shock.append(𝒯(τ_O_shock[-1]))
+τ_S_shock = np.r_[τ_R[:t_shock], τ_shock, np.full(n_plot - t_shock - 1, τ_M)]
+t_back = np.argmin(np.abs(τ_O - 𝒯(τ_shock)))
+print(f"tariff after the shock: {100 * 𝒯(τ_shock):.1f} percent, the undisturbed path's "
+ f"tariff at period {t_back}")
+
+fig, ax = plt.subplots()
+ax.plot(100 * np.array(τ_O_shock), 'C3-o', ms=4, lw=2, label="organizational equilibrium")
+ax.plot(100 * τ_S_shock, 'C0--s', ms=4, lw=2, label="plan sustained by Markov reversion")
+ax.plot(np.full(n_plot, 100 * τ_M), 'k:', lw=2, label="Markov equilibrium")
+ax.axvline(t_shock, color='gray', ls=':', lw=1)
+ax.set_xlabel("period (seven years)")
+ax.set_ylabel("tariff (percent)")
+ax.legend(loc='upper right', bbox_to_anchor=(1, 0.88))
+plt.show()
+```
+
+One period after the shock, the organizational tariff is back at the level that the undisturbed path
+reached at period 3, so the shock delays liberalization by eight periods, about 56 years, but does not
+change where liberalization ends up.
+
+In the plan sustained by Markov reversion, a one-period disturbance permanently destroys cooperation, a
+self-inflicted punishment that later policymakers would want to renegotiate.
+
+### A quantitative version
+
+{cite:t}`BassettoHuoRiosRull2026` replace the two-sector static block with a model of the G7 economies
+with 30 sectors, input-output linkages, and trade in final and intermediate goods, disciplined by the
+World Input-Output Database and KLEMS data.
+
+Because aggregate capital enters each firm's technology as an externality, the static equilibrium is again
+proportional to world capital, and the dynamic policy problem depends on the static block only through
+$\chi(\tau)$ and $G(\tau)$, as in {eq}`oe-tariff-payoff`.
+
+That separability lets them compute $\chi(\tau)$ and $G(\tau)$ by exact-hat algebra {cite}`DekleEatonKortum2008`
+from observed trade shares, without separately estimating technologies and tastes.
+
+They find a Markov tariff of about 12 percent and a best constant tariff of about 1.3 percent, and that
+the tariff raises worker welfare mainly by compressing consumption differences across sectors through the
+equal rebate of tariff revenue.
+
+(oe_connections)=
+## Connections to other lectures
+
+Organizational equilibrium adds a fourth equilibrium concept to the three that several lectures in this
+section study.
+
+* {doc}`gradual_trade_agreements` explains gradual liberalization differently, as a feature of efficient
+ self-enforcing agreements between countries of different size that are sustained by the threat of a
+ permanent trade war {cite}`BondPark2002`, the kind of cooperation whose fragility to a single
+ deviation {ref}`oe_tariffs` illustrates.
+* {doc}`calvo` computes a Ramsey plan, a Markov perfect equilibrium, and a constrained-to-constant-growth
+ Ramsey plan in a model of inflation; the last is the analogue of the best constant action, and an
+ organizational equilibrium converges to it but, because of no delay, does not start there.
+* {doc}`calvo_abreu` supports good outcomes in the same model with Abreu's severe stick-and-carrot
+ punishments {cite}`Abreu`, whereas an organizational equilibrium can use punishments proportional to the
+ deviation and gives every policymaker the same action payoff.
+* {doc}`chang_credible` computes the values of credible plans by iterating on a set-to-set operator in the
+ manner of {cite:t}`APS1986` and {cite:t}`APS1990`, an iteration that Bassetto, Huo, and Ríos-Rull cannot
+ use because their symmetry requirement, that every continuation give the same value as the whole
+ equilibrium, is an equality constraint.
+* {doc}`dyn_stack`, {doc}`opt_tax_recur`, and {doc}`chang_ramsey` make Ramsey plans recursive by carrying
+ promised values or promised private-sector decisions as state variables, which is needed because, as in
+ the tariff model, later actions are chosen partly to shape earlier private decisions.
+* {doc}`dovis_accounting_mf` studies a government that cannot fully commit and whose economy switches
+ endogenously between monetary-dominant and fiscal-dominant regimes; organizational equilibrium offers
+ a way to think about how institutions that discipline such a government might be built up over time.
+* {doc}`atkeson_1991` and {doc}`tsyrennikov_2013` study lending sustained by the threat of permanent
+ exclusion into autarky, a punishment of the same permanent kind as reversion to the Markov equilibrium
+ in {ref}`oe_tariffs`.
+
+## Exercises
+
+```{exercise}
+:label: oe_ex1
+
+In the growth model of {ref}`oe_growth`, the organizational equilibrium converges to the best constant
+saving rate $s^B$, which lies below the Ramsey planner's long-run rate $s^R = \alpha\beta$.
+
+For $\delta \in \{0.5, 0.7, 0.9, 0.95, 0.99\}$, holding $\alpha = 0.4$ and $\beta = 0.96$ fixed, compute
+$s^M$, the first organizational saving rate $s_0 = q(s^M; V^\ast)$, $s^B$, and $s^R$, and the numbers of
+periods that the organizational path takes to close half and 90 percent of the gap between $s_0$ and
+$s^B$.
+
+How do the long-run gap $s^R - s^B$ and the speed of convergence depend on $\delta$?
+```
+
+```{solution-start} oe_ex1
+:class: dropdown
+```
+
+```{code-cell} ipython3
+α_g, β_g = 0.4, 0.96
+
+def periods_to_close(fraction, s_start, s_target, V, δ):
+ "Periods until the organizational path closes the given fraction of the gap."
+ s, t = s_start, 0
+ while s_target - s > (1 - fraction) * (s_target - s_start):
+ s = q(s, V, α_g, β_g, δ)
+ t += 1
+ return t
+
+print(" δ s_M s_0 s_B s_R s_R - s_B periods to close 50% and 90%")
+for δ_i in [0.5, 0.7, 0.9, 0.95, 0.99]:
+ s_M_i, s_B_i, s_R_i = benchmarks(α_g, β_g, δ_i)
+ V_i = action_payoff([s_B_i], s_B_i, α_g, β_g, δ_i)
+ s_0_i = q(s_M_i, V_i, α_g, β_g, δ_i)
+ t_50, t_90 = [periods_to_close(f, s_0_i, s_B_i, V_i, δ_i) for f in (0.5, 0.9)]
+ print(f"{δ_i:5.2f} {s_M_i:7.4f} {s_0_i:7.4f} {s_B_i:7.4f} {s_R_i:7.4f}"
+ f" {s_R_i - s_B_i:10.5f} {t_50:6d} {t_90:6d}")
+```
+
+As $\delta$ rises toward one, the present bias weakens, and $s^M$, $s_0$, and $s^B$ all approach the
+Ramsey rate $s^R$, but $s^B < s^R$ for every $\delta < 1$.
+
+Whatever $\delta$, the organizational path closes half of its initial gap in four or five periods but
+needs 34 to 46 periods to close 90 percent of it, because $q(\cdot; V^\ast)$ has slope one at $s^B$.
+
+Convergence is slightly faster when the present bias is weak.
+
+```{solution-end}
+```
+
+```{exercise}
+:label: oe_ex2
+
+The difference equation {eq}`oe-q` with $\bar V = V^\ast$ has a solution for each starting point
+$\hat s \in [s^M, s^B]$, and all of them give the first planner the action payoff $V^\ast$.
+
+1. For a grid of starting points, compute the first planner's gain from sitting out,
+ $V(s^M, \hat s, s_1, \ldots) - V^\ast$, and confirm that the no-delay condition {eq}`oe-no-delay` holds
+ exactly when $\hat s \le q(s^M; V^\ast)$.
+1. Use {eq}`oe-q` to show that the gain equals $\beta (1 - \delta) \left[ \log\left(1 - q(s^M; V^\ast)\right) -
+ \log(1 - \hat s) \right]$.
+
+Hint: compute each path for many periods, and append $s^B$ as the constant tail.
+```
+
+```{solution-start} oe_ex2
+:class: dropdown
+```
+
+```{code-cell} ipython3
+def constant_value_path(s_start, n=5000):
+ s = [s_start]
+ for t in range(n):
+ s.append(q(s[-1], V_star))
+ return s
+
+starts = np.linspace(s_M, s_B, 9)
+gains = [action_payoff([s_M] + constant_value_path(x), s_B) - V_star for x in starts]
+formula = β * (1 - δ) * (np.log(1 - q(s_M, V_star)) - np.log(1 - starts))
+print(f"max |computed gain - formula| = {np.abs(np.array(gains) - formula).max():.1e}")
+
+fig, ax = plt.subplots()
+ax.plot(starts, gains, 'o-', lw=2)
+ax.axhline(0, color='k', lw=0.8)
+ax.axvline(q(s_M, V_star), color='C3', ls=':', label=r"$q(s^M; V^*)$")
+ax.set_xlabel(r"starting saving rate $\hat s$")
+ax.set_ylabel("gain from sitting out")
+ax.legend()
+plt.tight_layout()
+plt.show()
+```
+
+The gain from sitting out is negative for low starting points, zero at $\hat s = q(s^M; V^\ast)$, and
+positive above it, where the first planner would rather save at the Markov rate and let its successor start
+the sequence.
+
+For the formula, write $V_t$ for the action payoff of the sequence $s^M, \hat s, s_1, \ldots$ from date $t$
+on, so that $V_1 = V^\ast$.
+
+Subtracting $\beta V_1$ from $V_0$ as in the derivation of {eq}`oe-q` gives
+$V_0 - \beta V^\ast = \log(1 - s^M) + \frac{\delta\alpha\beta}{1 - \alpha\beta} \log s^M - \beta(1 - \delta)
+\log(1 - \hat s)$.
+
+By the definition of $q$, the first two terms on the right side equal
+$(1 - \beta) V^\ast + \beta(1 - \delta) \log\left(1 - q(s^M; V^\ast)\right)$.
+
+Substituting gives $V_0 - V^\ast = \beta (1 - \delta) \left[ \log\left(1 - q(s^M; V^\ast)\right) -
+\log(1 - \hat s) \right]$, which is positive exactly when $\hat s > q(s^M; V^\ast)$ and rises with $\hat s$.
+
+```{solution-end}
+```
+
+```{exercise}
+:label: oe_ex3
+
+In the tariff model of {ref}`oe_tariffs`, time inconsistency arises because capitalists' saving responds
+to expected returns.
+
+For $\sigma \in \{0.3, 0.5, 0.7, 1.0\}$, compute the Markov tariff $\tau^M$, the best constant tariff
+$\tau^B$, and the first organizational tariff $\mathcal{T}(\tau^M)$.
+
+Explain why the three coincide when $\sigma = 1$.
+```
+
+```{solution-start} oe_ex3
+:class: dropdown
+```
+
+```{code-cell} ipython3
+print(" σ τ_M (%) τ_B (%) T(τ_M) (%)")
+for σ_i in [0.3, 0.5, 0.7, 1.0]:
+ model_i = create_tariff_model(σ=σ_i)
+ τ_M_i, τ_B_i = markov_tariff(model_i), best_constant_tariff(model_i)
+ H_B_i = H(τ_B_i, s_const(τ_B_i, model_i), model_i)
+ τ_0_i = transition(τ_M_i, τ_B_i, H_B_i, model_i)
+ print(f"{σ_i:5.1f} {100 * τ_M_i:8.2f} {100 * τ_B_i:8.2f} {100 * τ_0_i:10.2f}")
+```
+
+The Markov tariff does not depend on $\sigma$, because a Markov policymaker takes the saving rate as given.
+
+The best constant tariff rises with $\sigma$, because the saving rate responds less to the return to
+capital, and so does the first organizational tariff.
+
+With $\sigma = 0.3$, the best constant tariff is at the corner $\tau^B = 0$.
+
+With $\sigma = 1$, capitalists save the constant fraction $\beta$ of their wealth whatever the return, so
+expected tariffs do not affect saving, there is no time inconsistency, and the Markov, best constant, and
+organizational tariffs coincide.
+
+```{solution-end}
+```