10.6. Exact Symbolic Calculus
10.6.1. Verified Exact Symbolic Computation
An exact residual proof often ends with a cancellation. To establish
A(x)/B(x)=C(x) on a domain \Omega, we can normalize
A(x)-B(x)C(x) to zero and prove that B(x)\ne0 throughout
\Omega. Polynomial arithmetic can settle the first question; a sign,
interval, or root-exclusion argument can settle the second. The domain
determines where we may use the resulting equality.
The normalization and polynomial-root certificates of the exact core cover conditional cancellation, real powers and exponentials, exact polynomial division, and Sturm chains. The calculus bridges use such identities to justify derivatives and antiderivatives.
The core expression type is an inductive syntax tree indexed by its variable
type. It contains rational constants, arithmetic operations, natural powers,
real powers with an arbitrary real exponent (Mathlib's Real.rpow),
trigonometric functions, exponential and logarithmic functions, square roots,
and the inverse tangent, sine, and cosine. Evaluation uses Lean's total
real functions. A separate validity predicate records sufficient conditions
for their analytic rules: a nonzero denominator or logarithm argument, a
positive square-root argument or power base, and an inverse sine or cosine
argument different from \pm1. These conditions are needed by the
calculus bridges; an equality about total values need not require them.
Schematically, the reflected language and its semantics are
e ::= q\mid x_i\mid \pi\mid \mathrm e
\mid -e\mid e_1\mathbin\circ e_2\mid e^n\mid e_1^{\,e_2}
\mid \sin e\mid\cos e\mid\arctan e\mid\arcsin e\mid\arccos e
\mid\exp e\mid\log e\mid\sqrt e,
\qquad
\operatorname{eval}: \operatorname{Expr}(\iota)\to(\iota\to\mathbb R)\to\mathbb R.
Here \circ\in\{+,-,\times,/\}, the exponent n of e^n is a natural
number while e_2 in e_1^{\,e_2} is an arbitrary expression, and rational
literals with zero denominator are rejected by the well-formedness layer.
Lean code for Definition10.1●1 definitionAssociated Lean declarationsCAS.Verified.Expr[complete]
CAS.Verified.Expr[complete]
- inductivedefined in CAS/Expr/Syntax.leancomplete
inductive CAS.Verified.Expr.{u_1} (ι : Type u_1) : Type u_1
inductive CAS.Verified.Expr.{u_1} (ι : Type u_1) : Type u_1
A deeply embedded real expression whose variable labels may inhabit any universe.
The constructor
.rat num denstores a natural denominator because it mirrors parser output. Mathematically meaningful use of this constructor is guarded byExpr.ValidAt, which requiresden ≠ 0; raw evaluation remains total because division inℝis total.Constructors
CAS.Verified.Expr.nat.{u_1} {ι : Type u_1} (n : ℕ) : CAS.Verified.Expr ι
A nonnegative integer literal.
CAS.Verified.Expr.int.{u_1} {ι : Type u_1} (n : ℤ) : CAS.Verified.Expr ι
An integer literal.
CAS.Verified.Expr.rat.{u_1} {ι : Type u_1} (num : ℤ) (den : ℕ) : CAS.Verified.Expr ι
A rational literal with an integer numerator and natural denominator.
CAS.Verified.Expr.pi.{u_1} {ι : Type u_1} : CAS.Verified.Expr ι
The circle constant
π.CAS.Verified.Expr.e.{u_1} {ι : Type u_1} : CAS.Verified.Expr ι
Euler's number
e = exp 1.CAS.Verified.Expr.var.{u_1} {ι : Type u_1} (name : ι) : CAS.Verified.Expr ι
A variable identified by an index in
ι.CAS.Verified.Expr.add.{u_1} {ι : Type u_1} (a b : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
The sum of two expressions.
CAS.Verified.Expr.mul.{u_1} {ι : Type u_1} (a b : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
The product of two expressions.
CAS.Verified.Expr.sub.{u_1} {ι : Type u_1} (a b : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
The difference of two expressions.
CAS.Verified.Expr.div.{u_1} {ι : Type u_1} (a b : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
The quotient of two expressions.
CAS.Verified.Expr.neg.{u_1} {ι : Type u_1} (a : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
The additive inverse of an expression.
CAS.Verified.Expr.pow.{u_1} {ι : Type u_1} (a : CAS.Verified.Expr ι) (n : ℕ) : CAS.Verified.Expr ι
A natural-number power.
CAS.Verified.Expr.sin.{u_1} {ι : Type u_1} (a : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
The sine of an expression.
CAS.Verified.Expr.cos.{u_1} {ι : Type u_1} (a : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
The cosine of an expression.
CAS.Verified.Expr.atan.{u_1} {ι : Type u_1} (a : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
The real inverse tangent of an expression.
CAS.Verified.Expr.asin.{u_1} {ι : Type u_1} (a : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
The principal real inverse sine of an expression.
CAS.Verified.Expr.acos.{u_1} {ι : Type u_1} (a : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
The principal real inverse cosine of an expression.
CAS.Verified.Expr.exp.{u_1} {ι : Type u_1} (a : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
The real exponential of an expression.
CAS.Verified.Expr.log.{u_1} {ι : Type u_1} (a : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
The real logarithm of an expression.
CAS.Verified.Expr.sqrt.{u_1} {ι : Type u_1} (a : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
The nonnegative real square root of an expression.
CAS.Verified.Expr.rpow.{u_1} {ι : Type u_1} (a b : CAS.Verified.Expr ι) : CAS.Verified.Expr ι
A real power
a ^ bin the sense ofReal.rpow;ValidAtasks for a positive base.
If the executable normalizer reduces an expression to literal zero, evaluating the original expression in any real environment gives zero. The computation therefore proposes a normal form, while this theorem is the kernel-checked semantic justification.
\operatorname{normalize}(e)=0
\quad\Longrightarrow\quad
\forall\rho,\ \operatorname{eval}(e,\rho)=0.
Lean code for Theorem10.2●1 theoremAssociated Lean declarations
- theoremdefined in CAS/ClosedForm/Expression/Polynomial/Normalization.leancomplete
theorem CAS.Verified.Expr.Alg.eval_eq_zero_of_normalize_eq_zero.{u_1} {ι : Type u_1} [DecidableEq ι] (ρ : ι → ℝ) (expr : CAS.Verified.Expr ι) (h : CAS.Verified.Expr.Alg.normalize expr = 0) : CAS.Verified.Expr.eval ρ expr = 0
theorem CAS.Verified.Expr.Alg.eval_eq_zero_of_normalize_eq_zero.{u_1} {ι : Type u_1} [DecidableEq ι] (ρ : ι → ℝ) (expr : CAS.Verified.Expr ι) (h : CAS.Verified.Expr.Alg.normalize expr = 0) : CAS.Verified.Expr.eval ρ expr = 0
If algebraic normalization computes a symbolic expression to zero, the original expression evaluates to zero in every environment.
The normalizer is accompanied by an invariant equating evaluation of each intermediate form with evaluation of the input. Specializing that invariant to a returned literal zero identifies the original value with the evaluation of zero, hence with zero in every environment.
Rational cancellation and other conditional rewrites return the nonzero conditions they require. Under those conditions, reduction to zero again implies equality of the original real expression.
If normalization returns a zero expression together with side conditions
S, then
\operatorname{normalizeWithSide}(e)=(0,S)
\land\operatorname{SideHolds}(\rho,S)
\quad\Longrightarrow\quad
\operatorname{eval}(e,\rho)=0.
Lean code for Theorem10.3●1 theoremAssociated Lean declarations
- theoremdefined in CAS/ClosedForm/Expression/Rational.leancomplete
theorem CAS.Verified.Expr.Alg.eval_eq_zero_of_normalizeWithSide_eq_zero.{u_1} {ι : Type u_1} [DecidableEq ι] (ρ : ι → ℝ) (expr : CAS.Verified.Expr ι) (hside : CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Verified.Expr.Alg.normalizeWithSide expr).nonzero) (hzero : (CAS.Verified.Expr.Alg.normalizeWithSide expr).expr = 0) : CAS.Verified.Expr.eval ρ expr = 0
theorem CAS.Verified.Expr.Alg.eval_eq_zero_of_normalizeWithSide_eq_zero.{u_1} {ι : Type u_1} [DecidableEq ι] (ρ : ι → ℝ) (expr : CAS.Verified.Expr ι) (hside : CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Verified.Expr.Alg.normalizeWithSide expr).nonzero) (hzero : (CAS.Verified.Expr.Alg.normalizeWithSide expr).expr = 0) : CAS.Verified.Expr.eval ρ expr = 0
If side-condition-aware normalization computes symbolic zero and its emitted denominator conditions hold, then the original expression evaluates to zero.
The side-aware route proves evaluation preservation conditionally on every
emitted nonzero or branch requirement. Once SideHolds supplies those
requirements, the route's final zero expression evaluates to zero, so the
original expression does as well.
Every checked symbolic transformation is recorded by one route type. A
SideClaimRoute stores the source and target expressions, the list of
expressions that must not vanish, and a proof that the target and source
evaluate equally wherever that list holds; a positivity requirement is encoded
as the nonvanishing of a square root. An unconditional transformation is the
same object with an empty list of assumptions.
For a route with source l, target r, and assumption list S,
\operatorname{SideHolds}(\rho,S)
\quad\Longrightarrow\quad
\operatorname{eval}(r,\rho)=\operatorname{eval}(l,\rho),
\qquad
S=[\,]\quad\Longrightarrow\quad
\forall\rho,\ \operatorname{eval}(r,\rho)=\operatorname{eval}(l,\rho).
Lean code for Definition10.4●4 declarationsAssociated Lean declarations
- structuredefined in CAS/ClosedForm/Pipeline/SideClaim.leancomplete
structure CAS.Verified.Expr.SideClaimRoute.{u_1} (ι : Type u_1) : Type u_1
structure CAS.Verified.Expr.SideClaimRoute.{u_1} (ι : Type u_1) : Type u_1
A checked symbolic transformation with explicit nonzero assumptions.
The
soundfield shows that the generated assumptions are sufficient for the target and source to have equal denotations. A transformation with no assumptions is aSideClaimRoutewithnonzero = []; seeSideClaimRoute.exact.Fields
lhs : CAS.Verified.Expr ι
Source expression.
rhs : CAS.Verified.Expr ι
Target expression produced by the symbolic transformation.
nonzero : List (CAS.Verified.Expr ι)
Nonzero assumptions required by the transformation, read through
Alg.SideHolds. An entrysqrt aencodes the positivity obligation0 < a, sinceReal.sqrt a ≠ 0 ↔ 0 < a.steps : List CAS.Verified.Expr.PassInfo
Report metadata naming the configured passes that built the claim; empty by default.
sound : ∀ (ρ : ι → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ self.nonzero → CAS.Verified.Expr.eval ρ self.rhs = CAS.Verified.Expr.eval ρ self.lhs
The pointwise equality certified by the claim: under the recorded assumptions the target and the source have equal denotations.
- theoremdefined in CAS/ClosedForm/Pipeline/SideClaim.leancomplete
theorem CAS.Verified.Expr.SideClaimRoute.sound.{u_1} {ι : Type u_1} (self : CAS.Verified.Expr.SideClaimRoute ι) (ρ : ι → ℝ) : CAS.Verified.Expr.Alg.SideHolds ρ self.nonzero → CAS.Verified.Expr.eval ρ self.rhs = CAS.Verified.Expr.eval ρ self.lhs
theorem CAS.Verified.Expr.SideClaimRoute.sound.{u_1} {ι : Type u_1} (self : CAS.Verified.Expr.SideClaimRoute ι) (ρ : ι → ℝ) : CAS.Verified.Expr.Alg.SideHolds ρ self.nonzero → CAS.Verified.Expr.eval ρ self.rhs = CAS.Verified.Expr.eval ρ self.lhs
The pointwise equality certified by the claim: under the recorded assumptions the target and the source have equal denotations.
- defdefined in CAS/ClosedForm/Pipeline/SideClaim.leancomplete
def CAS.Verified.Expr.SideClaimRoute.exact.{u_1} {ι : Type u_1} (lhs rhs : CAS.Verified.Expr ι) (proof : ∀ (ρ : ι → ℝ), CAS.Verified.Expr.eval ρ rhs = CAS.Verified.Expr.eval ρ lhs) (steps : List CAS.Verified.Expr.PassInfo := []) : CAS.Verified.Expr.SideClaimRoute ι
def CAS.Verified.Expr.SideClaimRoute.exact.{u_1} {ι : Type u_1} (lhs rhs : CAS.Verified.Expr ι) (proof : ∀ (ρ : ι → ℝ), CAS.Verified.Expr.eval ρ rhs = CAS.Verified.Expr.eval ρ lhs) (steps : List CAS.Verified.Expr.PassInfo := []) : CAS.Verified.Expr.SideClaimRoute ι
An unconditional checked claim: a transformation whose target and source evaluate equally at every assignment, recorded with an empty assumption list.
- theoremdefined in CAS/ClosedForm/Pipeline/SideClaim.leancomplete
theorem CAS.Verified.Expr.SideClaimRoute.sound_of_nonzero_eq_nil.{u_1} {ι : Type u_1} (claim : CAS.Verified.Expr.SideClaimRoute ι) (hnone : claim.nonzero = []) (ρ : ι → ℝ) : CAS.Verified.Expr.eval ρ claim.rhs = CAS.Verified.Expr.eval ρ claim.lhs
theorem CAS.Verified.Expr.SideClaimRoute.sound_of_nonzero_eq_nil.{u_1} {ι : Type u_1} (claim : CAS.Verified.Expr.SideClaimRoute ι) (hnone : claim.nonzero = []) (ρ : ι → ℝ) : CAS.Verified.Expr.eval ρ claim.rhs = CAS.Verified.Expr.eval ρ claim.lhs
A claim with no assumptions is an identity of denotations at every assignment.
The side-conditioned pipeline contains a pass for the algebra of real powers
and of the exponential, which it treats as the power of \mathrm e. Inside
a product or quotient all powers of one base collect into a single power,
nested powers flatten, powers of products distribute, exponents are put into
a polynomial normal form, and a literal exponent is read back as a natural
power, a reciprocal, or a square root. Each rewrite that Mathlib states for a
positive base records the positivity of that base as a condition unless the
base is structurally positive (a positive numeral, \pi, \mathrm e, an
exponential, or a product of these); rewrites valid for the total
Real.rpow, and the exponential identities, record nothing.
Writing (e',S) for the output of the pass on e,
\operatorname{SideHolds}(\rho,S)
\quad\Longrightarrow\quad
\operatorname{eval}(e',\rho)=\operatorname{eval}(e,\rho).
Lean code for Theorem10.5●1 theoremAssociated Lean declarations
- theoremdefined in CAS/ClosedForm/Pipeline/Passes/RealPower.leancomplete
theorem CAS.Verified.Expr.eval_realPowerDeepCleanup.{u_1} {ι : Type u_1} [DecidableEq ι] (ρ : ι → ℝ) (expr : CAS.Verified.Expr ι) (hside : CAS.Verified.Expr.Alg.SideHolds ρ expr.realPowerDeepCleanup.nonzero) : CAS.Verified.Expr.eval ρ expr.realPowerDeepCleanup.expr = CAS.Verified.Expr.eval ρ expr
theorem CAS.Verified.Expr.eval_realPowerDeepCleanup.{u_1} {ι : Type u_1} [DecidableEq ι] (ρ : ι → ℝ) (expr : CAS.Verified.Expr ι) (hside : CAS.Verified.Expr.Alg.SideHolds ρ expr.realPowerDeepCleanup.nonzero) : CAS.Verified.Expr.eval ρ expr.realPowerDeepCleanup.expr = CAS.Verified.Expr.eval ρ expr
Soundness of the real-power normal form: wherever the recorded base positivity conditions hold, the normal form evaluates to the original expression.
Each local rewrite uses the corresponding identity for real powers, square roots, or exponentials under its recorded positivity conditions. The bottom-up traversal retains every condition from the rewrites it applies. Induction over the traversal composes the local evaluation equalities into the equality for the whole tree; when the expression contains no power atom the pass returns it unchanged.
Exact interval evaluation encloses the value of a sparse rational polynomial at every real point of a rational panel. The root checks first try the centred form, the exact Taylor shift of the polynomial to the midpoint of the panel bounded term by term over its radius, and use termwise evaluation when the centred interval does not exclude zero. This theorem is the semantic basis for both root exclusion and derivative-sign checks.
x\in[a,b]
\quad\Longrightarrow\quad
p(x)\in\operatorname{enclosure}(p,[a,b]).
Lean code for Theorem10.6●3 theoremsAssociated Lean declarations
- theoremdefined in CAS/Polynomial/RealRoot/Interval.leancomplete
theorem CAS.Polynomial.RealRoot.evalInterval_sound (polynomial : CAS.Polynomial.Sparse.Univariate) {I : CAS.Continuum.RationalInterval} {x : ℝ} (hx : I.MemReal x) : (CAS.Polynomial.RealRoot.evalInterval polynomial I).MemReal (CAS.Polynomial.Sparse.evalReal polynomial x)
theorem CAS.Polynomial.RealRoot.evalInterval_sound (polynomial : CAS.Polynomial.Sparse.Univariate) {I : CAS.Continuum.RationalInterval} {x : ℝ} (hx : I.MemReal x) : (CAS.Polynomial.RealRoot.evalInterval polynomial I).MemReal (CAS.Polynomial.Sparse.evalReal polynomial x)
Sparse interval evaluation encloses real polynomial evaluation.
- theoremdefined in CAS/Polynomial/RealRoot/Interval.leancomplete
theorem CAS.Polynomial.RealRoot.centredInterval_sound (p : CAS.Polynomial.Sparse.Univariate) {I : CAS.Continuum.RationalInterval} {x : ℝ} (hx : I.MemReal x) : (CAS.Polynomial.RealRoot.centredInterval p I).MemReal (CAS.Polynomial.Sparse.evalReal p x)
theorem CAS.Polynomial.RealRoot.centredInterval_sound (p : CAS.Polynomial.Sparse.Univariate) {I : CAS.Continuum.RationalInterval} {x : ℝ} (hx : I.MemReal x) : (CAS.Polynomial.RealRoot.centredInterval p I).MemReal (CAS.Polynomial.Sparse.evalReal p x)
Centered interval evaluation encloses real polynomial evaluation.
- theoremdefined in CAS/Polynomial/RealRoot/Interval.leancomplete
theorem CAS.Polynomial.RealRoot.enclosure_sound (p : CAS.Polynomial.Sparse.Univariate) {I : CAS.Continuum.RationalInterval} {x : ℝ} (hx : I.MemReal x) : (CAS.Polynomial.RealRoot.enclosure p I).MemReal (CAS.Polynomial.Sparse.evalReal p x)
theorem CAS.Polynomial.RealRoot.enclosure_sound (p : CAS.Polynomial.Sparse.Univariate) {I : CAS.Continuum.RationalInterval} {x : ℝ} (hx : I.MemReal x) : (CAS.Polynomial.RealRoot.enclosure p I).MemReal (CAS.Polynomial.Sparse.evalReal p x)
The enclosure contains every value of the polynomial on the interval.
Termwise evaluation encloses each monomial with interval multiplication and
natural powers and combines the terms with interval addition. The basic
interval operations preserve membership, so induction over the sparse term
list shows that the real polynomial value lies between the computed rational
endpoints. For the centred form, write p(x)=\sum_k c_k(x-m)^k with the
exact shifted coefficients c_k, where m is the midpoint and r the
radius of the panel. Since |x-m|\le r, an even power (x-m)^k lies in
[0,r^k] and an odd one in [-r^k,r^k], so every term lies in a rational
interval and their sum encloses p(x). The enclosure returns one of these
two sound intervals.
If checked interval evaluation excludes zero, the polynomial is nonzero throughout the panel. The result can be used directly as a side condition for an ordinary real-expression theorem.
\operatorname{rootFree}(p,[a,b])=\mathrm{true}
\quad\Longrightarrow\quad
\forall x\in[a,b],\ p(x)\neq0.
Lean code for Theorem10.7●2 theoremsAssociated Lean declarations
- theoremdefined in CAS/Polynomial/RealRoot/Interval.leancomplete
theorem CAS.Polynomial.RealRoot.nonzeroOn_of_rootFree_eq_true (polynomial : CAS.Polynomial.Sparse.Univariate) (interval : CAS.Continuum.RationalInterval) (hvalid : CAS.Polynomial.RealRoot.rootFree polynomial interval = true) : CAS.Domain.NonzeroOn (CAS.Polynomial.Sparse.evalReal polynomial) (Set.Icc ↑interval.lo ↑interval.hi)
theorem CAS.Polynomial.RealRoot.nonzeroOn_of_rootFree_eq_true (polynomial : CAS.Polynomial.Sparse.Univariate) (interval : CAS.Continuum.RationalInterval) (hvalid : CAS.Polynomial.RealRoot.rootFree polynomial interval = true) : CAS.Domain.NonzeroOn (CAS.Polynomial.Sparse.evalReal polynomial) (Set.Icc ↑interval.lo ↑interval.hi)
An accepted root-free interval gives an ordinary pointwise nonzero theorem.
- theoremdefined in CAS/Polynomial/RealRoot/ClosedForm.leancomplete
theorem CAS.Polynomial.RealRoot.nonzeroOn_of_rootFreeOn_eq_true (expr : CAS.Verified.Expr (Fin 1)) (I : CAS.Continuum.RationalInterval) (hcheck : CAS.Polynomial.RealRoot.rootFreeOn expr I = true) : CAS.Domain.NonzeroOn (CAS.Exact.exprFn expr) (CAS.Polynomial.RealRoot.euclideanInterval I)
theorem CAS.Polynomial.RealRoot.nonzeroOn_of_rootFreeOn_eq_true (expr : CAS.Verified.Expr (Fin 1)) (I : CAS.Continuum.RationalInterval) (hcheck : CAS.Polynomial.RealRoot.rootFreeOn expr I = true) : CAS.Domain.NonzeroOn (CAS.Exact.exprFn expr) (CAS.Polynomial.RealRoot.euclideanInterval I)
A successful automatic root-free check proves the ordinary semantic nonzero statement.
Sound interval evaluation places every p(x) in the computed range.
The Boolean root-free test proves that zero is outside that range. Therefore
no enclosed value can equal zero.
For example, on [2,3], interval arithmetic gives
x^2-1\in[3,8]. This one enclosure proves that the denominator
x^2-1 never vanishes there and also gives
1/(x^2-1)\in[1/8,1/3]. The nonvanishing fact justifies an exact
cancellation; the two numerical endpoints control the size of the
reciprocal. Exact reasoning and CEGA draw on the same domain information.
Endpoint values satisfying p(a)\le0\le p(b), or the reversed
inequalities, give a root by the intermediate value theorem. A checked
strict derivative sign makes the polynomial strictly monotone in the
corresponding direction. Together they prove that the rational bracket
contains exactly one real root, possibly at an endpoint.
For every valid bracket certificate,
\exists!\,x\in[a,b],\qquad p(x)=0.
Lean code for Theorem10.8●1 theoremAssociated Lean declarations
- theoremdefined in CAS/Polynomial/RealRoot/Interval.leancomplete
theorem CAS.Polynomial.RealRoot.RootBracket.existsUnique_root (polynomial : CAS.Polynomial.Sparse.Univariate) (bracket : CAS.Polynomial.RealRoot.RootBracket) (hvalid : CAS.Polynomial.RealRoot.RootBracket.valid polynomial bracket = true) : ∃! x, x ∈ Set.Icc ↑bracket.interval.lo ↑bracket.interval.hi ∧ CAS.Polynomial.Sparse.evalReal polynomial x = 0
theorem CAS.Polynomial.RealRoot.RootBracket.existsUnique_root (polynomial : CAS.Polynomial.Sparse.Univariate) (bracket : CAS.Polynomial.RealRoot.RootBracket) (hvalid : CAS.Polynomial.RealRoot.RootBracket.valid polynomial bracket = true) : ∃! x, x ∈ Set.Icc ↑bracket.interval.lo ↑bracket.interval.hi ∧ CAS.Polynomial.Sparse.evalReal polynomial x = 0
An accepted bracket contains exactly one real root of the polynomial. The intermediate value theorem gives a root from the endpoint signs, and the strict sign of the derivative enclosure makes the polynomial strictly monotone on the interval, so the root is unique.
Continuity and the weak endpoint inequalities give existence by the intermediate
value theorem. The derivative enclosure has one strict sign on the whole
panel, so the mean value theorem makes p strictly monotone there. A
strictly monotone function has at most one zero, proving uniqueness.
A root atlas combines root-free and uniquely rooted panels with a proved cover. Every real root in the outer domain therefore belongs to one of the atlas's isolated root regions.
If \mathcal A is an atlas over D, its projection is
x\in D\land p(x)=0
\quad\Longrightarrow\quad
\exists R\in\mathcal A.\mathrm{rootRegions},\ x\in R.
For a global atlas the premise x\in D is removed by its outer-root bound.
Lean code for Theorem10.9●2 theoremsAssociated Lean declarations
- theoremdefined in CAS/Polynomial/RealRoot/Atlas.leancomplete
theorem CAS.Polynomial.RealRoot.RootAtlas.root_mem_region.{u_1} {ι : Type u_1} {polynomial : CAS.Polynomial.Sparse.Univariate} {domain : Set ℝ} (atlas : CAS.Polynomial.RealRoot.RootAtlas ι polynomial domain) {x : ℝ} (hxDomain : x ∈ domain) (hxRoot : CAS.Polynomial.Sparse.evalReal polynomial x = 0) : ∃ i, (atlas.region i).hasRoot = true ∧ x ∈ (atlas.region i).domain
theorem CAS.Polynomial.RealRoot.RootAtlas.root_mem_region.{u_1} {ι : Type u_1} {polynomial : CAS.Polynomial.Sparse.Univariate} {domain : Set ℝ} (atlas : CAS.Polynomial.RealRoot.RootAtlas ι polynomial domain) {x : ℝ} (hxDomain : x ∈ domain) (hxRoot : CAS.Polynomial.Sparse.evalReal polynomial x = 0) : ∃ i, (atlas.region i).hasRoot = true ∧ x ∈ (atlas.region i).domain
Every root in the covered domain lies in a region of the atlas that is marked as holding a root (
hasRoot = true). - theoremdefined in CAS/Polynomial/RealRoot/Atlas.leancomplete
theorem CAS.Polynomial.RealRoot.GlobalRootAtlas.root_mem_region.{u_1} {ι : Type u_1} {polynomial : CAS.Polynomial.Sparse.Univariate} (atlas : CAS.Polynomial.RealRoot.GlobalRootAtlas ι polynomial) {x : ℝ} (hxRoot : CAS.Polynomial.Sparse.evalReal polynomial x = 0) : ∃ i, (atlas.atlas.region i).hasRoot = true ∧ x ∈ (atlas.atlas.region i).domain
theorem CAS.Polynomial.RealRoot.GlobalRootAtlas.root_mem_region.{u_1} {ι : Type u_1} {polynomial : CAS.Polynomial.Sparse.Univariate} (atlas : CAS.Polynomial.RealRoot.GlobalRootAtlas ι polynomial) {x : ℝ} (hxRoot : CAS.Polynomial.Sparse.evalReal polynomial x = 0) : ∃ i, (atlas.atlas.region i).hasRoot = true ∧ x ∈ (atlas.atlas.region i).domain
Every real root lies in a region of the atlas that is marked as holding a root (
hasRoot = true).
Take a root in the covered domain and choose an atlas panel containing it. A root-free panel is impossible because its certificate excludes zero. Consequently the chosen panel is one of the root regions, which proves the covering conclusion. The global version first uses the outer bound to place the root in the covered domain.
A checked rational Cauchy certificate gives an explicit outer interval containing every real root. Its exact monic decomposition is verified before the resulting coefficient bound is used.
For its derived rational bound B,
p(x)=0\quad\Longrightarrow\quad |x|<B.
Lean code for Theorem10.10●1 theoremAssociated Lean declarations
- theoremdefined in CAS/Polynomial/RealRoot/CauchyBound.leancomplete
theorem CAS.Polynomial.RealRoot.CauchyBoundCertificate.abs_lt_bound {polynomial : CAS.Polynomial.Sparse.Univariate} {certificate : CAS.Polynomial.RealRoot.CauchyBoundCertificate} (hvalid : CAS.Polynomial.RealRoot.CauchyBoundCertificate.valid polynomial certificate = true) {x : ℝ} (hroot : CAS.Polynomial.Sparse.evalReal polynomial x = 0) : |x| < ↑certificate.bound
theorem CAS.Polynomial.RealRoot.CauchyBoundCertificate.abs_lt_bound {polynomial : CAS.Polynomial.Sparse.Univariate} {certificate : CAS.Polynomial.RealRoot.CauchyBoundCertificate} (hvalid : CAS.Polynomial.RealRoot.CauchyBoundCertificate.valid polynomial certificate = true) {x : ℝ} (hroot : CAS.Polynomial.Sparse.evalReal polynomial x = 0) : |x| < ↑certificate.bound
Every real root
xof a polynomial with a valid certificate has|x| < bound: it lies strictly between the rational endpoints-boundandbound.
Use the checked monic decomposition to rewrite a hypothetical root equation.
If |x| were at least the computed coefficient bound, the leading term would
strictly dominate the sum of all lower-degree terms, contradicting that their
sum is zero. Hence every root lies inside (-B,B).
Understanding a root certificate.
The isolated root need not be rational. A root atlas identifies it by a
rational interval and a uniqueness theorem, which is often exactly what a PDE
side-condition proof needs. The covering and uniqueness theorems of the
RootAtlas and GlobalRootAtlas interfaces can discharge nonvanishing,
domain, and monotonicity side conditions in later symbolic or PDE arguments.
Those theorems have the same form whether an atlas was assembled from
interval exclusion, Sturm subdivision, or both.
The Cauchy root bound in detail.
For a polynomial with rational coefficients, write it in monic form
p(x) = s \cdot \left(x^n + \sum_{k=0}^{n-1} a_k x^k\right),
where s \neq 0 is the leading scalar. The checked bound is
B = 1 + \sum_{k=0}^{n-1} |a_k|.
A CauchyBoundCertificate stores only the decomposition fields (scale s,
degree n, and the lower-degree tail). The bound B is computed from that
tail. An independent checker
validates:
the scale is nonzero;
every exponent in the tail is strictly below
n;the sparse identity
p = s \cdot (x^n + \text{tail})holds after normalization.
When n=0, the checked tail is empty and p=s\ne0, so there are no
roots. For n>0, the soundness proof (abs_lt_bound) proceeds by
contradiction. If |x|\ge B and p(x)=0, dividing by s gives
x^n=-\text{tail}(x). Since |x|\ge B\ge1, each lower-degree term
satisfies |a_k||x|^k\le|a_k||x|^{n-1}. Hence
|x|^n\le\left(\sum_{k=0}^{n-1}|a_k|\right)|x|^{n-1}.
Dividing by the positive factor |x|^{n-1} gives
|x|\le\sum|a_k|<B, a contradiction. The Lean proof implements this
leading-term estimate with exact sparse evaluation and cancellation by the
checked nonzero scale.
Example: isolating roots of x^2 + x - 1.
Consider the polynomial p(x) = x^2 + x - 1. A hand calculation shows the
certificate data; the generator may choose different split points.
Cauchy bound. In monic form the tail is
x - 1, whose coefficient absolute values sum to1 + 1 = 2. The checked bound isB = 1 + 2 = 3, so all roots lie in(-3, 3).Square-free reduction. The gcd of
pandp' = 2x + 1is1, sopis already square-free and its radical ispitself.Sturm chain construction.
S_0 = x^2 + x - 1,S_1 = p'(x) = 2x + 1,Euclidean division gives
S_0 = (\frac{x}{2}+\frac14)S_1 - \frac54, soS_2 = \frac54, a nonzero constant.
The terminal polynomial
S_2 = 5/4has zero derivative and nonzero value, hence is globally nonzero (proved using the mean value theorem).Variation counting. At
x = -3, the signs are(+, -, +), giving two sign changes. Atx = 3, they are(+, +, +), giving none. The dropV(-3) - V(3) = 2confirms thatphas exactly two distinct real roots.Bisection. At
x = 0, the signs are(-, +, +), giving one sign change. ThusV(-3) - V(0) = 1andV(0) - V(3) = 1. The intervals(-3,0)and(0,3)each contain exactly one root.Atlas assembly. The global root atlas records the two isolated intervals, together with the checked Sturm certificate that proves their root counts.
The Sturm chain algorithm.
A Sturm chain for a polynomial p is a sequence S_0, S_1, \ldots, S_m satisfying:
S_0 = p, \quad S_1 = p', \quad S_{i-1} = Q_i S_i - S_{i+1} \quad (i = 1, \ldots, m-1),
where the last element S_m is a nonzero constant. This signed Euclidean
remainder sequence is the ordinary Euclidean algorithm with the sign of each
remainder reversed. The certificate checker (SturmCertificate.valid)
validates every recurrence by exact polynomial arithmetic, independently of
the generator that proposed the chain. The variation count V(c) is the
number of sign changes in (S_0(c),S_1(c),\ldots,S_m(c)), zeros omitted;
Sturm's theorem turns its drop
between two endpoints into a root count.
The subdivision certificate.
A Sturm subdivision is a binary tree of rational intervals over a search
interval, such as the Cauchy-bounded [-B,B]: every leaf has Sturm count at
most one, and every split is at a rational point that is not a root. SymLean
checks such a tree when a caller supplies it and has no generator for it; the
root and sign commands use their own root-cover search and root-list checkers.
Leaves whose Sturm count is one are the isolated root regions.
Sparse polynomial representation.
The polynomial subsystem uses Verified.Expr.Alg.MvPoly n, a raw list of
rational coefficient–monomial pairs. A monomial is a function
\text{Fin}(n) \to \mathbb{N} recording the exponent of each variable.
The type permits repeated monomials and zero coefficients. The executable
normalization combines terms, removes zeros, and orders the result without
changing the polynomial's value.
Interpreting these lists as Mathlib polynomials over \mathbb Q preserves
evaluation. Importing a Mathlib multivariate polynomial and exporting it
again returns the original polynomial. In the other direction, different
lists can represent the same
polynomial, so a raw list need not equal its own round trip.
Key operations include:
Euclidean division: exact quotient and remainder satisfying
p=qs+rfor univariate polynomials.Square-free factorization (
squareFreeFactors?): a Yun-style candidate generator proposes factors indexed by intended multiplicity. Its output is a proposal; the semantic contract belongs to the radical certificate built from it.Rational factors (
RationalFactorization.split): linear and quadratic factors are kept;xis split off by exact division while it divides a factor of degree three or more; any other factor of degree three or more is split only if a supplied provider proposes proper factors whose product is the original factor. Otherwise it stays whole. Rational integration uses the list as a proposal and checks its final primitive by differentiation.Exact evaluation (
evalRat): evaluates at rational points with exact arithmetic, used for sign determination in Sturm chains.Interval evaluation (
evalInterval): rigorous enclosure of the polynomial's range on a rational panel.
An exact quotient-and-remainder candidate is accepted only after sparse
polynomial normalization proves the corresponding identity. The checked
identity is then projected to Mathlib's Polynomial ℚ.
Every accepted certificate proves the polynomial identity
P=DQ+R
in Polynomial ℚ, including the exact quotient and remainder supplied by the
candidate.
Lean code for Theorem10.11●1 theoremAssociated Lean declarations
- theoremdefined in CAS/Polynomial/ExactDivision.leancomplete
theorem CAS.Polynomial.Sparse.Univariate.DivisionResult.polynomial_identity (dividend divisor : CAS.Polynomial.Sparse.Univariate) (certificate : CAS.Polynomial.Sparse.Univariate.DivisionResult) (hvalid : CAS.Polynomial.Sparse.Univariate.DivisionResult.valid dividend divisor certificate = true) : CAS.Polynomial.Sparse.toRatPolynomial dividend = CAS.Polynomial.Sparse.toRatPolynomial divisor * CAS.Polynomial.Sparse.toRatPolynomial certificate.quotient + CAS.Polynomial.Sparse.toRatPolynomial certificate.remainder
theorem CAS.Polynomial.Sparse.Univariate.DivisionResult.polynomial_identity (dividend divisor : CAS.Polynomial.Sparse.Univariate) (certificate : CAS.Polynomial.Sparse.Univariate.DivisionResult) (hvalid : CAS.Polynomial.Sparse.Univariate.DivisionResult.valid dividend divisor certificate = true) : CAS.Polynomial.Sparse.toRatPolynomial dividend = CAS.Polynomial.Sparse.toRatPolynomial divisor * CAS.Polynomial.Sparse.toRatPolynomial certificate.quotient + CAS.Polynomial.Sparse.toRatPolynomial certificate.remainder
An accepted certificate proves the exact Mathlib polynomial identity over
ℚ.
Translate the candidate quotient and remainder into the sparse normal form and
normalize P-DQ-R. Acceptance means this difference has zero normal form.
Normalization soundness gives the polynomial identity over the rationals,
which is then transported to Mathlib's polynomial representation.
A radical certificate proves that a proposed square-free reduction has exactly the same real zero set as the original polynomial and has nonzero derivative at every root. The executable Yun-style generator returns only a certificate that passes the independent check of two divisibility identities and a Bézout identity.
Writing the checked radical as r,
\forall x\in\mathbb R,\qquad
p(x)=0\Longleftrightarrow r(x)=0,
\qquad
r(x)=0\Longrightarrow r'(x)\neq0.
Lean code for Theorem10.12●3 declarationsAssociated Lean declarations
- theoremdefined in CAS/Polynomial/RealRoot/Radical.leancomplete
theorem CAS.Polynomial.RealRoot.RadicalCertificate.evalReal_eq_zero_iff (original : CAS.Polynomial.Sparse.Univariate) (certificate : CAS.Polynomial.RealRoot.RadicalCertificate) (hvalid : CAS.Polynomial.RealRoot.RadicalCertificate.valid original certificate = true) (x : ℝ) : CAS.Polynomial.Sparse.evalReal original x = 0 ↔ CAS.Polynomial.Sparse.evalReal certificate.radical x = 0
theorem CAS.Polynomial.RealRoot.RadicalCertificate.evalReal_eq_zero_iff (original : CAS.Polynomial.Sparse.Univariate) (certificate : CAS.Polynomial.RealRoot.RadicalCertificate) (hvalid : CAS.Polynomial.RealRoot.RadicalCertificate.valid original certificate = true) (x : ℝ) : CAS.Polynomial.Sparse.evalReal original x = 0 ↔ CAS.Polynomial.Sparse.evalReal certificate.radical x = 0
A valid radical certificate proves equality of the original and radical zero sets.
- theoremdefined in CAS/Polynomial/RealRoot/Radical.leancomplete
theorem CAS.Polynomial.RealRoot.RadicalCertificate.derivative_ne_zero_at_root (original : CAS.Polynomial.Sparse.Univariate) (certificate : CAS.Polynomial.RealRoot.RadicalCertificate) (hvalid : CAS.Polynomial.RealRoot.RadicalCertificate.valid original certificate = true) {x : ℝ} (hroot : CAS.Polynomial.Sparse.evalReal certificate.radical x = 0) : CAS.Polynomial.Sparse.evalReal (CAS.Polynomial.Sparse.derivative 0 certificate.radical) x ≠ 0
theorem CAS.Polynomial.RealRoot.RadicalCertificate.derivative_ne_zero_at_root (original : CAS.Polynomial.Sparse.Univariate) (certificate : CAS.Polynomial.RealRoot.RadicalCertificate) (hvalid : CAS.Polynomial.RealRoot.RadicalCertificate.valid original certificate = true) {x : ℝ} (hroot : CAS.Polynomial.Sparse.evalReal certificate.radical x = 0) : CAS.Polynomial.Sparse.evalReal (CAS.Polynomial.Sparse.derivative 0 certificate.radical) x ≠ 0
Every root of a valid radical is simple.
- defdefined in CAS/Polynomial/RealRoot/RadicalGenerator.leancomplete
def CAS.Polynomial.RealRoot.RadicalCertificate.generate? (original : CAS.Polynomial.Sparse.Univariate) : Option { certificate // CAS.Polynomial.RealRoot.RadicalCertificate.valid original certificate = true }
def CAS.Polynomial.RealRoot.RadicalCertificate.generate? (original : CAS.Polynomial.Sparse.Univariate) : Option { certificate // CAS.Polynomial.RealRoot.RadicalCertificate.valid original certificate = true }
Generate and independently validate a checked radical certificate.
The checked division identities certify the gcd decomposition used by the square-free reduction. They show that removing repeated factors preserves exactly the zero set. Coprimality of the reduced polynomial and its derivative then rules out a point where both vanish, so every remaining root is simple.
An accepted Sturm certificate begins with the requested polynomial and its formal derivative, satisfies every signed Euclidean recurrence exactly, and ends in a polynomial that is nonzero on the real line. These are structural facts about the checked chain, before any root-counting theorem is applied.
For a chain S_0,\ldots,S_m, validation establishes
S_0=p,\qquad S_1=p',\qquad
S_{i-1}=Q_iS_i-S_{i+1},\qquad
\forall x\in\mathbb R,\ S_m(x)\neq0.
Lean code for Theorem10.13●4 theoremsAssociated Lean declarations
- theoremdefined in CAS/Polynomial/RealRoot/Sturm.leancomplete
theorem CAS.Polynomial.RealRoot.SturmCertificate.first_polynomial {polynomial first derivative : CAS.Polynomial.Sparse.Univariate} {tail quotients : List CAS.Polynomial.Sparse.Univariate} (hvalid : CAS.Polynomial.RealRoot.SturmCertificate.valid polynomial { chain := first :: derivative :: tail, quotients := quotients } = true) : CAS.Polynomial.Sparse.toRatPolynomial first = CAS.Polynomial.Sparse.toRatPolynomial polynomial
theorem CAS.Polynomial.RealRoot.SturmCertificate.first_polynomial {polynomial first derivative : CAS.Polynomial.Sparse.Univariate} {tail quotients : List CAS.Polynomial.Sparse.Univariate} (hvalid : CAS.Polynomial.RealRoot.SturmCertificate.valid polynomial { chain := first :: derivative :: tail, quotients := quotients } = true) : CAS.Polynomial.Sparse.toRatPolynomial first = CAS.Polynomial.Sparse.toRatPolynomial polynomial
An accepted certificate starts with the requested polynomial.
- theoremdefined in CAS/Polynomial/RealRoot/Sturm.leancomplete
theorem CAS.Polynomial.RealRoot.SturmCertificate.second_polynomial {polynomial first derivative : CAS.Polynomial.Sparse.Univariate} {tail quotients : List CAS.Polynomial.Sparse.Univariate} (hvalid : CAS.Polynomial.RealRoot.SturmCertificate.valid polynomial { chain := first :: derivative :: tail, quotients := quotients } = true) : CAS.Polynomial.Sparse.toRatPolynomial derivative = CAS.Polynomial.Sparse.toRatPolynomial (CAS.Polynomial.Sparse.derivative 0 polynomial)
theorem CAS.Polynomial.RealRoot.SturmCertificate.second_polynomial {polynomial first derivative : CAS.Polynomial.Sparse.Univariate} {tail quotients : List CAS.Polynomial.Sparse.Univariate} (hvalid : CAS.Polynomial.RealRoot.SturmCertificate.valid polynomial { chain := first :: derivative :: tail, quotients := quotients } = true) : CAS.Polynomial.Sparse.toRatPolynomial derivative = CAS.Polynomial.Sparse.toRatPolynomial (CAS.Polynomial.Sparse.derivative 0 polynomial)
The second entry of an accepted certificate is the formal derivative of the requested polynomial, as a Mathlib polynomial over
ℚ. - theoremdefined in CAS/Polynomial/RealRoot/Sturm.leancomplete
theorem CAS.Polynomial.RealRoot.SturmCertificate.recurrence_head_identity {dividend divisor quotient : CAS.Polynomial.Sparse.Univariate} {tail quotients : List CAS.Polynomial.Sparse.Univariate} (hvalid : CAS.Polynomial.RealRoot.SturmCertificate.recurrenceValid (dividend :: divisor :: tail) (quotient :: quotients) = true) : CAS.Polynomial.Sparse.toRatPolynomial dividend = CAS.Polynomial.Sparse.toRatPolynomial divisor * CAS.Polynomial.Sparse.toRatPolynomial quotient + CAS.Polynomial.Sparse.toRatPolynomial (CAS.Polynomial.RealRoot.SturmCertificate.signedRemainder tail)
theorem CAS.Polynomial.RealRoot.SturmCertificate.recurrence_head_identity {dividend divisor quotient : CAS.Polynomial.Sparse.Univariate} {tail quotients : List CAS.Polynomial.Sparse.Univariate} (hvalid : CAS.Polynomial.RealRoot.SturmCertificate.recurrenceValid (dividend :: divisor :: tail) (quotient :: quotients) = true) : CAS.Polynomial.Sparse.toRatPolynomial dividend = CAS.Polynomial.Sparse.toRatPolynomial divisor * CAS.Polynomial.Sparse.toRatPolynomial quotient + CAS.Polynomial.Sparse.toRatPolynomial (CAS.Polynomial.RealRoot.SturmCertificate.signedRemainder tail)
The head recurrence of an accepted recurrence suffix is an exact Mathlib polynomial identity.
- theoremdefined in CAS/Polynomial/RealRoot/Sturm.leancomplete
theorem CAS.Polynomial.RealRoot.SturmCertificate.recurrence_terminal_nonzero {last : CAS.Polynomial.Sparse.Univariate} (hvalid : CAS.Polynomial.RealRoot.SturmCertificate.recurrenceValid [last] [] = true) (x : ℝ) : CAS.Polynomial.Sparse.evalReal last x ≠ 0
theorem CAS.Polynomial.RealRoot.SturmCertificate.recurrence_terminal_nonzero {last : CAS.Polynomial.Sparse.Univariate} (hvalid : CAS.Polynomial.RealRoot.SturmCertificate.recurrenceValid [last] [] = true) (x : ℝ) : CAS.Polynomial.Sparse.evalReal last x ≠ 0
An accepted terminal suffix denotes a nonzero constant real function.
The executable checker validates both a zero formal derivative and a nonzero value at rational zero. The mean value theorem then supplies the global semantic conclusion without depending on the sparse term-order implementation.
The independent checker verifies the first two entries and every signed quotient-remainder identity using exact polynomial normalization. At the terminal entry it checks a zero formal derivative and a nonzero value at zero. The mean value theorem makes that polynomial constant, hence nowhere zero. Collecting these checked equalities yields the defining Sturm-chain conditions.
For an accepted chain and ordered rational endpoints that are not roots, the drop in endpoint sign variations equals the number of distinct real roots in the intervening open interval. This is the analytic Sturm theorem that gives the executable variation count its mathematical meaning.
V(a)-V(b)
=\#\{x\in(a,b)\mid p(x)=0\}.
Lean code for Theorem10.14●1 theoremAssociated Lean declarations
- theoremdefined in CAS/Polynomial/RealRoot/SturmTheorem.leancomplete
theorem CAS.Polynomial.RealRoot.SturmCertificate.variationDifference_eq_rootSet_ncard (polynomial : CAS.Polynomial.Sparse.Univariate) (certificate : CAS.Polynomial.RealRoot.SturmCertificate) (hvalid : CAS.Polynomial.RealRoot.SturmCertificate.valid polynomial certificate = true) {a b : ℚ} (hab : a ≤ b) (ha : CAS.Polynomial.Sparse.evalRat polynomial a ≠ 0) (hb : CAS.Polynomial.Sparse.evalRat polynomial b ≠ 0) : certificate.variationDifference a b = ((CAS.Polynomial.Sparse.toRealPolynomial polynomial).rootSet ℝ ∩ Set.Ioo ↑a ↑b).ncard
theorem CAS.Polynomial.RealRoot.SturmCertificate.variationDifference_eq_rootSet_ncard (polynomial : CAS.Polynomial.Sparse.Univariate) (certificate : CAS.Polynomial.RealRoot.SturmCertificate) (hvalid : CAS.Polynomial.RealRoot.SturmCertificate.valid polynomial certificate = true) {a b : ℚ} (hab : a ≤ b) (ha : CAS.Polynomial.Sparse.evalRat polynomial a ≠ 0) (hb : CAS.Polynomial.Sparse.evalRat polynomial b ≠ 0) : certificate.variationDifference a b = ((CAS.Polynomial.Sparse.toRealPolynomial polynomial).rootSet ℝ ∩ Set.Ioo ↑a ↑b).ncard
Sturm's theorem for an accepted
SturmCertificate: for rational endpointsa ≤ bthat are not roots ofpolynomial,variationDifference a bis the number of distinct real roots ofpolynomialin the open interval(a, b).
Along an interval containing no endpoint root, sign variation is locally
constant except when crossing a root of p. The signed Euclidean recurrence
shows that noninitial chain entries cannot create a net jump, while each
distinct root of p decreases the variation by one. Summing the jumps from
a to b gives the root count.
A signed Euclidean chain is proposed outside the checker and accepted only
when the independent structural checker SturmCertificate.valid accepts
every initial, recurrence, degree, and terminal condition. SymLean has no
chain generator: a caller supplies the chain.
\mathrm{valid}(p, C)=\mathrm{true}
\quad\Longrightarrow\quad
C\text{ is a validated Sturm certificate for }p.
Lean code for Definition10.15●1 definitionAssociated Lean declarations
- defdefined in CAS/Polynomial/RealRoot/Sturm.leancomplete
def CAS.Polynomial.RealRoot.SturmCertificate.valid (polynomial : CAS.Polynomial.Sparse.Univariate) (certificate : CAS.Polynomial.RealRoot.SturmCertificate) : Bool
def CAS.Polynomial.RealRoot.SturmCertificate.valid (polynomial : CAS.Polynomial.Sparse.Univariate) (certificate : CAS.Polynomial.RealRoot.SturmCertificate) : Bool
Exact checker for the initial derivative pair and every Sturm recurrence.
Sturm counts certify unique-root intervals and exact root counts for a checked subdivision tree. An accepted finite subdivision therefore projects to the same root-atlas interface used by interval and monotonicity certificates.
For each accepted node N with interval I_N,
N.\mathrm{rootCount}
=\#\{x\in I_N^\circ\mid p(x)=0\},
and every leaf with count one projects to an
\exists!\,x\in I_N,\ p(x)=0 certificate.
Lean code for Theorem10.16●3 declarationsAssociated Lean declarations
- theoremdefined in CAS/Polynomial/RealRoot/SturmInterval.leancomplete
theorem CAS.Polynomial.RealRoot.SturmIntervalCertificate.existsUnique_root (polynomial : CAS.Polynomial.Sparse.Univariate) (certificate : CAS.Polynomial.RealRoot.SturmIntervalCertificate) (hvalid : CAS.Polynomial.RealRoot.SturmIntervalCertificate.valid polynomial certificate = true) (hcount : certificate.count = 1) : ∃! x, x ∈ Set.Icc ↑certificate.interval.lo ↑certificate.interval.hi ∧ CAS.Polynomial.Sparse.evalReal polynomial x = 0
theorem CAS.Polynomial.RealRoot.SturmIntervalCertificate.existsUnique_root (polynomial : CAS.Polynomial.Sparse.Univariate) (certificate : CAS.Polynomial.RealRoot.SturmIntervalCertificate) (hvalid : CAS.Polynomial.RealRoot.SturmIntervalCertificate.valid polynomial certificate = true) (hcount : certificate.count = 1) : ∃! x, x ∈ Set.Icc ↑certificate.interval.lo ↑certificate.interval.hi ∧ CAS.Polynomial.Sparse.evalReal polynomial x = 0
A valid count-one interval contains exactly one real root.
- theoremdefined in CAS/Polynomial/RealRoot/SturmSubdivision.leancomplete
theorem CAS.Polynomial.RealRoot.SturmSubdivisionCertificate.nodeCount_eq_rootSet_ncard {polynomial : CAS.Polynomial.Sparse.Univariate} {certificate : CAS.Polynomial.RealRoot.SturmSubdivisionCertificate} (hvalid : CAS.Polynomial.RealRoot.SturmSubdivisionCertificate.valid polynomial certificate = true) : CAS.Polynomial.RealRoot.SturmSubdivision.nodeCount certificate.sturm certificate.subdivision = ((CAS.Polynomial.Sparse.toRealPolynomial polynomial).rootSet ℝ ∩ Set.Ioo ↑certificate.subdivision.interval.lo ↑certificate.subdivision.interval.hi).ncard
theorem CAS.Polynomial.RealRoot.SturmSubdivisionCertificate.nodeCount_eq_rootSet_ncard {polynomial : CAS.Polynomial.Sparse.Univariate} {certificate : CAS.Polynomial.RealRoot.SturmSubdivisionCertificate} (hvalid : CAS.Polynomial.RealRoot.SturmSubdivisionCertificate.valid polynomial certificate = true) : CAS.Polynomial.RealRoot.SturmSubdivision.nodeCount certificate.sturm certificate.subdivision = ((CAS.Polynomial.Sparse.toRealPolynomial polynomial).rootSet ℝ ∩ Set.Ioo ↑certificate.subdivision.interval.lo ↑certificate.subdivision.interval.hi).ncard
The root count computed at an accepted subdivision's outer interval is exactly the cardinality of the Mathlib real root set in that open interval.
- defdefined in CAS/Polynomial/RealRoot/SturmAtlas.leancomplete
def CAS.Polynomial.RealRoot.SturmSubdivisionCertificate.toRootAtlas {polynomial : CAS.Polynomial.Sparse.Univariate} (certificate : CAS.Polynomial.RealRoot.SturmSubdivisionCertificate) (hvalid : CAS.Polynomial.RealRoot.SturmSubdivisionCertificate.valid polynomial certificate = true) : CAS.Polynomial.RealRoot.RootAtlas certificate.LeafIndex polynomial (Set.Icc ↑certificate.subdivision.interval.lo ↑certificate.subdivision.interval.hi)
def CAS.Polynomial.RealRoot.SturmSubdivisionCertificate.toRootAtlas {polynomial : CAS.Polynomial.Sparse.Univariate} (certificate : CAS.Polynomial.RealRoot.SturmSubdivisionCertificate) (hvalid : CAS.Polynomial.RealRoot.SturmSubdivisionCertificate.valid polynomial certificate = true) : CAS.Polynomial.RealRoot.RootAtlas certificate.LeafIndex polynomial (Set.Icc ↑certificate.subdivision.interval.lo ↑certificate.subdivision.interval.hi)
Convert an accepted Sturm subdivision to the common root-atlas abstraction.
Apply the Sturm count theorem at every node. A node of count zero is root-free; a node of count one contains a root and cannot contain two distinct roots. For a split node, additivity of root counts over its adjacent children preserves the parent's exact count. Structural induction over the accepted subdivision tree therefore produces the root atlas.
The isolation certificates combine square-free reduction, a Sturm
subdivision, transport back to the original zero set, and a checked rational
Cauchy outer bound. GlobalPolynomialIsolationCertificate.valid checks every
stage, and the noncomputable toGlobalRootAtlas projection then yields a
global atlas covering every distinct real root; a nonzero constant has an
empty atlas. SymLean checks these certificates when a caller supplies them and
has no generator for them.
The final global contract is
p(x)=0
\quad\Longrightarrow\quad
\exists R\in\mathcal A.\mathrm{rootRegions},\ x\in R,
with each root-bearing region carrying a unique-root theorem.
Lean code for Definition10.17●3 definitionsAssociated Lean declarations
- defdefined in CAS/Polynomial/RealRoot/Atlas.leancomplete
def CAS.Polynomial.RealRoot.RootAtlas.transportAlongRadical.{u_1} {ι : Type u_1} {polynomial : CAS.Polynomial.Sparse.Univariate} {domain : Set ℝ} (certificate : CAS.Polynomial.RealRoot.RadicalCertificate) (hcertificate : CAS.Polynomial.RealRoot.RadicalCertificate.valid polynomial certificate = true) (atlas : CAS.Polynomial.RealRoot.RootAtlas ι certificate.radical domain) : CAS.Polynomial.RealRoot.RootAtlas ι polynomial domain
def CAS.Polynomial.RealRoot.RootAtlas.transportAlongRadical.{u_1} {ι : Type u_1} {polynomial : CAS.Polynomial.Sparse.Univariate} {domain : Set ℝ} (certificate : CAS.Polynomial.RealRoot.RadicalCertificate) (hcertificate : CAS.Polynomial.RealRoot.RadicalCertificate.valid polynomial certificate = true) (atlas : CAS.Polynomial.RealRoot.RootAtlas ι certificate.radical domain) : CAS.Polynomial.RealRoot.RootAtlas ι polynomial domain
Transport a root atlas along a checked equality of real zero sets.
The cover is unchanged. Every local region is combined with the radical certificate, so the theorems of the resulting atlas are about the original polynomial.
- defdefined in CAS/Polynomial/RealRoot/Automatic.leancomplete
def CAS.Polynomial.RealRoot.PolynomialIsolationCertificate.toRootAtlas {original : CAS.Polynomial.Sparse.Univariate} (certificate : CAS.Polynomial.RealRoot.PolynomialIsolationCertificate) (hvalid : CAS.Polynomial.RealRoot.PolynomialIsolationCertificate.valid original certificate = true) : CAS.Polynomial.RealRoot.RootAtlas certificate.subdivision.LeafIndex original (Set.Icc ↑certificate.subdivision.subdivision.interval.lo ↑certificate.subdivision.subdivision.interval.hi)
def CAS.Polynomial.RealRoot.PolynomialIsolationCertificate.toRootAtlas {original : CAS.Polynomial.Sparse.Univariate} (certificate : CAS.Polynomial.RealRoot.PolynomialIsolationCertificate) (hvalid : CAS.Polynomial.RealRoot.PolynomialIsolationCertificate.valid original certificate = true) : CAS.Polynomial.RealRoot.RootAtlas certificate.subdivision.LeafIndex original (Set.Icc ↑certificate.subdivision.subdivision.interval.lo ↑certificate.subdivision.subdivision.interval.hi)
Convert accepted isolation data to the canonical root-atlas interface for the original polynomial.
- defdefined in CAS/Polynomial/RealRoot/AutomaticGlobal.leancomplete
def CAS.Polynomial.RealRoot.GlobalPolynomialIsolationCertificate.toGlobalRootAtlas {original : CAS.Polynomial.Sparse.Univariate} (certificate : CAS.Polynomial.RealRoot.GlobalPolynomialIsolationCertificate) (hvalid : CAS.Polynomial.RealRoot.GlobalPolynomialIsolationCertificate.valid original certificate = true) : CAS.Polynomial.RealRoot.GlobalRootAtlas certificate.Index original
def CAS.Polynomial.RealRoot.GlobalPolynomialIsolationCertificate.toGlobalRootAtlas {original : CAS.Polynomial.Sparse.Univariate} (certificate : CAS.Polynomial.RealRoot.GlobalPolynomialIsolationCertificate) (hvalid : CAS.Polynomial.RealRoot.GlobalPolynomialIsolationCertificate.valid original certificate = true) : CAS.Polynomial.RealRoot.GlobalRootAtlas certificate.Index original
Project accepted finite evidence to a complete root atlas for the original polynomial.
Scope of the exact core.
The decision procedures of the exact core work inside its reflected real
language, with rational polynomial coefficients. A bounded search that returns
none has found no supported certificate within its budget; the statement
itself may still be true.
10.6.2. Symbolic Calculus and Analytic Bridges
For a scalar field u, the coordinate derivative is
\partial_i u(x)=Du(x)[e_i]: evaluate its Fréchet derivative on the
ith basis vector. A symbolic derivative must recover this same linear
approximation. The partial-derivative bridge proves that it does, under the domain
conditions of the expression being differentiated. For example,
\partial_x\log(x^2+y^2)=2x/(x^2+y^2) is valid whenever
(x,y)\ne(0,0); neither coordinate has to be nonzero on its own.
At every point satisfying the generated validity conditions, symbolic
differentiation in coordinate i agrees with our analytic Euclidean
partial derivative:
(\operatorname{diff}_i e)^\sharp(x)=\partial_i(e^\sharp)(x).
Lean code for Theorem10.18●1 theoremAssociated Lean declarationsCAS.Verified.Expr.partialDeriv_eval_eq[complete]
CAS.Verified.Expr.partialDeriv_eval_eq[complete]
- theoremdefined in PDE/Symbolic/Calculus/EuclideanOperators.leancomplete
theorem CAS.Verified.Expr.partialDeriv_eval_eq {n : ℕ} (expr : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (i : Fin n) (h : CAS.Verified.Expr.ValidAt x.ofLp expr) : (∂[i] fun y ↦ CAS.Verified.Expr.eval y.ofLp expr) x = CAS.Verified.Expr.eval x.ofLp (CAS.Verified.Expr.diff i expr)
theorem CAS.Verified.Expr.partialDeriv_eval_eq {n : ℕ} (expr : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (i : Fin n) (h : CAS.Verified.Expr.ValidAt x.ofLp expr) : (∂[i] fun y ↦ CAS.Verified.Expr.eval y.ofLp expr) x = CAS.Verified.Expr.eval x.ofLp (CAS.Verified.Expr.diff i expr)
The analytic
i-th partial derivative of expression evaluation equals evaluation of the symbolic partial derivativeexpr.diff i.
Structural induction on the expression constructs its Fréchet derivative
using the analytic sum, product, quotient, power, and elementary chain rules.
The validity hypotheses discharge each rule's domain conditions. Evaluating
the resulting continuous linear map on e_i gives exactly the evaluated
symbolic derivative, hence the stated coordinate identity.
CAS.Verified.Expr.contDiffAt_eval[complete]CAS.Verified.Expr.differentiableAt_eval[complete]CAS.Verified.Expr.contDiffOn_eval_paramEmbed[complete]CAS.Verified.Expr.contDiff_eval_paramEmbed[complete]CAS.Verified.Expr.contDiff_eval_lineEmbed[complete]CAS.Verified.Expr.differentiable_eval_lineEmbed[complete]
The validity predicate that justifies one symbolic derivative also certifies
regularity of every order. At a point where ValidAt holds, evaluation of a
reflected expression is C^m for every smoothness order m, the analytic
order included, because each constructor is interpreted by an elementary
function that Mathlib proves smooth of every order away from its
singularities; the On and global forms assume validity at every point of
the set or the space. The theorems are stated for the two conventions of the
theorem-facing tactics, functions on \mathbb R^n and functions on
\mathbb R with frozen parameters, and they are what cas applies
to a DifferentiableAt, Differentiable, ContDiffAt, ContDiffOn, or
ContDiff goal:
\operatorname{ValidAt}(x,e)
\quad\Longrightarrow\quad
e^\sharp\text{ is }C^m\text{ at }x
\qquad\text{for every }m\in\{0,1,2,\ldots,\infty,\omega\}.
Lean code for Theorem10.19●6 theoremsAssociated Lean declarationsCAS.Verified.Expr.contDiffAt_eval[complete]CAS.Verified.Expr.differentiableAt_eval[complete]CAS.Verified.Expr.contDiffOn_eval_paramEmbed[complete]CAS.Verified.Expr.contDiff_eval_paramEmbed[complete]CAS.Verified.Expr.contDiff_eval_lineEmbed[complete]CAS.Verified.Expr.differentiable_eval_lineEmbed[complete]
CAS.Verified.Expr.contDiffAt_eval[complete]CAS.Verified.Expr.differentiableAt_eval[complete]CAS.Verified.Expr.contDiffOn_eval_paramEmbed[complete]CAS.Verified.Expr.contDiff_eval_paramEmbed[complete]CAS.Verified.Expr.contDiff_eval_lineEmbed[complete]CAS.Verified.Expr.differentiable_eval_lineEmbed[complete]
- theoremdefined in CAS/Calculus/Smoothness.leancomplete
theorem CAS.Verified.Expr.contDiffAt_eval {n : ℕ} {m : WithTop ℕ∞} (expr : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (h : CAS.Verified.Expr.ValidAt x.ofLp expr) : ContDiffAt ℝ m (fun y ↦ CAS.Verified.Expr.eval y.ofLp expr) x
theorem CAS.Verified.Expr.contDiffAt_eval {n : ℕ} {m : WithTop ℕ∞} (expr : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (h : CAS.Verified.Expr.ValidAt x.ofLp expr) : ContDiffAt ℝ m (fun y ↦ CAS.Verified.Expr.eval y.ofLp expr) x
Evaluation of a valid verified expression is
C^mat the point for every orderm, including the analytic order. - theoremdefined in CAS/Calculus/Smoothness.leancomplete
theorem CAS.Verified.Expr.differentiableAt_eval {n : ℕ} (expr : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (h : CAS.Verified.Expr.ValidAt x.ofLp expr) : DifferentiableAt ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp expr) x
theorem CAS.Verified.Expr.differentiableAt_eval {n : ℕ} (expr : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (h : CAS.Verified.Expr.ValidAt x.ofLp expr) : DifferentiableAt ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp expr) x
Evaluation of a valid verified expression is differentiable at the point.
- theoremdefined in CAS/Calculus/Smoothness.leancomplete
theorem CAS.Verified.Expr.contDiffOn_eval_paramEmbed {n k : ℕ} {m : WithTop ℕ∞} (expr : CAS.Verified.Expr (Fin (n + k))) (c : Fin k → ℝ) (s : Set ℝ^n) (h : ∀ p ∈ s, CAS.Verified.Expr.ValidAt (CAS.Verified.Expr.paramEmbed c p).ofLp expr) : ContDiffOn ℝ m (fun q ↦ CAS.Verified.Expr.eval (CAS.Verified.Expr.paramEmbed c q).ofLp expr) s
theorem CAS.Verified.Expr.contDiffOn_eval_paramEmbed {n k : ℕ} {m : WithTop ℕ∞} (expr : CAS.Verified.Expr (Fin (n + k))) (c : Fin k → ℝ) (s : Set ℝ^n) (h : ∀ p ∈ s, CAS.Verified.Expr.ValidAt (CAS.Verified.Expr.paramEmbed c p).ofLp expr) : ContDiffOn ℝ m (fun q ↦ CAS.Verified.Expr.eval (CAS.Verified.Expr.paramEmbed c q).ofLp expr) s
Evaluation along the parameter embedding is
C^mon a set of valid points. - theoremdefined in CAS/Calculus/Smoothness.leancomplete
theorem CAS.Verified.Expr.contDiff_eval_paramEmbed {n k : ℕ} {m : WithTop ℕ∞} (expr : CAS.Verified.Expr (Fin (n + k))) (c : Fin k → ℝ) (h : ∀ (p : ℝ^n), CAS.Verified.Expr.ValidAt (CAS.Verified.Expr.paramEmbed c p).ofLp expr) : ContDiff ℝ m fun q ↦ CAS.Verified.Expr.eval (CAS.Verified.Expr.paramEmbed c q).ofLp expr
theorem CAS.Verified.Expr.contDiff_eval_paramEmbed {n k : ℕ} {m : WithTop ℕ∞} (expr : CAS.Verified.Expr (Fin (n + k))) (c : Fin k → ℝ) (h : ∀ (p : ℝ^n), CAS.Verified.Expr.ValidAt (CAS.Verified.Expr.paramEmbed c p).ofLp expr) : ContDiff ℝ m fun q ↦ CAS.Verified.Expr.eval (CAS.Verified.Expr.paramEmbed c q).ofLp expr
Evaluation along the parameter embedding is
C^mwhen the expression is valid everywhere. - theoremdefined in CAS/Calculus/Smoothness.leancomplete
theorem CAS.Verified.Expr.contDiff_eval_lineEmbed {k : ℕ} {m : WithTop ℕ∞} (expr : CAS.Verified.Expr (Fin (1 + k))) (c : Fin k → ℝ) (h : ∀ (t : ℝ), CAS.Verified.Expr.ValidAt (CAS.Verified.Expr.lineEmbed c t).ofLp expr) : ContDiff ℝ m fun s ↦ CAS.Verified.Expr.eval (CAS.Verified.Expr.lineEmbed c s).ofLp expr
theorem CAS.Verified.Expr.contDiff_eval_lineEmbed {k : ℕ} {m : WithTop ℕ∞} (expr : CAS.Verified.Expr (Fin (1 + k))) (c : Fin k → ℝ) (h : ∀ (t : ℝ), CAS.Verified.Expr.ValidAt (CAS.Verified.Expr.lineEmbed c t).ofLp expr) : ContDiff ℝ m fun s ↦ CAS.Verified.Expr.eval (CAS.Verified.Expr.lineEmbed c s).ofLp expr
Evaluation along the affine coordinate line is
C^mwhen the expression is valid everywhere. - theoremdefined in CAS/Calculus/Smoothness.leancomplete
theorem CAS.Verified.Expr.differentiable_eval_lineEmbed {k : ℕ} (expr : CAS.Verified.Expr (Fin (1 + k))) (c : Fin k → ℝ) (h : ∀ (t : ℝ), CAS.Verified.Expr.ValidAt (CAS.Verified.Expr.lineEmbed c t).ofLp expr) : Differentiable ℝ fun s ↦ CAS.Verified.Expr.eval (CAS.Verified.Expr.lineEmbed c s).ofLp expr
theorem CAS.Verified.Expr.differentiable_eval_lineEmbed {k : ℕ} (expr : CAS.Verified.Expr (Fin (1 + k))) (c : Fin k → ℝ) (h : ∀ (t : ℝ), CAS.Verified.Expr.ValidAt (CAS.Verified.Expr.lineEmbed c t).ofLp expr) : Differentiable ℝ fun s ↦ CAS.Verified.Expr.eval (CAS.Verified.Expr.lineEmbed c s).ofLp expr
Evaluation along the affine coordinate line is differentiable when the expression is valid everywhere.
Structural induction on the expression. Constants and coordinate projections
are smooth; sums, products, and negations preserve ContDiffAt; quotients,
logarithms, square roots, real powers, and the inverse sine and cosine are
smooth at every point satisfying the validity clause of their constructor, by
Mathlib's ContDiffAt lemmas for the elementary functions and the field
operations; the remaining elementary functions are smooth everywhere. The derivative bridge also gives differentiability, and the set and global
forms quantify these pointwise statements over their domain.
CAS.Verified.Expr.closedGradient_eval_eq_gradient[complete]CAS.Verified.Expr.closedLaplacian_eval_eq_laplacian[complete]CAS.Verified.Expr.closedDivergence_eval_eq_divergence[complete]CAS.Verified.Expr.closedCurl3_zero_eval_eq_partialDeriv[complete]CAS.Verified.Expr.closedCurl3_one_eval_eq_partialDeriv[complete]CAS.Verified.Expr.closedCurl3_two_eval_eq_partialDeriv[complete]
At a point where the scalar inputs being differentiated are valid, the
coordinatewise bridge gives gradient, divergence, and three-dimensional curl
formulas. The Laplacian bridge additionally assumes validity of every first
symbolic partial at that point. Hessians, Jacobians, symmetric
gradients, tensor divergence, and vector Laplacians use the same finite-indexed
construction. In particular,
(\nabla_{\mathrm{sym}}e)^\sharp(x)=\nabla(e^\sharp)(x),
(\Delta_{\mathrm{sym}}e)^\sharp(x)=\Delta(e^\sharp)(x),
(\operatorname{div}_{\mathrm{sym}}F)^\sharp(x)=\operatorname{div}(F^\sharp)(x),
and
(\operatorname{curl}_{\mathrm{sym}}F)^\sharp(x)=\operatorname{curl}(F^\sharp)(x).
Lean code for Theorem10.20●6 theoremsAssociated Lean declarationsCAS.Verified.Expr.closedGradient_eval_eq_gradient[complete]CAS.Verified.Expr.closedLaplacian_eval_eq_laplacian[complete]CAS.Verified.Expr.closedDivergence_eval_eq_divergence[complete]CAS.Verified.Expr.closedCurl3_zero_eval_eq_partialDeriv[complete]CAS.Verified.Expr.closedCurl3_one_eval_eq_partialDeriv[complete]CAS.Verified.Expr.closedCurl3_two_eval_eq_partialDeriv[complete]
CAS.Verified.Expr.closedGradient_eval_eq_gradient[complete]CAS.Verified.Expr.closedLaplacian_eval_eq_laplacian[complete]CAS.Verified.Expr.closedDivergence_eval_eq_divergence[complete]CAS.Verified.Expr.closedCurl3_zero_eval_eq_partialDeriv[complete]CAS.Verified.Expr.closedCurl3_one_eval_eq_partialDeriv[complete]CAS.Verified.Expr.closedCurl3_two_eval_eq_partialDeriv[complete]
- theoremdefined in CAS/Calculus/Gradient.leancomplete
theorem CAS.Verified.Expr.closedGradient_eval_eq_gradient {n : ℕ} (expr : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (h : CAS.Verified.Expr.ValidAt x.ofLp expr) : (WithLp.toLp 2 fun i ↦ CAS.Verified.Expr.eval x.ofLp ((∇ₛ expr) i)) = gradient (fun y ↦ CAS.Verified.Expr.eval y.ofLp expr) x
theorem CAS.Verified.Expr.closedGradient_eval_eq_gradient {n : ℕ} (expr : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (h : CAS.Verified.Expr.ValidAt x.ofLp expr) : (WithLp.toLp 2 fun i ↦ CAS.Verified.Expr.eval x.ofLp ((∇ₛ expr) i)) = gradient (fun y ↦ CAS.Verified.Expr.eval y.ofLp expr) x
At a valid point, the symbolic gradient evaluates to the analytic gradient.
- theoremdefined in PDE/Symbolic/Calculus/Operators.leancomplete
theorem CAS.Verified.Expr.closedLaplacian_eval_eq_laplacian {n : ℕ} (expr : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (h0 : CAS.Verified.Expr.ValidAt x.ofLp expr) (h1 : ∀ (i : Fin n), CAS.Verified.Expr.ValidAt x.ofLp (CAS.Verified.Expr.diff i expr)) : CAS.Verified.Expr.eval x.ofLp (Δₛ expr) = PDE.laplacian (fun y ↦ CAS.Verified.Expr.eval y.ofLp expr) x
theorem CAS.Verified.Expr.closedLaplacian_eval_eq_laplacian {n : ℕ} (expr : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (h0 : CAS.Verified.Expr.ValidAt x.ofLp expr) (h1 : ∀ (i : Fin n), CAS.Verified.Expr.ValidAt x.ofLp (CAS.Verified.Expr.diff i expr)) : CAS.Verified.Expr.eval x.ofLp (Δₛ expr) = PDE.laplacian (fun y ↦ CAS.Verified.Expr.eval y.ofLp expr) x
At a point where the expression and its first symbolic partials are valid, evaluating the checked symbolic Laplacian agrees with the analytic Laplacian.
- theoremdefined in PDE/Symbolic/Calculus/Operators.leancomplete
theorem CAS.Verified.Expr.closedDivergence_eval_eq_divergence {n : ℕ} (field : Fin n → CAS.Verified.Expr (Fin n)) (x : ℝ^n) (h : ∀ (i : Fin n), CAS.Verified.Expr.ValidAt x.ofLp (field i)) : CAS.Verified.Expr.eval x.ofLp (CAS.Verified.Expr.closedDivergence field) = (∇· fun y ↦ WithLp.toLp 2 fun i ↦ CAS.Verified.Expr.eval y.ofLp (field i)) x
theorem CAS.Verified.Expr.closedDivergence_eval_eq_divergence {n : ℕ} (field : Fin n → CAS.Verified.Expr (Fin n)) (x : ℝ^n) (h : ∀ (i : Fin n), CAS.Verified.Expr.ValidAt x.ofLp (field i)) : CAS.Verified.Expr.eval x.ofLp (CAS.Verified.Expr.closedDivergence field) = (∇· fun y ↦ WithLp.toLp 2 fun i ↦ CAS.Verified.Expr.eval y.ofLp (field i)) x
Symbolic divergence agrees with the analytic coordinate divergence for vector fields whose components are denoted by valid symbolic expressions.
- theoremdefined in PDE/Symbolic/Calculus/Operators.leancomplete
theorem CAS.Verified.Expr.closedCurl3_zero_eval_eq_partialDeriv {field : Fin 3 → CAS.Verified.Expr (Fin 3)} (x : ℝ^3) (h : ∀ (i : Fin 3), CAS.Verified.Expr.ValidAt x.ofLp (field i)) : CAS.Verified.Expr.eval x.ofLp (CAS.Verified.Expr.closedCurl3 field 0) = (∂[1] fun y ↦ CAS.Verified.Expr.eval y.ofLp (field 2)) x - (∂[2] fun y ↦ CAS.Verified.Expr.eval y.ofLp (field 1)) x
theorem CAS.Verified.Expr.closedCurl3_zero_eval_eq_partialDeriv {field : Fin 3 → CAS.Verified.Expr (Fin 3)} (x : ℝ^3) (h : ∀ (i : Fin 3), CAS.Verified.Expr.ValidAt x.ofLp (field i)) : CAS.Verified.Expr.eval x.ofLp (CAS.Verified.Expr.closedCurl3 field 0) = (∂[1] fun y ↦ CAS.Verified.Expr.eval y.ofLp (field 2)) x - (∂[2] fun y ↦ CAS.Verified.Expr.eval y.ofLp (field 1)) x
First component of the symbolic three-dimensional curl, transported to analytic partial derivatives:
(curl F)_x = ∂ᵧ F_z - ∂ᶻ F_y. - theoremdefined in PDE/Symbolic/Calculus/Operators.leancomplete
theorem CAS.Verified.Expr.closedCurl3_one_eval_eq_partialDeriv {field : Fin 3 → CAS.Verified.Expr (Fin 3)} (x : ℝ^3) (h : ∀ (i : Fin 3), CAS.Verified.Expr.ValidAt x.ofLp (field i)) : CAS.Verified.Expr.eval x.ofLp (CAS.Verified.Expr.closedCurl3 field 1) = (∂[2] fun y ↦ CAS.Verified.Expr.eval y.ofLp (field 0)) x - (∂[0] fun y ↦ CAS.Verified.Expr.eval y.ofLp (field 2)) x
theorem CAS.Verified.Expr.closedCurl3_one_eval_eq_partialDeriv {field : Fin 3 → CAS.Verified.Expr (Fin 3)} (x : ℝ^3) (h : ∀ (i : Fin 3), CAS.Verified.Expr.ValidAt x.ofLp (field i)) : CAS.Verified.Expr.eval x.ofLp (CAS.Verified.Expr.closedCurl3 field 1) = (∂[2] fun y ↦ CAS.Verified.Expr.eval y.ofLp (field 0)) x - (∂[0] fun y ↦ CAS.Verified.Expr.eval y.ofLp (field 2)) x
Second component of the symbolic three-dimensional curl, transported to analytic partial derivatives:
(curl F)_y = ∂ᶻ F_x - ∂ₓ F_z. - theoremdefined in PDE/Symbolic/Calculus/Operators.leancomplete
theorem CAS.Verified.Expr.closedCurl3_two_eval_eq_partialDeriv {field : Fin 3 → CAS.Verified.Expr (Fin 3)} (x : ℝ^3) (h : ∀ (i : Fin 3), CAS.Verified.Expr.ValidAt x.ofLp (field i)) : CAS.Verified.Expr.eval x.ofLp (CAS.Verified.Expr.closedCurl3 field 2) = (∂[0] fun y ↦ CAS.Verified.Expr.eval y.ofLp (field 1)) x - (∂[1] fun y ↦ CAS.Verified.Expr.eval y.ofLp (field 0)) x
theorem CAS.Verified.Expr.closedCurl3_two_eval_eq_partialDeriv {field : Fin 3 → CAS.Verified.Expr (Fin 3)} (x : ℝ^3) (h : ∀ (i : Fin 3), CAS.Verified.Expr.ValidAt x.ofLp (field i)) : CAS.Verified.Expr.eval x.ofLp (CAS.Verified.Expr.closedCurl3 field 2) = (∂[0] fun y ↦ CAS.Verified.Expr.eval y.ofLp (field 1)) x - (∂[1] fun y ↦ CAS.Verified.Expr.eval y.ofLp (field 0)) x
Third component of the symbolic three-dimensional curl, transported to analytic partial derivatives:
(curl F)_z = ∂ₓ F_y - ∂ᵧ F_x.
For each coordinate, Theorem 10.18 identifies evaluation of the reflected partial derivative with the corresponding analytic derivative. The reflected gradient is the vector of these coordinates, divergence is their finite sum, the Laplacian is the sum of the diagonal second derivatives, and curl is the stated alternating combination. Function extensionality and finite-sum congruence assemble the coordinate identities into the four displayed operator identities.
For the Laplacian, applying the first-derivative identity only at x
would not suffice: two functions can agree at one point and have different
derivatives there. Validity persists on a neighborhood of x, so the
analytic first partial and the evaluated symbolic first partial agree
throughout that neighborhood. Their derivatives at x therefore agree.
Validity of the first symbolic partial justifies the second application of
the derivative bridge. These are sufficient conditions on the intermediate
formulas; the largest domain of smoothness can be bigger.
If the advected scalar expression is valid at the evaluation point,
checked symbolic advection evaluates directly to our analytic
advectiveDerivative. The componentwise convection and source-subtracted
transport residual theorems use the same bridge, so later proofs need not
depend on the reflected evaluator's coordinate-sum representation:
\operatorname{Adv}(b^\sharp,u^\sharp)(x)
=\sum_i b_i^\sharp(x)\,\partial_i u^\sharp(x).
Lean code for Theorem10.21●3 theoremsAssociated Lean declarations
- theoremdefined in PDE/Symbolic/Calculus/PointwiseResidualSemantics.leancomplete
theorem CAS.advectionIntegrand_eval_eq_advectiveDerivative {n : ℕ} (b : Fin n → CAS.Verified.Expr (Fin n)) (u : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (hu : CAS.Verified.Expr.ValidAt x.ofLp u) : CAS.Verified.Expr.eval x.ofLp (CAS.advectionIntegrand b u) = PDE.advectiveDerivative (fun y ↦ WithLp.toLp 2 fun i ↦ CAS.Verified.Expr.eval y.ofLp (b i)) (fun y ↦ CAS.Verified.Expr.eval y.ofLp u) x
theorem CAS.advectionIntegrand_eval_eq_advectiveDerivative {n : ℕ} (b : Fin n → CAS.Verified.Expr (Fin n)) (u : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (hu : CAS.Verified.Expr.ValidAt x.ofLp u) : CAS.Verified.Expr.eval x.ofLp (CAS.advectionIntegrand b u) = PDE.advectiveDerivative (fun y ↦ WithLp.toLp 2 fun i ↦ CAS.Verified.Expr.eval y.ofLp (b i)) (fun y ↦ CAS.Verified.Expr.eval y.ofLp u) x
Symbolic advection evaluates to PDEAtlas's analytic advection operator.
This formulation hides the coordinate sum behind
advectiveDerivative. - theoremdefined in PDE/Symbolic/Calculus/PointwiseResidualSemantics.leancomplete
theorem CAS.convectiveDerivative_eval_eq_advectiveDerivative {n : ℕ} (u : Fin n → CAS.Verified.Expr (Fin n)) (x : ℝ^n) (i : Fin n) (hu : CAS.Verified.Expr.ValidAt x.ofLp (u i)) : CAS.Verified.Expr.eval x.ofLp (CAS.convectiveDerivative u i) = PDE.advectiveDerivative (fun y ↦ WithLp.toLp 2 fun j ↦ CAS.Verified.Expr.eval y.ofLp (u j)) (fun y ↦ CAS.Verified.Expr.eval y.ofLp (u i)) x
theorem CAS.convectiveDerivative_eval_eq_advectiveDerivative {n : ℕ} (u : Fin n → CAS.Verified.Expr (Fin n)) (x : ℝ^n) (i : Fin n) (hu : CAS.Verified.Expr.ValidAt x.ofLp (u i)) : CAS.Verified.Expr.eval x.ofLp (CAS.convectiveDerivative u i) = PDE.advectiveDerivative (fun y ↦ WithLp.toLp 2 fun j ↦ CAS.Verified.Expr.eval y.ofLp (u j)) (fun y ↦ CAS.Verified.Expr.eval y.ofLp (u i)) x
Symbolic convection agrees componentwise with analytic advection of the denoted vector field.
- theoremdefined in PDE/Symbolic/Calculus/PointwiseResidualSemantics.leancomplete
theorem CAS.transportResidualIntegrand_eval_eq_advectiveDerivative_sub {n : ℕ} (b : Fin n → CAS.Verified.Expr (Fin n)) (u f : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (hu : CAS.Verified.Expr.ValidAt x.ofLp u) : CAS.Verified.Expr.eval x.ofLp (CAS.transportResidualIntegrand b u f) = PDE.advectiveDerivative (fun y ↦ WithLp.toLp 2 fun i ↦ CAS.Verified.Expr.eval y.ofLp (b i)) (fun y ↦ CAS.Verified.Expr.eval y.ofLp u) x - CAS.Verified.Expr.eval x.ofLp f
theorem CAS.transportResidualIntegrand_eval_eq_advectiveDerivative_sub {n : ℕ} (b : Fin n → CAS.Verified.Expr (Fin n)) (u f : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (hu : CAS.Verified.Expr.ValidAt x.ofLp u) : CAS.Verified.Expr.eval x.ofLp (CAS.transportResidualIntegrand b u f) = PDE.advectiveDerivative (fun y ↦ WithLp.toLp 2 fun i ↦ CAS.Verified.Expr.eval y.ofLp (b i)) (fun y ↦ CAS.Verified.Expr.eval y.ofLp u) x - CAS.Verified.Expr.eval x.ofLp f
The symbolic transport residual evaluates to analytic advection minus the source.
Expand symbolic advection as a finite coordinate sum and apply
Theorem 10.18 to each derivative term. The
analytic operator is Du(x)[b(x)]; expanding b(x) in the Euclidean
basis identifies it with that sum.
For momentum component i, assume ValidAt at x for u_i and p.
The Navier–Stokes bridge also assumes validity of every first symbolic partial
of u_i; the conservation bridge assumes validity of every flux component.
These give the stationary Euler and Navier–Stokes momentum residuals and the
divergence-form conservation residual. Incompressibility is a separate equation.
The undifferentiated viscosity and source terms need no validity hypotheses
for these identities. Componentwise, the Euler bridge gives
R_i^{E}(x)=\sum_j u_j(x)\partial_j u_i(x)+\partial_i p(x)-f_i(x),
while the Navier–Stokes bridge adds -\nu(x)\Delta u_i(x) and the
conservation bridge gives
R^{C}(x)=\sum_i\partial_i F_i(x)-f(x).
Lean code for Theorem10.22●3 theoremsAssociated Lean declarations
- theoremdefined in PDE/Symbolic/Calculus/PointwiseResidualSemantics.leancomplete
theorem CAS.eulerMomentumResidual_eval_eq_sum_mul_partialDeriv_add_partialDeriv_sub {n : ℕ} (u : Fin n → CAS.Verified.Expr (Fin n)) (p : CAS.Verified.Expr (Fin n)) (f : Fin n → CAS.Verified.Expr (Fin n)) (x : ℝ^n) (i : Fin n) (hu : CAS.Verified.Expr.ValidAt x.ofLp (u i)) (hp : CAS.Verified.Expr.ValidAt x.ofLp p) : CAS.Verified.Expr.eval x.ofLp (CAS.eulerMomentumResidual u p f i) = ∑ j, CAS.Verified.Expr.eval x.ofLp (u j) * (∂[j] fun y ↦ CAS.Verified.Expr.eval y.ofLp (u i)) x + (∂[i] fun y ↦ CAS.Verified.Expr.eval y.ofLp p) x - CAS.Verified.Expr.eval x.ofLp (f i)
theorem CAS.eulerMomentumResidual_eval_eq_sum_mul_partialDeriv_add_partialDeriv_sub {n : ℕ} (u : Fin n → CAS.Verified.Expr (Fin n)) (p : CAS.Verified.Expr (Fin n)) (f : Fin n → CAS.Verified.Expr (Fin n)) (x : ℝ^n) (i : Fin n) (hu : CAS.Verified.Expr.ValidAt x.ofLp (u i)) (hp : CAS.Verified.Expr.ValidAt x.ofLp p) : CAS.Verified.Expr.eval x.ofLp (CAS.eulerMomentumResidual u p f i) = ∑ j, CAS.Verified.Expr.eval x.ofLp (u j) * (∂[j] fun y ↦ CAS.Verified.Expr.eval y.ofLp (u i)) x + (∂[i] fun y ↦ CAS.Verified.Expr.eval y.ofLp p) x - CAS.Verified.Expr.eval x.ofLp (f i)
A symbolic stationary Euler momentum component evaluates to
∑ⱼ uⱼ ∂ⱼuᵢ + ∂ᵢp - fᵢ. - theoremdefined in PDE/Symbolic/Calculus/PointwiseResidualSemantics.leancomplete
theorem CAS.conservationResidualIntegrand_eval_eq_sum_partialDeriv_sub {n : ℕ} (flux : Fin n → CAS.Verified.Expr (Fin n)) (f : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (hflux : ∀ (i : Fin n), CAS.Verified.Expr.ValidAt x.ofLp (flux i)) : CAS.Verified.Expr.eval x.ofLp (CAS.conservationResidualIntegrand flux f) = ∑ i, (∂[i] fun y ↦ CAS.Verified.Expr.eval y.ofLp (flux i)) x - CAS.Verified.Expr.eval x.ofLp f
theorem CAS.conservationResidualIntegrand_eval_eq_sum_partialDeriv_sub {n : ℕ} (flux : Fin n → CAS.Verified.Expr (Fin n)) (f : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (hflux : ∀ (i : Fin n), CAS.Verified.Expr.ValidAt x.ofLp (flux i)) : CAS.Verified.Expr.eval x.ofLp (CAS.conservationResidualIntegrand flux f) = ∑ i, (∂[i] fun y ↦ CAS.Verified.Expr.eval y.ofLp (flux i)) x - CAS.Verified.Expr.eval x.ofLp f
The symbolic conservation-law residual evaluates to analytic coordinate divergence minus the source.
Normalize each reflected residual, rewrite its differentiated components using Theorem 10.20, and identify the transport term with Theorem 10.21. The remaining sums and products evaluate definitionally.
The viscosity term here is specifically -\nu(x)\Delta u_i. For a
variable coefficient this differs from divergence-form diffusion:
-\nabla\cdot(\nu\nabla u_i)
=-\nu\Delta u_i-\nabla\nu\cdot\nabla u_i.
The extra term vanishes for constant viscosity. Keeping the exact operator visible matters when applying a residual bridge: a certificate for one of these expressions says nothing about the other.
In positive dimension, lower a differential equation against a closed-form
ansatz to a symbolic residual. If that residual evaluates to zero at the point
and its analytic side conditions hold there, then
R_{\mathrm{closed}}=0\ \Longrightarrow\
R_{\mathrm{analytic}}(u^\sharp,x)=0.
Lean code for Theorem10.23●1 theoremAssociated Lean declarations
- theoremdefined in PDE/Symbolic/ClosedForm/Differential/Equation.leancomplete
theorem CAS.DiffExpr.Equation.analyticResidual_eq_zero_of_closedResidualVanishesAt {n : ℕ} {σ : Type} [Fact (0 < n)] {ansatz : σ → CAS.Verified.Expr (Fin n)} {eqn : CAS.DiffExpr.Equation n σ} {x : ℝ^n} (hclosed : CAS.DiffExpr.Equation.ClosedResidualVanishesAt ansatz eqn x) (hside : CAS.DiffExpr.AnalyticSideCondition ansatz x eqn.residual) : CAS.DiffExpr.Equation.analyticResidual ansatz x eqn = 0
theorem CAS.DiffExpr.Equation.analyticResidual_eq_zero_of_closedResidualVanishesAt {n : ℕ} {σ : Type} [Fact (0 < n)] {ansatz : σ → CAS.Verified.Expr (Fin n)} {eqn : CAS.DiffExpr.Equation n σ} {x : ℝ^n} (hclosed : CAS.DiffExpr.Equation.ClosedResidualVanishesAt ansatz eqn x) (hside : CAS.DiffExpr.AnalyticSideCondition ansatz x eqn.residual) : CAS.DiffExpr.Equation.analyticResidual ansatz x eqn = 0
A vanishing lowered residual gives a vanishing analytic residual at every valid point.
Rewrite the analytic residual as the evaluation of the lowered residual,
using the analytic side conditions. ClosedResidualVanishesAt is exactly the
assertion that this evaluation is zero, so it finishes the proof. A side-aware
normalizer is one way to supply that vanishing proof after its denominator
and branch conditions have been discharged.
CAS.Verified.Expr.Alg.proportionality?_sound[complete]CAS.integrate?[complete]CAS.IntegrationPlanner.candidate?[complete]CAS.IntegrationCheck.certifyCandidate?[complete]CAS.Verified.Expr.sideHolds_of_compactNonzero[complete]CAS.IntegrationCheck.AntiderivativeCert.eval_diff_eq[complete]CAS.IntegrationCheck.AntiderivativeCert.intervalIntegral_eq_sub_eval_add_smul_single[complete]
The integration entry point accepts a candidate F only after checking
that \operatorname{diff}_iF-f normalizes to zero. Its certificate records
requirements for the primitive, the integrand, and the conditional
cancellations used in that check.
Fix a coordinate line \gamma(s)=x+s e_i. At each point where those
requirements hold, the evaluated primitive has derivative
f^\sharp(\gamma(s)). If they hold for every
s\in[\min(a,b),\max(a,b)], then
\int_a^b f^\sharp(\gamma(s))\,ds
=F^\sharp(\gamma(b))-F^\sharp(\gamma(a)).
The interval hypothesis is Set.uIcc a b in Lean. It includes both
endpoints and every point between them, regardless of their order.
Validity of the integrand supplies continuity and hence interval
integrability; validity of the primitive supplies the derivative needed by
the fundamental theorem of calculus. Every search method uses this same
certificate. At the reflected API, IntegrationCheck.certifyCandidate?
takes the coordinate, original integrand, and proposed primitive explicitly,
so it can check a candidate without running primitive search. The ordinary
interval tactic uses this boundary for a supplied function or a common
function reconstructed from the requested endpoint difference. It reflects
the integrand and candidate over one parameter table, so each coefficient
has the same meaning in both expressions. Checking a candidate against its
own derivative would not establish the requested integral.
Lean code for Theorem10.24●7 declarationsAssociated Lean declarationsCAS.Verified.Expr.Alg.proportionality?_sound[complete]CAS.integrate?[complete]CAS.IntegrationPlanner.candidate?[complete]CAS.IntegrationCheck.certifyCandidate?[complete]CAS.Verified.Expr.sideHolds_of_compactNonzero[complete]CAS.IntegrationCheck.AntiderivativeCert.eval_diff_eq[complete]CAS.IntegrationCheck.AntiderivativeCert.intervalIntegral_eq_sub_eval_add_smul_single[complete]
CAS.Verified.Expr.Alg.proportionality?_sound[complete]CAS.integrate?[complete]CAS.IntegrationPlanner.candidate?[complete]CAS.IntegrationCheck.certifyCandidate?[complete]CAS.Verified.Expr.sideHolds_of_compactNonzero[complete]CAS.IntegrationCheck.AntiderivativeCert.eval_diff_eq[complete]CAS.IntegrationCheck.AntiderivativeCert.intervalIntegral_eq_sub_eval_add_smul_single[complete]
- theoremdefined in CAS/ClosedForm/Expression/Rational/Proportionality.leancomplete
theorem CAS.Verified.Expr.Alg.proportionality?_sound.{u_1} {ι : Type u_1} [DecidableEq ι] {target source : CAS.Verified.Expr ι} {result : CAS.Verified.Expr.Alg.NormResult ι} (hresult : CAS.Verified.Expr.Alg.proportionality? target source = some result) (ρ : ι → ℝ) (hside : CAS.Verified.Expr.Alg.SideHolds ρ result.nonzero) : CAS.Verified.Expr.eval ρ target = CAS.Verified.Expr.eval ρ result.expr * CAS.Verified.Expr.eval ρ source
theorem CAS.Verified.Expr.Alg.proportionality?_sound.{u_1} {ι : Type u_1} [DecidableEq ι] {target source : CAS.Verified.Expr ι} {result : CAS.Verified.Expr.Alg.NormResult ι} (hresult : CAS.Verified.Expr.Alg.proportionality? target source = some result) (ρ : ι → ℝ) (hside : CAS.Verified.Expr.Alg.SideHolds ρ result.nonzero) : CAS.Verified.Expr.eval ρ target = CAS.Verified.Expr.eval ρ result.expr * CAS.Verified.Expr.eval ρ source
Every returned proportionality result proves the represented identity: if
proportionality? target sourcereturnsresult, thentargetandresult.expr * sourcehave the same value at every valuation where the conditionsresult.nonzerohold. - defdefined in CAS/Integration.leancomplete
def CAS.integrate? {n : ℕ} (i : Fin n) (expr : CAS.Verified.Expr (Fin n)) (provider? : Option CAS.Polynomial.Sparse.Univariate.RationalFactorization.Provider := none) : Option (CAS.IntegrationCheck.AntiderivativeCert i expr)
def CAS.integrate? {n : ℕ} (i : Fin n) (expr : CAS.Verified.Expr (Fin n)) (provider? : Option CAS.Polynomial.Sparse.Univariate.RationalFactorization.Provider := none) : Option (CAS.IntegrationCheck.AntiderivativeCert i expr)
Try to construct a checked symbolic antiderivative certificate in coordinate
i. - defdefined in CAS/Integration/Planner.leancomplete
def CAS.IntegrationPlanner.candidate? {n : ℕ} (i : Fin n) (expr : CAS.Verified.Expr (Fin n)) (provider? : Option CAS.Polynomial.Sparse.Univariate.RationalFactorization.Provider := none) : Option (CAS.Verified.Expr (Fin n))
def CAS.IntegrationPlanner.candidate? {n : ℕ} (i : Fin n) (expr : CAS.Verified.Expr (Fin n)) (provider? : Option CAS.Polynomial.Sparse.Univariate.RationalFactorization.Provider := none) : Option (CAS.Verified.Expr (Fin n))
Discover an antiderivative candidate;
integrate?performs the final certificate check. - defdefined in CAS/Integration/Check.leancomplete
def CAS.IntegrationCheck.certifyCandidate? {n : ℕ} (i : Fin n) (integrand candidate : CAS.Verified.Expr (Fin n)) : Option (CAS.IntegrationCheck.AntiderivativeCert i integrand)
def CAS.IntegrationCheck.certifyCandidate? {n : ℕ} (i : Fin n) (integrand candidate : CAS.Verified.Expr (Fin n)) : Option (CAS.IntegrationCheck.AntiderivativeCert i integrand)
Accept a candidate exactly when the checked residual route reaches zero.
- theoremdefined in CAS/ClosedForm/SideConditionCompaction.leancomplete
theorem CAS.Verified.Expr.sideHolds_of_compactNonzero.{u_1} {ι : Type u_1} [DecidableEq ι] {ρ : ι → ℝ} {side : List (CAS.Verified.Expr ι)} (h : CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Verified.Expr.compactNonzero side)) : CAS.Verified.Expr.Alg.SideHolds ρ side
theorem CAS.Verified.Expr.sideHolds_of_compactNonzero.{u_1} {ι : Type u_1} [DecidableEq ι] {ρ : ι → ℝ} {side : List (CAS.Verified.Expr ι)} (h : CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Verified.Expr.compactNonzero side)) : CAS.Verified.Expr.Alg.SideHolds ρ side
Compact nonzero obligations imply every original obligation.
- theoremdefined in CAS/Integration/Check.leancomplete
theorem CAS.IntegrationCheck.AntiderivativeCert.eval_diff_eq {n : ℕ} {i : Fin n} {integrand : CAS.Verified.Expr (Fin n)} (cert : CAS.IntegrationCheck.AntiderivativeCert i integrand) (x : ℝ^n) (h : cert.requirements.Holds x.ofLp) : CAS.Verified.Expr.eval x.ofLp (CAS.Verified.Expr.diff i cert.candidate) = CAS.Verified.Expr.eval x.ofLp integrand
theorem CAS.IntegrationCheck.AntiderivativeCert.eval_diff_eq {n : ℕ} {i : Fin n} {integrand : CAS.Verified.Expr (Fin n)} (cert : CAS.IntegrationCheck.AntiderivativeCert i integrand) (x : ℝ^n) (h : cert.requirements.Holds x.ofLp) : CAS.Verified.Expr.eval x.ofLp (CAS.Verified.Expr.diff i cert.candidate) = CAS.Verified.Expr.eval x.ofLp integrand
The derivative identity of a certificate: at every point
xwhere its requirements hold, the symbolic derivative of the certified primitive in coordinateihas the value of the integrand. The analytic statements ofCAS/Calculus/Antiderivative.leanstart from this identity. - theoremdefined in CAS/Calculus/Antiderivative.leancomplete
theorem CAS.IntegrationCheck.AntiderivativeCert.intervalIntegral_eq_sub_eval_add_smul_single {n : ℕ} {i : Fin n} {integrand : CAS.Verified.Expr (Fin n)} (cert : CAS.IntegrationCheck.AntiderivativeCert i integrand) (x : ℝ^n) (a b : ℝ) (hrequirements : ∀ t ∈ Set.uIcc a b, cert.requirements.Holds (x.ofLp + t • (EuclideanSpace.single i 1).ofLp)) : ∫ (t : ℝ) in a..b, CAS.Verified.Expr.eval (x + t • EuclideanSpace.single i 1).ofLp integrand = CAS.Verified.Expr.eval (x + b • EuclideanSpace.single i 1).ofLp cert.candidate - CAS.Verified.Expr.eval (x + a • EuclideanSpace.single i 1).ofLp cert.candidate
theorem CAS.IntegrationCheck.AntiderivativeCert.intervalIntegral_eq_sub_eval_add_smul_single {n : ℕ} {i : Fin n} {integrand : CAS.Verified.Expr (Fin n)} (cert : CAS.IntegrationCheck.AntiderivativeCert i integrand) (x : ℝ^n) (a b : ℝ) (hrequirements : ∀ t ∈ Set.uIcc a b, cert.requirements.Holds (x.ofLp + t • (EuclideanSpace.single i 1).ofLp)) : ∫ (t : ℝ) in a..b, CAS.Verified.Expr.eval (x + t • EuclideanSpace.single i 1).ofLp integrand = CAS.Verified.Expr.eval (x + b • EuclideanSpace.single i 1).ofLp cert.candidate - CAS.Verified.Expr.eval (x + a • EuclideanSpace.single i 1).ofLp cert.candidate
The fundamental theorem of calculus for a certified primitive along one coordinate line. When the requirements of the certificate hold at
x + t • e_ifor everytbetweenaandb, the integral of the integrand fromatobis the value of the primitive atbminus its value ata.
For substitutions, the proportionality checker validates its proposed factor with
Theorem 10.3. Polynomial, rational,
substitution, and integration-by-parts passes only propose candidates. The
integration checker validates the symbolic derivative identity with
Theorem 10.3. Under the certificate's
requirements, Theorem 10.18 turns it into
an analytic derivative along \gamma. The interval-wide requirements also
make the evaluated integrand continuous there, so the fundamental theorem
gives the endpoint difference.
The differentiation rule tree in detail.
DiffRule names the differentiation rules, and DiffDerivation records
their application to an expression. For an expression e and variable index
i, this tree connects the raw derivative e.diff i to the analytic partial
derivative. Its rules are:
Constant rule. Every rational literal,
\pi, and\mathrm edifferentiates to zero:\partial_i c = 0.Variable rule. A coordinate
x_jdifferentiates to the Kronecker delta:\partial_i x_j = \delta_{ij}.Sum, difference, and negation. These distribute linearly:
\partial_i(e_1 \pm e_2) = \partial_i e_1 \pm \partial_i e_2.Product rule. For
e_1 \cdot e_2: the derivative is(\partial_i e_1) e_2 + e_1 (\partial_i e_2).Quotient rule. For
e_1 / e_2withe_2 \neq 0at the evaluation point: the derivative is((\partial_i e_1)e_2 - e_1(\partial_i e_2))/e_2^2.Natural power rule. For
e^n: the derivative isn \cdot e^{n-1} \cdot \partial_i e.Real power rule. For
e_1^{\,e_2}withe_1 > 0at the evaluation point: the derivative is(\partial_i e_1)\, e_2\, e_1^{\,e_2-1} + (\partial_i e_2)\, e_1^{\,e_2} \log e_1, the two terms of Mathlib'sHasDerivAt.rpow; a literal natural exponent is lowered to the natural power rule instead.Transcendental chain rules. Each elementary function composes with the inner derivative
\partial_i e:\partial_i(\sin e) = (\cos e)(\partial_i e),\partial_i(\cos e) = -(\sin e)(\partial_i e),\partial_i(\arctan e) = (\partial_i e)/(1+e^2),\partial_i(\arcsin e) = (\partial_i e)/\sqrt{1-e^2}and\partial_i(\arccos e) = -(\partial_i e)/\sqrt{1-e^2}(requiringe \neq \pm1),\partial_i(\exp e) = (\exp e)(\partial_i e),\partial_i(\log e) = (\partial_i e)/e(requiringe \neq 0under Mathlib's total real logarithm),\partial_i(\sqrt{e}) = (\partial_i e)/(2\sqrt{e})(requiringe > 0).
The raw derivative is simplified by evaluating constant arithmetic,
eliminating multiplication by zero or one, and removing addition of zero.
These transformations preserve its value.
A theorem may request a form that this simplifier does not reach, such as a
factored heat-kernel derivative or a square-root expression needing
(\sqrt u)^2=u. The derivative tactic then tries the side-conditioned
normalizer, whose real-power and square-root rules identify the two forms
under the recorded conditions.
Example: differentiating \sin(xy).
Consider the expression e = \sin(x \cdot y) with variables x = x_0 and
y = x_1 in \mathbb{R}^2. Differentiating with respect to x_0:
The outermost constructor is sin, so the sine chain rule applies.
The inner expression is
x_0 \cdot x_1, which uses the product rule.Differentiating
x_0gives 1 (variable rule, Kronecker delta).Differentiating
x_1with respect tox_0gives 0 (variable rule).The product rule yields
1 \cdot x_1 + x_0 \cdot 0.The chain rule produces
\cos(x_0 x_1) \cdot (1 \cdot x_1 + x_0 \cdot 0).The simplifier reduces this to
x_1 \cos(x_0 x_1).
The bridge theorem then proves \partial_{x_0}[\sin(xy)](p) = y\cos(xy) at every point p = (x,y), as an identity in Lean's real analysis library.
Supported antiderivative patterns.
The bounded antiderivative search IntegrationPlanner.candidateWithFuel?
combines seven mechanisms.
Polynomial integration. Sparse multivariate polynomials are integrated
term by term. Each monomial c \cdot x_i^k integrates in coordinate i to c \cdot x_i^{k+1}/(k+1). The sparse representation avoids allocating zero coefficients.
Calibrated substitution. For an integrand f(x), the planner collects a list of substitution primitives. These include \log g for quotients by g, inverse-power primitives, \exp(g), -\cos(g), and \sin(g). For each primitive, the proportionality checker (Alg.proportionality?) verifies whether the integrand equals the primitive's derivative times a factor independent of the integration coordinate. If successful, the candidate is that constant factor times the primitive.
Integration by parts. The LIATE heuristic ranks factors by their
suitability for differentiation. Logarithmic and inverse-trigonometric factors
receive rank 5, algebraic polynomial factors rank 4, trigonometric factors rank 3, and exponential factors rank 2.
For a product u \cdot v', the planner recursively integrates v', forms uv - \int u'v, recursively integrates the correction, and validates the result. The initial recursion fuel is 96; this bounds recursive depth, not the total number of calls across search branches.
Exponential-trigonometric recurrences. For integrands of the form e^{ax}(p(x)\sin(cx) + q(x)\cos(cx)), the planner solves a finite coupled polynomial recurrence. Writing the antiderivative as e^{ax}(P(x)\sin(cx) + Q(x)\cos(cx)), the amplitudes satisfy
P' + aP - cQ = p, \qquad Q' + cP + aQ = q.
When a^2 + c^2 \neq 0, the constant matrix is invertible, and repeated matrix inversion lowers the polynomial degree. The process terminates in at most \max(\deg p, \deg q) + 1 steps.
The implemented route allows multivariate rational-polynomial amplitudes, with the other coordinates treated as parameters, and common exponential and trigonometric phases whose slopes in the selected coordinate are rational constants.
Trigonometric powers. The planner proposes primitives for sine and cosine
powers with every fixed natural exponent. For positive powers, the phase
derivative must simplify to an expression independent of the selected
coordinate and different from literal zero. The final certificate records the
nonvanishing conditions needed for division. For constant nonzero slope
\alpha, the low-power cases include:
\int \sin(\alpha x)\,dx = -\cos(\alpha x)/\alpha,\int \cos(\alpha x)\,dx = \sin(\alpha x)/\alpha,\int \sin^2(\alpha x)\,dx = x/2 - \sin(\alpha x)\cos(\alpha x)/(2\alpha),\int \cos^2(\alpha x)\,dx = x/2 + \sin(\alpha x)\cos(\alpha x)/(2\alpha).
Rational function integration. For univariate rational functions p(x)/q(x), the pipeline proceeds in three stages:
Polynomial division. Exact sparse Euclidean division separates the improper part:
p = s \cdot q + rwith\deg r < \deg q. The polynomial quotientsis integrated term by term.Hermite reduction. The proper fraction
r/qundergoes Yun square-free decomposition of the denominator. For each repeated factorf^m, the Hermite recurrence lowers the multiplicity by one at each step, producing rational correction terms that do not require logarithms.Elementary transcendental integration. The terminal square-free fraction uses partial-fraction decomposition over the rationals. Linear factors give logarithms. For a quadratic denominator
ax^2+bx+c, separate off the logarithmic-derivative part. The remaining primitive uses arctangent whenb^2-4ac<0and real logarithms whenb^2-4ac>0.
The rational factor search combines rational-root extraction and exact
Kronecker search over Rat; extended Euclid supplies the modular inverses.
Irrational scales in quadratic primitives remain exact symbolic square roots.
Bronstein (2005, Chapter 2) gives the rational-integration methods behind these stages. Here they are used in a bounded candidate search, and the accepted primitive's derivative is checked.
Compositional linearity. Sums, differences, negations, and scalar-independent multiples are handled compositionally.
Before a certificate's nonzero conditions reach a proof, a checked compactor collects square-root products, extracts common factors, splits products and powers, normalizes factors, and deduplicates them. Its soundness theorem recovers every raw obligation from the compact list.
Example: integrating a rational function.
Consider \int \frac{2x+3}{(x-1)^2(x+2)}\,dx. The algebra to be checked is
\frac{2x+3}{(x-1)^2(x+2)}
=\frac{1}{9(x-1)}+\frac{5}{3(x-1)^2}-\frac{1}{9(x+2)}.
Thus, on any interval avoiding 1 and -2, a candidate primitive is
F(x)=\frac19\log|x-1|-\frac{5}{3(x-1)}
-\frac19\log|x+2|.
Differentiating the middle term recovers the repeated pole; differentiating the two logarithms recovers the simple poles. This concrete decomposition explains the roles of the pipeline's stages:
Polynomial division. The numerator has lower degree, so the quotient is zero.
Square-free decomposition. The denominator factors as
(x-1)^2(x+2). Yun decomposition identifies(x-1)with multiplicity 2 and(x+2)with multiplicity 1.Hermite reduction. The recurrence absorbs the repeated factor, producing a rational correction and lowering the denominator to square-free form
(x-1)(x+2).Partial fractions. Modular inverse computation splits the residual into terms with denominators
(x-1)and(x+2).Elementary integration. Each partial fraction
c/(x-r)integrates toc\log|x-r|.Validation. The complete candidate is differentiated symbolically, and the residual is normalized to zero by the checked route. The requirement set records
x \neq 1andx \neq -2.
To use the endpoint formula, the entire closed interval must avoid both
poles. Checking only a\ne1,-2 and b\ne1,-2 is insufficient: the
endpoints a=0, b=2 pass those tests but enclose the pole at 1.
This is why the integral theorem asks for nonvanishing at every point of
Set.uIcc a b, while a pointwise derivative theorem asks only at its
evaluation point.
10.6.3. Formal Jets and Residual Losses
A residual loss is an ordinary real-valued function, differentiated with the analytic Fréchet derivative. A formal jet instead stores coefficients; identifying them with derivatives requires a separate semantic theorem.
Residual losses are ordinary functions.
PDE.AutoDiff.ResidualLoss.pointwiseEnergy[complete]PDE.AutoDiff.ResidualLoss.sampledLoss[complete]
A pointwise residual energy is the square of a LinearPDE's totalized residual
expression. A sampled loss sums these energies over a finite list of points.
Interpreting this objective as a classical PDE loss requires a separate
regularity proof for the candidate field. Given a parameterized model
\theta \mapsto u_\theta, its objective is the ordinary composition
\theta \mapsto \operatorname{sampledLoss}(u_\theta).
Lean code for Definition10.25●2 definitionsAssociated Lean declarationsPDE.AutoDiff.ResidualLoss.pointwiseEnergy[complete]PDE.AutoDiff.ResidualLoss.sampledLoss[complete]
PDE.AutoDiff.ResidualLoss.pointwiseEnergy[complete]PDE.AutoDiff.ResidualLoss.sampledLoss[complete]
- defdefined in PDE/AutoDiff/ResidualLoss.leancomplete
def PDE.AutoDiff.ResidualLoss.pointwiseEnergy {n k : ℕ} (pde : PDE.LinearPDE ℝ (ℝ^n) ℝ k) (u : ℝ^n → ℝ) (x : ℝ^n) : ℝ
def PDE.AutoDiff.ResidualLoss.pointwiseEnergy {n k : ℕ} (pde : PDE.LinearPDE ℝ (ℝ^n) ℝ k) (u : ℝ^n → ℝ) (x : ℝ^n) : ℝ
Square of the totalized pointwise residual expression of a linear PDE.
This objective is defined for every field. Reading the value as a classical order-
kPDE residual requiresC^kregularity of the field. - defdefined in PDE/AutoDiff/ResidualLoss.leancomplete
def PDE.AutoDiff.ResidualLoss.sampledLoss {n k : ℕ} (pde : PDE.LinearPDE ℝ (ℝ^n) ℝ k) (u : ℝ^n → ℝ) (samples : List ℝ^n) : ℝ
def PDE.AutoDiff.ResidualLoss.sampledLoss {n k : ℕ} (pde : PDE.LinearPDE ℝ (ℝ^n) ℝ k) (u : ℝ^n → ℝ) (samples : List ℝ^n) : ℝ
Sum of squared totalized residual expressions over a finite sample.
A zero sampled loss can still miss the equation between sample points. For
the one-dimensional equation u'=0 on [0,1], choose an integer
N\geq1 and A>0, and set
u(x)=\frac{A}{2\pi N}\bigl(1-\cos(2\pi Nx)\bigr),
\qquad r(x)=u'(x)=A\sin(2\pi Nx).
At every grid point x_j=j/N, the residual vanishes, so the sampled
squared loss is zero. Between these points its magnitude reaches A,
which can be arbitrarily large. The candidate is smooth and even has zero
values at both endpoints. A uniform residual enclosure would detect this
oscillation; sampling alone cannot. Converting such a uniform enclosure to
solution accuracy then needs a stability estimate in the relevant norm.
PDE.AutoDiff.Optimization.gradientDescentStep[complete]PDE.AutoDiff.Optimization.adamStep[complete]
For a differentiable objective f:E\to\mathbb R on a real Hilbert space,
the gradient-descent map is
x^+=x-\eta\,\nabla f(x).
In Euclidean coordinates, the Adam-style map first sets g=\nabla f(x) and computes
\begin{aligned}
m^+&=\beta_1m+(1-\beta_1)g,\\
v^+&=\beta_2v+(1-\beta_2)(g\odot g),\\
x_i^+&=x_i-\eta\,\frac{m_i^+}{\sqrt{v_i^+}+\varepsilon}.
\end{aligned}
Both are total update functions defined from the analytic gradient. An
analytic use of the Adam-style map must separately prove the sign and nonvanishing facts it
needs for \sqrt{v_i^+}+\varepsilon.
Lean code for Definition10.26●2 definitionsAssociated Lean declarationsPDE.AutoDiff.Optimization.gradientDescentStep[complete]PDE.AutoDiff.Optimization.adamStep[complete]
PDE.AutoDiff.Optimization.gradientDescentStep[complete]PDE.AutoDiff.Optimization.adamStep[complete]
- defdefined in PDE/AutoDiff/Optimization.leancomplete
def PDE.AutoDiff.Optimization.gradientDescentStep.{u_1} {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] (f : E → ℝ) (x : E) (stepSize : ℝ) : E
def PDE.AutoDiff.Optimization.gradientDescentStep.{u_1} {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] (f : E → ℝ) (x : E) (stepSize : ℝ) : E
One gradient-descent update.
- defdefined in PDE/AutoDiff/Optimization.leancomplete
def PDE.AutoDiff.Optimization.adamStep {n : ℕ} (f : ℝ^n → ℝ) (x m v : ℝ^n) (stepSize beta1 beta2 eps : ℝ) : ℝ^n × ℝ^n × ℝ^n
def PDE.AutoDiff.Optimization.adamStep {n : ℕ} (f : ℝ^n → ℝ) (x m v : ℝ^n) (stepSize beta1 beta2 eps : ℝ) : ℝ^n × ℝ^n × ℝ^n
One uncorrected Adam-style exponential-moment update.
The operation is total. Analytic uses should separately require nonnegative second moments and a positive denominator
Real.sqrt (newV i) + eps. This primitive stores no time step and applies no bias corrections1 - beta1 ^ tor1 - beta2 ^ t; the bias-corrected update of Kingma and Ba, Algorithm 1, keeps those state components and applies those corrections.
In applications, sampledLoss builds a real-valued objective from an
already defined PDE residual and a finite sample. A gradient step then has
the form
\theta_{\mathrm{new}}
=\theta-\eta\,\nabla_\theta L(\theta),
with the analytic gradient, so a residual-loss theorem rests on no
automatic-differentiation compiler.
Higher-order multivariate jets.
The jet layer uses Mathlib's multivariate formal power series, so variables
may be indexed by an arbitrary type \iota rather than only by Fin n.
PDE.AutoDiff.Jet[complete]PDE.AutoDiff.Jet.coefficient[complete]
For a multi-index \alpha:\iota\to_0\mathbb N, an order-N jet is a
formal coefficient family J_\alpha. When a separate semantic theorem
identifies these coefficients with derivatives, the normalization convention
is
J_\alpha(f,x)=\frac{D^\alpha f(x)}{\alpha!}.
Formal products use ordinary power-series convolution:
(JK)_\alpha
=\sum_{\beta+\gamma=\alpha}J_\beta K_\gamma.
The order index controls finite extraction and finite formal composition. The underlying representation is a full formal power series: coefficients above the index may be nonzero, and the carrier itself contains no function, base point, differentiability proof, or convergence theorem.
Lean code for Definition10.27●2 definitionsAssociated Lean declarationsPDE.AutoDiff.Jet[complete]PDE.AutoDiff.Jet.coefficient[complete]
PDE.AutoDiff.Jet[complete]PDE.AutoDiff.Jet.coefficient[complete]
- defdefined in PDE/AutoDiff/Jet/Basic.leancomplete
def PDE.AutoDiff.Jet.{u_1, u_2} (ι : Type u_1) (R : Type u_2) (_order : ℕ) : Type (max u_2 u_1)
def PDE.AutoDiff.Jet.{u_1, u_2} (ι : Type u_1) (R : Type u_2) (_order : ℕ) : Type (max u_2 u_1)
An order-indexed multivariate formal jet with coefficients in
R.The implementation is reducible to Mathlib's
MvPowerSeries, so all algebraic laws and coefficient convolution theorems are inherited rather than reproved. The order index is erased:Jet ι R 3andJet ι R 5are definitionally equal, and mixing inspection orders is permitted. Extraction and composition take that index as an explicit policy, not as a typing invariant. Only the value and first coefficients of compiled expressions have analytic certification; higher coefficients are formal data. - defdefined in PDE/AutoDiff/Jet/Basic.leancomplete
def PDE.AutoDiff.Jet.coefficient.{u_1, u_2} {ι : Type u_1} {R : Type u_2} {order : ℕ} [Semiring R] (α : PDE.AutoDiff.Jet.MultiIndex ι) (f : PDE.AutoDiff.Jet ι R order) : R
def PDE.AutoDiff.Jet.coefficient.{u_1, u_2} {ι : Type u_1} {R : Type u_2} {order : ℕ} [Semiring R] (α : PDE.AutoDiff.Jet.MultiIndex ι) (f : PDE.AutoDiff.Jet ι R order) : R
The formal coefficient at
α.A normalized Taylor interpretation requires a separate theorem relating the jet to derivatives of a function.
For a Euclidean scalar function f:\mathbb R^n\to\mathbb R, the proposition
that a formal jet J represents f to first order at x records
\begin{aligned}
&f\text{ is differentiable throughout a neighborhood of }x,\\
&J_0=f(x),\\
&J_{e_i}=\partial_i f(x)\qquad(i=1,\ldots,n).
\end{aligned}
The function, point, and jet are parameters of the proposition. Only the value and the first coefficients are constrained.
Lean code for Definition10.28●1 definitionAssociated Lean declarationsPDE.AutoDiff.Jet.RepresentsFirstOrderAt[complete]
PDE.AutoDiff.Jet.RepresentsFirstOrderAt[complete]
- structuredefined in PDE/AutoDiff/Jet/Analytic.leancomplete
structure PDE.AutoDiff.Jet.RepresentsFirstOrderAt {n order : ℕ} (jet : PDE.AutoDiff.Jet (Fin n) ℝ order) (f : ℝ^n → ℝ) (x : ℝ^n) : Prop
structure PDE.AutoDiff.Jet.RepresentsFirstOrderAt {n order : ℕ} (jet : PDE.AutoDiff.Jet (Fin n) ℝ order) (f : ℝ^n → ℝ) (x : ℝ^n) : Prop
A formal jet represents the value and coordinate derivatives of
fatxto first order.The function and point are indices of the proposition rather than duplicated fields. Neighborhood differentiability provides the regularity needed to interpret
partialDerivclassically; the remaining fields identify the formal constant and linear coefficients with the function value and coordinate derivatives.Fields
differentiableEventually : ∀ᶠ (y : ℝ^n) in nhds x, DifferentiableAt ℝ f y
The represented function is differentiable at every point in some neighborhood of
x.value_eq : jet.value = f x
The formal constant coefficient is the function value at
x.firstCoefficient_eq_partialDeriv : ∀ (i : Fin n), PDE.AutoDiff.Jet.firstCoefficient i jet = ∂[i] f x
Every formal linear coordinate coefficient is the corresponding partial derivative.
CAS.Verified.Expr.toJet[complete]CAS.Verified.Expr.toJet_representsFirstOrderAt[complete]
The expression compiler maps every constructor of the verified real expression language to an arbitrary-order multivariate formal jet. Arithmetic nodes use formal power-series algebra. A unary elementary function is lifted by finite formal composition with coefficients computed from normalized symbolic derivatives of the corresponding one-variable primitive.
Under sufficient differentiability and Taylor-remainder hypotheses, this is the familiar finite composition formula
\sum_{k=0}^{N}\frac{g^{(k)}(f(x))}{k!}
\bigl(f(x+h)-f(x)\bigr)^k.
Compilation is algebraically total, but analytic claims retain the original
ValidAt conditions. In particular, division requires a nonzero denominator,
the real logarithm requires a nonzero argument, and the classical square-root
rule requires a positive argument.
Lean code for Definition10.29●2 declarationsAssociated Lean declarationsCAS.Verified.Expr.toJet[complete]CAS.Verified.Expr.toJet_representsFirstOrderAt[complete]
CAS.Verified.Expr.toJet[complete]CAS.Verified.Expr.toJet_representsFirstOrderAt[complete]
- defdefined in PDE/AutoDiff/Jet/Expression.leancomplete
def CAS.Verified.Expr.toJet {ι : Type} [DecidableEq ι] {order : ℕ} (expr : CAS.Verified.Expr ι) (x : ι → ℝ) : PDE.AutoDiff.Jet ι ℝ order
def CAS.Verified.Expr.toJet {ι : Type} [DecidableEq ι] {order : ℕ} (expr : CAS.Verified.Expr ι) (x : ι → ℝ) : PDE.AutoDiff.Jet ι ℝ order
Compile a verified expression at
xinto a multivariate formal jet.This is a proof-only model over
ℝ. Symbolic coefficients can be enclosed by FloatLib; their analytic interpretation requires the separate derivative theorems. The variable typeιis arbitrary. The erased order index selects finite extraction and composition policies and provides no typing invariant. - theoremdefined in PDE/AutoDiff/Jet/Expression.leancomplete
theorem CAS.Verified.Expr.toJet_representsFirstOrderAt {n order : ℕ} (expr : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (horder : 1 ≤ order) (hvalid : CAS.Verified.Expr.ValidAt x.ofLp expr) : (expr.toJet x.ofLp).RepresentsFirstOrderAt (fun y ↦ CAS.Verified.Expr.eval y.ofLp expr) x
theorem CAS.Verified.Expr.toJet_representsFirstOrderAt {n order : ℕ} (expr : CAS.Verified.Expr (Fin n)) (x : ℝ^n) (horder : 1 ≤ order) (hvalid : CAS.Verified.Expr.ValidAt x.ofLp expr) : (expr.toJet x.ofLp).RepresentsFirstOrderAt (fun y ↦ CAS.Verified.Expr.eval y.ofLp expr) x
At positive order, compiling an expression valid at
xproduces a formal jet with first-order calculus semantics for expression evaluation.The certificate includes differentiability on a neighborhood of
x. It does not identify higher coefficients with mixed derivatives or assert convergence of the formal series.
For every positive order and Euclidean expression valid at the base point, the compiled jet agrees with the function value and all first-coordinate derivatives, and the function is differentiable on a neighborhood. Higher coefficients remain formal power-series coefficients unless another theorem identifies their analytic meaning. For example, the exponential jet has fourth coefficient
[h_x^4]\,e^{h_x}=\frac1{4!}=\frac1{24}.
This is a coefficient identity; it does not assert a general higher-order Taylor remainder theorem.
An interval jet assigns a rational interval to each formal multivariate
coefficient. Encloses F J means that every coefficient through the declared
order lies in its interval:
\deg\alpha\le N
\quad\Longrightarrow\quad
J_\alpha\in F_\alpha.
The interval operations are explicit rather than typeclass ring operations. This is necessary because interval multiplication is sound but not distributive.
Lean code for Definition10.30●3 declarationsAssociated Lean declarations
- defdefined in PDE/AutoDiff/Jet/Interval.leancomplete
def PDE.AutoDiff.IntervalJet.{u_1} (ι : Type u_1) (_order : ℕ) : Type u_1
def PDE.AutoDiff.IntervalJet.{u_1} (ι : Type u_1) (_order : ℕ) : Type u_1
Rational interval bounds for the normalized coefficients of an order-indexed jet.
The function is total on multi-indices. Soundness predicates only inspect coefficients through the declared order.
- defdefined in PDE/AutoDiff/Jet/Interval.leancomplete
def PDE.AutoDiff.IntervalJet.Encloses.{u_1} {ι : Type u_1} {order : ℕ} (bounds : PDE.AutoDiff.IntervalJet ι order) (f : PDE.AutoDiff.Jet ι ℝ order) : Prop
def PDE.AutoDiff.IntervalJet.Encloses.{u_1} {ι : Type u_1} {order : ℕ} (bounds : PDE.AutoDiff.IntervalJet ι order) (f : PDE.AutoDiff.Jet ι ℝ order) : Prop
Every relevant interval coefficient contains the corresponding exact jet coefficient.
- theoremdefined in PDE/AutoDiff/Jet/Interval.leancomplete
theorem PDE.AutoDiff.IntervalJet.valueAndGradient_mem_of_representsFirstOrderAt {n order : ℕ} {jet : PDE.AutoDiff.Jet (Fin n) ℝ order} {f : ℝ^n → ℝ} {x : ℝ^n} {F : PDE.AutoDiff.IntervalJet (Fin n) order} (hF : F.Encloses jet) (horder : 1 ≤ order) (hjet : jet.RepresentsFirstOrderAt f x) : F.value.MemReal (f x) ∧ ∀ (i : Fin n), (F.gradient i).MemReal (∂[i] f x)
theorem PDE.AutoDiff.IntervalJet.valueAndGradient_mem_of_representsFirstOrderAt {n order : ℕ} {jet : PDE.AutoDiff.Jet (Fin n) ℝ order} {f : ℝ^n → ℝ} {x : ℝ^n} {F : PDE.AutoDiff.IntervalJet (Fin n) order} (hF : F.Encloses jet) (horder : 1 ≤ order) (hjet : jet.RepresentsFirstOrderAt f x) : F.value.MemReal (f x) ∧ ∀ (i : Fin n), (F.gradient i).MemReal (∂[i] f x)
If the exact formal jet has first-order calculus semantics, its interval value and gradient enclose the function value and its coordinate derivatives.
This theorem transfers a pointwise semantic certificate. It does not turn coefficientwise enclosures into uniform bounds over a box.
Constants, coordinate seeding, addition, subtraction, negation, and power-series convolution preserve coefficient enclosures. At positive order, extracting the constant and first coefficients gives interval values and an output-first interval Jacobian for a vector residual. These intervals contain the corresponding exact formal coefficients. For a scalar jet that represents the function to first order, they also enclose its value and partial derivatives. These guarantees hold at a single input point.
These pointwise enclosures can supply data for validated root finding. The Krawczyk certificate proves existence and uniqueness of a zero in a closed ball from Jacobian enclosures that hold throughout the ball, together with self-mapping and strict contraction inequalities; a jet certificate supplies the corresponding data at one point.
Relationship to computer-assisted PDE proofs.
Gómez-Serrano's survey of computer-assisted proofs in PDE describes a pipeline that combines interval arithmetic, high-order automatic differentiation, rigorous quadrature, singular-integral decompositions, validated root finding, and problem-specific analytic estimates. PDEAtlas has checked foundations for several of these layers:
exact rational interval arithmetic and scalar elementary-function enclosures;
exact symbolic differentiation with explicit analytic domains;
arbitrary-index, arbitrary-order exact multivariate jets;
polynomial interval-jet algebra and certified residual/Jacobian extraction;
closed-ball Krawczyk certificates with interval-matrix residual bounds;
Taylor models and derivative-bound automation, chiefly in one real variable;
rigorous one-dimensional Simpson and Gauss–Legendre quadrature; and
abstract compact-operator, Fredholm, Hilbert-basis, and spectral theory.
The survey's Muskat and SQG results further use principal-value singular-integral splitting, multidimensional interval-Newton solvers, computer-validated spectral gaps, and a quantitative Crandall–Rabinowitz bifurcation argument.
10.6.4. Symbolic PDE Theorem API
To check a proposed heat profile, we hold space fixed while differentiating
in time, then hold time fixed while taking the spatial Laplacian. In the
library's spacetime coordinates p=(t,x,y), time is coordinate zero, so the
calculation is
\partial_0u-\partial_1^2u-\partial_2^2u=0.
For the Gaussian the domain matters, since its formula contains 1/t; the
polynomial x^2+y^2+4t has no such restriction. In both cases cas
computes the coordinate residual, and the slice-Laplacian theorem identifies
the spatial sum with the Laplacian of (x,y)\mapsto u(t,x,y). This is how
the calculation enters the ordinary heat-equation predicate.
The remaining examples ask different questions of the same calculus. Harmonic kernels require a punctured domain and a normalization; transport adds prescribed values at time zero; rigid rotation tests a symmetric gradient rather than a scalar Laplacian. Each theorem states which of these properties has been proved.
The field itself can remain abstract. In
PDE/Examples/Symbolic/CAS/FluxDerivatives.lean, if u is differentiable at
x, u(x)\ne0, and v is a fixed vector, the reciprocal-flux example
proves \nabla\cdot(u^{-1}v)(x)=-Du(x)[v]/u(x)^2.
Here cas differentiates the scalar reciprocal at u(x), and the general
divergence chain rule supplies the dependence on u. Only the stated
pointwise hypotheses are needed.
The symbolically represented planar Gaussian ansatz, interpreted as an ordinary spacetime function, has zero heat residual in spacetime coordinates at positive time, and the CAS proves it. With
\Phi(t,x,y)=\frac{\exp\!\left(-(x^2+y^2)/(4t)\right)}{4\pi t},
the linked Lean theorem states
t>0\quad\Longrightarrow\quad
\partial_t\Phi-\partial_x^2\Phi-\partial_y^2\Phi=0
at (t,x,y). The slice-Laplacian identity turns this into the residual
predicate
\operatorname{SatisfiesPDEProblem}(\operatorname{heatEquation}(\{t>0\}),\Phi).
For the analytic kernel that predicate is the
Gaussian heat theorem; for the
symbolic expression the Lean module derives it in an example.
Lean code for Theorem10.31●1 theoremAssociated Lean declarations
- theoremdefined in PDE/Parabolic/Symbolic/Heat/Gaussian.leancomplete
theorem HeatEquation.Symbolic.Space2.heatKernel2D_spacetime_coordinate_residual_zero_of_time_pos (p : ℝ^3) (ht : 0 < p.ofLp 0) : (∂[0] fun q ↦ CAS.Verified.Expr.eval q.ofLp HeatEquation.Symbolic.Space2.heatKernel2DAnsatz) p - ((∂[1] fun q ↦ CAS.Verified.Expr.eval q.ofLp (CAS.Verified.Expr.diff 1 HeatEquation.Symbolic.Space2.heatKernel2DAnsatz)) p + (∂[2] fun q ↦ CAS.Verified.Expr.eval q.ofLp (CAS.Verified.Expr.diff 2 HeatEquation.Symbolic.Space2.heatKernel2DAnsatz)) p) = 0
theorem HeatEquation.Symbolic.Space2.heatKernel2D_spacetime_coordinate_residual_zero_of_time_pos (p : ℝ^3) (ht : 0 < p.ofLp 0) : (∂[0] fun q ↦ CAS.Verified.Expr.eval q.ofLp HeatEquation.Symbolic.Space2.heatKernel2DAnsatz) p - ((∂[1] fun q ↦ CAS.Verified.Expr.eval q.ofLp (CAS.Verified.Expr.diff 1 HeatEquation.Symbolic.Space2.heatKernel2DAnsatz)) p + (∂[2] fun q ↦ CAS.Verified.Expr.eval q.ofLp (CAS.Verified.Expr.diff 2 HeatEquation.Symbolic.Space2.heatKernel2DAnsatz)) p) = 0
The planar heat-kernel equation in spacetime partial derivatives, proved by the CAS.
This is the coordinate residual of
heat2DEquation: time is coordinate0, and the spatial second derivatives are in coordinates1and2. The version with the Laplacian of the time slice is inPDE.Parabolic.Heat.Kernel.Equation.
Write \xi=(x,y) and r^2=x^2+y^2. Differentiating the prefactor
1/(4\pi t) and the exponential gives
\begin{aligned}
\Phi_t&=\left(\frac{r^2}{4t^2}-\frac1t\right)\Phi,\\
\Phi_{xx}&=\left(\frac{x^2}{4t^2}-\frac1{2t}\right)\Phi,\qquad
\Phi_{yy}=\left(\frac{y^2}{4t^2}-\frac1{2t}\right)\Phi.
\end{aligned}
Adding the two spatial derivatives recovers the time derivative. The CAS
checks this cancellation. The assumption t>0 discharges its time
denominators and the validity conditions needed to interpret both rounds of
differentiation; \pi\ne0 handles the constant denominator. The residual
bridge then gives the displayed equation for the coordinate partial
derivatives.
Positive time also selects the branch on which this formula agrees with
the analytic heat kernel, whose definition is zero for t\le0. At the
spatial origin the positive-time value is 1/(4\pi t), which grows without
bound as t\downarrow0. Thus substituting the definition's value at time
zero cannot establish an initial-trace theorem.
The two-dimensional Gaussian heat kernel satisfies the analytic heat equation on a domain where time is positive. The theorem statement uses the ordinary heat-equation predicate defined in the parabolic API. Its proof comes from the analytic heat-kernel theorem; the CAS computation of the same identity in spacetime coordinates is the symbolic Gaussian bridge.
For every \Omega\subseteq\mathbb R^3,
\left(\forall p\in\Omega,\ 0<\operatorname{time}(p)\right)
\quad\Longrightarrow\quad
\operatorname{SatisfiesPDEProblem}
(\operatorname{heatEquation}(\Omega),\Phi).
Lean code for Theorem10.32●1 theoremAssociated Lean declarations
- theoremdefined in PDE/Parabolic/Heat/Gaussian.leancomplete
theorem HeatEquation.Space2.gaussianHeatKernel_satisfies_heatResidual_on (Ω : Set ℝ^3) (hΩ : ∀ p ∈ Ω, 0 < PDE.time p) : PDE.SatisfiesPDEProblem (HeatEquation.heatEquation Ω) HeatEquation.Space2.gaussianHeatKernel
theorem HeatEquation.Space2.gaussianHeatKernel_satisfies_heatResidual_on (Ω : Set ℝ^3) (hΩ : ∀ p ∈ Ω, 0 < PDE.time p) : PDE.SatisfiesPDEProblem (HeatEquation.heatEquation Ω) HeatEquation.Space2.gaussianHeatKernel
The Gaussian heat kernel has zero heat residual on any domain contained in positive time.
The positive-time assumption supplies the nonzero and positivity conditions
needed when differentiating the Gaussian factor. The heat-kernel calculation
then identifies its time derivative with its spatial Laplacian. Rewriting the
heat residual by that identity gives zero at every point of the stated domain,
which is the SatisfiesPDEProblem conclusion.
The polynomial profile
u(t,x,y)=x^2+y^2+4t
has zero residual for the ordinary two-dimensional heat-equation problem on
all spacetime; the linked SatisfiesPDEProblem theorem is exactly that
residual property.
Lean code for Theorem10.33●1 theoremAssociated Lean declarations
- theoremdefined in PDE/Parabolic/Symbolic/Heat/Polynomial.leancomplete
theorem HeatEquation.Symbolic.Space2.polynomialHeat2D_satisfiesPDEProblem_univ : PDE.SatisfiesPDEProblem (HeatEquation.heatEquation Set.univ) fun p ↦ CAS.Verified.Expr.eval p.ofLp HeatEquation.Symbolic.Space2.polynomialHeat2DAnsatz
theorem HeatEquation.Symbolic.Space2.polynomialHeat2D_satisfiesPDEProblem_univ : PDE.SatisfiesPDEProblem (HeatEquation.heatEquation Set.univ) fun p ↦ CAS.Verified.Expr.eval p.ofLp HeatEquation.Symbolic.Space2.polynomialHeat2DAnsatz
The polynomial
u(t,x,y)=x²+y²+4tsolves the heat equation on all of spacetime.The CAS proves the spacetime coordinate residual. The slice-Laplacian identity used for the Gaussian kernel turns that calculation into the predicate
HeatEquation.heatEquationon all of spacetime.
Here u_t=4, u_{xx}=2, and u_{yy}=2, so the checked residual is
4-2-2=0. Polynomial evaluation and its derivatives are valid everywhere;
the coordinate and fixed-time slice bridges therefore apply on all
spacetime.
LaplacianEquation.Symbolic.laplaceFundamental2DSymbolic_eval_eq_fundamentalSolution[complete]LaplacianEquation.Symbolic.laplacian_laplaceFundamental2DSymbolic_of_ne_zero[complete]LaplacianEquation.Symbolic.fundamentalSolution_three_eq_scaled_newtonianCore3D[complete]LaplacianEquation.Symbolic.laplacian_newtonianCore3D_of_ne_zero[complete]
The linked value bridges identify the logarithmic planar expression with the normalized two-dimensional fundamental solution and the three-dimensional fundamental solution with a constant multiple of the Newtonian core. The symbolic profiles are checked to be harmonic away from the pole, with domain hypotheses kept explicit.
For the Poisson-normalized kernels
\Phi_2(x)=-\frac1{2\pi}\log\|x\|,
\qquad
\Phi_3(x)=\frac1{4\pi\|x\|},
the linked theorems prove
x\neq0\quad\Longrightarrow\quad
\Delta\Phi_2(x)=0
\quad\text{and}\quad
\Delta\Phi_3(x)=0.
Lean code for Theorem10.34●4 theoremsAssociated Lean declarationsLaplacianEquation.Symbolic.laplaceFundamental2DSymbolic_eval_eq_fundamentalSolution[complete]LaplacianEquation.Symbolic.laplacian_laplaceFundamental2DSymbolic_of_ne_zero[complete]LaplacianEquation.Symbolic.fundamentalSolution_three_eq_scaled_newtonianCore3D[complete]LaplacianEquation.Symbolic.laplacian_newtonianCore3D_of_ne_zero[complete]
LaplacianEquation.Symbolic.laplaceFundamental2DSymbolic_eval_eq_fundamentalSolution[complete]LaplacianEquation.Symbolic.laplacian_laplaceFundamental2DSymbolic_of_ne_zero[complete]LaplacianEquation.Symbolic.fundamentalSolution_three_eq_scaled_newtonianCore3D[complete]LaplacianEquation.Symbolic.laplacian_newtonianCore3D_of_ne_zero[complete]
- theoremdefined in PDE/Elliptic/Symbolic/Radial/Logarithmic.leancomplete
theorem LaplacianEquation.Symbolic.laplaceFundamental2DSymbolic_eval_eq_fundamentalSolution (p : ℝ^2) (hp : p ∈ LaplacianEquation.Symbolic.puncturedPlane2D) : CAS.Verified.Expr.eval p.ofLp LaplacianEquation.Symbolic.laplaceFundamental2DSymbolic = PotentialTheory.fundamentalSolution 2 p
theorem LaplacianEquation.Symbolic.laplaceFundamental2DSymbolic_eval_eq_fundamentalSolution (p : ℝ^2) (hp : p ∈ LaplacianEquation.Symbolic.puncturedPlane2D) : CAS.Verified.Expr.eval p.ofLp LaplacianEquation.Symbolic.laplaceFundamental2DSymbolic = PotentialTheory.fundamentalSolution 2 p
The symbolic normalized logarithmic fundamental solution agrees with the analytic
PotentialTheory.fundamentalSolution 2away from the pole.The residual theorems below are therefore about the same function as the analytic potential theory.
- theoremdefined in PDE/Elliptic/Symbolic/Radial/Logarithmic.leancomplete
theorem LaplacianEquation.Symbolic.laplacian_laplaceFundamental2DSymbolic_of_ne_zero (p : ℝ^2) (hp : p ∈ LaplacianEquation.Symbolic.puncturedPlane2D) : PDE.laplacian (fun q ↦ CAS.Verified.Expr.eval q.ofLp LaplacianEquation.Symbolic.laplaceFundamental2DSymbolic) p = 0
theorem LaplacianEquation.Symbolic.laplacian_laplaceFundamental2DSymbolic_of_ne_zero (p : ℝ^2) (hp : p ∈ LaplacianEquation.Symbolic.puncturedPlane2D) : PDE.laplacian (fun q ↦ CAS.Verified.Expr.eval q.ofLp LaplacianEquation.Symbolic.laplaceFundamental2DSymbolic) p = 0
Analytic Laplacian theorem for the normalized two-dimensional fundamental expression.
Ordinary Lean proves validity of the logarithmic expression away from the pole. The checked CAS closes only the constant-scaled symbolic residual, and the derivative identity transports that result to the Euclidean Laplacian.
- theoremdefined in PDE/Elliptic/Symbolic/Radial/Newtonian.leancomplete
theorem LaplacianEquation.Symbolic.fundamentalSolution_three_eq_scaled_newtonianCore3D (p : ℝ^3) : PotentialTheory.fundamentalSolution 3 p = 1 / ((3 - 2) * 3 * PDE.Analysis.unitBallVolume 3) * CAS.Verified.Expr.eval p.ofLp LaplacianEquation.Symbolic.newtonianCore3D
theorem LaplacianEquation.Symbolic.fundamentalSolution_three_eq_scaled_newtonianCore3D (p : ℝ^3) : PotentialTheory.fundamentalSolution 3 p = 1 / ((3 - 2) * 3 * PDE.Analysis.unitBallVolume 3) * CAS.Verified.Expr.eval p.ofLp LaplacianEquation.Symbolic.newtonianCore3D
Relation to the analytic three-dimensional fundamental solution.
The Evans/Poisson fundamental solution is the Newtonian radial core multiplied by its dimension-dependent normalization constant.
- theoremdefined in PDE/Elliptic/Symbolic/Radial/Newtonian.leancomplete
theorem LaplacianEquation.Symbolic.laplacian_newtonianCore3D_of_ne_zero (p : ℝ^3) (hp : p ∈ LaplacianEquation.Symbolic.puncturedSpace3D) : PDE.laplacian (fun q ↦ CAS.Verified.Expr.eval q.ofLp LaplacianEquation.Symbolic.newtonianCore3D) p = 0
theorem LaplacianEquation.Symbolic.laplacian_newtonianCore3D_of_ne_zero (p : ℝ^3) (hp : p ∈ LaplacianEquation.Symbolic.puncturedSpace3D) : PDE.laplacian (fun q ↦ CAS.Verified.Expr.eval q.ofLp LaplacianEquation.Symbolic.newtonianCore3D) p = 0
The symbolic Newtonian core has zero analytic Laplacian on punctured
ℝ^3.
For the planar logarithmic expression, Theorem 10.23
transports the checked CAS residual to the analytic Laplacian. The Newtonian
core instead reuses the general radial-Laplacian identity: the coefficient
k(k+2-n) vanishes at k=1, n=3. Its value bridge identifies the
reflected expression with the inverse norm; constant scaling gives the
normalized fundamental solution.
Harmonicity away from the pole cannot determine the normalization: every
constant multiple of a harmonic profile is still harmonic there. In three
dimensions the unit-source normalization is visible in the flux through a
sphere of radius r>0:
-\int_{\partial B_r}\nabla\Phi_3\cdot n\,dS
=-\left(-\frac{1}{4\pi r^2}\right)4\pi r^2=1.
This calculation explains why the coefficient 1/(4\pi) matters. A
distributional identity -\Delta\Phi_3=\delta_0 must account for that
flux at the excluded pole, which the pointwise zero-residual theorem does not
see.
10.6.4.1. One profile, two equations
The profile u(t,x)=\sin(x-t) solves two different equations. We use it as
a small example of the wave and
transport interfaces:
\partial_t^2u-\partial_x^2u=0,
\qquad
\partial_tu+\partial_xu=0,
\qquad
u(0,x)=\sin x.
The checked examples live in PDE/Examples/Hyperbolic. The wave theorem
records the zero residual on all spacetime; the transport theorem also
checks the assigned value u(0,x)=\sin x by substitution. That part of
its proof is a slice equality, with no limiting argument. The derivative
calculation is short:
u_t=-\cos(x-t) and u_x=\cos(x-t) cancel, while
u_{tt}=u_{xx}=-\sin(x-t).
For the wave calculation, the derivative bridge transfers the symbolic identity to ordinary derivatives. The transport example applies the checked derivative tactic directly to the ordinary function. Both calculations then feed the library's PDE predicates.
We can also integrate the residual. For this profile, the symbolic residual equals the ordinary advective derivative at every point, so their integrals agree on every set and both vanish.
Writing R_{\mathrm{sym}} for the reflected residual and
D_bu=\partial_tu+\partial_xu, the example proves
R_{\mathrm{sym}}(p)=D_bu(p),\qquad
\int_\Omega R_{\mathrm{sym}}\,dp
=\int_\Omega D_bu\,dp,\qquad
\int_\Omega D_bu\,dp=0
for every p\in\mathbb R^2 and every set \Omega\subseteq\mathbb R^2.
A conservation-law weak formulation needs more, including test functions
and the initial or boundary terms.
10.6.4.2. Rigid rotation
For the planar rigid rotation u(x,y)=(-y,x), every entry of the symmetric
gradient vanishes. Consequently its small-strain energy density integrates to
zero on every domain. The public theorem is an ordinary integral identity;
the symbolic engine is used only to calculate the coordinate derivatives and
close the pointwise algebra.
Lean code for Theorem10.35●1 theoremAssociated Lean declarations
- theoremdefined in PDE/Elliptic/Symbolic/VariationalIntegrands.leancomplete
theorem VariationalEquation.Symbolic.rigid_rotation_sym_energy_density_integral_zero (Ω : Set ℝ^2) : ∫ (q : ℝ^2) in Ω, VariationalEquation.Symbolic.rigidRotationSymEnergyDensity2 q = 0
theorem VariationalEquation.Symbolic.rigid_rotation_sym_energy_density_integral_zero (Ω : Set ℝ^2) : ∫ (q : ℝ^2) in Ω, VariationalEquation.Symbolic.rigidRotationSymEnergyDensity2 q = 0
Euclidean coordinate-partial integral zero for rigid-rotation small-strain energy.
The checked derivative bridge computes the four coordinate derivatives of
(-y,x) as 0,-1,1,0. Each symmetric-gradient entry therefore vanishes,
so the sum of their squares is pointwise zero. Integral congruence gives
the result on every set.

