Expand description
Satisfiability analysis and schema pruning. Ported from
~/dev/omnist/omnist/ops/prune.py.
A record is satisfiable iff it admits at least one finite document, and
prune returns an equivalent schema with everything that can never
match removed. Satisfiability is a least fixpoint over the env’s records:
a record is satisfiable iff every field with min >= 1 is either a
Scalar or a Ref to a satisfiable record (fields with min == 0 never
block satisfiability – they simply need not be emitted).
Functions§
- is_
empty - True iff
s’s root record is unsatisfiable – the schema’s language (the set of documents it accepts) is empty. - prune
- An equivalent schema with everything that can never match removed:
records unreachable from root are dropped; fields with
max == 0are dropped; optional (min == 0) fields whose type is an unsatisfiable record are dropped; records left unreachable/unsatisfiable after the above are dropped from the environment too. - satisfiable_
set - The set of env record names that admit at least one finite document.