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
Derive the fourteen arms that were assumed, from cells quoted out of the spec
FABIOTESScc82154717ce
diff --git a/docs/decisions/0002-an-inference-carries-a-certificate.md b/docs/decisions/0002-an-inference-carries-a-certificate.mdindex 6ab71465..b0592ac5 100644--- a/docs/decisions/0002-an-inference-carries-a-certificate.md+++ b/docs/decisions/0002-an-inference-carries-a-certificate.md@@ -39,17 +39,22 @@ on the engine's author having thought of the bug.RDF-based semantics of the vocabulary the rules use (`lean/OOCert/Semantics.lean`). The proofis one lemma per rule plus an induction over the certificate. `#guard_msgs` pins the axioms to`propext`, `Classical.choice` and `Quot.sound`; a `sorry` or a `native_decide` fails the build.-4. **The semantic conditions are the weakest the rules need.** Each is the *if* direction of the- corresponding W3C condition or a consequence of it. Weaker conditions admit more- interpretations, so soundness here implies soundness under the OWL 2 RDF-Based Semantics and- under the Direct Semantics read through triples. Where the W3C reads a list off the graph, so- does `Model`, through `Chain`.+4. **The semantic conditions are the weakest the rules need**, with fourteen exceptions that were+ found later and are now discharged; see the correction at the foot of this record. Each of the+ rest is the *if* direction of the corresponding W3C condition or a consequence of it. Weaker+ conditions admit more interpretations, so soundness here implies soundness under the OWL 2+ RDF-Based Semantics, and since 15 September 2026 that implication is a theorem+ (`OOCert.W3CEntails.of_entails`) rather than an argument in a docstring. `Model` reads a list+ off the asserted graph through `Chain`, which is weaker than the specification's semantic+ sequence relation and so keeps the model class larger.5. **The theorem is shown non-vacuous in the same directory.** A soundness result about anunsatisfiable semantics proves nothing, so `lean/OOCert/Witness.lean` exhibits a model of anarbitrary graph, exhibits a triple that is not entailed, and proves that the derivation`cls-svf1` used to make is refuted by a model of its own premises while the half the reasonerstill makes is entailed. That last pair turns "we removed a rule we could not justify" into "we- removed a rule that was unsound", machine-checked.+ removed a rule that was unsound", machine-checked. Those refutations are about this layer's own+ model class and not about the specification's; the correction below says why, and which one now+ has a conforming replacement.6. **Core Lean only.** No Mathlib. `Std.HashSet` for membership, with its own lemmas bridging tolist membership in the proof. The trust surface is the Lean kernel plus `lean/`.7. **The gate is proved able to fail.** The test suite appends a forged conclusion, a premise@@ -72,3 +77,38 @@ graph is a model, and `Dl.checkModel` verifies it. When it answers unsatisfiablestill carries no certificate, because that needs a refutation rather than a model, and the reportsays so rather than leaving the reader to assume symmetry. The differential oracleagainst pyshacl (`tools/shacl_differential.py`) remains the gate for SHACL.++## Correction, 15 September 2026++An independent second formalisation in Isabelle/HOL, written from the W3C specifications with the+Lean deliberately unread, found two things wrong with decisions 4 and 5 above. Both are recorded+here rather than quietly edited, because the original wording is what the project told people.++**Fourteen arms were not the weakest condition the rule needs. They were the rule.** Twelve of them+(`scm-eqc1` and `scm-eqp1`, two conclusions each, plus `scm-svf1`, `scm-svf2`, `scm-avf1`,+`scm-avf2`, `scm-dom1`, `scm-dom2`, `scm-rng1`, `scm-rng2`) are stated by no cell of any+specification table, and `rdfs5` and `rdfs11` were licensed but redundant. For those arms the+machine-checked content was close to nothing: the theorem said the rule was sound because a field of+the condition record said so. All fourteen are now derived from quoted cells in+`lean/OOCert/W3C.lean`, and every derivation is a proof term depending on no axiom at all. The cell+that makes them derivable is Table 5.8's connective, which carries `rowspan="4"` in the+specification's HTML and therefore states an `iff`, not the `if-then` that RDFS alone gives.++**The claim about the OWL 2 Direct Semantics read through triples is withdrawn.** It was never+verified, and it is false as written for those twelve arms.++**The claim that the W3C reads a list off the graph is withdrawn.** The specification's sequence+notation quantifies over `IEXT(I(rdf:first))` and `IEXT(I(rdf:rest))`, never over the graph, and it+says explicitly that no semantic constraint enforces well-formed sequence structures. `Chain` is+still the right thing to use, but for the opposite reason to the one given: it fires on strictly+fewer lists, so the conditions over it are weaker and the model class is larger.++**Non-entailment never transferred outward and the record did not say so.** A model of the weaker+conditions need not be a conforming interpretation, so a refutation built from one is a statement+about this layer's model class alone. That covers every `¬ Entails`, every `¬ Unsat` and every+exhibited `Model` in the repository. One of them now has a conforming replacement,+`the_natural_avf2_direction_is_not_w3c_entailed` in `lean/OOCert/W3CWitness.lean`; the rest stay+open with the obstruction written at each of them.++Neither finding is a soundness bug. Both are the layer claiming more than it had earned, which by+this project's own standard is the same category of defect.diff --git a/docs/lean-certificates.md b/docs/lean-certificates.mdindex f06fe072..4a3627d8 100644--- a/docs/lean-certificates.md+++ b/docs/lean-certificates.md@@ -77,10 +77,27 @@ inside one.> if `checkCert G steps = true` then for every step, `G ⊨ step.conclusion`where `G ⊨ t` is truth in every model of `G` under the semantics in `lean/OOCert/Semantics.lean`:-the RDF-based reading of the twenty rules' vocabulary, with each semantic condition the *if*-direction of the W3C condition or a consequence of it, never more. Weaker conditions admit more-interpretations, so the result carries over to the OWL 2 RDF-Based Semantics and to the Direct-Semantics read through triples.+the RDF-based reading of the twenty-nine rules' vocabulary, with each semantic condition the *if*+direction of the W3C condition or a consequence of it, never more.++Weaker conditions admit more interpretations, so the result carries outward, and that transfer is+now a theorem rather than a claim. `lean/OOCert/W3C.lean` states the OWL 2 RDF-Based Semantics+conditions at full strength, one field per table cell quoted verbatim from the raw HTML of the+specification, and `OOCert.W3CEntails.of_entails` proves that everything `Entails` gives is true in+every interpretation meeting them. `OOCert.certificate_w3c_sound` is `certificate_sound` restated+over that class, with the same certificates and the same checker.++Fourteen arms of the soundness proof used to be *posited*: the theorem that `scm-dom1` is sound read+a field off `Conditions` which said that `scm-dom1` holds. All fourteen are now derived, and each+derivation is a proof term that depends on no axiom at all. The cell that makes them derivable is+Table 5.8's connective, which carries `rowspan="4"` in the source and so states an `iff` for+`rdfs:subClassOf`, `rdfs:subPropertyOf`, `rdfs:domain` and `rdfs:range`. RDFS alone gives those rows+only the `if-then` direction, and the twelve `scm-*` arms among the fourteen do not follow from it.++**The claim that the result carries over to the OWL 2 Direct Semantics read through triples is+withdrawn.** Nobody verified it, and it is false as written for those twelve arms, which need a+backward direction the Direct Semantics has no `rdfs:subClassOf` triples to carry. Do not reinstate+it without a formalisation of that translation.The axioms the theorem depends on are pinned in the source by `#guard_msgs`:`propext`, `Classical.choice`, `Quot.sound`. A `sorry`, or a `native_decide`, fails `lake build`.@@ -103,6 +120,49 @@ used to make: a model of the premises in which `x` is not a `C`. So the removedfact, not merely unjustified by the rule set the checker implements. The witness is the Herbrandinterpretation of the premises plus the single consequence the semantics does force.+### Which model class a negative result is about, and it is not the specification's++Entailment transfers outward and non-entailment does not. A triple true in every model of the+weaker `Conditions` is true in every conforming interpretation, which is what+`W3CEntails.of_entails` proves; a triple *false* in some model of `Conditions` need not be false in+any conforming one, because that model need not be conforming.++**Every `¬ Entails`, every `¬ Unsat` and every `Model I G` in this repository is therefore a+statement about the Lean's own model class unless it is stated over `W3CModel`.** That includes the+second and third rows of the table above. Each is discharged by a Herbrand or a saturated+interpretation, and neither kind is a conforming one: a Herbrand witness carrying no `rdf:type`+triple has `IC` empty, so Table 5.8's backward direction forces `rdfs:subClassOf` and+`rdfs:subPropertyOf` triples that the witness does not contain.++Two of them now have conforming versions, in `lean/OOCert/W3CWitness.lean`:++| theorem | says |+|---|---|+| `live_is_a_w3c_model` | a seventeen-element interpretation meets the quoted cells of Tables 5.2, 5.3, 5.6, 5.8, 5.9, 5.12 and 5.13, so `W3C` is satisfiable |+| `live_is_live` | and it is not degenerate: `IC` has three members and is not the carrier, one class extension is everything, another is a proper subset witnessed on both sides, a third is empty, and the property that matters has a pair in it |+| `the_natural_avf2_direction_is_not_w3c_entailed` | the reversed `scm-avf2` conclusion fails in that interpretation |+| `not_everything_is_w3c_entailed` | `W3CEntails` is not the trivial relation either |++`live_is_live` is compiled into the build on purpose. A soundness theorem over a degenerate model+class would look better than the assumption it replaced while proving less, so the liveness facts+are a `decide`-checked theorem rather than a sentence in a comment, and shortening the model to fix+a build failure breaks it rather than hollowing it out quietly.++The rest stay open, and the obstruction is recorded at each of them rather than worked around.+`RefuteWitness.lean`'s `Der`, which is the repository's only general "every graph has a model"+machine, cannot be extended to carry Table 5.8's backward halves: the constructor would put `Der` to+the left of an arrow and Lean rejects the strictly negative occurrence. The obstruction is+mathematical and not an artefact of Lean. `sc_bwd` is antitone in `ICEXT(a)`, so adding a `rdf:type`+triple can un-force a `rdfs:subClassOf` triple that `sc_fwd` still demands, and there is no least+fixed point by monotonicity. Every conforming countermodel has to be a hand-built finite structure.++`the_natural_avf2_direction_is_not_w3c_entailed` is also not a proof that the triple fails to be+OWL 2 RDF-Based entailed, and nobody should write that sentence. `W3CModel`'s class is still larger+than the conforming interpretations, because `W3C` omits every table row no rule consumes: the model+violates Table 5.2's `owl:Thing | = IR` and `rdf:Property | = IP` rows, and the axiomatic triple+tables are absent entirely. It is closer to the specification than anything else here and it does+not arrive.+## What is not proved- Completeness. The checker rejects anything it cannot re-derive by pattern, including validdiff --git a/lean/OOCert.lean b/lean/OOCert.leanindex 749e2410..5332af02 100644--- a/lean/OOCert.lean+++ b/lean/OOCert.lean@@ -2,7 +2,9 @@ import OOCert.Tripleimport OOCert.Semanticsimport OOCert.Rulesimport OOCert.Soundness+import OOCert.W3Cimport OOCert.Witness+import OOCert.W3CWitnessimport OOCert.Hornimport OOCert.HornBuiltinimport OOCert.HornWitnessdiff --git a/lean/OOCert/Semantics.lean b/lean/OOCert/Semantics.leanindex 3206dcbd..432c913d 100644--- a/lean/OOCert/Semantics.lean+++ b/lean/OOCert/Semantics.lean@@ -27,17 +27,44 @@ Each condition is the *if* direction of the corresponding W3C semanticcondition, or a consequence of it, never more. Where the W3C table states an*iff* (subClassOf, for instance, is extensional in the RDF-based semantics)only the half the rules use is assumed, plus transitivity where a rule-concludes a schema triple. Weaker assumptions mean more interpretations, so a-rule proved sound here is sound under the W3C semantics and under the OWL 2-Direct Semantics translated to triples, since every model of those satisfies-these conditions.+concludes a schema triple.++Weaker assumptions mean more interpretations, so a rule proved sound here is+sound under the OWL 2 RDF-Based Semantics. That transfer is now a theorem and+not a claim: `W3C.lean` states the specification conditions at full strength and+`W3CEntails.of_entails` proves that everything `Entails` gives is true in every+interpretation meeting them.++The claim this paragraph USED to make about the OWL 2 Direct Semantics+translated to triples is withdrawn. Nobody verified it, and it is false as+written for the twelve fields below that need the BACKWARD direction of+RDF-Based Semantics Table 5.8: RDFS gives `rdfs:domain`, `rdfs:range`,+`rdfs:subClassOf` and `rdfs:subPropertyOf` only the `if-then` direction, and the+Direct Semantics has no `rdfs:subClassOf` triples at all. Do not reinstate it+without a formalisation of that translation.The list constructors are the exception to "conditions on the interpretationalone". `owl:intersectionOf`, `owl:unionOf` and `owl:oneOf` point at an RDF-list, and a list is a syntactic object: the W3C tables read it off the graph-with the sequence notation. `Model` therefore reads the list off the graph-too, through `Chain`, and states the class condition relative to the graph-being interpreted.+list, and `Model` reads that list off the ASSERTED GRAPH, through `Chain`.++**The reason once given for that is false and is replaced here.** The W3C tables+do NOT read the list off the graph. RDF-Based Semantics defines "`s` sequence of+`a₁ , … , aₙ ∈ S`" over the interpretation: "`s` = `I(rdf:nil)` for `n = 0`; and+for `n > 0` there exist `z₁ ∈ IR , … , zₙ ∈ IR`, such that `s = z₁`, `a₁ ∈ S`,+`( z₁ , a₁ ) ∈ IEXT(I(rdf:first))`, `( z₁ , z₂ ) ∈ IEXT(I(rdf:rest))`, … ", and+it adds that "there are no semantic constraints that enforce "well-formed"+sequence structures", so one head may denote more than one sequence. The+quantifier is over `IEXT(I(rdf:first))` and `IEXT(I(rdf:rest))`, never over `G`.++The real justification is that the error runs in the safe direction. Any model+of `G` satisfies `G`'s own `rdf:first` and `rdf:rest` triples, so every `Chain G`+list is a semantic sequence, while a semantic sequence assembled from pairs the+graph never asserts is not a `Chain G` list. `Chain` therefore fires on strictly+fewer lists, the conditions stated over it are WEAKER than Tables 5.4 and 5.5,+the model class is larger, and entailment still transfers outward. What does not+follow is the converse, and `W3CModel` records that gap at its list fields+rather than closing it: no rule in this checker consumes `rdf:first` or+`rdf:rest` semantically, so nothing here needs a sequence relation.## Conditions that let a rule CONCLUDE a schema triple@@ -48,12 +75,28 @@ rules use is assumed. A rule whose CONCLUSION is a schema triple thereforeneeds its own condition, and `sc_trans` is the first of them: it is what lets`rdfs11` conclude `a rdfs:subClassOf c`.-Eight more of that kind arrive with the restriction-ordering and the-domain-and-range rules (`scm-svf1`, `scm-svf2`, `scm-avf1`, `scm-avf2`,-`scm-dom1`, `scm-dom2`, `scm-rng1`, `scm-rng2`). Each is stated as exactly the-W3C rule and nothing wider, and each field below carries the verbatim rule from-OWL 2 Profiles Table 9 together with the derivation that makes it a CONSEQUENCE-of the OWL 2 RDF-Based Semantics rather than an independent assumption.+**There are FOURTEEN arms of that kind, not nine, and this paragraph used to say+nine.** The undercount was real: it named the eight restriction-ordering and+domain-and-range fields (`scm-svf1`, `scm-svf2`, `scm-avf1`, `scm-avf2`,+`scm-dom1`, `scm-dom2`, `scm-rng1`, `scm-rng2`) plus `sc_trans`, and left out+`sp_trans` (`rdfs5`) and the two conclusions each that `eqc` (`scm-eqc1`) and+`eqp` (`scm-eqp1`) license. Those four conclude a schema triple by exactly the+same criterion.++`eqc` and `eqp` belong on the list for a reason worth keeping in view: RBS+Table 5.9 gives `owl:equivalentClass` an extension EQUALITY and never a+`rdfs:subClassOf` triple, so a field handing back two such triples is a+restatement of the rule and not a reading of a table. `sc_trans` is NOT of that+kind on its own, because RDF 1.1 Semantics section 9 states transitivity of+`rdfs:subClassOf` as a condition in its own right; it is on the list because+Table 5.8 makes it redundant.++**All fourteen are now DERIVED, in `W3C.lean`, from quoted specification+cells**, and `W3CModel.toModel` supplies each of them as a proof term rather+than a projection. The English derivations that follow each field below are kept+because they say what the machine-checked proof does, but they are no longer the+only thing standing behind these fields. Every field below still carries the+verbatim rule from OWL 2 Profiles Table 9.## Why the direction of that argument is the only one that is safe@@ -67,6 +110,45 @@ strictly stronger, would buy nothing any rule needs, and would put thenon-vacuity witnesses at risk, which is the observable symptom of a conditionthat has gone too far.+**THE ARGUMENT SECURES POSITIVE RESULTS ONLY, AND THIS IS THE SENTENCE THE FILE+WAS MISSING.** `Conditions` admits MORE interpretations than the specification+does. A triple true in every one of them is true in every conforming one, so+`Entails` transfers outward and `W3CEntails.of_entails` proves it. Nothing+transfers the other way. A model of `Conditions` need not be a conforming+interpretation, so `¬ Entails G t` does NOT give `¬ W3CEntails G t`, and neither+does `¬ Unsat`, and neither does exhibiting a `Model I G`.++Consequently **every `¬ Entails`, every `¬ Unsat` and every `Model I G` in this+repository is a statement about THIS model class and not about the+specification's** unless it is stated over `W3CModel`. That covers+`Witness.lean`'s `not_everything_is_entailed`,+`the_old_svf_derivation_is_not_entailed`,+`the_natural_avf2_direction_is_not_entailed`,+`an_unlisted_individual_is_not_entailed` and+`membership_in_one_member_does_not_give_the_intersection`; `Mixed.lean`'s+`mix_not_absolutely_entailed`, which is the machine-checked basis for reporting+`entailed_under_supplied_rules` rather than `entailed`; `Refute.lean`'s+`not_unsat_of_joint_model`; and `RefuteWitness.lean`'s `feed_is_not_refuted`,+`unsatisfiable_means_a_violation` and every `Model` it builds. Each is refuted+by a Herbrand or a saturated interpretation, and neither kind is a `W3CModel`:+a Herbrand witness that carries no `rdf:type` triple has `IC` empty, so+Table 5.8's backward direction forces `rdfs:subClassOf` and `rdfs:subPropertyOf`+triples the witness does not contain.++Exactly one of them has a conforming replacement, and it is in+`W3CWitness.lean`: `the_natural_avf2_direction_is_not_w3c_entailed` refutes the+reversed `scm-avf2` with a seventeen-element model that meets the quoted cells.+The others are open, and the obstruction is stated rather than worked around:+`RefuteWitness.lean`'s `Der` cannot carry Table 5.8's backward halves, because a+constructor whose premise contains `∀ x, Der G ⟨x, type, a⟩ → Der G ⟨x, type, b⟩`+puts `Der` to the left of an arrow and Lean rejects the strictly negative+occurrence. The obstruction is mathematical and not a Lean artefact: `sc_bwd` is+ANTITONE in `ICEXT(a)`, so adding a `rdf:type` triple can un-force a+`rdfs:subClassOf` triple that `sc_fwd` still demands, and there is no least+fixed point by monotonicity. Every conforming countermodel must therefore be a+hand-built finite structure, with no Herbrand shortcut and no+`closure_is_a_model` shortcut.+`scm-dom1` is the one that had to be checked rather than assumed. Under RDFSemantics `rdfs:domain` carries only the *if* direction and the rule does NOTfollow. The OWL 2 RDF-Based Semantics is stronger: in Table 5.8 the `iff` cell@@ -322,8 +404,21 @@ structure Model (I : Interp) (G : List Triple) : Prop whereAT LEAST the listed members. The ⊆ half, that it holds no others, is what arule concluding `owl:sameAs` or a clash would need, and no rule hereconcludes either, so assuming it would shrink the model class for nothing.- `Witness.lean`'s `an_unlisted_individual_is_not_entailed` is the check that- it really was left out. -/++ **The claim that `Witness.lean`'s `an_unlisted_individual_is_not_entailed` is+ "the check that it really was left out" is FALSE and is withdrawn here.** That+ witness is `ooWitness`, which is `[a rdf:type E, b rdf:type E] ++ ooPremises`,+ so its `ICEXT(E)` is exactly `{a, b}`, exactly the listed members, and it+ already satisfies Table 5.5's full equality. Adding the `⊆` half changes+ nothing about it: the witness still models the premises and still does not+ type `z`. A witness that passes unchanged whether or not the condition is+ present cannot detect the condition's absence.++ So the omission of the `⊆` half is UNDETECTED. Detecting it needs a model in+ which some `z` outside the list IS in `ICEXT(E)` while the premises hold,+ which the Herbrand construction cannot give, because a Herbrand interpretation+ contains only the triples written down. Nothing else in the repository tests+ it either. -/oneOf : ∀ c l ms, (⟨c, V.oneOf, l⟩ : Triple) ∈ G → Chain G l ms →∀ m ∈ ms, I.cext (I.ι c) (I.ι m)diff --git a/lean/OOCert/W3C.lean b/lean/OOCert/W3C.leannew file mode 100644index 00000000..7b7647dc--- /dev/null+++ b/lean/OOCert/W3C.lean@@ -0,0 +1,676 @@+import OOCert.Soundness++/-!+# The specification conditions, and the fourteen arms that were assumed++`Semantics.lean` states `Conditions`, and fourteen of its arms are *posited*:+the theorem that `scm-dom1` is sound reads a field off `Conditions` which says+that `scm-dom1` holds. The docstring beside each such field argues in English+that the field follows from the OWL 2 RDF-Based Semantics. This file replaces+those fourteen English arguments with machine-checked proofs, and it does so+without touching `Conditions`, `Interp`, `Entails` or any existing statement.++## What is here++`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:++| arm | rule id | derived in |+|---|---|---|+| `sc_trans` | rdfs11 | `W3C.sc_trans` |+| `sp_trans` | rdfs5 | `W3C.sp_trans` |+| `eqc` (two conclusions) | scm-eqc1 | `W3C.eqc` |+| `eqp` (two conclusions) | scm-eqp1 | `W3C.eqp` |+| `svf_sc` | scm-svf1 | `W3C.svf_sc` |+| `svf_sp` | scm-svf2 | `W3C.svf_sp` |+| `avf_sc` | scm-avf1 | `W3C.avf_sc` |+| `avf_sp` | scm-avf2 | `W3C.avf_sp` |+| `dom_sc` | scm-dom1 | `W3C.dom_sc` |+| `dom_sp` | scm-dom2 | `W3C.dom_sp` |+| `rng_sc` | scm-rng1 | `W3C.rng_sc` |+| `rng_sp` | scm-rng2 | `W3C.rng_sp` |++Twelve of those fourteen arms (everything but `sc_trans` and `sp_trans`) are+stated by NO cell of any specification table. They conclude a `rdfs:subClassOf`,+`rdfs:subPropertyOf`, `rdfs:domain` or `rdfs:range` triple that no premise+asserts, and the only thing in the OWL 2 RDF-Based Semantics that can put such+a triple into an extension is the BACKWARD direction of Table 5.8's `iff`.+`rdfs11` and `rdfs5` are the other two: RDF 1.1 Semantics section 9 does state+them, so they were licensed, but Table 5.8 makes them redundant and they are+derived here as well.++## Why this is a separate structure and not a change to `Conditions`++Every field of `W3C` is at least as strong as the corresponding field of+`Conditions`, and several are strictly stronger. Adding any of them to+`Conditions` would SHRINK the model class, which makes `Entails` easier to+satisfy and weakens `certificate_sound` with no error appearing anywhere and+every proof still passing. That is the failure mode the weakest-conditions+discipline exists to prevent, so the strengthening is quarantined here, where+it shrinks nothing: `Entails` does not mention this structure.++The theorem that pays for the quarantine is `W3CEntails.of_entails`. It says+that everything `Entails` already gives is true in every interpretation meeting+the specification conditions, and the fourteen arms that used to be posited are+steps inside its proof. `certificate_sound` keeps its exact statement and its+exact axiom footprint.++`IP` is a PARAMETER of this structure rather than a field of `Interp`, which is+what makes the whole file additive. It stays completely free: not one of the+fourteen derivations consumes a free-standing `IP` membership, because every+`IP` fact they use is produced by a forward condition applied to a premise+triple. The second formalisation in `isabelle/` needs three axiomatic-triple+consequences (`c_type_IP`, `c_sco_IP`, `c_spo_IP`, `OO_Semantics.thy`) for the+same table; this file needs none, because `Interp.sat` has no `IP` conjunct.++## The bridge to a conforming interpretation, which is prose and not a theorem++There is no Lean formalisation of an OWL 2 RDF-Based interpretation to quantify+over, and building one is a different project, so this step is an argument and+is marked as one.++Given a conforming interpretation in the sense of OWL 2 RDF-Based Semantics+section 5, take `D := IR`, `ι := I`, and++> `iext p x y := IP p ∧ (x, y) ∈ IEXT p`.++Then `Interp.sat t` unfolds to `IP(I(t.p)) ∧ (I(t.s), I(t.o)) ∈ IEXT(I(t.p))`,+which is RDF 1.1 Semantics section 5's truth condition, in that section's+"Semantic conditions for ground graphs" table, read out of the raw HTML of+<https://www.w3.org/TR/rdf11-mt/> on 15 September 2026:++> if E is a ground triple s p o `.` then I(E) = true if+> I(p) is in IP and the pair <I(s),I(o)> is in IEXT(I(p))+> otherwise I(E) = false.++The `IP` conjunct in `iext` is not an addition to that clause, it IS the+clause's own first conjunct, and the same section's item 3 gives the reason it+has to be there: "A mapping IEXT from IP into the powerset of IR x IR", so+`IEXT` is not defined off `IP` at all. Without the conjunct the Lean conclusion+would give membership in an extension without giving the predicate's denotation+to be a property. Under that reading each field of `W3C` below is the+corresponding table cell, and `Interp.cext` is section 9's `ICEXT`.++An earlier draft of this paragraph quoted the RDF 1.0 (2004) wording of the same+clause, "if I(s), I(p) and I(o) are all defined and <I(s),I(o)> is in+IEXT(I(p))", and called it RDF 1.1 verbatim. It is not; RDF 1.1 replaced the+definedness phrasing with the explicit `IP` membership above. The argument is+unaffected and in fact stronger, but a quote that is not the quote is exactly+the defect this file exists to remove, so the correction is recorded rather than+silently applied.++`Interp.sat` is deliberately NOT changed to carry an `IP` conjunct. Doing so+would move `Entails` in two directions at once, making `facts` harder to supply+and the conclusion harder to use, and it buys nothing the bridge definition+above does not already buy.++## Sources, re-fetched from the raw HTML rather than from a rendering++All quotes below are from <https://www.w3.org/TR/owl2-rdf-based-semantics/>,+fetched 14 September 2026, read out of the raw HTML with the markup intact. A+markdown conversion of these tables loses the `rowspan` attributes and renders+Table 5.8's `iff` as `if`, which would make the twelve-arm result unprovable+and the mistake invisible. The single load-bearing fact is Table 5.8's+connective cell, which in the source reads++```html+</td><th rowspan="4" style="text-align: center"> iff+```++at source line 2676, inside the `<table>` whose caption is "Table 5.8: Semantic+Conditions for the RDFS Vocabulary", and that table's body has exactly four+`<tr>` rows: `rdfs:subClassOf`, `rdfs:subPropertyOf`, `rdfs:domain`,+`rdfs:range`. The section prose agrees: "The semantic conditions provided here+are "iff" conditions, while the original semantic conditions, as specified in+Section 4.1 of the RDF Semantics, are weaker "if-then" conditions."+-/+namespace OOCert++namespace V+/-- `rdfs:Class`. RBS Table 5.2 gives it the row++```+rdfs:Class | ∈ IC | = IC+```++where the third column is headed `ICEXT(I(E))`. So `ICEXT(I(rdfs:Class))` IS+`IC`, which is what licenses `Interp.IC` below being a DEFINITION rather than a+condition. A definition cannot shrink the model class; a condition can. -/+def Class : Term := "<http://www.w3.org/2000/01/rdf-schema#Class>"++/-- `owl:Restriction`. RBS Table 5.2, row++```+owl:Restriction | ∈ IC | ⊆ IC+```++SUBSET and never equality. Writing the equality here would be a strengthening+the specification does not make, and it would force every class into+`ICEXT(owl:Restriction)`. -/+def Restriction : Term := "<http://www.w3.org/2002/07/owl#Restriction>"+end V++namespace Interp++/-- `IC`, the set of classes. RDF 1.1 Semantics section 9 introduces+`ICEXT(y) = { x : <x,y> ∈ IEXT(I(rdf:type)) }` as an abbreviation, which is+`Interp.cext`, and RBS Table 5.2 gives `rdfs:Class` the class-extension entry+`= IC`. Composing the two makes this a definition. -/+def IC (I : Interp) (c : I.D) : Prop := I.cext (I.ι V.Class) c++end Interp++/-! ## The specification conditions++One field per table row, at full strength, with the cell quoted above it. Read+the quotes as the licence for every strengthening in this file: a field with no+quote 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. -/++/-- The OWL 2 RDF-Based Semantics conditions that the twenty-nine rules consume,+at FULL specification strength. -/+structure W3C (I : Interp) (IP : I.D → Prop) : Prop where+ /-- RBS Table 5.8, row 1, forward. The `iff` cell carries `rowspan="4"` and+ governs this row and the three below it.++ > `( c₁ , c₂ ) ∈ IEXT(I(rdfs:subClassOf))` **iff** `c₁ , c₂ ∈ IC ,+ > ICEXT(c₁) ⊆ ICEXT(c₂)` -/+ sc_fwd : ∀ a b, I.sc a b → I.IC a ∧ I.IC b ∧ ∀ x, I.cext a x → I.cext b x+ /-- RBS Table 5.8, row 1, backward. Same cell.++ **Trap T2, guarded here.** Dropping the `IC` conjuncts from this direction+ makes every derivation below shorter and never fails a proof. It would also+ force a `rdfs:subClassOf` triple between any two things with nested+ extensions, including things that are not classes. They are kept. -/+ sc_bwd : ∀ a b, I.IC a → I.IC b → (∀ x, I.cext a x → I.cext b x) → I.sc a b+ /-- RBS Table 5.8, row 2, forward.++ > `( p₁ , p₂ ) ∈ IEXT(I(rdfs:subPropertyOf))` **iff** `p₁ , p₂ ∈ IP ,+ > IEXT(p₁) ⊆ IEXT(p₂)` -/+ sp_fwd : ∀ a b, I.sp a b → IP a ∧ IP b ∧ ∀ x y, I.iext a x y → I.iext b x y+ /-- RBS Table 5.8, row 2, backward. Same cell; `IP` conjuncts kept, per T2. -/+ sp_bwd : ∀ a b, IP a → IP b → (∀ x y, I.iext a x y → I.iext b x y) → I.sp a b+ /-- RBS Table 5.8, row 3, forward.++ > `( p , c ) ∈ IEXT(I(rdfs:domain))` **iff** `p ∈ IP , c ∈ IC ,+ > ∀ x , y : ( x , y ) ∈ IEXT(p) implies x ∈ ICEXT(c)`++ RDFS alone gives `rdfs:domain` only the `if-then` direction, and `scm-dom1`+ does NOT follow from it. This row being inside Table 5.8's `rowspan="4"` is+ the whole reason the twelve arms are derivable. -/+ dom_fwd : ∀ p c, I.iext (I.ι V.domain) p c →+ IP p ∧ I.IC c ∧ ∀ x y, I.iext p x y → I.cext c x+ /-- RBS Table 5.8, row 3, backward. Same cell; conjuncts kept, per T2. -/+ dom_bwd : ∀ p c, IP p → I.IC c → (∀ x y, I.iext p x y → I.cext c x) →+ I.iext (I.ι V.domain) p c+ /-- RBS Table 5.8, row 4, forward.++ > `( p , c ) ∈ IEXT(I(rdfs:range))` **iff** `p ∈ IP , c ∈ IC ,+ > ∀ x , y : ( x , y ) ∈ IEXT(p) implies y ∈ ICEXT(c)`++ The range row differs from the domain row in exactly one letter, `y` for `x`+ in the extension clause, and the four range derivations below differ from the+ four domain ones by exactly that letter. -/+ rng_fwd : ∀ p c, I.iext (I.ι V.range) p c →+ IP p ∧ I.IC c ∧ ∀ x y, I.iext p x y → I.cext c y+ /-- RBS Table 5.8, row 4, backward. Same cell; conjuncts kept, per T2. -/+ rng_bwd : ∀ p c, IP p → I.IC c → (∀ x y, I.iext p x y → I.cext c y) →+ I.iext (I.ι V.range) p c+ /-- RBS Table 5.9, forward. The `iff` cell there carries `rowspan="6"`.++ > `( c₁ , c₂ ) ∈ IEXT(I(owl:equivalentClass))` **iff** `c₁ , c₂ ∈ IC ,+ > ICEXT(c₁) = ICEXT(c₂)`++ Note what the cell does NOT say: it gives an extension EQUALITY and never a+ `rdfs:subClassOf` triple. That is why `Conditions.eqc`, which hands back two+ such triples, is a restatement of `scm-eqc1` rather than a reading of a+ table, and why it counts among the fourteen. -/+ eqc_fwd : ∀ a b, I.iext (I.ι V.equivalentClass) a b →+ I.IC a ∧ I.IC b ∧ ∀ x, (I.cext a x ↔ I.cext b x)+ /-- RBS Table 5.9, forward.++ > `( p₁ , p₂ ) ∈ IEXT(I(owl:equivalentProperty))` **iff** `p₁ , p₂ ∈ IP ,+ > IEXT(p₁) = IEXT(p₂)` -/+ eqp_fwd : ∀ a b, I.iext (I.ι V.equivalentProperty) a b →+ IP a ∧ IP b ∧ ∀ x y, (I.iext a x y ↔ I.iext b x y)+ /-- RBS Table 5.9, forward direction only.++ > `( a₁ , a₂ ) ∈ IEXT(I(owl:sameAs))` **iff** `a₁ = a₂`++ The converse would force `owl:sameAs` to hold reflexively across the entire+ universe, and `eq-sym` is the only rule that reads this condition. Weakest+ conditions: the converse is not written. -/+ same_fwd : ∀ a b, I.iext (I.ι V.sameAs) a b → a = b+ /-- RBS Table 5.12, forward direction only.++ > `( p₁ , p₂ ) ∈ IEXT(I(owl:inverseOf))` **iff** `p₁ , p₂ ∈ IP ,+ > IEXT(p₁) = { ( x , y ) | ( y , x ) ∈ IEXT(p₂) }`++ Both inclusions of the set equality are kept: `prp-inv1` and `prp-inv2` use+ opposite ones. -/+ inv_fwd : ∀ p q, I.iext (I.ι V.inverseOf) p q →+ IP p ∧ IP q ∧ ∀ x y, (I.iext p x y ↔ I.iext q y x)+ /-- RBS Table 5.13, the universally quantified part only.++ > `p ∈ ICEXT(I(owl:SymmetricProperty))` **iff** `p ∈ IP , ∀ x , y :+ > ( x , y ) ∈ IEXT(p) implies ( y , x ) ∈ IEXT(p)`++ The `p ∈ IP` conjunct is dropped because `prp-symp`'s head predicate is the+ same `?p` that its body triple already carries. Keeping it would be faithful+ and redundant; dropping it is the weaker condition. -/+ sym_fwd : ∀ p, I.cext (I.ι V.symmetricProperty) p → ∀ x y, I.iext p x y → I.iext p y x+ /-- RBS Table 5.13, the universally quantified part only.++ > `p ∈ ICEXT(I(owl:TransitiveProperty))` **iff** `p ∈ IP , ∀ x , y , z :+ > ( x , y ) ∈ IEXT(p) and ( y , z ) ∈ IEXT(p) implies ( x , z ) ∈ IEXT(p)` -/+ trp_fwd : ∀ p, I.cext (I.ι V.transitiveProperty) p →+ ∀ x y z, I.iext p x y → I.iext p y z → I.iext p x z+ /-- RBS Table 5.6.++ > **if** `( z , c ) ∈ IEXT(I(owl:someValuesFrom)) , ( z , p ) ∈+ > IEXT(I(owl:onProperty))` **then**+ > `ICEXT(z) = { x | ∃ y : ( x , y ) ∈ IEXT(p) and y ∈ ICEXT(c) }`++ Two things about this row are load-bearing and they pull in opposite+ directions. The OUTER connective is an IF-THEN, not an `iff`: the section's+ own note reads "All the semantic conditions are "if-then" conditions, since+ the corresponding OWL 2 language constructs are class expressions", and+ Tables 5.8 and 5.9 two sections away ARE `iff`s, so a reader carrying that+ habit into 5.6 shrinks the model class while every proof still passes. The+ CONSEQUENT is a set EQUALITY, and both inclusions are consumed:+ `⊇` by `cls-svf1`, `⊆` by `scm-svf1` and `scm-svf2`.++ **This is the sharpest trap in the file.** Writing only `⊆` is the safe+ error, because `cls-svf1` then refuses to go through. The dangerous moment is+ the repair: faced with a failing `scm-svf1` the natural move is to add a+ fresh field asserting the missing direction in slightly different words, and+ that 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. -/+ 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.++ > **if** `( z , c ) ∈ IEXT(I(owl:allValuesFrom)) , ( z , p ) ∈+ > IEXT(I(owl:onProperty))` **then**+ > `ICEXT(z) = { x | ∀ y : ( x , y ) ∈ IEXT(p) implies y ∈ ICEXT(c) }`++ Both inclusions consumed: `⊆` by `cls-avf`, `⊇` by `scm-avf1` and+ `scm-avf2`. Same discipline as `svf_eq`. -/+ avf_eq : ∀ z c p, I.iext (I.ι V.allValuesFrom) 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.++ > **if** `( z , a ) ∈ IEXT(I(owl:hasValue)) , ( z , p ) ∈+ > IEXT(I(owl:onProperty))` **then** `ICEXT(z) = { x | ( x , a ) ∈ IEXT(p) }`++ `cls-hv1` needs `⊆`, `cls-hv2` needs `⊇`, so `Conditions.hv` already carried+ the equality and this field is the same statement. -/+ hv_eq : ∀ z a p, I.iext (I.ι V.hasValue) z a → I.iext (I.ι V.onProperty) z p →+ ∀ x, (I.cext z x ↔ I.iext p x a)+ /-- RBS Table 5.2, the `owl:Restriction` row: `ICEXT(I(owl:Restriction)) ⊆ IC`.++ Needed by all four restriction-ordering derivations, whose conclusion is a+ `rdfs:subClassOf` triple and whose `sc_bwd` antecedent therefore demands+ `IC`. Nothing else in this structure supplies it, because those rules'+ premises mention only `someValuesFrom`, `allValuesFrom` and `onProperty`. -/+ restr_IC : ∀ x, I.cext (I.ι V.Restriction) x → I.IC x+ /-- RBS Table 5.3, the `owl:someValuesFrom` row:+ `IEXT(I(owl:someValuesFrom)) ⊆ ICEXT(I(owl:Restriction)) × IC`. -/+ svf_typ : ∀ z c, I.iext (I.ι V.someValuesFrom) z c →+ I.cext (I.ι V.Restriction) z ∧ I.IC c+ /-- RBS Table 5.3, the `owl:allValuesFrom` row:+ `IEXT(I(owl:allValuesFrom)) ⊆ ICEXT(I(owl:Restriction)) × IC`. -/+ avf_typ : ∀ z c, I.iext (I.ι V.allValuesFrom) z c →+ I.cext (I.ι V.Restriction) z ∧ I.IC c+ /-- RBS Table 5.3, the `owl:onProperty` row:+ `IEXT(I(owl:onProperty)) ⊆ ICEXT(I(owl:Restriction)) × IP`. -/+ onp_typ : ∀ z p, I.iext (I.ι V.onProperty) z p →+ I.cext (I.ι V.Restriction) z ∧ IP p++/-! ## The fourteen derivations++Every theorem in this section is a proof term over `W3C`, not a projection out+of it. Each replaces one field of `Conditions` and therefore one arm of+`checkStep_sound`. -/++namespace W3C+variable {I : Interp} {IP : I.D → Prop}++/-! ### Group A: domain and range, four arms++These are the cheapest derivations in the set, and the reason `scm-dom1` had to+be checked rather than assumed. Each is Table 5.8 forward on one argument, the+subclass or subproperty inclusion, then Table 5.8 backward on the other. -/++/-- **scm-dom1.** `T(?p, rdfs:domain, ?c1)`, `T(?c1, rdfs:subClassOf, ?c2)`+gives `T(?p, rdfs:domain, ?c2)`. A domain may be weakened to a superclass.++Table 5.8 row 3 left to right on `c1`, then `ICEXT(c1) ⊆ ICEXT(c2)` from row 1,+then row 3 right to left on `c2`. The `IC c2` the backward direction demands+comes from row 1's forward direction, not from anywhere new. -/+theorem dom_sc (W : W3C I IP) (p c1 c2 : I.D)+ (hd : I.iext (I.ι V.domain) p c1) (hsc : I.sc c1 c2) :+ I.iext (I.ι V.domain) p c2 :=+ W.dom_bwd p c2 (W.dom_fwd p c1 hd).1 (W.sc_fwd c1 c2 hsc).2.1+ (fun x y hxy => (W.sc_fwd c1 c2 hsc).2.2 x ((W.dom_fwd p c1 hd).2.2 x y hxy))++/-- **scm-dom2.** `T(?p2, rdfs:domain, ?c)`, `T(?p1, rdfs:subPropertyOf, ?p2)`+gives `T(?p1, rdfs:domain, ?c)`. A domain is inherited by every subproperty.++Table 5.8 row 3 left to right on `p2`, then `IEXT(p1) ⊆ IEXT(p2)` from row 2,+so every pair of `p1` is a pair of `p2` and its subject is already in+`ICEXT(c)`, then row 3 right to left on `p1`. The composition runs the other+way round from `dom_sc`'s. -/+theorem dom_sp (W : W3C I IP) (p1 p2 c : I.D)+ (hd : I.iext (I.ι V.domain) p2 c) (hsp : I.sp p1 p2) :+ I.iext (I.ι V.domain) p1 c :=+ W.dom_bwd p1 c (W.sp_fwd p1 p2 hsp).1 (W.dom_fwd p2 c hd).2.1+ (fun x y hxy => (W.dom_fwd p2 c hd).2.2 x y ((W.sp_fwd p1 p2 hsp).2.2 x y hxy))++/-- **scm-rng1.** `T(?p, rdfs:range, ?c1)`, `T(?c1, rdfs:subClassOf, ?c2)`+gives `T(?p, rdfs:range, ?c2)`. `dom_sc` with row 4 for row 3, which is `y` for+`x` in the extension clause and nothing else. -/+theorem rng_sc (W : W3C I IP) (p c1 c2 : I.D)+ (hr : I.iext (I.ι V.range) p c1) (hsc : I.sc c1 c2) :+ I.iext (I.ι V.range) p c2 :=+ W.rng_bwd p c2 (W.rng_fwd p c1 hr).1 (W.sc_fwd c1 c2 hsc).2.1+ (fun x y hxy => (W.sc_fwd c1 c2 hsc).2.2 y ((W.rng_fwd p c1 hr).2.2 x y hxy))++/-- **scm-rng2.** `T(?p2, rdfs:range, ?c)`, `T(?p1, rdfs:subPropertyOf, ?p2)`+gives `T(?p1, rdfs:range, ?c)`. `dom_sp` with row 4 for row 3. -/+theorem rng_sp (W : W3C I IP) (p1 p2 c : I.D)+ (hr : I.iext (I.ι V.range) p2 c) (hsp : I.sp p1 p2) :+ I.iext (I.ι V.range) p1 c :=+ W.rng_bwd p1 c (W.sp_fwd p1 p2 hsp).1 (W.rng_fwd p2 c hr).2.1+ (fun x y hxy => (W.rng_fwd p2 c hr).2.2 x y ((W.sp_fwd p1 p2 hsp).2.2 x y hxy))++/-! ### Group B: the two transitivity arms++RDF 1.1 Semantics section 9 does state "IEXT(I(rdfs:subClassOf)) is transitive+and reflexive on IC" as a condition in its own right, so `Conditions.sc_trans`+and `Conditions.sp_trans` are licensed in a way the other twelve are not. Once+Table 5.8 is present they are redundant, and the honest thing is to derive them+rather than assume something a stronger cell already gives.++The second formalisation keeps both as primitive on purpose+(`isabelle/OO_Semantics.thy`, DECISION M10), for a diagnostic reason that does+not apply here: there, keeping them separate puts the six `rdfs*` arms in a+strictly weaker fragment than the twelve that need Table 5.8's backward+direction, and the consumption map shows which arm needs which. Here `W3C` is a+single structure, no arm sits in a distinguished fragment of it, and there is+nothing to diagnose. -/++/-- **rdfs11.** Transitivity of `rdfs:subClassOf`, from Table 5.8 row 1 forward+twice, composition of the two inclusions, and row 1 backward once. -/+theorem sc_trans (W : W3C I IP) (a b c : I.D) (hab : I.sc a b) (hbc : I.sc b c) : I.sc a c :=+ W.sc_bwd a c (W.sc_fwd a b hab).1 (W.sc_fwd b c hbc).2.1+ (fun x hx => (W.sc_fwd b c hbc).2.2 x ((W.sc_fwd a b hab).2.2 x hx))++/-- **rdfs5.** Transitivity of `rdfs:subPropertyOf`, from Table 5.8 row 2. -/+theorem sp_trans (W : W3C I IP) (a b c : I.D) (hab : I.sp a b) (hbc : I.sp b c) : I.sp a c :=+ W.sp_bwd a c (W.sp_fwd a b hab).1 (W.sp_fwd b c hbc).2.1+ (fun x y hxy => (W.sp_fwd b c hbc).2.2 x y ((W.sp_fwd a b hab).2.2 x y hxy))++/-! ### Group C: the four equivalence arms++`scm-eqc1` and `scm-eqp1` each license two conclusions from one premise, so+these two theorems carry four arms between them. The signatures keep+`Conditions.eqc` and `Conditions.eqp`'s conjunction shape exactly, so+`Soundness.lean`'s `scmEqc1` and `scmEqp1` cases need no edit. -/++/-- **scm-eqc1, both conclusions.** `T(?a, owl:equivalentClass, ?b)` gives+`T(?a, rdfs:subClassOf, ?b)` and `T(?b, rdfs:subClassOf, ?a)`.++Table 5.9 hands back an extension EQUALITY and never a `rdfs:subClassOf`+triple; the triples come out of Table 5.8 row 1 backward, once in each+direction, with the `IC` memberships supplied by Table 5.9's own conjuncts. -/+theorem eqc (W : W3C I IP) (a b : I.D) (h : I.iext (I.ι V.equivalentClass) a b) :+ I.sc a b ∧ I.sc b a :=+ ⟨W.sc_bwd a b (W.eqc_fwd a b h).1 (W.eqc_fwd a b h).2.1+ (fun x hx => ((W.eqc_fwd a b h).2.2 x).mp hx),+ W.sc_bwd b a (W.eqc_fwd a b h).2.1 (W.eqc_fwd a b h).1+ (fun x hx => ((W.eqc_fwd a b h).2.2 x).mpr hx)⟩++/-- **scm-eqp1, both conclusions.** Table 5.9's `owl:equivalentProperty` row+and Table 5.8 row 2 backward. -/+theorem eqp (W : W3C I IP) (a b : I.D) (h : I.iext (I.ι V.equivalentProperty) a b) :+ I.sp a b ∧ I.sp b a :=+ ⟨W.sp_bwd a b (W.eqp_fwd a b h).1 (W.eqp_fwd a b h).2.1+ (fun x y hxy => ((W.eqp_fwd a b h).2.2 x y).mp hxy),+ W.sp_bwd b a (W.eqp_fwd a b h).2.1 (W.eqp_fwd a b h).1+ (fun x y hxy => ((W.eqp_fwd a b h).2.2 x y).mpr hxy)⟩++/-! ### Group D: the four restriction-ordering arms++These are the expensive ones. Each needs Table 5.6's equality in the direction+`Conditions` does not have, plus Tables 5.2 and 5.3's typing rows to supply the+`IC` memberships that `sc_bwd`'s antecedent demands.++`svf_sc` and `svf_sp` consume the `⊆` half of Table 5.6's `someValuesFrom`+equality, which `Conditions.svf` does not carry. `avf_sc` and `avf_sp` consume+the `⊇` half of the `allValuesFrom` equality, which `Conditions.avf` does not+carry. Those two halves are the entire strengthening in this file, and the cell+that licenses them is Table 5.6's consequent being a set equality, quoted above+`svf_eq` and `avf_eq`. -/++/-- **scm-svf1.** Two existential restrictions on the same property, ordered by+their fillers: a wider filler makes a wider class.++`ICEXT(c1) ⊆ ICEXT(c2)` by unfolding Table 5.6 on `c1`, widening the found+witness's filler membership through Table 5.8 row 1 forward, and folding Table+5.6 back up on `c2`. Then row 1 backward turns the inclusion into the triple,+with `IC c1` and `IC c2` from Table 5.3's `someValuesFrom` row into Table 5.2's+`owl:Restriction` row. -/+theorem svf_sc (W : W3C I IP) (c1 c2 p y1 y2 : I.D)+ (h1 : I.iext (I.ι V.someValuesFrom) c1 y1) (h2 : I.iext (I.ι V.onProperty) c1 p)+ (h3 : I.iext (I.ι V.someValuesFrom) c2 y2) (h4 : I.iext (I.ι V.onProperty) c2 p)+ (h5 : I.sc y1 y2) : I.sc c1 c2 :=+ W.sc_bwd c1 c2 (W.restr_IC c1 (W.svf_typ c1 y1 h1).1) (W.restr_IC c2 (W.svf_typ c2 y2 h3).1)+ (fun x hx =>+ (W.svf_eq c2 y2 p h3 h4 x).mpr+ (match (W.svf_eq c1 y1 p h1 h2 x).mp hx with+ | ⟨y, hxy, hy⟩ => ⟨y, hxy, (W.sc_fwd y1 y2 h5).2.2 y hy⟩))++/-- **scm-svf2.** Two existential restrictions with the same filler, ordered by+their properties. `svf_sc` with the witness moved across by Table 5.8 row 2+forward instead of the filler being widened by row 1. -/+theorem svf_sp (W : W3C I IP) (c1 c2 p1 p2 y : I.D)+ (h1 : I.iext (I.ι V.someValuesFrom) c1 y) (h2 : I.iext (I.ι V.onProperty) c1 p1)+ (h3 : I.iext (I.ι V.someValuesFrom) c2 y) (h4 : I.iext (I.ι V.onProperty) c2 p2)+ (h5 : I.sp p1 p2) : I.sc c1 c2 :=+ W.sc_bwd c1 c2 (W.restr_IC c1 (W.svf_typ c1 y h1).1) (W.restr_IC c2 (W.svf_typ c2 y h3).1)+ (fun x hx =>+ (W.svf_eq c2 y p2 h3 h4 x).mpr+ (match (W.svf_eq c1 y p1 h1 h2 x).mp hx with+ | ⟨v, hxv, hv⟩ => ⟨v, (W.sp_fwd p1 p2 h5).2.2 x v hxv, hv⟩))++/-- **scm-avf1.** Two universal restrictions on the same property, ordered by+their fillers, and this one runs the SAME way round as the three above.++Widening `ICEXT(c)` weakens the consequent of Table 5.6's implication, so it+widens `ICEXT(z)`. A universal restriction is MONOTONE in its filler and+antitone only in its property, which is why this rule and `avf_sp` run in+opposite directions. -/+theorem avf_sc (W : W3C I IP) (c1 c2 p y1 y2 : I.D)+ (h1 : I.iext (I.ι V.allValuesFrom) c1 y1) (h2 : I.iext (I.ι V.onProperty) c1 p)+ (h3 : I.iext (I.ι V.allValuesFrom) c2 y2) (h4 : I.iext (I.ι V.onProperty) c2 p)+ (h5 : I.sc y1 y2) : I.sc c1 c2 :=+ W.sc_bwd c1 c2 (W.restr_IC c1 (W.avf_typ c1 y1 h1).1) (W.restr_IC c2 (W.avf_typ c2 y2 h3).1)+ (fun x hx =>+ (W.avf_eq c2 y2 p h3 h4 x).mpr+ (fun v hv => (W.sc_fwd y1 y2 h5).2.2 v ((W.avf_eq c1 y1 p h1 h2 x).mp hx v hv)))++/-- **scm-avf2, and the conclusion is REVERSED**: `T(?c2, rdfs:subClassOf, ?c1)`+where the other three restriction-ordering rules conclude+`T(?c1, rdfs:subClassOf, ?c2)`.++**After this derivation the direction is forced by the proof rather than agreed+between two hand-written statements.** `Soundness.lean`'s `scmAvf2` case used to+be defended by a comment saying that `avf_sp` "is stated that way round and the+two must agree, so getting either one backwards fails to compile rather than+shipping a rule no model supports". That is a consistency check between two+things the same author wrote, and it passes if both are wrong. Here `sc_bwd` is+applied to the pair `(c2, c1)`, and it is applied that way round because the+only `avf_eq` whose `.mp` fires on the hypothesis is `c2`'s and the only one+whose `.mpr` closes the goal is `c1`'s. Writing `(c1, c2)` does not merely fail+a sanity check, it fails to typecheck, and it fails against the specification's+antitonicity rather than against a second copy of the claim. -/+theorem avf_sp (W : W3C I IP) (c1 c2 p1 p2 y : I.D)+ (h1 : I.iext (I.ι V.allValuesFrom) c1 y) (h2 : I.iext (I.ι V.onProperty) c1 p1)+ (h3 : I.iext (I.ι V.allValuesFrom) c2 y) (h4 : I.iext (I.ι V.onProperty) c2 p2)+ (h5 : I.sp p1 p2) : I.sc c2 c1 :=+ W.sc_bwd c2 c1 (W.restr_IC c2 (W.avf_typ c2 y h3).1) (W.restr_IC c1 (W.avf_typ c1 y h1).1)+ (fun x hx =>+ (W.avf_eq c1 y p1 h1 h2 x).mpr+ (fun v hv => (W.avf_eq c2 y p2 h3 h4 x).mp hx v ((W.sp_fwd p1 p2 h5).2.2 x v hv)))++end W3C++/-! ## A conforming model of a graph, and the adequacy theorem -/++/-- `I` with property set `IP` meets the specification conditions and models+`G`. The three list rows are stated over `Chain`, which reads the list off the+ASSERTED GRAPH.++**This is the one place where the structure is not the specification's**, and+the divergence is recorded rather than argued away. RBS's convention section+defines "`s` sequence of `a₁ , … , aₙ ∈ S`" semantically: "`s` = `I(rdf:nil)`+for `n = 0`; and for `n > 0` there exist `z₁ ∈ IR , … , zₙ ∈ IR`, such that+`s = z₁`, `a₁ ∈ S`, `( z₁ , a₁ ) ∈ IEXT(I(rdf:first))`, `( z₁ , z₂ ) ∈+IEXT(I(rdf:rest))`, … ". It quantifies over `IEXT(I(rdf:first))` and+`IEXT(I(rdf:rest))`, NOT over `G`, and it adds that "there are no semantic+constraints that enforce "well-formed" sequence structures. So, for example, it+is possible for a sequence head `s` to refer to more than one sequence."++`Chain G` fires on strictly fewer lists than the specification's relation does+in any model of `G`, because a model satisfies `G`'s own `rdf:first` and+`rdf:rest` triples and so every graph chain is a semantic sequence, while a+semantic sequence built from pairs the graph never asserts is not a graph+chain. Conditions stated over `Chain` are therefore WEAKER than the+specification's, the model class is larger, and entailment still transfers+outward. What does not follow is the converse: an interpretation meeting these+three fields is not thereby known to meet Tables 5.4 and 5.5. Closing that gap+needs `rdf:first` and `rdf:rest` in the vocabulary and a semantic sequence+relation, which no rule in this checker consumes. -/+structure W3CModel (I : Interp) (IP : I.D → Prop) (G : List Triple) : Prop where+ conds : W3C I IP+ facts : ∀ t ∈ G, I.sat t+ /-- RBS Table 5.4: **if** `s` sequence of `c₁ , … , cₙ ∈ IR` **then**+ `( z , s ) ∈ IEXT(I(owl:intersectionOf))` **iff** `z , c₁ , … , cₙ ∈ IC ,+ ICEXT(z) = ICEXT(c₁) ∩ … ∩ ICEXT(cₙ)`. The equality, both halves; the `IC`+ conjuncts are dropped because no arm consumes them. -/+ int_eq : ∀ c l ms, (⟨c, V.intersectionOf, l⟩ : Triple) ∈ G → Chain G l ms →+ ∀ x, (I.cext (I.ι c) x ↔ ∀ m ∈ ms, I.cext (I.ι m) x)+ /-- RBS Table 5.4: the `owl:unionOf` row, `ICEXT(z) = ICEXT(c₁) ∪ … ∪+ ICEXT(cₙ)`. -/+ uni_eq : ∀ c l ms, (⟨c, V.unionOf, l⟩ : Triple) ∈ G → Chain G l ms →+ ∀ x, (I.cext (I.ι c) x ↔ ∃ m ∈ ms, I.cext (I.ι m) x)+ /-- RBS Table 5.5: **if** `s` sequence of `a₁ , … , aₙ ∈ IR` **then**+ `( z , s ) ∈ IEXT(I(owl:oneOf))` **iff** `z ∈ IC , ICEXT(z) = { a₁ , … , aₙ }`.++ `Model.oneOf` is the `⊇` half of this and nothing else, so a conforming+ interpretation gives it and the `⊆` half is available here but consumed by no+ rule. -/+ oneOf_eq : ∀ c l ms, (⟨c, V.oneOf, l⟩ : Triple) ∈ G → Chain G l ms →+ ∀ x, (I.cext (I.ι c) x ↔ ∃ m ∈ ms, x = I.ι m)++/-- **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. -/+theorem W3CModel.toModel {I : Interp} {IP : I.D → Prop} {G : List Triple}+ (W : W3CModel I IP G) : Model I G where+ conds :=+ { sc_sub := fun a b h x hx => (W.conds.sc_fwd a b h).2.2 x hx+ sc_trans := W.conds.sc_trans+ sp_sub := fun a b h x y hxy => (W.conds.sp_fwd a b h).2.2 x y hxy+ sp_trans := W.conds.sp_trans+ dom := fun p c h x y hxy => (W.conds.dom_fwd p c h).2.2 x y hxy+ rng := fun p c h x y hxy => (W.conds.rng_fwd p c h).2.2 x y hxy+ trp := W.conds.trp_fwd+ symp := W.conds.sym_fwd+ inv := fun p q h x y => (W.conds.inv_fwd p q h).2.2 x y+ same := W.conds.same_fwd+ eqc := W.conds.eqc+ eqp := W.conds.eqp+ svf := fun r p c hop hsv x y hxy hy =>+ (W.conds.svf_eq r c p hsv hop x).mpr ⟨y, hxy, hy⟩+ avf := fun r p c hop hav x y hx hxy =>+ (W.conds.avf_eq r c p hav hop x).mp hx y hxy+ hv := fun r p v hop hhv x => W.conds.hv_eq r v p hhv hop x+ svf_sc := W.conds.svf_sc+ svf_sp := W.conds.svf_sp+ avf_sc := W.conds.avf_sc+ avf_sp := W.conds.avf_sp+ dom_sc := W.conds.dom_sc+ dom_sp := W.conds.dom_sp+ rng_sc := W.conds.rng_sc+ rng_sp := W.conds.rng_sp }+ facts := W.facts+ int := fun c l ms hin hch x hall => (W.int_eq c l ms hin hch x).mpr hall+ int2 := fun c l ms hin hch x hx m hm => (W.int_eq c l ms hin hch x).mp hx m hm+ uni := fun c l ms hin hch x m hm hx => (W.uni_eq c l ms hin hch x).mpr ⟨m, hm, hx⟩+ oneOf := fun c l ms hin hch m hm => (W.oneOf_eq c l ms hin hch (I.ι m)).mpr ⟨m, hm, rfl⟩++/-- Entailment over the conforming interpretations. Stated separately from+`Entails` on purpose: this is a SMALLER class of interpretations, so this+relation is LARGER, and a non-entailment result about it is a strictly stronger+claim than a non-entailment result about `Entails`. Nothing in this file proves+one. -/+def W3CEntails (G : List Triple) (t : Triple) : Prop :=+ ∀ (I : Interp) (IP : I.D → Prop), W3CModel I IP G → I.sat t++/-- **The sentence the layer can put its name to.** Everything `Entails` gives+is true in every conforming interpretation of the graph, and the fourteen+conditions that used to be posited are steps inside the proof of it.++The transfer runs in this direction and only this one. `Conditions` admits more+interpretations than `W3C` does, so a claim true in all of them is true in all+of the smaller class. The converse fails, which is why a `¬ Entails` result+does NOT give `¬ W3CEntails`, and why every non-entailment witness in+`Witness.lean`, `Refute.lean`, `RefuteWitness.lean` and `Mixed.lean` is a+statement about the `Conditions` model class alone. -/+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. -/+theorem certificate_w3c_sound (G : List Triple) (steps : List Step)+ (h : checkCert G steps = true) :+ ∀ st ∈ steps, W3CEntails G st.conclusion :=+ fun st hst => W3CEntails.of_entails (certificate_sound G steps h st hst)++/-! ## The axiom tripwire++The same guard `Soundness.lean` carries, on the new theorems. A `sorry` or a+`native_decide` anywhere in the fourteen derivations fails the build here.+`native_decide` would add `Lean.ofReduceBool`, which is why it is banned rather+than merely discouraged. -/++/-- info: 'OOCert.W3CModel.toModel' does not depend on any axioms -/+#guard_msgs in+#print axioms W3CModel.toModel++/-- info: 'OOCert.certificate_w3c_sound' depends on axioms: [propext, Classical.choice, Quot.sound] -/+#guard_msgs in+#print axioms certificate_w3c_sound++end OOCertdiff --git a/lean/OOCert/W3CWitness.lean b/lean/OOCert/W3CWitness.leannew file mode 100644index 00000000..2ee04a34--- /dev/null+++ b/lean/OOCert/W3CWitness.lean@@ -0,0 +1,682 @@+import OOCert.W3C+import OOCert.Witness++/-!+# A LIVE conforming model, and the first non-entailment that is about the specification++`W3C.lean` derives fourteen arms from quoted specification cells. That result is+worth nothing until something exhibits a `W3CModel`, and it is worth very little+if the thing that exhibits one is degenerate. This file builds a model that is+not, and uses it twice.++## Why `saturated` is not enough++`Witness.lean`'s `saturated` (domain `Unit`, every relation total) satisfies+`W3C` with `IP := fun _ => True`: every field holds because both sides of every+equality are all of `Unit`. So bare satisfiability of `W3C` is one theorem and+it says nothing, because such a model distinguishes no condition from any other+and refutes nothing. `W3CModel.toModel` proved over an unsatisfiable or a+degenerate `W3C` would be a theorem about nothing that LOOKED better than the+assumption it replaced, which is a strictly worse defect than the one being+repaired. The gate is therefore a NON-DEGENERATE model, and `live_is_live`+below compiles the liveness facts into the build so that the next person to+shorten this graph to fix a `decide` timeout breaks it rather than hollowing it+out silently.++| liveness fact | why it is the gate |+|---|---|+| `IC` has three members and does not swallow the carrier | the conditions are about classes, there are some, and not everything is one |+| `ICEXT(C1)` is the whole domain | a class extension is not empty |+| `ICEXT(C2)` is a PROPER subset of it | two distinct non-trivial extensions, so `sc_fwd` and `sc_bwd` have something to separate |+| `ICEXT(Y)` is empty and `sc_bwd` still does not collapse | the `IC` conjunct of trap T2 doing its job |+| `ICEXT(owl:Restriction)` is a PROPER subset of `IC` | Table 5.2's subset read as a subset and not as an equality |+| `IEXT(p2)` is non-empty | `dom_bwd` and `rng_bwd` are discharged over a relation with a pair in it, not vacuously |++That last row is the one neither formalisation had. The second kernel's+`isabelle/OO_NonVacuity.thy` claims at its own summary that `c_dom_bwd` and+`c_rng_bwd` are live in its model M3, while M3's proofs of those two derive+`False` from their antecedents and an inline comment in the same file says so.+Its M3 therefore exercises the two backward halves VACUOUSLY.+`live_dom_bwd_is_exercised` and `live_rng_bwd_is_exercised` discharge the+`forall x y` clause over `IEXT(p2) = {(alice, bob)}` instead.++## The model++Carrier: two individuals `alice` and `bob`; the five terms `avfPremises`+mentions, as `c1`, `c2`, `filler`, `p1`, `p2`; the vocabulary denotations that+have to be told apart, as `ty`, `sco`, `spo`, `dm`, `rg`, `avf`, `onp`, `cls`,+`restr`; and one junk element `other` absorbing every remaining IRI. Seventeen+elements.++THREE rows are chosen and the conditions determine everything else.++* `IEXT(p1) := empty`, `IEXT(p2) := {(alice, bob)}`, `ICEXT(filler) := empty`.+* `avf_eq` then forces `ICEXT(c1)` to be the whole carrier, because nothing has+ a `p1`-successor at all, and `ICEXT(c2)` to be the carrier minus `alice`,+ because `alice` has the `p2`-successor `bob` and `bob` is not in+ `ICEXT(filler)`.+* So `ICEXT(c1)` is not contained in `ICEXT(c2)`, and `sc_fwd` makes+ `(c1, c2)` in `IEXT(rdfs:subClassOf)` IMPOSSIBLE. That is the refutation.+* And `ICEXT(c2)` IS contained in `ICEXT(c1)`, so `sc_bwd` FORCES+ `(c2, c1)` into `IEXT(rdfs:subClassOf)`, which is what `scm-avf2` draws. The+ witness confirms both halves of the pair, where the Herbrand witness in+ `Witness.lean` asserts one and leaves the other out by hand.+* `IC := {c1, c2, filler}` through `ICEXT(rdfs:Class)`, and+ `ICEXT(owl:Restriction) := {c1, c2}`, a PROPER subset of `IC` per Table 5.2.+ `owl:Restriction` itself is kept out of `IC`, so `sc_bwd` raises no obligation+ about it.+* `sp_bwd`, `dom_bwd` and `rng_bwd` then force the rest of+ `IEXT(rdfs:subPropertyOf)`, `IEXT(rdfs:domain)` and `IEXT(rdfs:range)`, and+ those three tables are a FIXPOINT rather than a free choice: each is defined+ in terms of the others, because `rdfs:subPropertyOf`, `rdfs:domain` and+ `rdfs:range` are themselves members of `IP` and so are subject to the very+ conditions they carry. The tables below are that fixpoint, reached in two+ iterations. `(p2, p1)` is NOT in `IEXT(rdfs:subPropertyOf)`, because+ `IEXT(p2)` is not contained in `IEXT(p1)`, and the domain and range tables+ DIFFER, by exactly `(p2, c2)` and `(ty, c2)`, which is the model separating+ the two rows of Table 5.8 rather than satisfying them both by accident.++The fixpoint is why several entries look strange at first reading.+`rdfs:domain` has `rdfs:subClassOf` in its subject position, for instance. That+is forced, not chosen: `rdfs:subClassOf` is in `IP`, `c1` is in `IC`, every+subject of `IEXT(rdfs:subClassOf)` lies in `ICEXT(c1)` because `ICEXT(c1)` is+everything, and Table 5.8's `rdfs:domain` row is an `iff`. RDF has no sortal+separation, and this is what that costs.++## `IP`, and why these nine++`IP` must contain every element with a non-empty extension, or the structure is+not the image of any conforming interpretation under the bridge in `W3C.lean`+(there, `iext p x y := IP p and (x, y) in IEXT p`, so a pair in an extension+implies its predicate is in `IP`). `live_is_bridge_coherent` checks that below.++The nine are `p1`, `p2` and the seven vocabulary denotations that carry pairs,+and every one of them is in `IP` in any conforming interpretation:++* `owl:allValuesFrom` and `owl:onProperty` by RBS Table 5.3 directly, whose+ second column reads "in IP" for both.+* `rdf:type` by RDF 1.1 Semantics' RDF axiomatic triple+ `rdf:type rdf:type rdf:Property .` together with RBS Table 5.2's row+ `rdf:Property | in IC | = IP`.+* `rdfs:domain`, `rdfs:range` and `rdfs:subPropertyOf` by the RDFS axiomatic+ triples `rdfs:domain rdfs:domain rdf:Property .`,+ `rdfs:range rdfs:domain rdf:Property .` and+ `rdfs:subPropertyOf rdfs:domain rdf:Property .`, each read through the same+ Table 5.2 row.+* `rdfs:subClassOf` by the RDFS axiomatic triple+ `rdfs:subClassOf rdfs:domain rdfs:Class .`, whose truth puts+ `I(rdfs:subClassOf)` into `IP` through the forward direction of Table 5.8's+ `rdfs:domain` row.+* `p1` and `p2` because `onp_typ` demands it of both.++## WHAT THIS WITNESS DOES NOT ESTABLISH, and it is less than it looks++It establishes `not W3CEntails avfPremises (C1, rdfs:subClassOf, C2)`. That is+strictly stronger than the existing Herbrand result, which is about the Lean's+much larger `Conditions` class, and the refuting structure here satisfies+Table 5.8 in both directions, Table 5.6's `allValuesFrom` equality, and the+typing rows of Tables 5.2 and 5.3, none of which any Herbrand witness in this+repository does.++**It is NOT a proof that the triple is not OWL 2 RDF-Based entailed, and nobody+should write that sentence.** Positive transfer runs outward and negative+transfer does not. `W3CModel`'s class is strictly LARGER than the bridge image+of the conforming interpretations, because `W3C` deliberately omits every row no+rule consumes, so a refutation here does not rule out that every genuinely+conforming interpretation satisfies the triple. Concretely, this model violates+at least these rows of RBS Table 5.2, all of which a conforming interpretation+must satisfy:++* `owl:Thing | in IC | = IR`. Here `owl:Thing` denotes `other`, whose class+ extension is empty and is not the carrier.+* `rdf:Property | in IC | = IP`. Here `rdf:Property` also denotes `other`, so+ its class extension is empty rather than the nine-element `IP`.+* `rdfs:Resource | in IC | = IR`, and the RDF and RDFS axiomatic triple tables+ themselves, which are simply absent.++Closing that gap means formalising Table 5.2's forty-odd rows, the axiomatic+triple tables, and the parts of the universe from Table 5.1, and then rebuilding+this model over them. That is a different project, and the honest report is that+this witness gets closer to the specification than anything else here and does+not arrive.++## What it leaves untouched++It does NOT rehabilitate the other non-entailment results.+`Witness.lean`'s `the_old_svf_derivation_is_not_entailed`,+`an_unlisted_individual_is_not_entailed`,+`membership_in_one_member_does_not_give_the_intersection`,+`not_everything_is_entailed`, `Mixed.lean`'s `mix_not_absolutely_entailed`,+`Refute.lean`'s `not_unsat_of_joint_model` and `RefuteWitness.lean`'s+`feed_is_not_refuted` are all discharged by Herbrand or saturated+interpretations, and none of those is a `W3CModel`. The obstruction is recorded+at each of them and at `Semantics.lean`'s safety paragraph.+-/+namespace OOCert++/-! ## The carrier -/++/-- The seventeen elements. `other` absorbs every IRI the model does not need to+tell apart, and its extension and class extension are both empty, which is what+makes every condition over a vocabulary term not named here hold vacuously. -/+inductive LiveD where+ /-- An individual with a `p2`-successor, and the only element outside+ `ICEXT(c2)`. -/+ | alice+ /-- Its `p2`-successor, and the witness that `ICEXT(c2)` is not empty. -/+ | bob+ /-- `C1`, which `avfPremises` makes the universal restriction on `p1`. -/+ | c1+ /-- `C2`, which `avfPremises` makes the universal restriction on `p2`. -/+ | c2+ /-- `Y`, the shared filler, with an EMPTY class extension. -/+ | filler+ /-- `p1`, with an empty property extension. -/+ | p1+ /-- `p2`, with the single pair `(alice, bob)`. -/+ | p2+ /-- `rdf:type`, whose extension IS `ICEXT`. -/+ | ty+ /-- `rdfs:subClassOf`. -/+ | sco+ /-- `rdfs:subPropertyOf`. -/+ | spo+ /-- `rdfs:domain`. -/+ | dm+ /-- `rdfs:range`. -/+ | rg+ /-- `owl:allValuesFrom`. -/+ | avf+ /-- `owl:onProperty`. -/+ | onp+ /-- `rdfs:Class`, whose class extension IS `IC` (Table 5.2, "= IC"). -/+ | cls+ /-- `owl:Restriction`, whose class extension is a PROPER subset of `IC`+ (Table 5.2 writes a subset, never an equality, and this model makes the+ inclusion strict). -/+ | restr+ /-- Every other IRI. -/+ | other+deriving DecidableEq, Repr++namespace LiveD++/-- The carrier as a list, so that quantification over it is decidable without+Mathlib's `Fintype`. -/+def all : List LiveD :=+ [alice, bob, c1, c2, filler, p1, p2, ty, sco, spo, dm, rg, avf, onp, cls, restr, other]++theorem mem_all (w : LiveD) : w ∈ all := by cases w <;> decide++/-- Universal quantification over the carrier is decidable. Every condition+below is settled by `decide` through this instance, so the model is an+executable fact and not a tactic script that might be proving something else. -/+instance decForall (p : LiveD → Prop) [DecidablePred p] : Decidable (∀ w, p w) :=+ decidable_of_iff (∀ w ∈ all, p w) ⟨fun h w => h w (mem_all w), fun h w _ => h w⟩++/-- And so is existential quantification, which `svf_eq` needs on its right-hand+side. -/+instance decExists (p : LiveD → Prop) [DecidablePred p] : Decidable (∃ w, p w) :=+ decidable_of_iff (∃ w ∈ all, p w)+ ⟨fun ⟨w, _, h⟩ => ⟨w, h⟩, fun ⟨w, h⟩ => ⟨w, mem_all w, h⟩⟩++end LiveD++/-! ## The interpretation -/++/-- The denotation table. Everything absent from it denotes `other`, so+`owl:someValuesFrom`, `owl:hasValue`, `owl:equivalentClass`,+`owl:equivalentProperty`, `owl:sameAs`, `owl:inverseOf`,+`owl:SymmetricProperty`, `owl:TransitiveProperty`, `owl:intersectionOf`,+`owl:unionOf`, `owl:oneOf`, `owl:Thing` and `rdf:Property` all land there+together and their conditions hold vacuously. That is a choice about what this+witness is FOR: it exercises Table 5.8 in both directions and Table 5.6's+`allValuesFrom` row, and it says nothing about the rest. The last two of those+IRIs are also where the model stops being a conforming interpretation; see the+module docstring. -/+def liveTable : List (Term × LiveD) :=+ [ (V.type, .ty), (V.subClassOf, .sco), (V.subPropertyOf, .spo),+ (V.domain, .dm), (V.range, .rg),+ (V.allValuesFrom, .avf), (V.onProperty, .onp),+ (V.Class, .cls), (V.Restriction, .restr),+ (tC1, .c1), (tC2, .c2), (tY, .filler), (tp1, .p1), (tp2, .p2) ]++/-- Terms denote their table entry, or `other`. -/+def liveι (t : Term) : LiveD := (List.lookup t liveTable).getD .other++/-- `IP`. The eight elements that carry pairs, plus `p1`, which `onp_typ`+demands.++Every one of them is in `IP` in any conforming interpretation, by RBS Table 5.3+for `owl:allValuesFrom` and `owl:onProperty` and by the RDF and RDFS axiomatic+triples read through Table 5.2's `rdf:Property | = IP` row for the rest; the+citations are in the module docstring. Nothing else is in `IP`, which is what+keeps `sp_bwd`, `dom_bwd` and `rng_bwd` from forcing schema triples about+individuals. -/+def isIP : LiveD → Bool+ | .p1 | .p2 | .ty | .sco | .spo | .dm | .rg | .avf | .onp => true+ | _ => false++/-- The property extensions, as a decidable relation.++Three rows are chosen: `p1` empty, `p2` at `(alice, bob)`, and `ty` at `c1`,+`c2`, `cls` and `restr`. `sco`, `spo`, `dm` and `rg` are the FIXPOINT that+Table 5.8's two directions force from them, and the fixpoint is mutual, because+`spo`, `dm` and `rg` are themselves in `IP` and so appear on both sides of their+own conditions. Nothing here can be adjusted without the build going red. -/+def liveIext : LiveD → LiveD → LiveD → Bool+ -- ICEXT(rdfs:Class) = IC = {C1, C2, Y}. Table 5.2's "= IC" row.+ | .ty, x, .cls => x == .c1 || x == .c2 || x == .filler+ -- ICEXT(owl:Restriction) = {C1, C2}, a PROPER subset of IC. Table 5.2 writes+ -- a subset there and never an equality.+ | .ty, x, .restr => x == .c1 || x == .c2+ -- ICEXT(C1) is everything. Forced: C1 is the universal restriction on p1 and+ -- IEXT(p1) is empty.+ | .ty, _, .c1 => true+ -- ICEXT(C2) is everything but alice. Forced: C2 is the universal restriction+ -- on p2, alice has the p2-successor bob, and bob is not in ICEXT(Y).+ | .ty, x, .c2 => x != .alice+ -- ICEXT of everything else, Y included, is empty.+ | .ty, _, _ => false+ -- IEXT(rdfs:subClassOf): exactly the pairs of IC whose extensions nest.+ -- (C1, C2) is ABSENT, and that absence is the theorem at the end of the file.+ | .sco, u, v =>+ (u == .c1 && v == .c1) || (u == .c2 && (v == .c1 || v == .c2)) ||+ (u == .filler && (v == .c1 || v == .c2 || v == .filler))+ -- IEXT(rdfs:subPropertyOf): exactly the pairs of IP whose extensions nest.+ -- p1's extension is empty so it is below every property; the diagonal; and+ -- the one strict inclusion among the rest, IEXT(rdfs:domain) inside+ -- IEXT(rdfs:range), which holds because every domain pair of this model is+ -- also a range pair. (p2, p1) is ABSENT, and that kind separation is what+ -- keeps scm-avf2 antitone here.+ | .spo, u, v => (u == .p1 && isIP v) || (isIP u && u == v) || (u == .dm && v == .rg)+ -- IEXT(rdfs:domain): every p in IP and c in IC such that every subject of p+ -- lies in ICEXT(c). p1 qualifies everywhere because its extension is empty;+ -- p2 and rdf:type only at C1, because alice is a subject of both and alice is+ -- outside ICEXT(C2); the remaining six qualify at C1 and C2 because their+ -- subjects are classes and properties, never alice.+ | .dm, u, v =>+ (u == .p1 && (v == .c1 || v == .c2 || v == .filler)) ||+ ((u == .avf || u == .dm || u == .onp || u == .rg || u == .sco || u == .spo) &&+ (v == .c1 || v == .c2)) ||+ ((u == .p2 || u == .ty) && v == .c1)+ -- IEXT(rdfs:range): the same with objects for subjects, and it DIFFERS from+ -- the domain table by exactly (p2, C2) and (rdf:type, C2), because the object+ -- bob IS in ICEXT(C2) while the subject alice is not.+ | .rg, u, v =>+ (u == .p1 && (v == .c1 || v == .c2 || v == .filler)) ||+ ((u == .avf || u == .dm || u == .onp || u == .p2 || u == .rg || u == .sco ||+ u == .spo || u == .ty) && (v == .c1 || v == .c2))+ -- The graph's two restrictions.+ | .avf, u, v => (u == .c1 || u == .c2) && v == .filler+ | .onp, u, v => (u == .c1 && v == .p1) || (u == .c2 && v == .p2)+ -- The one asserted individual pair.+ | .p2, u, v => u == .alice && v == .bob+ -- Everything else, `other` and `p1` included, is empty.+ | _, _, _ => false++/-- The interpretation. -/+def live : Interp where+ D := LiveD+ ι := liveι+ iext := fun p x y => liveIext p x y = true++/-- `IP` as a predicate. A parameter of `W3C` and not a field of `Interp`, so+nothing outside this file sees it. -/+def liveIP (x : LiveD) : Prop := isIP x = true++/-- `IP` membership is decidable, which is what lets every condition mentioning+it be settled by `decide` rather than by a tactic script. -/+instance : DecidablePred liveIP := fun x => decidable_of_iff (isIP x = true) Iff.rfl++@[simp] theorem live_iext (p x y : LiveD) : live.iext p x y ↔ liveIext p x y = true := Iff.rfl+@[simp] theorem live_cext (c x : LiveD) : live.cext c x ↔ liveIext .ty x c = true := Iff.rfl+@[simp] theorem live_sc (u v : LiveD) : live.sc u v ↔ liveIext .sco u v = true := Iff.rfl+@[simp] theorem live_sp (u v : LiveD) : live.sp u v ↔ liveIext .spo u v = true := Iff.rfl+@[simp] theorem live_IC (u : LiveD) : live.IC u ↔ liveIext .ty u .cls = true := Iff.rfl++/-! ## The conditions, one decidable fact each++Each lemma is stated over `liveIext` and `liveι` directly, which is what makes+it a closed decidable proposition; `live_w3c` takes each as the corresponding+field by definitional unfolding, so nothing is restated in two places that could+drift apart. -/++theorem live_sc_fwd : ∀ a b : LiveD, liveIext .sco a b = true →+ liveIext .ty a .cls = true ∧ liveIext .ty b .cls = true ∧+ ∀ x, liveIext .ty x a = true → liveIext .ty x b = true := by decide++theorem live_sc_bwd : ∀ a b : LiveD, liveIext .ty a .cls = true → liveIext .ty b .cls = true →+ (∀ x, liveIext .ty x a = true → liveIext .ty x b = true) → liveIext .sco a b = true := by+ decide++theorem live_sp_fwd : ∀ a b : LiveD, liveIext .spo a b = true →+ liveIP a ∧ liveIP b ∧ ∀ x y, liveIext a x y = true → liveIext b x y = true := by decide++theorem live_sp_bwd : ∀ a b : LiveD, liveIP a → liveIP b →+ (∀ x y, liveIext a x y = true → liveIext b x y = true) → liveIext .spo a b = true := by decide++theorem live_dom_fwd : ∀ p c : LiveD, liveIext (liveι V.domain) p c = true →+ liveIP p ∧ liveIext .ty c .cls = true ∧+ ∀ x y, liveIext p x y = true → liveIext .ty x c = true := by decide++theorem live_dom_bwd : ∀ p c : LiveD, liveIP p → liveIext .ty c .cls = true →+ (∀ x y, liveIext p x y = true → liveIext .ty x c = true) →+ liveIext (liveι V.domain) p c = true := by decide++theorem live_rng_fwd : ∀ p c : LiveD, liveIext (liveι V.range) p c = true →+ liveIP p ∧ liveIext .ty c .cls = true ∧+ ∀ x y, liveIext p x y = true → liveIext .ty y c = true := by decide++theorem live_rng_bwd : ∀ p c : LiveD, liveIP p → liveIext .ty c .cls = true →+ (∀ x y, liveIext p x y = true → liveIext .ty y c = true) →+ liveIext (liveι V.range) p c = true := by decide++theorem live_eqc_fwd : ∀ a b : LiveD, liveIext (liveι V.equivalentClass) a b = true →+ liveIext .ty a .cls = true ∧ liveIext .ty b .cls = true ∧+ ∀ x, (liveIext .ty x a = true ↔ liveIext .ty x b = true) := by decide++theorem live_eqp_fwd : ∀ a b : LiveD, liveIext (liveι V.equivalentProperty) a b = true →+ liveIP a ∧ liveIP b ∧ ∀ x y, (liveIext a x y = true ↔ liveIext b x y = true) := by decide++theorem live_same_fwd : ∀ a b : LiveD, liveIext (liveι V.sameAs) a b = true → a = b := by decide++theorem live_inv_fwd : ∀ p q : LiveD, liveIext (liveι V.inverseOf) p q = true →+ liveIP p ∧ liveIP q ∧ ∀ x y, (liveIext p x y = true ↔ liveIext q y x = true) := by decide++theorem live_sym_fwd : ∀ p : LiveD, liveIext .ty p (liveι V.symmetricProperty) = true →+ ∀ x y, liveIext p x y = true → liveIext p y x = true := by decide++theorem live_trp_fwd : ∀ p : LiveD, liveIext .ty p (liveι V.transitiveProperty) = true →+ ∀ x y z, liveIext p x y = true → liveIext p y z = true → liveIext p x z = true := by decide++theorem live_svf_eq : ∀ z c p : LiveD, liveIext (liveι V.someValuesFrom) z c = true →+ liveIext (liveι V.onProperty) z p = true →+ ∀ x, (liveIext .ty x z = true ↔ ∃ y, liveIext p x y = true ∧ liveIext .ty y c = true) := by+ decide++theorem live_avf_eq : ∀ z c p : LiveD, liveIext (liveι V.allValuesFrom) z c = true →+ liveIext (liveι V.onProperty) z p = true →+ ∀ x, (liveIext .ty x z = true ↔ ∀ y, liveIext p x y = true → liveIext .ty y c = true) := by+ decide++theorem live_hv_eq : ∀ z a p : LiveD, liveIext (liveι V.hasValue) z a = true →+ liveIext (liveι V.onProperty) z p = true →+ ∀ x, (liveIext .ty x z = true ↔ liveIext p x a = true) := by decide++theorem live_restr_IC : ∀ x : LiveD, liveIext .ty x (liveι V.Restriction) = true →+ liveIext .ty x .cls = true := by decide++theorem live_svf_typ : ∀ z c : LiveD, liveIext (liveι V.someValuesFrom) z c = true →+ liveIext .ty z (liveι V.Restriction) = true ∧ liveIext .ty c .cls = true := by decide++theorem live_avf_typ : ∀ z c : LiveD, liveIext (liveι V.allValuesFrom) z c = true →+ liveIext .ty z (liveι V.Restriction) = true ∧ liveIext .ty c .cls = true := by decide++theorem live_onp_typ : ∀ z p : LiveD, liveIext (liveι V.onProperty) z p = true →+ liveIext .ty z (liveι V.Restriction) = true ∧ liveIP p := by decide++/-- Every asserted triple of `avfPremises` holds. -/+theorem live_facts : ∀ t ∈ avfPremises, liveIext (liveι t.p) (liveι t.s) (liveι t.o) = true := by+ decide++/-- The conditions, assembled. Each field is the decidable fact above, taken by+definitional unfolding of `Interp.sc`, `Interp.sp`, `Interp.cext` and+`Interp.IC`. -/+theorem live_w3c : W3C live liveIP where+ sc_fwd := live_sc_fwd+ sc_bwd := live_sc_bwd+ sp_fwd := live_sp_fwd+ sp_bwd := live_sp_bwd+ dom_fwd := live_dom_fwd+ dom_bwd := live_dom_bwd+ rng_fwd := live_rng_fwd+ rng_bwd := live_rng_bwd+ eqc_fwd := live_eqc_fwd+ eqp_fwd := live_eqp_fwd+ same_fwd := live_same_fwd+ inv_fwd := live_inv_fwd+ sym_fwd := live_sym_fwd+ trp_fwd := live_trp_fwd+ svf_eq := live_svf_eq+ avf_eq := live_avf_eq+ hv_eq := live_hv_eq+ restr_IC := live_restr_IC+ svf_typ := live_svf_typ+ avf_typ := live_avf_typ+ onp_typ := live_onp_typ++/-- **A conforming model of `avfPremises`.** The three list fields are vacuous+because `avfPremises` carries no `owl:intersectionOf`, `owl:unionOf` or+`owl:oneOf` triple; the model says nothing about those rows and does not pretend+to. -/+theorem live_is_a_w3c_model : W3CModel live liveIP avfPremises where+ conds := live_w3c+ facts := live_facts+ int_eq := fun c l _ hc =>+ absurd hc (not_mem_pred avfPremises V.intersectionOf (by decide) c l)+ uni_eq := fun c l _ hc => absurd hc (not_mem_pred avfPremises V.unionOf (by decide) c l)+ oneOf_eq := fun c l _ hc => absurd hc (not_mem_pred avfPremises V.oneOf (by decide) c l)++/-! ## Non-vacuity, compiled into the build++The facts the model exists to carry, in one theorem, so that a later edit that+hollows the model out fails here instead of passing quietly. Everything above+would still compile with an empty carrier and every relation false; this is what+stops that from being reported as a result.++Each is stated twice: once over `liveIext` and `liveι`, where it is a closed+decidable proposition, and once over `live`, where it is the sentence a reader+wants. The second is the first by definitional unfolding, so the two cannot+drift. -/++theorem live_is_live_raw :+ (liveIext .ty .c1 .cls = true ∧ liveIext .ty .c2 .cls = true ∧+ liveIext .ty .filler .cls = true) ∧+ (¬ liveIext .ty .restr .cls = true ∧ ¬ liveIext .ty .alice .cls = true) ∧+ (∀ x, liveIext .ty x .c1 = true) ∧+ (∀ x, liveIext .ty x .c2 = true → liveIext .ty x .c1 = true) ∧+ (liveIext .ty .alice .c1 = true ∧ ¬ liveIext .ty .alice .c2 = true ∧+ liveIext .ty .bob .c2 = true) ∧+ (∀ x, ¬ liveIext .ty x .filler = true) ∧+ (liveIext .ty .c1 (liveι V.Restriction) = true ∧+ ¬ liveIext .ty .filler (liveι V.Restriction) = true) ∧+ (∀ x y, ¬ liveIext .p1 x y = true) ∧ liveIext .p2 .alice .bob = true := by decide++/-- **The liveness gate.** `IC` has three members and does not swallow the+carrier; one class extension is the whole carrier; another is a proper subset of+it, witnessed on both sides; a third is empty; `ICEXT(owl:Restriction)` is a+proper subset of `IC`; and the one property that matters has a pair in it. -/+theorem live_is_live :+ (live.IC .c1 ∧ live.IC .c2 ∧ live.IC .filler) ∧ (¬ live.IC .restr ∧ ¬ live.IC .alice) ∧+ (∀ x, live.cext .c1 x) ∧ (∀ x, live.cext .c2 x → live.cext .c1 x) ∧+ (live.cext .c1 .alice ∧ ¬ live.cext .c2 .alice ∧ live.cext .c2 .bob) ∧+ (∀ x, ¬ live.cext .filler x) ∧+ (live.cext (live.ι V.Restriction) .c1 ∧ ¬ live.cext (live.ι V.Restriction) .filler) ∧+ (∀ x y, ¬ live.iext .p1 x y) ∧ live.iext .p2 .alice .bob :=+ live_is_live_raw++theorem live_is_bridge_coherent_raw :+ ∀ p x y : LiveD, liveIext p x y = true → liveIP p := by decide++/-- **The bridge shape, checked.** Every predicate with a pair in its extension+is in `IP`.++This is what makes the refutation at the end of the file worth more than the+Herbrand one it replaces. `W3C.lean`'s bridge reads a conforming interpretation+into an `Interp` by `iext p x y := IP p and (x, y) in IEXT p`, so a structure+with a pair under a predicate outside `IP` is not the image of any conforming+interpretation and cannot honestly refute anything about them. `W3C` does not+impose this, because no arm consumes it and imposing it would shrink the model+class for nothing; the witness satisfies it anyway, and says so here. -/+theorem live_is_bridge_coherent : ∀ p x y : LiveD, live.iext p x y → liveIP p :=+ live_is_bridge_coherent_raw++theorem live_c1_is_a_class : liveIext .ty .c1 .cls = true := by decide+theorem live_c2_is_a_class : liveIext .ty .c2 .cls = true := by decide+theorem live_p2_is_in_IP : liveIP .p2 := by decide++/-- The universally quantified clause `dom_bwd` demands, at `c1`, discharged+over the pair `(alice, bob)` and NOT by there being no pairs. -/+theorem live_p2_subjects_are_c1 :+ ∀ x y : LiveD, liveIext .p2 x y = true → liveIext .ty x .c1 = true := by decide++/-- The same clause for `rng_bwd`, at `c2`. `alice` is outside `ICEXT(c2)` and+`bob` is inside it, which is what makes the domain and range extensions+differ. -/+theorem live_p2_objects_are_c2 :+ ∀ x y : LiveD, liveIext .p2 x y = true → liveIext .ty y .c2 = true := by decide++theorem live_p2_is_not_a_domain_of_c2 : ¬ liveIext (liveι V.domain) .p2 .c2 = true := by decide++/-- `dom_bwd` is discharged over a NON-EMPTY relation: the clause it demands is+proved at `(alice, bob)` and not by there being no pairs, which is the thing the+second kernel's own witness fails to do for this condition. -/+theorem live_dom_bwd_is_exercised : live.iext (live.ι V.domain) .p2 .c1 :=+ live_w3c.dom_bwd .p2 .c1 live_p2_is_in_IP live_c1_is_a_class live_p2_subjects_are_c1++/-- `rng_bwd`, likewise, and at a class `dom_bwd` does NOT reach. The two+backward halves of Table 5.8 are separated by this model rather than satisfied+together by accident: `(p2, C2)` is in the range extension and not in the domain+extension, because `bob` is in `ICEXT(C2)` and `alice` is not. -/+theorem live_rng_bwd_is_exercised :+ live.iext (live.ι V.range) .p2 .c2 ∧ ¬ live.iext (live.ι V.domain) .p2 .c2 :=+ ⟨live_w3c.rng_bwd .p2 .c2 live_p2_is_in_IP live_c2_is_a_class live_p2_objects_are_c2,+ live_p2_is_not_a_domain_of_c2⟩++/-! ## What it refutes, and what it confirms -/++/-- **The direction the W3C table gives, over this model class.** `scm-avf2`+concludes `C2 rdfs:subClassOf C1`, and that is true in every `W3CModel` of these+premises. Transferred from the existing result rather than reproved, which is+the whole point of `W3CEntails.of_entails`. -/+theorem the_avf2_direction_the_table_gives_is_w3c_entailed :+ W3CEntails avfPremises ⟨tC2, V.subClassOf, tC1⟩ :=+ W3CEntails.of_entails the_avf2_direction_the_table_gives_is_entailed++theorem live_refutes_the_natural_direction :+ ¬ liveIext (liveι V.subClassOf) (liveι tC1) (liveι tC2) = true := by decide++/-- **And the natural-looking direction is refuted by a bridge-coherent+interpretation.**++`Witness.lean`'s `the_natural_avf2_direction_is_not_entailed` refutes the same+triple with a Herbrand interpretation, which satisfies `Conditions` and is not a+`W3CModel`: `avfWitness` contains no `rdf:type` triple at all, so `IC` is empty+there, `avf_typ` and `onp_typ` fail outright for want of an `owl:Restriction`+typing, and if those were patched in then `sp_bwd` would force `(p2, p1)` into+`rdfs:subPropertyOf`, a triple that witness does not contain. That result is+therefore about the Lean's larger `Conditions` class only.++This one is about a class much closer to the specification's: the refuting+structure satisfies Table 5.8 in both directions, Table 5.6's `allValuesFrom`+equality, Tables 5.9, 5.12 and 5.13, and the typing rows of Tables 5.2 and 5.3,+and it is bridge-coherent. A rule concluding `C1 rdfs:subClassOf C2` from these+premises, which is what copying the shape of `scm-avf1`, `scm-svf1` and+`scm-svf2` gives, would be making a claim that such a structure refutes.++**Read the module docstring before quoting this anywhere.** It is NOT a proof+that the triple fails to be OWL 2 RDF-Based entailed: `W3CModel`'s class is+larger than the conforming interpretations, because `W3C` omits every row no+rule consumes, and this model violates Table 5.2's `owl:Thing | = IR` and+`rdf:Property | = IP` rows among others. -/+theorem the_natural_avf2_direction_is_not_w3c_entailed :+ ¬ W3CEntails avfPremises ⟨tC1, V.subClassOf, tC2⟩ := fun h =>+ absurd (h live liveIP live_is_a_w3c_model) live_refutes_the_natural_direction++/-- The pair, stated together: the rule's own conclusion holds in every+`W3CModel` and the reversed one fails in this one. A checker that had `scm-avf2`+the natural way round would be accepting certificates whose conclusions this+structure makes false, and that is now a machine-checked sentence rather than an+argument in a docstring. -/+theorem scm_avf2_runs_one_way_under_the_specification :+ W3CEntails avfPremises ⟨tC2, V.subClassOf, tC1⟩ ∧+ ¬ W3CEntails avfPremises ⟨tC1, V.subClassOf, tC2⟩ :=+ ⟨the_avf2_direction_the_table_gives_is_w3c_entailed,+ the_natural_avf2_direction_is_not_w3c_entailed⟩++/-! ## And `W3CEntails` is not everything either++`live` closes one vacuity hole: `W3C` has a non-degenerate model, so+`W3CModel.toModel` is not a theorem about an empty class. The other hole is that+`W3CEntails` could hold of every triple, which would make+`certificate_w3c_sound` say nothing at all. It does not, and the cheapest+witness closes it: over the EMPTY graph every antecedent in `W3C` is false, and+`IP := fun _ => False` makes the four backward conditions vacuous too. -/++/-- The Herbrand interpretation of the empty graph is a conforming model of it,+with an empty `IP`. Bridge-coherent for free: `iext` is empty, so nothing has to+be in `IP`. -/+theorem empty_herbrand_is_a_w3c_model : W3CModel (herbrand []) (fun _ => False) [] where+ conds :=+ { sc_fwd := fun a b hab => absurd hab (not_mem_pred [] V.subClassOf (by simp) a b)+ sc_bwd := fun a b ha => absurd ha (not_typed [] V.Class (by simp) a)+ sp_fwd := fun a b hab => absurd hab (not_mem_pred [] V.subPropertyOf (by simp) a b)+ sp_bwd := fun _ _ h => absurd h (fun x => x)+ dom_fwd := fun p c hpc => absurd hpc (not_mem_pred [] V.domain (by simp) p c)+ dom_bwd := fun _ _ h => absurd h (fun x => x)+ rng_fwd := fun p c hpc => absurd hpc (not_mem_pred [] V.range (by simp) p c)+ rng_bwd := fun _ _ h => absurd h (fun x => x)+ eqc_fwd := fun a b hab => absurd hab (not_mem_pred [] V.equivalentClass (by simp) a b)+ eqp_fwd := fun a b hab => absurd hab (not_mem_pred [] V.equivalentProperty (by simp) a b)+ same_fwd := fun a b hab => absurd hab (not_mem_pred [] V.sameAs (by simp) a b)+ inv_fwd := fun p q hpq => absurd hpq (not_mem_pred [] V.inverseOf (by simp) p q)+ sym_fwd := fun p hp => absurd hp (not_typed [] V.symmetricProperty (by simp) p)+ trp_fwd := fun p hp => absurd hp (not_typed [] V.transitiveProperty (by simp) p)+ svf_eq := fun z c _ h => absurd h (not_mem_pred [] V.someValuesFrom (by simp) z c)+ avf_eq := fun z c _ h => absurd h (not_mem_pred [] V.allValuesFrom (by simp) z c)+ hv_eq := fun z a _ h => absurd h (not_mem_pred [] V.hasValue (by simp) z a)+ restr_IC := fun x hx => absurd hx (not_typed [] V.Restriction (by simp) x)+ svf_typ := fun z c h => absurd h (not_mem_pred [] V.someValuesFrom (by simp) z c)+ avf_typ := fun z c h => absurd h (not_mem_pred [] V.allValuesFrom (by simp) z c)+ onp_typ := fun z p h => absurd h (not_mem_pred [] V.onProperty (by simp) z p) }+ facts := by intro t ht; simp at ht+ int_eq := by intro c l _ hc; exact absurd hc (not_mem_pred [] V.intersectionOf (by simp) c l)+ uni_eq := by intro c l _ hc; exact absurd hc (not_mem_pred [] V.unionOf (by simp) c l)+ oneOf_eq := by intro c l _ hc; exact absurd hc (not_mem_pred [] V.oneOf (by simp) c l)++/-- **`W3CEntails` is not trivial**, so `certificate_w3c_sound` is not a theorem+about a relation that holds of everything. This is obligation (2) of+`Witness.lean`'s own header, restated over the conforming model class, and it is+the one obligation there that transfers without a new hand-built structure. -/+theorem not_everything_is_w3c_entailed :+ ¬ W3CEntails [] ⟨"<http://ex.org/a>", "<http://ex.org/b>", "<http://ex.org/c>"⟩ := by+ intro h+ have hs := h (herbrand []) (fun _ => False) empty_herbrand_is_a_w3c_model+ simp at hs++/-! ## Axioms, pinned++A `sorry` or a `native_decide` here would restore the vacuity objection this+file exists to close, and `native_decide` would add `Lean.ofReduceBool` to every+footprint below. -/++/-- info: 'OOCert.live_is_a_w3c_model' depends on axioms: [propext] -/+#guard_msgs in+#print axioms live_is_a_w3c_model++/-- info: 'OOCert.live_is_live' depends on axioms: [propext] -/+#guard_msgs in+#print axioms live_is_live++/-- info: 'OOCert.live_is_bridge_coherent' depends on axioms: [propext] -/+#guard_msgs in+#print axioms live_is_bridge_coherent++/-- info: 'OOCert.live_dom_bwd_is_exercised' depends on axioms: [propext] -/+#guard_msgs in+#print axioms live_dom_bwd_is_exercised++/-- info: 'OOCert.live_rng_bwd_is_exercised' depends on axioms: [propext] -/+#guard_msgs in+#print axioms live_rng_bwd_is_exercised++/-- info: 'OOCert.scm_avf2_runs_one_way_under_the_specification' depends on axioms: [propext] -/+#guard_msgs in+#print axioms scm_avf2_runs_one_way_under_the_specification++/-- info: 'OOCert.not_everything_is_w3c_entailed' depends on axioms: [propext, Quot.sound] -/+#guard_msgs in+#print axioms not_everything_is_w3c_entailed++end OOCertdiff --git a/lean/OOCert/Witness.lean b/lean/OOCert/Witness.leanindex 2d43b2f9..6538ae7b 100644--- a/lean/OOCert/Witness.lean+++ b/lean/OOCert/Witness.lean@@ -58,7 +58,15 @@ def saturated : Interp whereiext := fun _ _ _ => True/-- Every graph has a model, so `Entails` is never the "anything follows" of an inconsistent-premise set. -/+premise set.++`saturated` also satisfies `W3C.lean`'s specification conditions, with+`IP := fun _ => True`, because both sides of every equality there are all of+`Unit`. That is worth knowing and worth NOT reporting as a result: a model that+makes every relation total distinguishes no condition from any other and refutes+nothing, so bare satisfiability of the stronger structure says exactly as little+as bare satisfiability of this one. The non-degenerate witness is+`W3CWitness.lean`'s `live`, and `live_is_live` is what makes it non-degenerate. -/theorem saturated_is_a_model (G : List Triple) : Model saturated G whereconds :={ sc_sub := fun _ _ _ _ _ => trivial@@ -162,7 +170,14 @@ theorem empty_herbrand_is_a_model : Model (herbrand []) [] whereuni := by intro c l _ hc; exact absurd hc (not_mem_pred [] V.unionOf (by simp) c l)oneOf := by intro c l _ hc; exact absurd hc (not_mem_pred [] V.oneOf (by simp) c l)-/-- Entailment is not trivial. -/+/-- Entailment is not trivial.++This one DOES transfer to the conforming model class, and+`W3CWitness.lean`'s `not_everything_is_w3c_entailed` is the transfer: over the+empty graph every antecedent of `W3C` is false and `IP := fun _ => False` makes+the four backward conditions vacuous, so the same interpretation serves. It is+the only non-entailment in this file that transfers without a new hand-built+structure. -/theorem not_everything_is_entailed :¬ Entails [] ⟨"<http://ex.org/a>", "<http://ex.org/b>", "<http://ex.org/c>"⟩ := byintro h@@ -277,7 +292,30 @@ theorem svf_witness_is_a_model : Model (herbrand svfWitness) svfPremises whereoneOf := by intro c l _ hc; exact absurd hc (not_mem_pred svfPremises V.oneOf (by decide) c l)/-- **The old rule was unsound.** `C ⊑ ∃p.D` together with `x p y` and `y ∈ D` does not entail-`x ∈ C`. The reasoner derived exactly this until 13 September 2026. -/+`x ∈ C`. The reasoner derived exactly this until 13 September 2026.++**The claim is about the `Conditions` model class, and `herbrand svfWitness` is+NOT a `W3CModel`.** Two fields of `W3C.lean`'s structure fail on it outright.+`svf_typ` is RBS Table 5.3's row `owl:someValuesFrom ⊆ ICEXT(owl:Restriction) ×+IC`, and `svfWitness` carries `R owl:someValuesFrom D` with no+`R rdf:type owl:Restriction`, so the antecedent holds and the consequent does+not. `sc_fwd` is Table 5.8 row 1 forward, and `svfWitness` carries+`C rdfs:subClassOf R` while `IC` is empty there, because no triple has+`rdfs:Class` as its object.++Patching those in does not finish the job. Bridge coherence+(`W3CWitness.lean`'s `live_is_bridge_coherent`) puts every predicate the witness+uses into `IP`, which here is `rdf:type`, `rdfs:subClassOf`, `owl:onProperty`,+`owl:someValuesFrom` and `p`; `sp_bwd` then forces `q rdfs:subPropertyOf q` for+each of those five, and `svfWitness` contains no `rdfs:subPropertyOf` triple at+all. Adding them puts `rdfs:subPropertyOf` itself into `IP`, and the tables+become a mutual fixpoint. A conforming replacement is therefore a hand-built+finite structure of the kind `W3CWitness.lean` builds, not a patch to this list.++**The claim itself is not in doubt and must not be withdrawn on the strength of+this note.** `tests/reason_rl_ext_soundness_test.rs` pins a real defect; what is+open is whether a conforming interpretation also refutes it, and nothing here+suggests it does not. -/theorem the_old_svf_derivation_is_not_entailed :¬ Entails svfPremises ⟨tx, V.type, tC⟩ := fun h =>absurd (h (herbrand svfWitness) svf_witness_is_a_model)@@ -422,7 +460,22 @@ theorem the_avf2_direction_the_table_gives_is_entailed :/-- **And the other direction is unsound.** A rule that concluded`C1 rdfs:subClassOf C2` here, which is what copying `scm-avf1` gives, would be-making a claim this model refutes. -/+making a claim this model refutes.++**This one has a conforming replacement**, and it is the only non-entailment in+the repository that does:+`W3CWitness.lean`'s `the_natural_avf2_direction_is_not_w3c_entailed` refutes the+same triple from the same premises with a seventeen-element bridge-coherent+structure that meets the quoted cells of Tables 5.2, 5.3, 5.6, 5.8, 5.9, 5.12+and 5.13.++`herbrand avfWitness` is not such a structure and cannot be patched into one.+`avfWitness` contains no `rdf:type` triple at all, so `IC` is empty and every+class extension is empty; `avf_typ` and `onp_typ` then fail for want of an+`owl:Restriction` typing. Supply those and `sp_bwd` forces `(p2, p1)` into+`rdfs:subPropertyOf`, because both properties have empty extensions there, and+that triple is absent. The replacement escapes by giving `p2` a pair, which is+also what makes `dom_bwd` and `rng_bwd` fire non-vacuously. -/theorem the_natural_avf2_direction_is_not_entailed :¬ Entails avfPremises ⟨tC1, V.subClassOf, tC2⟩ := fun h =>absurd (h (herbrand avfWitness) avf_witness_is_a_model)@@ -553,7 +606,23 @@ theorem an_enumerated_member_is_entailed : Entails ooPremises ⟨tA, V.type, tE/-- **And it stops at the members.** The condition says the class holds atleast the listed members; it does not say it holds no others, so an individual-the list never mentions is not entailed to be one. -/+the list never mentions is not entailed to be one.++Two separate things are wrong with the old reading of this theorem, and both are+recorded rather than repaired.++FIRST, it is not the detector `Semantics.lean` used to nominate it as. `ooWitness`+is `[a rdf:type E, b rdf:type E] ++ ooPremises`, so `ICEXT(E)` is exactly the two+listed members and already satisfies Table 5.5's full equality. The witness+passes unchanged whether or not the missing `⊆` half is present, so it cannot+detect that half's absence. That omission is currently undetected by anything in+this repository.++SECOND, the result is about the `Conditions` model class. Bridge coherence puts+every predicate `ooWitness` uses into `IP`, which is `rdf:type`, `owl:oneOf`,+`rdf:first` and `rdf:rest`; `sp_bwd` then forces `q rdfs:subPropertyOf q` for+each, and `ooWitness` contains no `rdfs:subPropertyOf` triple. A conforming+replacement is a hand-built finite structure. -/theorem an_unlisted_individual_is_not_entailed : ¬ Entails ooPremises ⟨tZ, V.type, tE⟩ :=fun h =>absurd (h (herbrand ooWitness) oo_witness_is_a_model)@@ -687,7 +756,13 @@ theorem a_member_of_the_intersection_is_entailed : Entails intPremises ⟨tw, V.(M.facts ⟨tw, V.type, tK⟩ (by simp [intPremises])) tM1 (by simp)/-- **And the converse still needs every member.** `v` is an `M1` and no model-has to make it a `K`, so `cls-int1` has lost nothing to `cls-int2`. -/+has to make it a `K`, so `cls-int1` has lost nothing to `cls-int2`.++About the `Conditions` model class, for the same reason as the `owl:oneOf` pair+above: bridge coherence puts `rdf:type`, `owl:intersectionOf`, `rdf:first` and+`rdf:rest` into `IP`, and `sp_bwd` then forces four `rdfs:subPropertyOf` triples+that `intWitness` does not contain. A conforming replacement is a hand-built+finite structure. -/theorem membership_in_one_member_does_not_give_the_intersection :¬ Entails intPremises ⟨tv, V.type, tK⟩ := fun h =>absurd (h (herbrand intWitness) int_witness_is_a_model)