latex-gate
The groupant beside latex/src/gate.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.
Facts
Implementation material. A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.
Components
| component | label | where |
|---|---|---|
| approximant | partial | approximant |
| ast | partial | syntax.json |
| composition | partial | composition |
| descriptant | present | descriptant |
| invariant | partial | invariant |
| tests | executed bounded checks | tests |
Obernants
The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.
| id | type | label | where |
|---|---|---|---|
behavior_complement | behavior_complement | partial source derived model | behavior_complement |
reverse_reconstruction | reverse_reconstruction | partial source derived model | reverse_reconstruction |
failure_order | failure_order | partial source derived model | failure_order |
fault_support | fault_support | partial source derived model | fault_support |
observation | observation | partial source derived model | observation |
payload | payload | partial source derived model | payload |
Model text
descriptant
latex-gate
check_printed parses printer output: Err→ReparseError, equal→Ok, unequal→Mismatch retaining candidate. check/check_faulty select printer. affected ORs structural fault predicates during walk; roundtrip first parses original source.
Epoch 2026-10-31: complete sources read before tests/model edits. Partial source-bound modeling; no production optimization or speed claim. Nested fragments share the parent lexical syntax. Caller/callee contracts outside owned files remain delegated.
approximant
Forward relation
check_printed parses printer output: Err→ReparseError, equal→Ok, unequal→Mismatch retaining candidate. check/check_faulty select printer. affected ORs structural fault predicates during walk; roundtrip first parses original source.
Domain and executable surrogate gap
Bounded UTF-8 inputs and synthetic local files; supported parser-produced trees and representable arithmetic. Arbitrary public constructors are not certified total. Exact categorical semantics lack a useful percentage surrogate; no executable approximant attachment. Future numerical profiles require an explicit metric, zero case, source/evidence binding and supported 1/2/5/10% cap. Failure/effect differences cannot count as numerical error.
invariant
Invariant
Failure retains exact printed string; equality structural per AST contract, not numeric truth. No I/O. Arbitrary empty/manual trees not promised accepted.
Cost
Tprint(N)+Tparse(L)+Teq plus O(L+N') storage; affected visits all nodes O(N), no early exit.
Allocation failure, stack exhaustion and unchecked counter overflow have no additional certificate. No timing claim or global error bound.
composition
Composition
check_printed parses printer output: Err→ReparseError, equal→Ok, unequal→Mismatch retaining candidate. check/check_faulty select printer. affected ORs structural fault predicates during walk; roundtrip first parses original source.
Failure retains exact printed string; equality structural per AST contract, not numeric truth. No I/O. Arbitrary empty/manual trees not promised accepted.
Parser, printer, AST equality, Macros, Rat and evaluator dependencies retain their own contracts. Structural roundtrip is not arithmetic definedness or numeric truth. Exact lexical binding does not prove caller/callee semantics.
models
behavior_complement
Failed candidate parse or unequal tree cannot return Ok. Original parse error excludes printing. affected false does not prove arbitrary AST printer correctness.
reverse_reconstruction
Ok preimage trees equal to reparse chosen print; many original spellings share tree. Mismatch/ReparseError lose original tree, admitting every original producing stored candidate under selected print.
failure_order
Original parse before print; candidate parse before equality.
fault_support
SwapFrac unequal parts, DropSup existing sup, DropLast Row len>=3.
observation
Textual change irrelevant if tree equal; no arithmetic definedness check.
payload
Mismatch boxes candidate, ReparseError retains Error, Ok discards print.
tests
Selected evidence
cargo test -p latex --features math --lib gate::tests
Two debug/two release executions retained matching sorted named outcomes. External wave28 latexbridge receipts retain numeric exits, compiled assertion controls, restoration, feature checks and source-test map. This scope is not exhaustive branch coverage; parent tests may only exercise some child transitions. Frozen VMM DATA/classification/hash subprocess, live corpus, teacher/API, training/GPU excluded. Reexport/feature compilation is separate from runtime semantics.
Recorded outcome, 2026-10-31
Selected source tests: 1. See evidence.json for exact names, source/log hashes and paired debug/release receipts. Control prefix: control-gate; when present compile=0, assertion-failure=101, restored-positive=0. Seven distinct controls total across this subsystem; bridge implementation shares its integration-test control. No independent runtime control for reexports. Strict Clippy returned 101 on 14 pre-existing library lints in unchanged code.
This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/latex/src/gate.rs.groupant/