Scope and limitations
Octant translates a bounded subset of mathematical LaTeX. When the input falls outside that subset, Octant fails fast with a structured error rather than silently producing wrong Chelis. This chapter describes what Octant does not translate, the rewrite for each case, and the error catalog organized by exit code.
What Octant does not do
Section titled “What Octant does not do”Octant translates math. It does not render LaTeX to PDF or any visual format, does not handle arbitrary LaTeX text or document structure, does not execute the resulting Chelis program, and does not translate Chelis back into LaTeX. Verifying the resulting program against properties is a separate Chelis step downstream.
Constructs outside the subset
Section titled “Constructs outside the subset”Each construct below produces a clean error. Fix it at the source before translating.
Custom macros (\newcommand)
Section titled “Custom macros (\newcommand)”Macro expansion is out of scope. Pre-expand macros with a tool such as
latexpand or de-macro, or your editor's macro expansion, then
translate the expanded LaTeX.
\begin{align} rows
Section titled “\begin{align} rows”The & row separator is unhandled. The \begin{align} shell parses but
each & raises an unrecognized-character error. Split the alignment into
multiple \begin{equation} blocks.
f'(x) prime derivative
Section titled “f'(x) prime derivative”The prime token is not tokenized as a derivative. Use \frac{df}{dx} or
\frac{\partial f}{\partial x} instead.
\dot{x} time derivative
Section titled “\dot{x} time derivative”\dot{x} would denote a time derivative, but there is no way to
introduce the implicit time variable. Rewrite as \frac{dx}{dt} with an
explicit % chelis: t : f32 annotation. \ddot{x} becomes
\frac{d^2 x}{d t^2}. The accent decorators \hat{x}, \bar{x}, and
\tilde{x} error as unknown commands; rewrite the accented identifier to
a distinct name (for example \hat{y} to y_hat). The purely
typographic decorators \vec{x}, \mathbf{x}, and \boldsymbol{x}
strip silently.
Set-membership iteration (\sum_{i \in S})
Section titled “Set-membership iteration (\sum_{i \in S})”\in is not a recognized command. Rewrite to the bounded form
\sum_{i=1}^{|S|}, materializing the index set up front.
(x)^+ positive-part shorthand
Section titled “(x)^+ positive-part shorthand”The trailing-plus superscript is not recognized. Write \max(x, 0)
directly.
Joint probability \mathbb{P}(A, B)
Section titled “Joint probability \mathbb{P}(A, B)”The parser reads \mathbb{P}(...) as conditional probability, so the
comma is unexpected. Use \mathbb{P}(A \cap B) if your context defines
cap, or split into two probabilities and handle the join in the
surrounding Chelis.
Inner product \langle x, y \rangle
Section titled “Inner product \langle x, y \rangle”\langle is not recognized. Use x \cdot y for the dot product, or
rewrite explicitly as \sum_i x_i y_i.
Comparison operators (<, >, \leq, \geq)
Section titled “Comparison operators (<, >, \leq, \geq)”These are not supported as free binary operators. They are permitted only
inside indicator-condition position and the \sum lower-bound syntax.
Beta short form B(a, b)
Section titled “Beta short form B(a, b)”The parser does not surface multi-argument paren calls on a bare
identifier. Use \text{Beta}(a, b), which routes through the Beta
mapping, or build via \Gamma-based identities.
Integrals (\int_a^b f(x) dx)
Section titled “Integrals (\int_a^b f(x) dx)”Octant requires a known closed form and does not ship a closed-form recognizer, so every integral errors. Hand-expand the integral to its closed-form expression and translate that.
Error catalog by exit code
Section titled “Error catalog by exit code”Octant's diagnostics follow the form
<source>:<line>:<col>: error[<category>]: <message>, followed by a
caret-underlined source block and an optional = help: line. The exit
code reflects the category.
Exit 1, parse errors
Section titled “Exit 1, parse errors”The LaTeX failed to tokenize or parse. Common cases:
- Empty input (an empty file, only whitespace, or only
% chelis:comments). Add the formula; magic comments alone are not a program. - An unterminated
{in a\fracnumerator or denominator. Close the brace; the caret points at the unclosed{. - An empty
{}where a body is required, for example\frac{}{b}. Provide a body. - Mismatched
\leftand\right, for example\left( x \right]. Match the closer to the opener. - A stray
\rightwith no matching\left. Remove the\rightor add the\left. - An unterminated
(on a bare identifier, for exampleB(a, b). Use the backslash-prefixed function form. - An unclosed paren after a function call, for example
\sin(x. Close the parenthesis. - A
\sqrtwith no radicand. Add the brace argument,\sqrt{x}. - An unrecognized character (
&,', a non-ASCII letter that is not a Greek-letter command). Rewrite using supported syntax. - A malformed magic comment, for example a stray
:inr ::: f64or an unknown primitive type. Use the<names> : <type>form with a recognized primitive.
Exit 2, type inference errors
Section titled “Exit 2, type inference errors”Type inference rejected the program. Common cases:
- An unbound identifier: a free identifier with no
% chelis:annotation, that is not a known constant, and is not bound by a sum or product. Add the annotation. The message includes the suggested form. Subscripted identifiers flatten, sox_ineeds% chelis: x_i : f32; annotating barexdoes not satisfyx_i. - A type mismatch: two operands with incompatible types, for example a
boolmixed with numeric arithmetic. Fix the annotation, or keep thebooland numeric values apart. Indicators are the standard way to turn a predicate into a numeric value. - A custom symbol not in scope, for example
\mathbb{P}(a | b)with no import bringingcond_probabilityinto scope. Add the import.
Octant does not enforce builtin function arity. It maps the LaTeX name to
its Chelis target without claiming a signature; the Chelis compiler
resolves the arity at build time. So \max(x) with one argument
translates without error, and the mismatch surfaces as a Chelis-side
diagnostic, with the spans manifest still pointing back to the LaTeX.
Exit 3, unsupported constructs
Section titled “Exit 3, unsupported constructs”A LaTeX construct outside the supported subset. These are the constructs
listed above: custom macros, integrals, ambiguous or unbounded sum
bounds, non-math environments, and unknown commands. The message names
the construct and, for unknown commands, suggests checking the supported
subset or registering a mapping with --config.
Exit 4, I/O errors
Section titled “Exit 4, I/O errors”A filesystem or stdio failure: an input file that does not exist or is
not readable, or a --config file that could not be opened. Check the
path. Use - for stdin.
Exit 5, encoding errors
Section titled “Exit 5, encoding errors”The input bytes are not valid UTF-8, or an unsupported encoding was
requested through --input-encoding. Octant reads UTF-8 only. Convert
the input first, for example with iconv, then translate without the
encoding flag.