Logic & kernel theory

Analysis

The system must reach abstract analysis: bounded variation, Sobolev spaces, measures, and Schwartz distributions. This page shows that the kernel's logic suffices, gives the standard definitions in the form they take in the logic, orders them into a ladder of theory packages, and states which kernel features each level needs. The evidence that higher-order logic suffices is practical as well as theoretical: HOL Light formalizes multivariate real and complex analysis [Harrison 2013], and Isabelle/HOL formalizes measure theory and Lebesgue integration [Hölzl and Heller 2011], both without dependent types.

Totalized operations

Analysis is full of partial operations: limits, derivatives, and integrals may fail to exist. The logic has only total functions. The standard solution, used by HOL Light, Isabelle/HOL, and judgment_mathlib, is to pair a relation that states existence with a total operation defined by choice.

Definition A-1 (totalization). For a relation \(R(x, y)\) that characterizes a unique \(y\) when one exists (for example, \(\mathrm{tends}(f, a, L)\): \(f(x) \to L\) as \(x \to a\)), define

\[ \mathrm{op}(x):= \varepsilon\big(\lambda y.\, R(x, y)\big), \qquad \mathrm{defined}(x):= \exists y.\, R(x, y). \]

Theorem A-1. Totalized operations are conservative definitions, and \(\mathrm{defined}(x) \Rightarrow R(x, \mathrm{op}(x))\) is a theorem. If \(R\) is functional (\(R(x, y) \land R(x, y') \Rightarrow y = y'\)), then \(\mathrm{defined}(x) \Rightarrow (R(x, y) \leftrightarrow y = \mathrm{op}(x))\).

Proof. The definition's body is closed, and its type variables occur in its type, so Theorem M-5 applies. The first statement is the choice axiom applied to the witness given by \(\mathrm{defined}(x)\); the second follows from functionality. \(\square\)

Where the operation is undefined, its value is unspecified, and no theorem about it can be used without the guard \(\mathrm{defined}(x)\). This is how the guards of the CAS arise in analysis: D[f, x] corresponds to \(\mathrm{deriv}(f, x)\) under the guard \(\mathrm{differentiable}(f, x)\), an integral to \(\mathrm{integral}(f, S)\) under \(\mathrm{integrable}(f, S)\), and so on [Farmer 2004 discusses the general problem of undefinedness in calculus].

Bridge to scalar. Functions of analysis are maps between subsets of \(\hat S\), typically \(\mathbb R \to \hat S\) or \(\mathbb R^n \to \hat S\), with real numbers as a predicate (Definition X-P1). The bridge lemmas state that defined results are finite, for example \(\mathrm{differentiable}(f, x) \Rightarrow \mathrm{finite}(\mathrm{deriv}(f, x))\), so that the guarded algebra of the scalar carrier (Theorem X-5) applies to them.

The ladder

Level Notions Definition in the logic Kernel features needed
1. Natural numbers \(\mathbb N\), induction, recursion the least subset of \(\mathsf{ind}\) containing a zero and closed under the infinity witness, as the type \(\mathsf{nat}\); induction is its leastness; the recursion theorem is proved from it (natural numbers, Theorems NR-1 to NR-4) the existing logical core, with a type definition
2. Finite sums and products \(\sum_{i < n}\), \(\prod_{i < n}\) definitions by the recursion theorem level 1
3. Real completeness suprema, infima the least-upper-bound property of \(\mathbb R \subset \hat S\), a profile axiom true in the model (Theorem X-8) none
4. Limits, continuity, derivatives \(\varepsilon\)-\(\delta\) predicates with quantifiers over reals; totalized operations (Definition A-1) none
5. Measures and integration σ-algebras, measures, the Lebesgue integral sets as predicates \(\alpha \to \mathsf{Prop}\); a measure \(\mu\) maps sets to \([0, \infty] = \{x \in \mathbb R \mid x \ge 0\} \cup \{D_1\}\) and is countably additive; the integral is the supremum over simple functions levels 1–4
6. \(L^p\) spaces \(p\)-integrable functions modulo null sets representatives with the relation "equal almost everywhere", rather than a quotient type level 5
7. Distributions test functions, \(\mathcal D'(\Omega)\), \(\mathcal S'\) below levels 4–5
8. Sobolev spaces weak derivatives, \(W^{k,p}(\Omega)\) below levels 6–7
9. Bounded variation total variation, \(BV\) below levels 2–5, 7

Levels 1 and 2 need induction and recursive definitions; the optional judgment_nat package supplies them by definitions (the natural numbers). No level needs dependent types.

Definitions at the top of the ladder

The following are the standard definitions [Hörmander 1990, ch. 2 and 6; Evans and Gariepy 2015; Ambrosio, Fusco and Pallara 2000], written as they are stated in the logic, with functions total and properties as predicates.

Definition A-2 (test functions). For an open \(\Omega \subseteq \mathbb R^n\), \(\varphi: \mathbb R^n \to \hat S\) is a test function on \(\Omega\) when it is infinitely differentiable, real or complex valued (finite everywhere), and vanishes outside a compact subset of \(\Omega\). A sequence \(\varphi_k\) converges to \(0\) in \(\mathcal D(\Omega)\) when all supports lie in one compact \(K \subset \Omega\) and every derivative \(\partial^\alpha \varphi_k\) converges to \(0\) uniformly.

Definition A-3 (distributions). A distribution on \(\Omega\) is a function \(T\) from functions to \(\hat S\) that is linear on test functions and sequentially continuous: \(\varphi_k \to 0\) in \(\mathcal D(\Omega)\) implies \(T(\varphi_k) \to 0\). Its derivative is \((\partial^\alpha T)(\varphi) = (-1)^{\lvert\alpha\rvert}\, T(\partial^\alpha \varphi)\). A locally integrable \(f\) defines the distribution \(T_f(\varphi) = \int f \varphi\); the Dirac distribution at \(a\) is \(\delta_a(\varphi) = \varphi(a)\). Tempered distributions are defined likewise on the Schwartz space \(\mathcal S(\mathbb R^n)\).

Since \(T\) is a total function on all functions, the definition constrains it only on test functions; two distributions are equal when they agree on all test functions, which is an equivalence relation used in place of a quotient.

Definition A-4 (Sobolev spaces). \(g\) is the weak derivative \(\partial^\alpha f\) when \(T_g = \partial^\alpha T_f\), that is, \(\int f\, \partial^\alpha \varphi = (-1)^{\lvert\alpha\rvert} \int g\, \varphi\) for every test function \(\varphi\). Then \(W^{k,p}(\Omega) = \{\, f \in L^p(\Omega) \mid \partial^\alpha f \text{ exists weakly and lies in } L^p(\Omega) \text{ for } \lvert\alpha\rvert \le k \,\}\), as a predicate on functions.

Definition A-5 (bounded variation). For \(f: [a, b] \to \mathbb R\),

\[ V_a^b(f) = \sup \Big\{ \sum_{i=1}^m \lvert f(x_i) - f(x_{i-1}) \rvert \;\Big|\; a = x_0 < x_1 < \cdots < x_m = b \Big\}, \]

and \(f \in BV([a, b])\) when \(V_a^b(f)\) is finite. In several variables, \(f \in BV(\Omega)\) when \(f \in L^1(\Omega)\) and its distributional gradient is a finite vector-valued Radon measure. For integrable \(f\) on an interval, the two notions agree up to the choice of a good representative [Ambrosio, Fusco and Pallara 2000, ch. 3].

Computational rule bundles

Rule bundles that a CAS uses state these rules as theorems with their hypotheses as guards. A rule whose levels of the ladder are not yet formalized is admitted (recorded as an axiom of its bundle); it becomes a theorem once the levels it depends on are formalized.

Rule Statement Guard
sifting \(\int f(x)\, \delta(x - a)\, dx = f(a)\), read as \(\delta_a(f) = f(a)\) \(f\) a test function, or continuous at \(a\) when the pairing is extended to continuous functions
multiplication \(f\, \delta_a = f(a)\, \delta_a\), where \((fT)(\varphi) = T(f\varphi)\) \(f\) infinitely differentiable
derivative of the step \(H' = \delta_0\) for the Heaviside function, as distributions none
weak derivative \(\lvert x\rvert' = \operatorname{sign}(x)\) weakly none
composition \(\delta(g(x)) = \sum_i \delta_{x_i} / \lvert g'(x_i)\rvert\) \(g\) smooth with finitely many zeros \(x_i\), all simple
Fourier transform \(\mathcal F \delta_0 = 1\) and \(\mathcal F 1 = 2\pi\, \delta_0\), with \(\mathcal F\varphi(\xi) = \int \varphi(x)\, e^{-i x \xi}\, dx\) on \(\mathcal S'(\mathbb R)\)
Fourier and derivatives \(\mathcal F(\partial T) = i\xi\, \mathcal F T\) on \(\mathcal S'(\mathbb R)\)

The numeric admission gate does not apply to rules about distributions, whose two sides are not numbers. Such a bundle is admitted only after a review of each rule against the cited sources, and the review is recorded with the bundle.

judgment v1.0.0 for Mojo 1.2 · Apache License 2.0 with LLVM Exceptions · Source on GitHub