latex-corpus
The groupant beside latex/src/corpus.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 |
limit_order | limit_order | partial source derived model | limit_order |
record_policy | record_policy | partial source derived model | record_policy |
report_order | report_order | partial source derived model | report_order |
effect_prefix | effect_prefix | partial source derived model | effect_prefix |
Parts
Model text
descriptant
latex-corpus
collect sorts directory entries and filters suffix .xml.gz/.xml/.tex. run skips read errors, scans macros per tex file, or literal XML record/id/title/abstract with first-ID global dedup. process extracts whole text before checking formula limit; counts formula/hash then parse, unknown/clean, gate and optional Expr/relation bridge. Output writes occur after report construction, nontransactionally.
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
collect sorts directory entries and filters suffix .xml.gz/.xml/.tex. run skips read errors, scans macros per tex file, or literal XML record/id/title/abstract with first-ID global dedup. process extracts whole text before checking formula limit; counts formula/hash then parse, unknown/clean, gate and optional Expr/relation bridge. Output writes occur after report construction, nontransactionally.
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
formulas=parsed+sum(error counts), rt_ok+rt_fail=parsed, clean<=parsed, distinct_clean subset distinct. Unknown counts are occurrences. Elapsed fields and count-only error-sort ties nondeterministic.
Cost
Directory sorting sum O(d log d), decoded file plus path/ID/hash sets retained. Extraction can rescan quadratically; parse/gate/bridge delegated. Error samples cap12/kind, gate40, bridge60; sets unbounded.
Allocation failure, stack exhaustion and unchecked counter overflow have no additional certificate. No timing claim or global error bound.
composition
Composition
collect sorts directory entries and filters suffix .xml.gz/.xml/.tex. run skips read errors, scans macros per tex file, or literal XML record/id/title/abstract with first-ID global dedup. process extracts whole text before checking formula limit; counts formula/hash then parse, unknown/clean, gate and optional Expr/relation bridge. Output writes occur after report construction, nontransactionally.
formulas=parsed+sum(error counts), rt_ok+rt_fail=parsed, clean<=parsed, distinct_clean subset distinct. Unknown counts are occurrences. Elapsed fields and count-only error-sort ties nondeterministic.
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
Zero limit excludes formula parse but not extraction errors. Duplicate IDs exclude later title/abstract. Parse error excludes gate/bridge counts. out=None excludes writes. Selected suffix does not imply valid document.
reverse_reconstruction
Report preimage contains many documents with differing ignored prose, duplicates and capped samples. Hash cardinalities cannot reconstruct formulas and may collide. Rounded durations and examples lose information; outputs do not recover source paths or macro states.
limit_order
Extraction bad count precedes limit; return true means a subsequent formula encountered at limit, not just count==limit.
record_policy
ID-less ignored; first textual ID wins; title before abstract; macros only for tex.
report_order
Unknown and bridge reasons have lexical tie-break, errors only descending count.
effect_prefix
unknown.tsv→errors.tsv→roundtrip-fail.tsv→optional bridge-sample.tsv→summary.md can leave partial/stale files.
tests
Selected evidence
cargo test -p latex --features math --bin latex wave28
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: 2. See evidence.json for exact names, source/log hashes and paired debug/release receipts. Control prefix: effect; 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/corpus.rs.groupant/