Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

Merge remote-tracking branch 'origin/main' into verdict-by-construction

FABIOTESSe0a635d13e21
diff --cc CHANGELOG.md
index 70f2ef48,859d73dc..0ff00af7
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -64,47 -64,57 +64,98 @@@ All notable changes to Open Ontologies
already said the numbers belong in the test output, three sections before writing them out.
### Changed
+- **A certified verdict is now unconstructible without the evidence, so laundering one is a
+ compile error rather than a test failure.** The discipline that `model_checked` requires
+ `checker_exit == 0`, that `preserved_checked` requires an accepted `oo-cert` run, and that
+ `checked` requires a zero exit code off a Lean binary, used to be carried by comments saying
+ "the ONE place this word is produced" and by tests that walked a serialised report looking for
+ a checked word with nothing behind it. Those tests were right and they still run. They were
+ also incomplete by construction: a new module that formatted `"model_checked"` in a new place
+ passed every one of them until somebody noticed and pointed a guard at it. `src/verdict.rs`
+ now holds the whole certified vocabulary. `Certified` has a private field and no constructor,
+ `CheckerRun` has private fields and one constructor that SPAWNS the checker and reads its exit
+ status, and `CheckerRun::accepted` is the only function in the crate that returns a `Certified`
+ and returns `None` on any non-zero exit. Every certified variant carries one:
+ `FolVerdict::ModelChecked`, `GoalVerdict::PreservedChecked`,
+ `GoalVerdict::PreservedUnderSuppliedRulesChecked`, `ClosureVerdict::Checked`,
+ `Warrant::Checked`, `CheckerStatus::Accepted` and `OwlReading`. The theorem name travels
+ inside the token rather than beside it, so `OOCert.certificate_sound`,
+ `OOCert.horn_certificate_sound` and `Fol.satisfiable_of_check` are unspeakable on a path that
+ did not run a checker either. Six `compile_fail` doctests run under `cargo test` and fail if
+ any of that stops being true; the induced error is E0451, "field `theorem` of struct
+ `Certified` is private". None of these types implements `Deserialize`, because parsing
+ `"preserved_checked"` out of somebody else's JSON is not the same act as earning it and a
+ derive would be a public constructor for the certified state; reports are read back as
+ `serde_json::Value`, which is what every caller already did. The WIRE FORMAT is unchanged:
+ `Serialize` is hand-written to emit the same bare string the derive emitted, verified
+ byte-for-byte against a binary built from the previous commit over `preserve`, `fol-model`,
+ `closure-diff`, `reason`, `reason --rules`, `rules-import` and three MCP `tools/call`
+ responses.
+- **The MCP server no longer advertises eight tools it cannot serve.** `onto_plugin_list`,
+ `onto_plugin_call`, `onto_embed`, `onto_hnsw_build`, `onto_search`, `onto_similarity`,
+ `onto_import_schema` and `onto_sql_ingest` each have a body that is
+ `#[cfg(not(feature = ...))] { return "Compiled without X feature" }`, so on a default build
+ every call to one of them fails for every input. They were listed in `tools/list` anyway: a
+ client read a description about embeddings or a Postgres URL, called the tool, and got an
+ error that had nothing to do with what it asked. `toolfilter::remove_unavailable` now drops
+ their routes before the operator's own filter and independently of its mode, so a default
+ build advertises 106 of the 114 registered tools and says which eight are missing and which
+ Cargo feature brings each one back. The server's instructions string used to state two
+ hand-typed totals, 114 and 112, neither of which was the number the router advertised, and to
+ promise that the eight WERE advertised; it is formatted from `tool_router.list_all()` now, so
+ there is no literal left to go stale.
+
+ - **The bridge to the specification was prose. It is a theorem.** `lean/OOCert/Conforming.lean`
+ formalises an OWL 2 RDF-Based interpretation in core Lean as `OOCert.Interpretation`: the parts
+ of RBS Table 5.1, with `IR` as the carrier type so that the table's `IP ⊆ IR`, `IC ⊆ IR`,
+ `ICEXT(x) ⊆ IR` and `IEXT(x) ⊆ IR × IR` hold by typing, plus `IS`, `IL`, the blank-node
+ assignment of RDF 1.1 Semantics section 5.1, and `ICEXT` and `IC` as definitions per section 9.
+ Truth is section 5's clause with its `I(p) is in IP` conjunct, stated as the specification
+ states it. `OOCert.Conforming` collects thirty fields, twenty-nine of them a quoted cell and the
+ thirtieth Table 5.1's `IR ≠ ∅`: Table 5.8 in both directions, Tables 5.9, 5.12 and 5.13 forward only, Table 5.6's
+ three restriction rows with the outer `if-then` and the consequent equality, the typing rows of
+ Tables 5.2 and 5.3, Tables 5.4 and 5.5 forward, and five axiomatic triples.
+ `OOCert.Conforming.toW3C` proves that every such interpretation carries `W3C` at full strength,
+ `OOCert.Conforming.toW3CModel` carries that to `W3CModel` including proving that every `Chain G`
+ list is a semantic sequence in the specification's sense, and
+ `OOCert.certificate_conforming_sound` is the sentence `certificate_w3c_sound`'s docstring says
+ of itself that it is not: a checked certificate's conclusions hold in every conforming
+ interpretation of the asserted graph. Its statement mentions no structure of this repository's
+ invention.
+ **The five `IP` memberships the old bridge assumed are discharged, not moved.** Each is a field
+ asserting one axiomatic triple whose own predicate is the wanted term, so the truth clause hands
+ the fact back as the triple's first conjunct: `rdf:type rdf:type rdf:Property .`,
+ `rdfs:Datatype rdfs:subClassOf rdfs:Class .`,
+ `rdfs:isDefinedBy rdfs:subPropertyOf rdfs:seeAlso .`,
+ `rdf:type rdfs:domain rdfs:Resource .` and `rdf:type rdfs:range rdfs:Class .`. Taking them at all
+ is licensed by RBS Definition 4.2, RBS section 4.2 and RDF 1.1 section 9, quoted in the file.
+ **One of the five was previously sourced to the wrong triple.** `W3C.lean`'s table gave
+ `I(rdfs:range) ∈ IP` the source `rdfs:range rdfs:domain rdf:Property .` "whose truth puts its own
+ predicate in `IP`"; that triple's predicate is `rdfs:domain`, so its truth gives
+ `I(rdfs:domain) ∈ IP` and reaching `rdfs:range` from it needs a further step the entry omits. The
+ fact is true and the route was wrong; the correction is recorded at both files rather than
+ applied silently.
+ `lean/OOCert/ConformingWitness.lean` exhibits a two-element interpretation satisfying every one
+ of those conditions, every RDF axiom of RDF 1.1 section 8 and every RDFS axiomatic triple of
+ section 9 (fifty-four, checked by `decide`), and three identity rows of RBS Table 5.2 that
+ `W3CWitness.lean`'s `live` records itself as violating. Table 5.8 is alive there in both
+ directions and CONSTRAINING: `IEXT(I(rdfs:subClassOf))` holds three of four possible pairs, the
+ missing one excluded by the forward direction and one of the present ones forced by the backward
+ direction, both checked. The eleven OWL-vocabulary extensions are empty there and
+ `two_dead_fields` says so as a theorem; `two_violates_these_known_rows` records the Table 5.2 row
+ it breaks. The file also carries one non-entailment and one entailment (`rdfs9` at an instance),
+ so `ConformingEntails` is neither empty nor everything.
+ **What is still not a theorem**, stated at the top of the file rather than at the bottom: that
+ `Conforming`'s field list is a SUBSET of the Recommendation's conditions. A subset is the safe
+ direction, which is why it is allowed, and a reader checks it cell by cell. One modelling
+ decision does NOT run in the safe direction and is named at its field: `IL` is total, following
+ RBS section 4.2's wording rather than RDF 1.1 section 5's, so interpretations in which a literal
+ fails to denote are outside the claim; closing that needs a term-occurrence lemma about
+ `checkStep` that nobody has written. One reading is load-bearing and flagged: RBS Table 5.4 at
+ `n = 0`, which `Rules.lean`'s `takeChain` and `Semantics.lean`'s `Model.int` already depend on.
+ `Conditions`, `Interp`, `Model`, `Entails` and `certificate_sound` are untouched, and
+ `Conforming.lean` pins all twenty-three fields of `Conditions` and all five of `Model` with
+ `#guard_msgs` on their constructors, so a change to any of them breaks the build.
- **A binding is data, and a certificate that admits two readings is refused.** Running the
Lean checker in `lean/OOCert/Horn.lean` and the independent Isabelle/HOL one in `isabelle/`
over 1,718 certificates found 47 rows where the two disagreed, always in the same direction