Ast #
ODE RHS expression language + interval evaluator.
This is a small companion to the existing PINN PDE DSL, specialized for ODE IVPs:
$$ u'(t)=f(t,u(t)). $$
We use conservative interval arithmetic over α × α intervals (for any scalar α with a
Context instance), with a few common transcendentals (sin, cos, exp, log) needed by the
benchmarks in arXiv:2601.19818.
For the trigonometric cases we use a 1-Lipschitz enclosure around the midpoint and then clamp to
$[-1,1]$. Over real-valued semantics this is the intended enclosure argument; executable scalar
backends rely on their Context operations matching the assumed real behavior closely enough for
the checker mode being used.
Expr is an AST for ODE right-hand sides $f(t,u)$.
We cover the arithmetic and elementary functions needed by the ODE certificate format used in
TorchLean: constants, the independent variable t, the state variable u, field arithmetic, and
the common scalar functions sin, cos, exp, and log. Keeping this language explicit makes
the checker easier to inspect while still covering the benchmark equations we want to verify.
- const (c : Float) : Expr
- t : Expr
- u : Expr
- add (a b : Expr) : Expr
- sub (a b : Expr) : Expr
- mul (a b : Expr) : Expr
- div (a b : Expr) : Expr
- neg (a : Expr) : Expr
- sin (a : Expr) : Expr
- cos (a : Expr) : Expr
- exp (a : Expr) : Expr
- log (a : Expr) : Expr
Instances For
Interval primitives used by eval.
These operations are written against the abstract scalar interface Context α so we can evaluate
the same expression under Float or IEEE32Exec (or other executable scalars).
Whether a checker scalar is finite under the supported Float and IEEE32Exec backends.
Both backends produce NaN for $\infty-\infty$ and for $\mathrm{NaN}-\mathrm{NaN}$, whereas every
finite value subtracts
from itself to zero. Expressing the guard through Context keeps the interval evaluator generic
without relying on a backend-specific bit decoder.
Instances For
Boolean $x\leq y$ test that rejects NaN and infinite endpoints.
Writing this as $\neg(x>y)$ would treat unordered values as less than or equal to every value. Some
host Float comparisons also use a total implementation order, so the explicit finite guards are
part of the certificate check rather than an optimization.
Instances For
Minimum of two scalar endpoints, propagating a non-finite operand so later checks reject it.
Instances For
Maximum of two scalar endpoints, propagating a non-finite operand so later checks reject it.
Instances For
Interval evaluation for Expr.
evalWithFuel uses a fuel parameter so the evaluator is total even for malformed/self-referential
expressions (though Expr itself has no recursion).