Logical Inference from Schematron Schemas

A schema can be reduced to a set of logical propositions.
Schemas in different language can be reduced and thus combined.
These proposition can be queried as a system.
The queries can validate the schema does not have inconsistencies,
and to give user guidance about allowed elemetns during editing or validity.

In this note the schema language could be Schematron,
the reduction could be an XSL transformation, and the query system
is Prolog-ish.

Bootstrap

First, we provide some bootstrapping relationships for Trees
and schemas.

Obviously there are many more relations that need to be coped with.
In particular, schemas are often incomplete, so validation involves no tests being false
rather than no tests being undecidable. And we need to make the distinction
between an element x and every element x if we want to move to less
single-element-at-a-time sessions. Because Schemas exhibit great locality effect,
it is quite possible that traversing a document in document order, loading the parent/sibling/children propositions from the instance, doing the validation or making quereis,
and then rolloing back the instance data and moving on, may be just as efficient as loading the
complete instance as propositions.