Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.
Rust ai-nativedescription-logicsformal-verificationinfrastructure-as-codeisabelle-languageknowledge-graphleanlean4mcpmcp-serverontologyowlowl2reasoningrustshaclsparqltheorem-proving
Say what the new layer does not prove, and prove two things it only asserted
FABIOTESS948c157873f6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex daf72dee..c5e98925 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -191,6 +191,95 @@ All notable changes to Open Ontologies are documented here.now resolves every such citation in `python/` against the current file andfails when a line stops containing the token it names. A citation written in ashape the test cannot read fails too, rather than going quietly unguarded.++- **Fourteen arms of the OWL 2 RL soundness proof were assumed, and are now+ derived.** A second formalisation in Isabelle/HOL, written from the W3C+ specifications with the Lean deliberately unread, found that fourteen arms+ across twelve of the twenty-nine rules were sound because a field of+ `Conditions` said the rule holds. Twelve of those arms are stated by no cell+ of any specification table: `scm-eqc1` and `scm-eqp1` with two conclusions+ each, `scm-svf1`, `scm-svf2`, `scm-avf1`, `scm-avf2`, `scm-dom1`, `scm-dom2`,+ `scm-rng1`, `scm-rng2`. The other two, `rdfs5` and `rdfs11`, were licensed by+ RDF 1.1 Semantics but redundant once the stronger cell is present. For those+ arms the machine-checked content was close to nothing, while the proofs passed+ and the axiom footprints were clean.++ `lean/OOCert/W3C.lean` now states the OWL 2 RDF-Based Semantics conditions at+ full strength, one field per table row with the cell quoted above it, and+ derives all fourteen. `OOCert.W3CModel.toModel` and every one of the twelve+ derivation theorems depend on no axiom at all. `OOCert.W3CEntails.of_entails`+ proves that everything `Entails` already gave is true in every conforming+ interpretation, and `OOCert.certificate_w3c_sound` restates the checker's+ verdict over that class.++ `Conditions`, `Interp`, `Entails` and `certificate_sound` are untouched and+ `certificate_sound` keeps its exact axiom footprint, because strengthening+ `Conditions` in place would have shrunk the model class and weakened the+ headline theorem with every proof still passing. The cell that makes the+ twelve derivable is Table 5.8's connective, which carries `rowspan="4"` in the+ specification's HTML and therefore states an `iff` where RDFS alone gives only+ `if-then`. It was re-fetched from the raw HTML and not from a rendering: a+ markdown conversion of that table drops the `rowspan` and shows `if`, which+ would make the result unprovable and the mistake invisible.++- **A live, non-degenerate model of those conditions, with its liveness compiled+ into the build.** `lean/OOCert/W3CWitness.lean` builds a seventeen-element+ interpretation meeting the quoted cells of Tables 5.2, 5.3, 5.6, 5.8, 5.9,+ 5.12 and 5.13, with every condition settled by the kernel's `decide`. A+ soundness theorem over a degenerate model class would prove less than the+ assumption it replaced while looking better, so `live_is_live` pins the facts+ that make it non-degenerate: `IC` has three members and is not the carrier,+ one class extension is the whole carrier, another is a proper subset witnessed+ on both sides, a third is empty, `ICEXT(owl:Restriction)` is a proper subset of+ `IC`, and the property that matters carries a pair. `dom_bwd` and `rng_bwd` are+ discharged over that pair rather than vacuously, which the second kernel's own+ witness does not manage. `the_natural_avf2_direction_is_not_w3c_entailed` is+ the first non-entailment in this repository that is about the conforming model+ class rather than the Lean's own.++- **Two more English claims turned into theorems, one of which was wrong.**+ `Witness.lean` asserted in prose that `saturated` also satisfies the new+ specification conditions. It does, and `saturated_meets_the_w3c_conditions`+ now proves it, which matters only because it shows how little that is worth:+ a model in which every relation is total distinguishes no condition from any+ other. The claim does **not** extend from the conditions to the models, and+ `saturated_is_not_a_w3c_model_of_an_empty_enumeration` proves the gap on the+ one-triple graph `E owl:oneOf rdf:nil`. Table 5.5's equality forces an empty+ enumeration to denote the empty class, and `saturated` makes every class the+ whole universe. `Conditions.oneOf` carries only the `⊇` half and so models the+ same graph without complaint, which is the cost of that omission stated as a+ pair of theorems rather than as a remark.++### Fixed+- **Four claims the certificate layer made and had not earned, withdrawn rather+ than edited away.** (1) Soundness here does **not** carry over to the OWL 2+ Direct Semantics read through triples; nobody verified it, and it is false as+ written for the twelve arms that need Table 5.8's backward direction. (2) The+ W3C tables do **not** read a list off the graph. The sequence notation+ quantifies over `IEXT(I(rdf:first))` and `IEXT(I(rdf:rest))`, and the+ specification says explicitly that no semantic constraint enforces well-formed+ sequence structures. `Chain` is still right, for the opposite reason to the one+ given: it fires on fewer lists, so the model class stays larger. (3)+ `an_unlisted_individual_is_not_entailed` was nominated as the check that the+ `⊆` half of `owl:oneOf` was really left out, and it cannot detect that half's+ absence: its witness already satisfies the full equality and passes unchanged+ either way. That omission is undetected by anything in this repository. (4)+ Non-entailment never transferred outward. Every `¬ Entails`, every `¬ Unsat`+ and every exhibited `Model` here is a statement about this layer's model class+ alone. Each of these is now recorded at the point of the assumption, and+ `docs/decisions/0002` carries a dated correction.++- **A quote that was not a quote.** The RDF 1.1 truth clause cited in the new+ bridge argument was the RDF 1.0 (2004) wording. RDF 1.1 replaced the+ definedness phrasing with an explicit `I(p) is in IP` conjunct, which makes the+ argument stronger, not weaker. Corrected against the raw HTML, with the+ substitution recorded in the file.++- `docs/lean-certificates.md` said the semantics was "the RDF-based reading of+ the twenty rules' vocabulary". There are twenty-nine rule ids, as+ `tests/certificate_boundary_proptest.rs` has asserted since it landed.++### Added- **The refutation checker has a producer.** `lean/OOCert/Refute.lean` haschecked refutations since it landed and nothing in `src/` could write one: achecker with no producer, which is the same shape of defect as a gate thatdiff --git a/README.md b/README.mdindex 329cdae4..6ab6e768 100644--- a/README.md+++ b/README.md@@ -147,6 +147,28 @@ makes this different. If you are evaluating the claim, readThe second kernel is in [isabelle/](isabelle/), written from the W3C specifications with the Leandeliberately unread, and it is run over the same bytes on every differential run.+Its sharpest catch was not a disagreement about a certificate. It was that fourteen arms of the+Lean's soundness proof, across twelve of its twenty-nine rules, were sound because a field of the+condition record said the rule holds. Twelve of those arms are stated by no cell of any+specification table. The proofs passed, the axiom footprints were clean, and the machine-checked+content for those arms was close to nothing. All fourteen are now derived from cells quoted out of+the specification's raw HTML, in [lean/OOCert/W3C.lean](lean/OOCert/W3C.lean), and+`OOCert.certificate_w3c_sound` restates the checker's verdict over every interpretation meeting+those cells, rather than over the weaker conditions this Lean used to posit. Same certificates,+same checker, and not one of those derivations depends on any axiom at all.++One step short of that is still an argument rather than a theorem, and it is labelled as one in the+file: reading a conforming interpretation as a Lean `Interp` is a bridge written in prose, because+nothing in core Lean quantifies over the specification's metatheory. The bridge is four lines and+checkable by hand. It is not machine-checked, and the file says so where a reader will hit it.++The same review found the limit of that result, and it is written down rather than buried.+Entailment transfers outward and non-entailment does not, so every `¬ Entails` in the repository is+a statement about this layer's model class and not about the specification's. One of them now has a+conforming replacement, one of them was nominated as a detector for a condition it cannot detect,+and the rest carry the obstruction at the point of the assumption. See+[docs/lean-certificates.md](docs/lean-certificates.md).+The discipline matters more than the machinery, and it runs through all of it.A rule **you** supplied is an assumption the certificate carries, never a fact it establishes, sodiff --git a/docs/lean-certificates.md b/docs/lean-certificates.mdindex 4a3627d8..15c741dc 100644--- a/docs/lean-certificates.md+++ b/docs/lean-certificates.md@@ -94,6 +94,15 @@ Table 5.8's connective, which carries `rowspan="4"` in the source and so states`rdfs:subClassOf`, `rdfs:subPropertyOf`, `rdfs:domain` and `rdfs:range`. RDFS alone gives those rowsonly the `if-then` direction, and the twelve `scm-*` arms among the fourteen do not follow from it.+One step is an argument rather than a theorem, and it is labelled as one in the file. Reading a+conforming interpretation as a Lean `Interp` needs a bridge, `iext p x y := IP p and (x, y) in+IEXT p`, under which `Interp.sat` unfolds to RDF 1.1 Semantics section 5's truth clause including+its `I(p) is in IP` conjunct. Core Lean has nothing to quantify over on the specification side, so+that step is prose. It is four lines and checkable by hand. `W3CModel` is also deliberately weaker+than conformance, because `W3C` omits every table row no rule consumes, so its class is larger than+the bridge image. Both gaps run in the safe direction for soundness, where a larger class makes the+conclusion stronger, and neither runs in the safe direction for a non-entailment result.+**The claim that the result carries over to the OWL 2 Direct Semantics read through triples iswithdrawn.** Nobody verified it, and it is false as written for those twelve arms, which need abackward direction the Direct Semantics has no `rdfs:subClassOf` triples to carry. Do not reinstatediff --git a/lean/OOCert/W3C.lean b/lean/OOCert/W3C.leanindex 7b7647dc..3bbb8538 100644--- a/lean/OOCert/W3C.lean+++ b/lean/OOCert/W3C.lean@@ -15,9 +15,11 @@ without touching `Conditions`, `Interp`, `Entails` or any existing statement.`W3C I IP` carries the specification's semantic conditions at FULL strength,one field per table row, each with the cell quoted verbatim above it.`W3CModel I IP G` adds the asserted graph and the three list-constructor rows.-`W3CModel.toModel` builds a `Model I G` from it, and fourteen of the-twenty-three condition fields it supplies are DERIVATIONS rather than-projections. Those fourteen are exactly the arms that used to be assumed:+`W3CModel.toModel` builds a `Model I G` from it, and TWELVE of the twenty-three+condition fields it supplies are DERIVATIONS rather than projections. Those+twelve fields carry FOURTEEN of the soundness proof's arms, because `eqc` and+`eqp` each license two conclusions and `Soundness.lean` consumes each of them+twice. Counted as arms, they are exactly the ones that used to be assumed:| arm | rule id | derived in ||---|---|---|@@ -170,10 +172,14 @@ One field per table row, at full strength, with the cell quoted above it. Readthe quotes as the licence for every strengthening in this file: a field with noquote above it is a field nobody checked.-Three fields of `Conditions` survive here unchanged (`same_fwd`, `sym_fwd`,-`trp_fwd`). Fourteen become halves of the conditions that derive them. Twelve-disappear entirely, because they are theorems about this structure rather than-assumptions in it. -/+`Conditions` has twenty-three fields and they land here in three groups. THREE+survive unchanged (`same_fwd`, `sym_fwd`, `trp_fwd`). EIGHT are consequences of+a strictly stronger field here (`sc_sub`, `sp_sub`, `dom`, `rng` and `inv` of+the forward conditions that also carry the `IC` and `IP` memberships; `svf`,+`avf` and `hv` of the Table 5.6 equalities). TWELVE have no counterpart in this+structure at all, because over it they are theorems rather than assumptions.+`Conditions` itself is untouched and still carries all twenty-three; `toModel`+is what supplies them, and for those twelve it supplies a proof. -//-- The OWL 2 RDF-Based Semantics conditions that the twenty-nine rules consume,at FULL specification strength. -/@@ -293,10 +299,11 @@ structure W3C (I : Interp) (IP : I.D → Prop) : Prop wherethe repair: faced with a failing `scm-svf1` the natural move is to add afresh field asserting the missing direction in slightly different words, andthat is a strengthening in a place the specification did not strengthen, it- turns everything green, and nobody writes it down. The twelve fields this- file removes from `Conditions` are that move, made twelve times. The equality- is written here ONCE, as the specification has it, and no second field in- this area may be added to close a proof. -/+ turns everything green, and nobody writes it down. The twelve fields of+ `Conditions` that this structure does not restate are that move, made twelve+ times, and they are derived below instead. The equality is written here ONCE,+ as the specification has it, and no second field in this area may be added to+ close a proof. -/svf_eq : ∀ z c p, I.iext (I.ι V.someValuesFrom) z c → I.iext (I.ι V.onProperty) z p →∀ x, (I.cext z x ↔ ∃ y, I.iext p x y ∧ I.cext c y)/-- RBS Table 5.6.@@ -587,12 +594,13 @@ structure W3CModel (I : Interp) (IP : I.D → Prop) (G : List Triple) : Prop whe/-- **Every conforming interpretation is a model here.**-Fourteen of the twenty-three `Conditions` fields below are derivations rather-than projections, and they are exactly the arms that `Semantics.lean` posits:-`sc_trans`, `sp_trans`, `eqc`, `eqp`, `svf_sc`, `svf_sp`, `avf_sc`, `avf_sp`,-`dom_sc`, `dom_sp`, `rng_sc`, `rng_sp`. The other nine and the four list fields-are projections out of the corresponding quoted table cell, which is what they-were meant to be all along. -/+Twelve of the twenty-three `Conditions` fields below are derivations rather than+projections: `sc_trans`, `sp_trans`, `eqc`, `eqp`, `svf_sc`, `svf_sp`,+`avf_sc`, `avf_sp`, `dom_sc`, `dom_sp`, `rng_sc`, `rng_sp`. They are exactly the+fields `Semantics.lean` posits, and they carry fourteen of the soundness proof's+arms, because `Soundness.lean` consumes `eqc` and `eqp` twice each. The other+eleven fields and the four list fields are projections out of the corresponding+quoted table cell, which is what they were meant to be all along. -/theorem W3CModel.toModel {I : Interp} {IP : I.D → Prop} {G : List Triple}(W : W3CModel I IP G) : Model I G whereconds :=@@ -649,10 +657,22 @@ theorem W3CEntails.of_entails {G : List Triple} {t : Triple} (h : Entails G t) :W3CEntails G t :=fun _ _ W => h _ W.toModel-/-- The checker's verdict, restated over the specification's model class. Same-certificates, same checker, same `checkCert`; the only thing that changed is-that the word "entailed" now names the OWL 2 RDF-Based conforming-interpretations rather than the weaker set of conditions the Lean posited. -/+/-- The checker's verdict, restated over the specification's conditions. Same+certificates, same checker, same `checkCert`; what changed is that "entailed"+now quantifies over every interpretation meeting the quoted table cells, rather+than over the weaker set of conditions the Lean posited, and that the fourteen+arms which used to be posited are steps inside the proof.++**This is not yet the sentence "true in every conforming interpretation", and+the difference is the bridge in the module docstring above, which is an argument+and not a theorem.** `W3CModel` is a Lean structure; a conforming interpretation+is an object of the specification's metatheory, and nothing here quantifies over+those. The bridge says how to read one as the other, and it is checkable by+hand, but it is prose. `W3CModel` is also strictly weaker than conformance,+because `W3C` deliberately omits every table row no rule consumes, so its class+is larger than the bridge image. Both gaps run in the safe direction for THIS+theorem, since a larger class makes the conclusion stronger; neither runs in the+safe direction for a non-entailment result. -/theorem certificate_w3c_sound (G : List Triple) (steps : List Step)(h : checkCert G steps = true) :∀ st ∈ steps, W3CEntails G st.conclusion :=diff --git a/lean/OOCert/W3CWitness.lean b/lean/OOCert/W3CWitness.leanindex 2ee04a34..427598b2 100644--- a/lean/OOCert/W3CWitness.lean+++ b/lean/OOCert/W3CWitness.lean@@ -595,6 +595,74 @@ theorem scm_avf2_runs_one_way_under_the_specification :⟨the_avf2_direction_the_table_gives_is_w3c_entailed,the_natural_avf2_direction_is_not_w3c_entailed⟩+/-! ## The degenerate model, proved rather than asserted++`Witness.lean` says in English, beside `saturated_is_a_model`, that `saturated`+also satisfies the conditions in `W3C.lean`. An unproved claim in a docstring is+the defect this whole file exists to remove, so it is a theorem here. -/++/-- **`W3C` is satisfiable trivially, and that is exactly why bare satisfiability+is not the gate.** `saturated` has domain `Unit` and every relation total, so+both sides of every equality in `W3C` are all of `Unit` and every field holds+without saying anything. It distinguishes no condition from any other and+refutes nothing.++Note what it does NOT extend to. `W3CModel` would additionally demand+`oneOf_eq`, and that fails here whenever the graph carries an `owl:oneOf` triple+whose list is EMPTY: the left side is `ICEXT(c)`, which is all of `Unit`, and the+right side is `∃ m ∈ [], x = I(m)`, which is false. Table 5.5's equality forces an+empty enumeration to denote the empty class, and a model in which every class is+the whole universe cannot do that. `Conditions.oneOf` carries only the `⊇` half+and so never notices. That is the same asymmetry recorded at `Model.oneOf` in+`Semantics.lean`, seen from the other side. -/+theorem saturated_meets_the_w3c_conditions : W3C saturated (fun _ => True) where+ sc_fwd := fun _ _ _ => ⟨trivial, trivial, fun _ _ => trivial⟩+ sc_bwd := fun _ _ _ _ _ => trivial+ sp_fwd := fun _ _ _ => ⟨trivial, trivial, fun _ _ _ => trivial⟩+ sp_bwd := fun _ _ _ _ _ => trivial+ dom_fwd := fun _ _ _ => ⟨trivial, trivial, fun _ _ _ => trivial⟩+ dom_bwd := fun _ _ _ _ _ => trivial+ rng_fwd := fun _ _ _ => ⟨trivial, trivial, fun _ _ _ => trivial⟩+ rng_bwd := fun _ _ _ _ _ => trivial+ eqc_fwd := fun _ _ _ => ⟨trivial, trivial, fun _ => Iff.rfl⟩+ eqp_fwd := fun _ _ _ => ⟨trivial, trivial, fun _ _ => Iff.rfl⟩+ same_fwd := fun a b _ => by cases a; cases b; rfl+ inv_fwd := fun _ _ _ => ⟨trivial, trivial, fun _ _ => Iff.rfl⟩+ sym_fwd := fun _ _ _ _ _ => trivial+ trp_fwd := fun _ _ _ _ _ _ _ => trivial+ svf_eq := fun _ _ _ _ _ _ => ⟨fun _ => ⟨(), trivial, trivial⟩, fun _ => trivial⟩+ avf_eq := fun _ _ _ _ _ _ => ⟨fun _ _ _ => trivial, fun _ => trivial⟩+ hv_eq := fun _ _ _ _ _ _ => Iff.rfl+ restr_IC := fun _ _ => trivial+ svf_typ := fun _ _ _ => ⟨trivial, trivial⟩+ avf_typ := fun _ _ _ => ⟨trivial, trivial⟩+ onp_typ := fun _ _ _ => ⟨trivial, trivial⟩++/-- A one-triple graph enumerating nothing: `E owl:oneOf rdf:nil`. -/+def emptyOneOfG : List Triple := [⟨"<e:E>", V.oneOf, V.nil⟩]++/-- **And the gap in the docstring above is a theorem too.** `saturated` meets+every field of `W3C`, and it is still not a `W3CModel` of this graph, because+Table 5.5's equality forces an empty enumeration to denote the empty class while+`saturated` makes every class the whole universe.++So `W3C` and `W3CModel` genuinely differ, the list rows are not decoration, and+"`saturated` satisfies the specification conditions" is true of the conditions+and false of the models. `Conditions.oneOf` carries only the `⊇` half and never+notices, which is why `saturated_is_a_model` holds for EVERY graph including+this one. -/+theorem saturated_is_not_a_w3c_model_of_an_empty_enumeration :+ ¬ W3CModel saturated (fun _ => True) emptyOneOfG := by+ intro W+ have h := (W.oneOf_eq "<e:E>" V.nil [] (by simp [emptyOneOfG]) Chain.nil ()).mp trivial+ simp at h++/-- The same graph, modelled by the weaker conditions without complaint. The two+sit side by side on purpose: this is what the `⊆` half of Table 5.5 buys, and+what leaving it out costs. -/+theorem saturated_is_a_model_of_the_same_graph : Model saturated emptyOneOfG :=+ saturated_is_a_model emptyOneOfG+/-! ## And `W3CEntails` is not everything either`live` closes one vacuity hole: `W3C` has a non-degenerate model, so@@ -679,4 +747,15 @@ footprint below. -/#guard_msgs in#print axioms not_everything_is_w3c_entailed+/-- info: 'OOCert.saturated_meets_the_w3c_conditions' does not depend on any axioms -/+#guard_msgs in+#print axioms saturated_meets_the_w3c_conditions++/--+info: 'OOCert.saturated_is_not_a_w3c_model_of_an_empty_enumeration' depends on axioms: [propext,+Quot.sound]+-/+#guard_msgs in+#print axioms saturated_is_not_a_w3c_model_of_an_empty_enumeration+end OOCert