Parse #
Hand-rolled parser for ODE RHS expressions.
Grammar (informal): expr := term (('+' | '-') term)* term := factor (('' | '/') factor) factor := unary ('^' nat)? unary := '-' unary | primary primary:= number | 't' | 'u' | ident '(' expr ')' | ident | '(' expr ')'
Supported unary functions: sin, cos, exp, log. Supported identifiers: pi.
Exponentiation is expanded into repeated multiplication when ^ n is given.
This parser is part of the executable ODE verifier. We keep the grammar direct and hand-written so that the accepted certificate syntax is visible in one file, with predictable errors and no hidden parser-combinator behavior.
The output AST is NN.Verification.ODE.Ast.Expr.
Parser state and low-level helpers #
Peek at the current character, if any, without advancing.
Instances For
Advance the current position by one character.
Instances For
A fuel budget derived from the remaining input length (used to guarantee termination).
Instances For
Internal: ASCII whitespace predicate used by skipWs.
Instances For
Skip ASCII whitespace (' ', '\t', '\n').
Instances For
Built-in constants and unary functions #
Internal: interpret built-in constants like pi / π.
Instances For
Recursive descent: expression/term/factor/unary/primary #
Internal: parse an expr (addition/subtraction chain), with an explicit fuel budget.
This is a plain def (not private) because the module is in a public section for
export/doc tooling, and Lean 4.29 disallows referring to private declarations from
public ones.