Skip to main content

omnist/ops/
mod.rs

1//! Schema algebra: `prune`, `minimize`/`normalize`, `subschema`, `extract`,
2//! `lint`, `isomorphic`, `signature` -- ported from `~/dev/omnist/omnist/ops/`
3//! (issue #12), one module per op (matching the Python layout, which is
4//! already a reasonable structure per "architecture freedom").
5//!
6//! ## The `any` type
7//!
8//! [`crate::schema::FieldType`] has three kinds: `Scalar`, `Ref`, and `Any`
9//! (issue #29). Every op in this family treats `Any` the same way the
10//! Python reference's `AnyType` is treated in the corresponding op:
11//! satisfiability treats it like a `Scalar` (always satisfiable, never
12//! blocks a mandatory field); `local_signature`/minimize give it its own
13//! target-blind shape key (`("any",)`); `subschema` treats `any` on the
14//! superschema side as absorbing everything, and `any` only on the
15//! subschema side as never compatible with a non-`any` target; `lint`'s
16//! `lint.any-field` check inventories every `Any`-typed field in the schema.
17//!
18//! ## Determinism
19//!
20//! Every op here produces a "canonical form" (a pruned/minimized schema, a
21//! sorted lint report, a deterministic equivalence-class partition). None of
22//! this module's code uses `std::collections::HashMap`/`HashSet` --
23//! `indexmap`'s `IndexMap`/`IndexSet` everywhere an ordered structure is
24//! needed, and an explicit `.sort()` everywhere the Python reference itself
25//! sorts for canonical output (see `signature::local_signature`, `lint::lint`,
26//! `minimize::normalize`). See `tests.rs` for the repeated-run determinism
27//! proof and the `omnist-ts#56` ordering-regression tests (codepoint, not
28//! locale, order; `prune`'s declaration-order environment reconstruction).
29
30pub mod extract;
31pub mod isomorphic;
32pub mod lint;
33pub mod minimize;
34pub mod prune;
35pub mod signature;
36pub mod subschema;
37
38pub use extract::extract;
39pub use isomorphic::is_isomorphic;
40pub use lint::{LintFinding, lint};
41pub use minimize::{equivalence_classes, normalize};
42pub use prune::{is_empty, prune, satisfiable_set};
43pub use signature::local_signature;
44pub use subschema::{compatible_with, equivalent};
45
46#[cfg(test)]
47mod tests;