  Local fields, and fields complete with respect to a discrete valuation, are
essential objects in commutative algebra, with applications to number theory
and algebraic geometry. We formalize in Lean the basic theory of discretely
valued fields. In particular, we prove that the unit ball with respect to a
discrete valuation on a field is a discrete valuation ring and, conversely,
that the adic valuation on the field of fractions of a discrete valuation ring
is discrete. We define finite extensions of valuations and of discrete
valuation rings, and prove some global-to-local results. Building on this
general theory, we formalize the abstract definition and some fundamental
properties of local fields. As an application, we show that finite extensions
of the field $\mathbb{Q}_p$ of $p$-adic numbers and of the field
$\mathbb{F}_p(\!(X)\!)$ of Laurent series over $\mathbb{F}_p$ are local fields.
