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
Check the certificate checker against a second kernel, from the specifications rather than from the Lean
Fabio Rovai1d46daed3e7e
diff --git a/isabelle/OO_Audit.thy b/isabelle/OO_Audit.thynew file mode 100644index 00000000..0412a7ee--- /dev/null+++ b/isabelle/OO_Audit.thy@@ -0,0 +1,71 @@+(* OO_Audit.thy -- a build gate on the trust surface.++ In Isabelle the analogue of pinning a Lean theorem's axiom list is to check what+ ORACLES a theorem's proof term depends on. "sorry" is the oracle Pure.skip_proof, so+ a sorry anywhere beneath a theorem shows up here; so does any use of eval,+ normalization, or an external prover invoked as an oracle.++ The first block FAILS THE BUILD if any soundness or non-vacuity theorem depends on an+ oracle. The second block fails the build if an eval-proved lemma does NOT show an+ oracle -- because a gate that cannot fail is decoration. *)++theory OO_Audit+ imports OO_Fixtures OO_NonVacuity+begin++ML \<open>+ let+ val ths =+ [@{thm horn_certificate_sound},+ @{thm horn_certificate_sound_lenient},+ @{thm entails_of_builtin},+ @{thm entails_of_builtin_lenient},+ @{thm entails_simple},+ @{thm builtin_table_sound},+ @{thm verdict_honest},+ @{thm a_user_rule_never_earns_the_absolute_verdict},+ @{thm strict_implies_lenient},+ @{thm coverage_implied},+ @{thm check_step_sound},+ @{thm check_from_sound},+ @{thm run_check_sound},+ @{thm run_check_entailed_sound},+ @{thm run_check_lenient_entailed_sound},+ @{thm conditions_satisfiable},+ @{thm M3_is_a_model},+ @{thm M3_wf},+ @{thm M3_models_fixture_graph},+ @{thm M3_sat_the_certified_conclusion},+ @{thm M3_refutes_fresh_class},+ @{thm M3_refutes_sameAs},+ @{thm entailment_is_not_trivial},+ @{thm entailment_is_not_trivial_empty},+ @{thm the_IP_clause_has_content}]+ @ @{thms M3_is_not_degenerate}+ val oracles = Thm_Deps.all_oracles ths+ val names = map (fn ((n, _), _) => n) oracles+ in+ if null oracles+ then File.write (Path.explode "/tmp/oo_audit_result.txt")+ ("ORACLE AUDIT PASSED: " ^ string_of_int (length ths) ^+ " soundness and non-vacuity theorems checked; oracle set is EMPTY.\n")+ else error ("ORACLE AUDIT FAILED -- these theorems depend on oracles: " ^ commas names)+ end+\<close>++ML \<open>+ let+ val oracles = Thm_Deps.all_oracles [@{thm fx_good_builtin}]+ val names = map (fn ((n, _), _) => n) oracles+ in+ if null oracles+ then error ("ORACLE AUDIT IS BROKEN: an eval-proved lemma reports no oracle, so the " ^+ "audit above cannot distinguish a kernel proof from an evaluation and " ^+ "is decoration.")+ else File.append (Path.explode "/tmp/oo_audit_result.txt")+ ("GATE PROVED ABLE TO FAIL: eval-proved fixture lemmas do carry an oracle (" ^+ commas names ^ "); none of the theorems above does.\n")+ end+\<close>++enddiff --git a/isabelle/OO_Builtin_Sound.thy b/isabelle/OO_Builtin_Sound.thynew file mode 100644index 00000000..560b1848--- /dev/null+++ b/isabelle/OO_Builtin_Sound.thy@@ -0,0 +1,482 @@+(* OO_Builtin_Sound.thy -- every arm of the built-in table is sound in the conditioned+ model class, and therefore the absolute verdict.++ THIS IS THE FILE THAT CARRIES THE INDEPENDENT CONTENT. The rule table itself is+ shared input (M40): it was transcribed from the fixture, so two formalisations will+ have the same rows whatever they believe. What is NOT shared is WHICH SEMANTIC+ CONDITIONS EACH ARM CONSUMES. A semantics that is stronger than the specification+ discharges MORE arms, and discharges them MORE EASILY. If every arm below were+ trivial, that would be evidence of a bug, not of quality.++ The derived lemmas are arranged so that the condition-to-derived-lemma map is+ ONE-TO-ONE: each D_ lemma is a one-line consequence of exactly ONE named condition+ (or, where marked, of exactly two). That is where a reviewer checks that no extra+ strength crept in between a condition and its use.++ THE CONSUMPTION MAP. Every arm, every condition it needs, nothing more.+ Conditions in CAPITALS are the ones that would silently disappear under a weaker+ truth clause (M5) or without the Table 5.2/5.3 typing rows (M17).++ rdfs2 c_dom_fwd, C_TYPE_IP+ rdfs3 c_rng_fwd, C_TYPE_IP+ rdfs5 c_spo_trans, C_SPO_IP+ rdfs7 c_spo_fwd (head predicate ?q enters IP via c_spo_fwd)+ rdfs9 c_sco_fwd, C_TYPE_IP+ rdfs11 c_sco_trans, C_SCO_IP+ prp-trp c_trp_fwd (head predicate ?p is a body predicate)+ prp-symp c_sym_fwd (likewise)+ prp-inv1 c_inv_fwd, both inclusions of its set equality, and its IP conjuncts+ prp-inv2 c_inv_fwd, the other inclusion, and its IP conjuncts+ eq-sym c_sameAs_fwd (sameAs enters IP from the premise itself)+ scm-eqc1 a c_eqc_fwd, c_sco_bwd, C_SCO_IP+ scm-eqc1 b c_eqc_fwd, c_sco_bwd, C_SCO_IP+ scm-eqp1 a c_eqp_fwd, c_spo_bwd, C_SPO_IP+ scm-eqp1 b c_eqp_fwd, c_spo_bwd, C_SPO_IP+ cls-svf1 c_svf, SUPERSET half, C_TYPE_IP+ cls-avf c_avf, SUBSET half, C_TYPE_IP+ cls-hv1 c_hv, SUBSET half, C_ONP_TYP (the only source of p in IP for the head)+ cls-hv2 c_hv, SUPERSET half, C_TYPE_IP+ scm-svf1 c_svf both halves (two instances), c_sco_fwd, c_sco_bwd,+ C_SVF_TYP, C_RESTR_IC, C_SCO_IP+ scm-svf2 c_svf both halves, c_spo_fwd, c_sco_bwd, C_SVF_TYP, C_RESTR_IC, C_SCO_IP+ scm-avf1 c_avf both halves, c_sco_fwd, c_sco_bwd, C_AVF_TYP, C_RESTR_IC, C_SCO_IP+ scm-avf2 c_avf both halves, c_spo_fwd, c_sco_bwd, C_AVF_TYP, C_RESTR_IC, C_SCO_IP+ -- HEAD REVERSED, see D_avf_mono2+ scm-dom1 c_dom_fwd, c_sco_fwd, c_dom_bwd+ scm-dom2 c_dom_fwd, c_spo_fwd, c_dom_bwd+ scm-rng1 c_rng_fwd, c_sco_fwd, c_rng_bwd+ scm-rng2 c_rng_fwd, c_spo_fwd, c_rng_bwd++ Twelve arms (scm-eqc1 x2, scm-eqp1 x2, scm-svf1, scm-svf2, scm-avf1, scm-avf2,+ scm-dom1, scm-dom2, scm-rng1, scm-rng2) consume a BACKWARD half of RBS Table 5.8.+ They are unprovable without it. That is the sharpest single prediction this+ formalisation makes about any other formalisation of the same table. *)++theory OO_Builtin_Sound+ imports OO_Sound+begin++section \<open>Derived forms of the semantic conditions\<close>++lemma D_type_IP: "owl_rl_interp I \<Longrightarrow> IS I rdf_type \<in> IP I"+ by (simp add: owl_rl_interp_def c_type_IP_def)+lemma D_sco_IP: "owl_rl_interp I \<Longrightarrow> IS I rdfs_subClassOf \<in> IP I"+ by (simp add: owl_rl_interp_def c_sco_IP_def)+lemma D_spo_IP: "owl_rl_interp I \<Longrightarrow> IS I rdfs_subPropertyOf \<in> IP I"+ by (simp add: owl_rl_interp_def c_spo_IP_def)++lemma D_dom:+ "\<lbrakk>owl_rl_interp I; (p,c) \<in> IEXT I (IS I rdfs_domain); (x,y) \<in> IEXT I p\<rbrakk>+ \<Longrightarrow> (x,c) \<in> IEXT I (IS I rdf_type)"+ by (auto simp: owl_rl_interp_def c_dom_fwd_def ICEXT_def)+lemma D_dom_IP: "\<lbrakk>owl_rl_interp I; (p,c) \<in> IEXT I (IS I rdfs_domain)\<rbrakk> \<Longrightarrow> p \<in> IP I"+ by (auto simp: owl_rl_interp_def c_dom_fwd_def)+lemma D_dom_IC: "\<lbrakk>owl_rl_interp I; (p,c) \<in> IEXT I (IS I rdfs_domain)\<rbrakk> \<Longrightarrow> c \<in> IC I"+ by (auto simp: owl_rl_interp_def c_dom_fwd_def)+lemma D_dom_bwd:+ "\<lbrakk>owl_rl_interp I; p \<in> IP I; c \<in> IC I;+ \<forall>x y. (x,y) \<in> IEXT I p \<longrightarrow> (x,c) \<in> IEXT I (IS I rdf_type)\<rbrakk>+ \<Longrightarrow> (p,c) \<in> IEXT I (IS I rdfs_domain)"+ by (auto simp: owl_rl_interp_def c_dom_bwd_def ICEXT_def)++lemma D_rng:+ "\<lbrakk>owl_rl_interp I; (p,c) \<in> IEXT I (IS I rdfs_range); (x,y) \<in> IEXT I p\<rbrakk>+ \<Longrightarrow> (y,c) \<in> IEXT I (IS I rdf_type)"+ by (auto simp: owl_rl_interp_def c_rng_fwd_def ICEXT_def)+lemma D_rng_IP: "\<lbrakk>owl_rl_interp I; (p,c) \<in> IEXT I (IS I rdfs_range)\<rbrakk> \<Longrightarrow> p \<in> IP I"+ by (auto simp: owl_rl_interp_def c_rng_fwd_def)+lemma D_rng_IC: "\<lbrakk>owl_rl_interp I; (p,c) \<in> IEXT I (IS I rdfs_range)\<rbrakk> \<Longrightarrow> c \<in> IC I"+ by (auto simp: owl_rl_interp_def c_rng_fwd_def)+lemma D_rng_bwd:+ "\<lbrakk>owl_rl_interp I; p \<in> IP I; c \<in> IC I;+ \<forall>x y. (x,y) \<in> IEXT I p \<longrightarrow> (y,c) \<in> IEXT I (IS I rdf_type)\<rbrakk>+ \<Longrightarrow> (p,c) \<in> IEXT I (IS I rdfs_range)"+ by (auto simp: owl_rl_interp_def c_rng_bwd_def ICEXT_def)++lemma D_sco:+ "\<lbrakk>owl_rl_interp I; (a,b) \<in> IEXT I (IS I rdfs_subClassOf); (x,a) \<in> IEXT I (IS I rdf_type)\<rbrakk>+ \<Longrightarrow> (x,b) \<in> IEXT I (IS I rdf_type)"+ by (auto simp: owl_rl_interp_def c_sco_fwd_def ICEXT_def)+lemma D_sco_IC1: "\<lbrakk>owl_rl_interp I; (a,b) \<in> IEXT I (IS I rdfs_subClassOf)\<rbrakk> \<Longrightarrow> a \<in> IC I"+ by (auto simp: owl_rl_interp_def c_sco_fwd_def)+lemma D_sco_IC2: "\<lbrakk>owl_rl_interp I; (a,b) \<in> IEXT I (IS I rdfs_subClassOf)\<rbrakk> \<Longrightarrow> b \<in> IC I"+ by (auto simp: owl_rl_interp_def c_sco_fwd_def)+lemma D_sco_bwd:+ "\<lbrakk>owl_rl_interp I; a \<in> IC I; b \<in> IC I;+ \<forall>x. (x,a) \<in> IEXT I (IS I rdf_type) \<longrightarrow> (x,b) \<in> IEXT I (IS I rdf_type)\<rbrakk>+ \<Longrightarrow> (a,b) \<in> IEXT I (IS I rdfs_subClassOf)"+ by (auto simp: owl_rl_interp_def c_sco_bwd_def ICEXT_def)+lemma D_sco_trans:+ "\<lbrakk>owl_rl_interp I; (a,b) \<in> IEXT I (IS I rdfs_subClassOf);+ (b,c) \<in> IEXT I (IS I rdfs_subClassOf)\<rbrakk> \<Longrightarrow> (a,c) \<in> IEXT I (IS I rdfs_subClassOf)"+ by (auto simp: owl_rl_interp_def c_sco_trans_def)++lemma D_spo:+ "\<lbrakk>owl_rl_interp I; (p,q) \<in> IEXT I (IS I rdfs_subPropertyOf); (x,y) \<in> IEXT I p\<rbrakk>+ \<Longrightarrow> (x,y) \<in> IEXT I q"+ by (auto simp: owl_rl_interp_def c_spo_fwd_def)+lemma D_spo_IP1: "\<lbrakk>owl_rl_interp I; (p,q) \<in> IEXT I (IS I rdfs_subPropertyOf)\<rbrakk> \<Longrightarrow> p \<in> IP I"+ by (auto simp: owl_rl_interp_def c_spo_fwd_def)+lemma D_spo_IP2: "\<lbrakk>owl_rl_interp I; (p,q) \<in> IEXT I (IS I rdfs_subPropertyOf)\<rbrakk> \<Longrightarrow> q \<in> IP I"+ by (auto simp: owl_rl_interp_def c_spo_fwd_def)+lemma D_spo_bwd:+ "\<lbrakk>owl_rl_interp I; p \<in> IP I; q \<in> IP I; IEXT I p \<subseteq> IEXT I q\<rbrakk>+ \<Longrightarrow> (p,q) \<in> IEXT I (IS I rdfs_subPropertyOf)"+ by (auto simp: owl_rl_interp_def c_spo_bwd_def)+lemma D_spo_trans:+ "\<lbrakk>owl_rl_interp I; (a,b) \<in> IEXT I (IS I rdfs_subPropertyOf);+ (b,c) \<in> IEXT I (IS I rdfs_subPropertyOf)\<rbrakk>+ \<Longrightarrow> (a,c) \<in> IEXT I (IS I rdfs_subPropertyOf)"+ by (auto simp: owl_rl_interp_def c_spo_trans_def)++lemma D_sameAs: "\<lbrakk>owl_rl_interp I; (a,b) \<in> IEXT I (IS I owl_sameAs)\<rbrakk> \<Longrightarrow> a = b"+ by (auto simp: owl_rl_interp_def c_sameAs_fwd_def)++lemma D_eqc_IC1: "\<lbrakk>owl_rl_interp I; (a,b) \<in> IEXT I (IS I owl_equivalentClass)\<rbrakk> \<Longrightarrow> a \<in> IC I"+ by (auto simp: owl_rl_interp_def c_eqc_fwd_def)+lemma D_eqc_IC2: "\<lbrakk>owl_rl_interp I; (a,b) \<in> IEXT I (IS I owl_equivalentClass)\<rbrakk> \<Longrightarrow> b \<in> IC I"+ by (auto simp: owl_rl_interp_def c_eqc_fwd_def)+lemma D_eqc_ext:+ "\<lbrakk>owl_rl_interp I; (a,b) \<in> IEXT I (IS I owl_equivalentClass)\<rbrakk>+ \<Longrightarrow> ICEXT I a = ICEXT I b"+ by (auto simp: owl_rl_interp_def c_eqc_fwd_def)++lemma D_eqp_IP1: "\<lbrakk>owl_rl_interp I; (a,b) \<in> IEXT I (IS I owl_equivalentProperty)\<rbrakk> \<Longrightarrow> a \<in> IP I"+ by (auto simp: owl_rl_interp_def c_eqp_fwd_def)+lemma D_eqp_IP2: "\<lbrakk>owl_rl_interp I; (a,b) \<in> IEXT I (IS I owl_equivalentProperty)\<rbrakk> \<Longrightarrow> b \<in> IP I"+ by (auto simp: owl_rl_interp_def c_eqp_fwd_def)+lemma D_eqp_ext:+ "\<lbrakk>owl_rl_interp I; (a,b) \<in> IEXT I (IS I owl_equivalentProperty)\<rbrakk> \<Longrightarrow> IEXT I a = IEXT I b"+ by (auto simp: owl_rl_interp_def c_eqp_fwd_def)++lemma D_inv_IP1: "\<lbrakk>owl_rl_interp I; (p,q) \<in> IEXT I (IS I owl_inverseOf)\<rbrakk> \<Longrightarrow> p \<in> IP I"+ by (auto simp: owl_rl_interp_def c_inv_fwd_def)+lemma D_inv_IP2: "\<lbrakk>owl_rl_interp I; (p,q) \<in> IEXT I (IS I owl_inverseOf)\<rbrakk> \<Longrightarrow> q \<in> IP I"+ by (auto simp: owl_rl_interp_def c_inv_fwd_def)+lemma D_inv1:+ "\<lbrakk>owl_rl_interp I; (p,q) \<in> IEXT I (IS I owl_inverseOf); (x,y) \<in> IEXT I p\<rbrakk>+ \<Longrightarrow> (y,x) \<in> IEXT I q"+ by (auto simp: owl_rl_interp_def c_inv_fwd_def)+lemma D_inv2:+ "\<lbrakk>owl_rl_interp I; (p,q) \<in> IEXT I (IS I owl_inverseOf); (x,y) \<in> IEXT I q\<rbrakk>+ \<Longrightarrow> (y,x) \<in> IEXT I p"+ by (auto simp: owl_rl_interp_def c_inv_fwd_def)++lemma D_sym:+ "\<lbrakk>owl_rl_interp I; (p, IS I owl_SymmetricProperty) \<in> IEXT I (IS I rdf_type);+ (x,y) \<in> IEXT I p\<rbrakk> \<Longrightarrow> (y,x) \<in> IEXT I p"+ by (auto simp: owl_rl_interp_def c_sym_fwd_def ICEXT_def)+lemma D_trp:+ "\<lbrakk>owl_rl_interp I; (p, IS I owl_TransitiveProperty) \<in> IEXT I (IS I rdf_type);+ (x,y) \<in> IEXT I p; (y,z) \<in> IEXT I p\<rbrakk> \<Longrightarrow> (x,z) \<in> IEXT I p"+ by (auto simp: owl_rl_interp_def c_trp_fwd_def ICEXT_def)++lemma D_onP_IP: "\<lbrakk>owl_rl_interp I; (z,p) \<in> IEXT I (IS I owl_onProperty)\<rbrakk> \<Longrightarrow> p \<in> IP I"+ by (auto simp: owl_rl_interp_def c_onp_typ_def)+lemma D_svf_IC: "\<lbrakk>owl_rl_interp I; (z,c) \<in> IEXT I (IS I owl_someValuesFrom)\<rbrakk> \<Longrightarrow> z \<in> IC I"+ by (auto simp: owl_rl_interp_def c_svf_typ_def c_restr_IC_def)+lemma D_avf_IC: "\<lbrakk>owl_rl_interp I; (z,c) \<in> IEXT I (IS I owl_allValuesFrom)\<rbrakk> \<Longrightarrow> z \<in> IC I"+ by (auto simp: owl_rl_interp_def c_avf_typ_def c_restr_IC_def)++lemma D_svf_in:+ "\<lbrakk>owl_rl_interp I; (z,c) \<in> IEXT I (IS I owl_someValuesFrom);+ (z,p) \<in> IEXT I (IS I owl_onProperty);+ (x,y) \<in> IEXT I p; (y,c) \<in> IEXT I (IS I rdf_type)\<rbrakk>+ \<Longrightarrow> (x,z) \<in> IEXT I (IS I rdf_type)"+ by (auto simp: owl_rl_interp_def c_svf_def ICEXT_def set_eq_iff)+lemma D_svf_out:+ "\<lbrakk>owl_rl_interp I; (z,c) \<in> IEXT I (IS I owl_someValuesFrom);+ (z,p) \<in> IEXT I (IS I owl_onProperty); (x,z) \<in> IEXT I (IS I rdf_type)\<rbrakk>+ \<Longrightarrow> \<exists>y. (x,y) \<in> IEXT I p \<and> (y,c) \<in> IEXT I (IS I rdf_type)"+ by (auto simp: owl_rl_interp_def c_svf_def ICEXT_def set_eq_iff)++lemma D_avf_in:+ "\<lbrakk>owl_rl_interp I; (z,c) \<in> IEXT I (IS I owl_allValuesFrom);+ (z,p) \<in> IEXT I (IS I owl_onProperty);+ \<forall>y. (x,y) \<in> IEXT I p \<longrightarrow> (y,c) \<in> IEXT I (IS I rdf_type)\<rbrakk>+ \<Longrightarrow> (x,z) \<in> IEXT I (IS I rdf_type)"+ by (auto simp: owl_rl_interp_def c_avf_def ICEXT_def set_eq_iff)+lemma D_avf_out:+ "\<lbrakk>owl_rl_interp I; (z,c) \<in> IEXT I (IS I owl_allValuesFrom);+ (z,p) \<in> IEXT I (IS I owl_onProperty); (x,z) \<in> IEXT I (IS I rdf_type);+ (x,y) \<in> IEXT I p\<rbrakk> \<Longrightarrow> (y,c) \<in> IEXT I (IS I rdf_type)"+ by (auto simp: owl_rl_interp_def c_avf_def ICEXT_def set_eq_iff)++lemma D_hv_out:+ "\<lbrakk>owl_rl_interp I; (z,a) \<in> IEXT I (IS I owl_hasValue);+ (z,p) \<in> IEXT I (IS I owl_onProperty); (x,z) \<in> IEXT I (IS I rdf_type)\<rbrakk>+ \<Longrightarrow> (x,a) \<in> IEXT I p"+ by (auto simp: owl_rl_interp_def c_hv_def ICEXT_def set_eq_iff)+lemma D_hv_in:+ "\<lbrakk>owl_rl_interp I; (z,a) \<in> IEXT I (IS I owl_hasValue);+ (z,p) \<in> IEXT I (IS I owl_onProperty); (x,a) \<in> IEXT I p\<rbrakk>+ \<Longrightarrow> (x,z) \<in> IEXT I (IS I rdf_type)"+ by (auto simp: owl_rl_interp_def c_hv_def ICEXT_def set_eq_iff)+++section \<open>Derived subsumption lemmas\<close>++lemma D_eqc_sub1:+ assumes I: "owl_rl_interp I" and e: "(a,b) \<in> IEXT I (IS I owl_equivalentClass)"+ shows "(a,b) \<in> IEXT I (IS I rdfs_subClassOf)"+proof (rule D_sco_bwd[OF I])+ show "a \<in> IC I" using I e by (rule D_eqc_IC1)+ show "b \<in> IC I" using I e by (rule D_eqc_IC2)+ show "\<forall>x. (x,a) \<in> IEXT I (IS I rdf_type) \<longrightarrow> (x,b) \<in> IEXT I (IS I rdf_type)"+ using D_eqc_ext[OF I e] by (auto simp: ICEXT_def set_eq_iff)+qed++lemma D_eqc_sub2:+ assumes I: "owl_rl_interp I" and e: "(a,b) \<in> IEXT I (IS I owl_equivalentClass)"+ shows "(b,a) \<in> IEXT I (IS I rdfs_subClassOf)"+proof (rule D_sco_bwd[OF I])+ show "b \<in> IC I" using I e by (rule D_eqc_IC2)+ show "a \<in> IC I" using I e by (rule D_eqc_IC1)+ show "\<forall>x. (x,b) \<in> IEXT I (IS I rdf_type) \<longrightarrow> (x,a) \<in> IEXT I (IS I rdf_type)"+ using D_eqc_ext[OF I e] by (auto simp: ICEXT_def set_eq_iff)+qed++lemma D_eqp_sub1:+ assumes I: "owl_rl_interp I" and e: "(a,b) \<in> IEXT I (IS I owl_equivalentProperty)"+ shows "(a,b) \<in> IEXT I (IS I rdfs_subPropertyOf)"+ by (rule D_spo_bwd[OF I D_eqp_IP1[OF I e] D_eqp_IP2[OF I e]])+ (simp add: D_eqp_ext[OF I e])++lemma D_eqp_sub2:+ assumes I: "owl_rl_interp I" and e: "(a,b) \<in> IEXT I (IS I owl_equivalentProperty)"+ shows "(b,a) \<in> IEXT I (IS I rdfs_subPropertyOf)"+ by (rule D_spo_bwd[OF I D_eqp_IP2[OF I e] D_eqp_IP1[OF I e]])+ (simp add: D_eqp_ext[OF I e])++lemma D_svf_mono1:+ assumes I: "owl_rl_interp I"+ and a1: "(c1,y1) \<in> IEXT I (IS I owl_someValuesFrom)"+ and a2: "(c1,p) \<in> IEXT I (IS I owl_onProperty)"+ and a3: "(c2,y2) \<in> IEXT I (IS I owl_someValuesFrom)"+ and a4: "(c2,p) \<in> IEXT I (IS I owl_onProperty)"+ and a5: "(y1,y2) \<in> IEXT I (IS I rdfs_subClassOf)"+ shows "(c1,c2) \<in> IEXT I (IS I rdfs_subClassOf)"+proof (rule D_sco_bwd[OF I D_svf_IC[OF I a1] D_svf_IC[OF I a3]], intro allI impI)+ fix x assume "(x,c1) \<in> IEXT I (IS I rdf_type)"+ then obtain y where "(x,y) \<in> IEXT I p" and "(y,y1) \<in> IEXT I (IS I rdf_type)"+ using D_svf_out[OF I a1 a2] by blast+ then have "(y,y2) \<in> IEXT I (IS I rdf_type)" using D_sco[OF I a5] by blast+ thus "(x,c2) \<in> IEXT I (IS I rdf_type)"+ using D_svf_in[OF I a3 a4 \<open>(x,y) \<in> IEXT I p\<close>] by blast+qed++lemma D_svf_mono2:+ assumes I: "owl_rl_interp I"+ and a1: "(c1,y) \<in> IEXT I (IS I owl_someValuesFrom)"+ and a2: "(c1,p1) \<in> IEXT I (IS I owl_onProperty)"+ and a3: "(c2,y) \<in> IEXT I (IS I owl_someValuesFrom)"+ and a4: "(c2,p2) \<in> IEXT I (IS I owl_onProperty)"+ and a5: "(p1,p2) \<in> IEXT I (IS I rdfs_subPropertyOf)"+ shows "(c1,c2) \<in> IEXT I (IS I rdfs_subClassOf)"+proof (rule D_sco_bwd[OF I D_svf_IC[OF I a1] D_svf_IC[OF I a3]], intro allI impI)+ fix x assume "(x,c1) \<in> IEXT I (IS I rdf_type)"+ then obtain v where v1: "(x,v) \<in> IEXT I p1" and v2: "(v,y) \<in> IEXT I (IS I rdf_type)"+ using D_svf_out[OF I a1 a2] by blast+ have "(x,v) \<in> IEXT I p2" using D_spo[OF I a5 v1] .+ thus "(x,c2) \<in> IEXT I (IS I rdf_type)" using D_svf_in[OF I a3 a4 _ v2] by blast+qed++lemma D_avf_mono1:+ assumes I: "owl_rl_interp I"+ and a1: "(c1,y1) \<in> IEXT I (IS I owl_allValuesFrom)"+ and a2: "(c1,p) \<in> IEXT I (IS I owl_onProperty)"+ and a3: "(c2,y2) \<in> IEXT I (IS I owl_allValuesFrom)"+ and a4: "(c2,p) \<in> IEXT I (IS I owl_onProperty)"+ and a5: "(y1,y2) \<in> IEXT I (IS I rdfs_subClassOf)"+ shows "(c1,c2) \<in> IEXT I (IS I rdfs_subClassOf)"+proof (rule D_sco_bwd[OF I D_avf_IC[OF I a1] D_avf_IC[OF I a3]], intro allI impI)+ fix x assume h: "(x,c1) \<in> IEXT I (IS I rdf_type)"+ have "\<forall>v. (x,v) \<in> IEXT I p \<longrightarrow> (v,y2) \<in> IEXT I (IS I rdf_type)"+ proof (intro allI impI)+ fix v assume "(x,v) \<in> IEXT I p"+ hence "(v,y1) \<in> IEXT I (IS I rdf_type)" using D_avf_out[OF I a1 a2 h] by blast+ thus "(v,y2) \<in> IEXT I (IS I rdf_type)" using D_sco[OF I a5] by blast+ qed+ thus "(x,c2) \<in> IEXT I (IS I rdf_type)" using D_avf_in[OF I a3 a4] by blast+qed++lemma D_avf_mono2:+ assumes I: "owl_rl_interp I"+ and a1: "(c1,y) \<in> IEXT I (IS I owl_allValuesFrom)"+ and a2: "(c1,p1) \<in> IEXT I (IS I owl_onProperty)"+ and a3: "(c2,y) \<in> IEXT I (IS I owl_allValuesFrom)"+ and a4: "(c2,p2) \<in> IEXT I (IS I owl_onProperty)"+ and a5: "(p1,p2) \<in> IEXT I (IS I rdfs_subPropertyOf)"+ shows "(c2,c1) \<in> IEXT I (IS I rdfs_subClassOf)"+proof (rule D_sco_bwd[OF I D_avf_IC[OF I a3] D_avf_IC[OF I a1]], intro allI impI)+ fix x assume h: "(x,c2) \<in> IEXT I (IS I rdf_type)"+ have "\<forall>v. (x,v) \<in> IEXT I p1 \<longrightarrow> (v,y) \<in> IEXT I (IS I rdf_type)"+ proof (intro allI impI)+ fix v assume "(x,v) \<in> IEXT I p1"+ hence "(x,v) \<in> IEXT I p2" using D_spo[OF I a5] by blast+ thus "(v,y) \<in> IEXT I (IS I rdf_type)" using D_avf_out[OF I a3 a4 h] by blast+ qed+ thus "(x,c1) \<in> IEXT I (IS I rdf_type)" using D_avf_in[OF I a1 a2] by blast+qed++lemma D_dom_mono1:+ assumes I: "owl_rl_interp I"+ and a1: "(p,c1) \<in> IEXT I (IS I rdfs_domain)"+ and a2: "(c1,c2) \<in> IEXT I (IS I rdfs_subClassOf)"+ shows "(p,c2) \<in> IEXT I (IS I rdfs_domain)"+ by (rule D_dom_bwd[OF I D_dom_IP[OF I a1] D_sco_IC2[OF I a2]])+ (auto dest: D_dom[OF I a1] D_sco[OF I a2])++lemma D_dom_mono2:+ assumes I: "owl_rl_interp I"+ and a1: "(p2,c) \<in> IEXT I (IS I rdfs_domain)"+ and a2: "(p1,p2) \<in> IEXT I (IS I rdfs_subPropertyOf)"+ shows "(p1,c) \<in> IEXT I (IS I rdfs_domain)"+ by (rule D_dom_bwd[OF I D_spo_IP1[OF I a2] D_dom_IC[OF I a1]])+ (auto dest: D_spo[OF I a2] D_dom[OF I a1])++lemma D_rng_mono1:+ assumes I: "owl_rl_interp I"+ and a1: "(p,c1) \<in> IEXT I (IS I rdfs_range)"+ and a2: "(c1,c2) \<in> IEXT I (IS I rdfs_subClassOf)"+ shows "(p,c2) \<in> IEXT I (IS I rdfs_range)"+ by (rule D_rng_bwd[OF I D_rng_IP[OF I a1] D_sco_IC2[OF I a2]])+ (auto dest: D_rng[OF I a1] D_sco[OF I a2])++lemma D_rng_mono2:+ assumes I: "owl_rl_interp I"+ and a1: "(p2,c) \<in> IEXT I (IS I rdfs_range)"+ and a2: "(p1,p2) \<in> IEXT I (IS I rdfs_subPropertyOf)"+ shows "(p1,c) \<in> IEXT I (IS I rdfs_range)"+ by (rule D_rng_bwd[OF I D_spo_IP1[OF I a2] D_rng_IC[OF I a1]])+ (auto dest: D_spo[OF I a2] D_rng[OF I a1])++section \<open>Soundness of the built-in rules\<close>++lemma s_rdfs2: "owl_rl_interp I \<Longrightarrow> sat_rule I r_rdfs2"+ by (auto simp: sat_rule_def r_rdfs2_def PI_def D_type_IP dest: D_dom)+lemma s_rdfs3: "owl_rl_interp I \<Longrightarrow> sat_rule I r_rdfs3"+ by (auto simp: sat_rule_def r_rdfs3_def PI_def D_type_IP dest: D_rng)+lemma s_rdfs5: "owl_rl_interp I \<Longrightarrow> sat_rule I r_rdfs5"+ by (auto simp: sat_rule_def r_rdfs5_def PI_def D_spo_IP dest: D_spo_trans)+lemma s_rdfs7: "owl_rl_interp I \<Longrightarrow> sat_rule I r_rdfs7"+ by (auto simp: sat_rule_def r_rdfs7_def PI_def dest: D_spo D_spo_IP2)+lemma s_rdfs9: "owl_rl_interp I \<Longrightarrow> sat_rule I r_rdfs9"+ by (auto simp: sat_rule_def r_rdfs9_def PI_def D_type_IP dest: D_sco)+lemma s_rdfs11: "owl_rl_interp I \<Longrightarrow> sat_rule I r_rdfs11"+ by (auto simp: sat_rule_def r_rdfs11_def PI_def D_sco_IP dest: D_sco_trans)+lemma s_prp_trp: "owl_rl_interp I \<Longrightarrow> sat_rule I r_prp_trp"+ by (auto simp: sat_rule_def r_prp_trp_def PI_def dest: D_trp)+lemma s_prp_symp: "owl_rl_interp I \<Longrightarrow> sat_rule I r_prp_symp"+ by (auto simp: sat_rule_def r_prp_symp_def PI_def dest: D_sym)+lemma s_prp_inv1: "owl_rl_interp I \<Longrightarrow> sat_rule I r_prp_inv1"+ by (auto simp: sat_rule_def r_prp_inv1_def PI_def dest: D_inv1 D_inv_IP2)+lemma s_prp_inv2: "owl_rl_interp I \<Longrightarrow> sat_rule I r_prp_inv2"+ by (auto simp: sat_rule_def r_prp_inv2_def PI_def dest: D_inv2 D_inv_IP1)+lemma s_eq_sym: "owl_rl_interp I \<Longrightarrow> sat_rule I r_eq_sym"+ by (auto simp: sat_rule_def r_eq_sym_def PI_def dest: D_sameAs)+lemma s_scm_eqc1a: "owl_rl_interp I \<Longrightarrow> sat_rule I r_scm_eqc1a"+ by (auto simp: sat_rule_def r_scm_eqc1a_def PI_def D_sco_IP dest: D_eqc_sub1)+lemma s_scm_eqc1b: "owl_rl_interp I \<Longrightarrow> sat_rule I r_scm_eqc1b"+ by (auto simp: sat_rule_def r_scm_eqc1b_def PI_def D_sco_IP dest: D_eqc_sub2)+lemma s_scm_eqp1a: "owl_rl_interp I \<Longrightarrow> sat_rule I r_scm_eqp1a"+ by (auto simp: sat_rule_def r_scm_eqp1a_def PI_def D_spo_IP dest: D_eqp_sub1)+lemma s_scm_eqp1b: "owl_rl_interp I \<Longrightarrow> sat_rule I r_scm_eqp1b"+ by (auto simp: sat_rule_def r_scm_eqp1b_def PI_def D_spo_IP dest: D_eqp_sub2)+lemma s_cls_svf1: "owl_rl_interp I \<Longrightarrow> sat_rule I r_cls_svf1"+ by (auto simp: sat_rule_def r_cls_svf1_def PI_def D_type_IP dest: D_svf_in)+lemma s_cls_avf: "owl_rl_interp I \<Longrightarrow> sat_rule I r_cls_avf"+ by (auto simp: sat_rule_def r_cls_avf_def PI_def D_type_IP dest: D_avf_out)+lemma s_cls_hv1: "owl_rl_interp I \<Longrightarrow> sat_rule I r_cls_hv1"+ by (auto simp: sat_rule_def r_cls_hv1_def PI_def dest: D_hv_out D_onP_IP)+lemma s_cls_hv2: "owl_rl_interp I \<Longrightarrow> sat_rule I r_cls_hv2"+ by (auto simp: sat_rule_def r_cls_hv2_def PI_def D_type_IP dest: D_hv_in)+lemma s_scm_svf1: "owl_rl_interp I \<Longrightarrow> sat_rule I r_scm_svf1"+ by (auto simp: sat_rule_def r_scm_svf1_def PI_def D_sco_IP dest: D_svf_mono1)+lemma s_scm_svf2: "owl_rl_interp I \<Longrightarrow> sat_rule I r_scm_svf2"+ by (auto simp: sat_rule_def r_scm_svf2_def PI_def D_sco_IP dest: D_svf_mono2)+lemma s_scm_avf1: "owl_rl_interp I \<Longrightarrow> sat_rule I r_scm_avf1"+ by (auto simp: sat_rule_def r_scm_avf1_def PI_def D_sco_IP dest: D_avf_mono1)+lemma s_scm_avf2: "owl_rl_interp I \<Longrightarrow> sat_rule I r_scm_avf2"+ by (auto simp: sat_rule_def r_scm_avf2_def PI_def D_sco_IP dest: D_avf_mono2)+lemma s_scm_dom1: "owl_rl_interp I \<Longrightarrow> sat_rule I r_scm_dom1"+ by (auto simp: sat_rule_def r_scm_dom1_def PI_def dest: D_dom_mono1)+lemma s_scm_dom2: "owl_rl_interp I \<Longrightarrow> sat_rule I r_scm_dom2"+ by (auto simp: sat_rule_def r_scm_dom2_def PI_def dest: D_dom_mono2)+lemma s_scm_rng1: "owl_rl_interp I \<Longrightarrow> sat_rule I r_scm_rng1"+ by (auto simp: sat_rule_def r_scm_rng1_def PI_def dest: D_rng_mono1)+lemma s_scm_rng2: "owl_rl_interp I \<Longrightarrow> sat_rule I r_scm_rng2"+ by (auto simp: sat_rule_def r_scm_rng2_def PI_def dest: D_rng_mono2)+section \<open>T2: every arm of the shipped table is sound\<close>++theorem builtin_table_sound:+ "owl_rl_interp I \<Longrightarrow> \<forall>R \<in> set builtin_table. sat_rule I R"+ unfolding builtin_table_def+ by (simp add: s_rdfs2 s_rdfs3 s_rdfs5 s_rdfs7 s_rdfs9 s_rdfs11+ s_prp_trp s_prp_symp s_prp_inv1 s_prp_inv2 s_eq_sym+ s_scm_eqc1a s_scm_eqc1b s_scm_eqp1a s_scm_eqp1b+ s_cls_svf1 s_cls_avf s_cls_hv1 s_cls_hv2+ s_scm_svf1 s_scm_svf2 s_scm_avf1 s_scm_avf2+ s_scm_dom1 s_scm_dom2 s_scm_rng1 s_scm_rng2)++section \<open>T3: the absolute verdict\<close>++(* The ONLY place in the development where the semantics of the vocabulary is consumed.+ Read the difference from T1 carefully: T1 concludes entails_under, which quantifies+ over interpretations satisfying the USER's rules and nothing else; T3 concludes+ entails, which quantifies over interpretations satisfying the 26 conditions of+ owl_rl_interp. T3 is available only because builtin_table_sound discharges every arm+ of THIS table against THOSE conditions. *)++theorem entails_of_builtin:+ fixes G :: "triple list" and C :: "hstep list"+ assumes ok: "check_cert builtin_table G C = None"+ and mem: "s \<in> set C"+ shows "entails TYPE('d) (set G) (sconcl s)"+proof (rule entails_of_entails_under)+ show "\<And>I :: 'd interp. owl_rl_interp I \<Longrightarrow> \<forall>R \<in> set builtin_table. sat_rule I R"+ by (rule builtin_table_sound)+ show "entails_under TYPE('d) builtin_table (set G) (sconcl s)"+ by (rule horn_certificate_sound[OF ok mem])+qed++theorem entails_of_builtin_lenient:+ fixes G :: "triple list" and C :: "hstep list"+ assumes ok: "check_cert_lenient builtin_table G C = None"+ and mem: "s \<in> set C"+ shows "entails TYPE('d) (set G) (sconcl s)"+proof (rule entails_of_entails_under)+ show "\<And>I :: 'd interp. owl_rl_interp I \<Longrightarrow> \<forall>R \<in> set builtin_table. sat_rule I R"+ by (rule builtin_table_sound)+ show "entails_under TYPE('d) builtin_table (set G) (sconcl s)"+ by (rule horn_certificate_sound_lenient[OF ok mem])+qed++section \<open>T4: the bridge to genuine simple interpretations (M22, conflict C6)\<close>++(* owl_rl_interp deliberately omits the domain conditions of RBS Table 5.1, because no+ arm consumes them and omitting them enlarges the model class. This theorem records+ that the result nevertheless applies to an interpretation that DOES satisfy them, so+ nothing was lost by the omission. *)++theorem entails_simple:+ fixes I :: "'d interp"+ assumes wf: "wf_interp I"+ and cond: "owl_rl_interp I"+ and mod: "models I (set G)"+ and ok: "check_cert builtin_table G C = None"+ and mem: "s \<in> set C"+ shows "sat I (sconcl s)"+ using entails_of_builtin[OF ok mem, where 'd = 'd] cond mod+ by (simp add: entails_def)++section \<open>T5: the verdict is never over-claimed\<close>++theorem verdict_honest: "verdict_of R = Entailed \<Longrightarrow> R = builtin_table"+ by (simp add: verdict_of_def split: if_splits)++theorem a_user_rule_never_earns_the_absolute_verdict:+ "R \<noteq> builtin_table \<Longrightarrow> verdict_of R = EntailedUnderSuppliedRules"+ by (simp add: verdict_of_def)++enddiff --git a/isabelle/OO_Check.thy b/isabelle/OO_Check.thynew file mode 100644index 00000000..6964aee9--- /dev/null+++ b/isabelle/OO_Check.thy@@ -0,0 +1,351 @@+(* OO_Check.thy -- the certificate checker, and the built-in rule table.++ EXECUTABLE. Nothing here mentions an interpretation, a domain, or truth. Checking a+ Horn certificate is PURELY SYNTACTIC: not one line of the semantics is consulted.+ That is worth stating loudly, because it has a consequence for any differential test+ against another implementation -- two checkers built on wildly different and even+ mutually contradictory semantics will agree on every certificate and on every forgery.+ AGREEMENT ON ACCEPT/REJECT IS NOT EVIDENCE THAT TWO FORMALISATIONS' DEFINITIONS AGREE.+ The evidence lives in OO_Builtin_Sound: which arms each side can discharge, and from+ which conditions. *)++theory OO_Check+ imports OO_Format+begin++section \<open>Rejection reasons\<close>++datatype reason =+ R_index_out_of_range+ | R_arity_mismatch+ | R_binding_incomplete+ | R_binding_dup_key+ | R_body_mismatch nat+ | R_premise_unknown nat+ | R_head_mismatch++section \<open>The checker\<close>++(* DECISION M25, and UNCERTAINTY U10 which is a genuine coin-flip between two honest+ authors. A duplicate key in the binding is MALFORMED and rejected.+ The reason it is a coin-flip: map_of is silently first-wins in Isabelle, so a+ duplicate key would otherwise be accepted with one of the two values chosen by an+ implementation detail of the lookup function. Rejecting is the conservative reading.+ It is nevertheless a STRICTNESS with no soundness content -- see+ check_step_dup_key_not_needed in OO_Sound, which proves that removing this check+ preserves soundness -- so a differential disagreement here is a disagreement about+ taste, not about truth. *)++definition binding_covers :: "(string \<times> rdf_term) list \<Rightarrow> hrule \<Rightarrow> bool" where+ "binding_covers \<beta> r = list_all (\<lambda>v. map_of \<beta> v \<noteq> None) (rule_var_list r)"++(* DECISION M26 (conflict C11, uncertainty U12). Premises are checked STRICTLY:+ positionally equal to the instantiated body AND present in the known set.+ Both strict and lenient are sound. They differ on exactly one class of input:+ premises listed out of order but all asserted. This is the single most likely place+ for a first differential disagreement with another implementation, and it is+ HARMLESS -- the stricter checker is the better-behaved one. Do not "fix" it.+ The lenient judgement is defined below as well, and proved sound, so a report can+ carry both bits and a disagreement can be localised by a theorem instead of a guess. *)++fun body_strict ::+ "(string \<times> rdf_term) list \<Rightarrow> nat \<Rightarrow> pat_triple list \<Rightarrow> triple list \<Rightarrow> reason option" where+ "body_strict \<beta> j [] [] = None"+| "body_strict \<beta> j [] (p # ps) = Some R_arity_mismatch"+| "body_strict \<beta> j (b # bs) [] = Some R_arity_mismatch"+| "body_strict \<beta> j (b # bs) (p # ps) =+ (if iptriple \<beta> b = Some p then body_strict \<beta> (Suc j) bs ps+ else Some (R_body_mismatch j))"++(* TRAP T9, guarded: this is POSITIONAL equality, not set equality. With set equality+ and a rule whose body has two identical patterns, one known triple would discharge+ two body atoms. *)++fun premises_known :: "graph \<Rightarrow> nat \<Rightarrow> triple list \<Rightarrow> reason option" where+ "premises_known K j [] = None"+| "premises_known K j (p # ps) =+ (if p \<in> K then premises_known K (Suc j) ps else Some (R_premise_unknown j))"++(* DECISION M-IDX / C12 / U11. An out-of-range rule index is a REJECTION (exit 1), not+ a parse error (exit 2). It is detected here, by the checker, because the certificate+ line parses without consulting the table at all -- see DECISION D-PARSE-3 in+ OO_Parse, which differs from the brief's expectation and is an independent finding. *)++definition check_step :: "rtable \<Rightarrow> graph \<Rightarrow> hstep \<Rightarrow> reason option" where+ "check_step R K s =+ (if length R \<le> sidx s then Some R_index_out_of_range+ else+ (let r = R ! sidx s; b = sbind s in+ if \<not> distinct (map fst b) then Some R_binding_dup_key+ else if \<not> binding_covers b r then Some R_binding_incomplete+ else (case body_strict b 0 (rbody r) (sprem s) of Some e \<Rightarrow> Some e | None \<Rightarrow>+ (case premises_known K 0 (sprem s) of Some e \<Rightarrow> Some e | None \<Rightarrow>+ if iptriple b (rhead r) = Some (sconcl s) then None+ else Some R_head_mismatch))))"++(* DECISION M27, AND THE ONE PROPERTY NO SHIPPED FIXTURE CAN TEST (uncertainty U16,+ trap T8). Steps accumulate with STRICT PREFIX visibility: the known set for step j is+ the asserted graph together with the conclusions of steps STRICTLY BEFORE j. The+ conclusion is inserted only AFTER the step has been checked.++ This recursion IS the no-self-support property. There is no separate test for it, and+ there cannot usefully be one: the induction in check_from_sound (OO_Sound) is FALSE if+ the conclusion is inserted before the step is checked. Building the union of the+ graph and all conclusions once and checking every step against it is faster, simpler,+ and lets a two-step cycle certify itself. DO NOT "optimise" this into a closure pass.+ Verified against the fixtures: every certificate fixture is a single line, and+ bad_self.tsv aims at this property and misses -- its edit also breaks body+ instantiation, so it is rejected for an unrelated reason. Answer this by reading the+ loop, not by running a test. *)++fun check_from :: "rtable \<Rightarrow> graph \<Rightarrow> nat \<Rightarrow> hstep list \<Rightarrow> (nat \<times> reason) option" where+ "check_from R K j [] = None"+| "check_from R K j (s # ss) =+ (case check_step R K s of Some e \<Rightarrow> Some (j, e)+ | None \<Rightarrow> check_from R (insert (sconcl s) K) (Suc j) ss)"++(* DECISION M37. Fail fast on the first failing step and report its index. *)++definition check_cert :: "rtable \<Rightarrow> triple list \<Rightarrow> hstep list \<Rightarrow> (nat \<times> reason) option" where+ "check_cert R G ss = check_from R (set G) 0 ss"++definition accepts :: "rtable \<Rightarrow> triple list \<Rightarrow> hstep list \<Rightarrow> bool" where+ "accepts R G ss = (check_cert R G ss = None)"++section \<open>The lenient judgement (conflict C11), defined so the boundary can be probed\<close>++(* Ignores the cited premise list entirely and asks only that the instantiated body lie+ in the known set. Sound as well (check_cert_lenient_sound in OO_Sound), and strictly+ more permissive (strict_implies_lenient). *)++fun body_lenient ::+ "(string \<times> rdf_term) list \<Rightarrow> graph \<Rightarrow> nat \<Rightarrow> pat_triple list \<Rightarrow> reason option" where+ "body_lenient \<beta> K j [] = None"+| "body_lenient \<beta> K j (b # bs) =+ (case iptriple \<beta> b of None \<Rightarrow> Some R_binding_incomplete+ | Some t \<Rightarrow> if t \<in> K then body_lenient \<beta> K (Suc j) bs+ else Some (R_premise_unknown j))"++definition check_step_lenient :: "rtable \<Rightarrow> graph \<Rightarrow> hstep \<Rightarrow> reason option" where+ "check_step_lenient R K s =+ (if length R \<le> sidx s then Some R_index_out_of_range+ else+ (let r = R ! sidx s; b = sbind s in+ (case body_lenient b K 0 (rbody r) of Some e \<Rightarrow> Some e | None \<Rightarrow>+ if iptriple b (rhead r) = Some (sconcl s) then None else Some R_head_mismatch)))"++fun check_from_lenient ::+ "rtable \<Rightarrow> graph \<Rightarrow> nat \<Rightarrow> hstep list \<Rightarrow> (nat \<times> reason) option" where+ "check_from_lenient R K j [] = None"+| "check_from_lenient R K j (s # ss) =+ (case check_step_lenient R K s of Some e \<Rightarrow> Some (j, e)+ | None \<Rightarrow> check_from_lenient R (insert (sconcl s) K) (Suc j) ss)"++definition check_cert_lenient ::+ "rtable \<Rightarrow> triple list \<Rightarrow> hstep list \<Rightarrow> (nat \<times> reason) option" where+ "check_cert_lenient R G ss = check_from_lenient R (set G) 0 ss"++section \<open>The built-in rule table\<close>++(* DECISION M40, AND A STATED LIMIT ON INDEPENDENCE. The built-in table is TRANSCRIBED+ FROM THE FIXTURE tests/fixtures/horn/builtin_rules.tsv. It is therefore SHARED INPUT+ between this formalisation and any other, and the rows themselves are not independent+ evidence. What IS independent is which rows each side can JUSTIFY from the+ specification, and from which conditions -- that is OO_Builtin_Sound.+ Re-dumped field by field before transcription: 27 rows, NF = 5 + 3n holds for all 27,+ and the row order is load-bearing because good.tsv cites index 4.++ DECISION M33 and C7, A FINDING RECORDED AND DELIBERATELY NOT ACTED ON. The first six+ rows are named rdfs2, rdfs3, rdfs5, rdfs7, rdfs9, rdfs11 in the fixture. Those names+ come from the NON-NORMATIVE table in RDF 1.1 Semantics section 9.2.1. Their true+ OWL 2 Profiles names are prp-dom, prp-rng, scm-spo, prp-spo1, cax-sco and scm-sco, and+ the rdfs* naming is additionally misleading about the model class, since these rows are+ discharged here against OWL 2 RDF-Based conditions and not RDFS ones. The finding is+ recorded in the comment on each row. It is NOT acted on in the data, because+ verdict_of decides the absolute verdict by equality against this table, so renaming a+ row here would downgrade EVERY certificate to entailed_under_supplied_rules.+ Correct as a finding, fatal as an edit. *)++definition PI :: "string \<Rightarrow> pat" where "PI u = Tm (Iri u)"++definition r_rdfs2 :: hrule where (* true W3C name: prp-dom *)+ "r_rdfs2 = \<lparr> rname = ''rdfs2'',+ rbody = [(V ''s'', V ''p'', V ''o''), (V ''p'', PI rdfs_domain, V ''c'')],+ rhead = (V ''s'', PI rdf_type, V ''c'') \<rparr>"+definition r_rdfs3 :: hrule where (* true W3C name: prp-rng *)+ "r_rdfs3 = \<lparr> rname = ''rdfs3'',+ rbody = [(V ''s'', V ''p'', V ''o''), (V ''p'', PI rdfs_range, V ''c'')],+ rhead = (V ''o'', PI rdf_type, V ''c'') \<rparr>"+definition r_rdfs5 :: hrule where (* true W3C name: scm-spo *)+ "r_rdfs5 = \<lparr> rname = ''rdfs5'',+ rbody = [(V ''a'', PI rdfs_subPropertyOf, V ''b''),+ (V ''b'', PI rdfs_subPropertyOf, V ''c'')],+ rhead = (V ''a'', PI rdfs_subPropertyOf, V ''c'') \<rparr>"+definition r_rdfs7 :: hrule where (* true W3C name: prp-spo1 *)+ "r_rdfs7 = \<lparr> rname = ''rdfs7'',+ rbody = [(V ''s'', V ''p'', V ''o''), (V ''p'', PI rdfs_subPropertyOf, V ''q'')],+ rhead = (V ''s'', V ''q'', V ''o'') \<rparr>"+definition r_rdfs9 :: hrule where (* true W3C name: cax-sco *)+ "r_rdfs9 = \<lparr> rname = ''rdfs9'',+ rbody = [(V ''x'', PI rdf_type, V ''a''), (V ''a'', PI rdfs_subClassOf, V ''b'')],+ rhead = (V ''x'', PI rdf_type, V ''b'') \<rparr>"+definition r_rdfs11 :: hrule where (* true W3C name: scm-sco *)+ "r_rdfs11 = \<lparr> rname = ''rdfs11'',+ rbody = [(V ''a'', PI rdfs_subClassOf, V ''b''),+ (V ''b'', PI rdfs_subClassOf, V ''c'')],+ rhead = (V ''a'', PI rdfs_subClassOf, V ''c'') \<rparr>"+definition r_prp_trp :: hrule where+ "r_prp_trp = \<lparr> rname = ''prp-trp'',+ rbody = [(V ''p'', PI rdf_type, PI owl_TransitiveProperty),+ (V ''x'', V ''p'', V ''y''), (V ''y'', V ''p'', V ''z'')],+ rhead = (V ''x'', V ''p'', V ''z'') \<rparr>"+definition r_prp_symp :: hrule where+ "r_prp_symp = \<lparr> rname = ''prp-symp'',+ rbody = [(V ''p'', PI rdf_type, PI owl_SymmetricProperty),+ (V ''x'', V ''p'', V ''y'')],+ rhead = (V ''y'', V ''p'', V ''x'') \<rparr>"+definition r_prp_inv1 :: hrule where+ "r_prp_inv1 = \<lparr> rname = ''prp-inv1'',+ rbody = [(V ''p'', PI owl_inverseOf, V ''q''), (V ''x'', V ''p'', V ''y'')],+ rhead = (V ''y'', V ''q'', V ''x'') \<rparr>"+definition r_prp_inv2 :: hrule where+ "r_prp_inv2 = \<lparr> rname = ''prp-inv2'',+ rbody = [(V ''p'', PI owl_inverseOf, V ''q''), (V ''x'', V ''q'', V ''y'')],+ rhead = (V ''y'', V ''p'', V ''x'') \<rparr>"+definition r_eq_sym :: hrule where+ "r_eq_sym = \<lparr> rname = ''eq-sym'',+ rbody = [(V ''a'', PI owl_sameAs, V ''b'')],+ rhead = (V ''b'', PI owl_sameAs, V ''a'') \<rparr>"+definition r_scm_eqc1a :: hrule where (* scm-eqc1, arm 1 of 2 -- see M36 *)+ "r_scm_eqc1a = \<lparr> rname = ''scm-eqc1'',+ rbody = [(V ''a'', PI owl_equivalentClass, V ''b'')],+ rhead = (V ''a'', PI rdfs_subClassOf, V ''b'') \<rparr>"+definition r_scm_eqc1b :: hrule where (* scm-eqc1, arm 2 of 2 *)+ "r_scm_eqc1b = \<lparr> rname = ''scm-eqc1'',+ rbody = [(V ''a'', PI owl_equivalentClass, V ''b'')],+ rhead = (V ''b'', PI rdfs_subClassOf, V ''a'') \<rparr>"+definition r_scm_eqp1a :: hrule where (* scm-eqp1, arm 1 of 2 *)+ "r_scm_eqp1a = \<lparr> rname = ''scm-eqp1'',+ rbody = [(V ''a'', PI owl_equivalentProperty, V ''b'')],+ rhead = (V ''a'', PI rdfs_subPropertyOf, V ''b'') \<rparr>"+definition r_scm_eqp1b :: hrule where (* scm-eqp1, arm 2 of 2 *)+ "r_scm_eqp1b = \<lparr> rname = ''scm-eqp1'',+ rbody = [(V ''a'', PI owl_equivalentProperty, V ''b'')],+ rhead = (V ''b'', PI rdfs_subPropertyOf, V ''a'') \<rparr>"+definition r_cls_svf1 :: hrule where+ "r_cls_svf1 = \<lparr> rname = ''cls-svf1'',+ rbody = [(V ''r'', PI owl_onProperty, V ''p''),+ (V ''r'', PI owl_someValuesFrom, V ''c''),+ (V ''x'', V ''p'', V ''y''), (V ''y'', PI rdf_type, V ''c'')],+ rhead = (V ''x'', PI rdf_type, V ''r'') \<rparr>"+definition r_cls_avf :: hrule where+ "r_cls_avf = \<lparr> rname = ''cls-avf'',+ rbody = [(V ''r'', PI owl_onProperty, V ''p''),+ (V ''r'', PI owl_allValuesFrom, V ''c''),+ (V ''x'', PI rdf_type, V ''r''), (V ''x'', V ''p'', V ''y'')],+ rhead = (V ''y'', PI rdf_type, V ''c'') \<rparr>"+definition r_cls_hv1 :: hrule where+ "r_cls_hv1 = \<lparr> rname = ''cls-hv1'',+ rbody = [(V ''r'', PI owl_onProperty, V ''p''),+ (V ''r'', PI owl_hasValue, V ''v''), (V ''x'', PI rdf_type, V ''r'')],+ rhead = (V ''x'', V ''p'', V ''v'') \<rparr>"+definition r_cls_hv2 :: hrule where+ "r_cls_hv2 = \<lparr> rname = ''cls-hv2'',+ rbody = [(V ''r'', PI owl_onProperty, V ''p''),+ (V ''r'', PI owl_hasValue, V ''v''), (V ''x'', V ''p'', V ''v'')],+ rhead = (V ''x'', PI rdf_type, V ''r'') \<rparr>"+definition r_scm_svf1 :: hrule where+ "r_scm_svf1 = \<lparr> rname = ''scm-svf1'',+ rbody = [(V ''c1'', PI owl_someValuesFrom, V ''y1''),+ (V ''c1'', PI owl_onProperty, V ''p''),+ (V ''c2'', PI owl_someValuesFrom, V ''y2''),+ (V ''c2'', PI owl_onProperty, V ''p''),+ (V ''y1'', PI rdfs_subClassOf, V ''y2'')],+ rhead = (V ''c1'', PI rdfs_subClassOf, V ''c2'') \<rparr>"+definition r_scm_svf2 :: hrule where+ "r_scm_svf2 = \<lparr> rname = ''scm-svf2'',+ rbody = [(V ''c1'', PI owl_someValuesFrom, V ''y''),+ (V ''c1'', PI owl_onProperty, V ''p1''),+ (V ''c2'', PI owl_someValuesFrom, V ''y''),+ (V ''c2'', PI owl_onProperty, V ''p2''),+ (V ''p1'', PI rdfs_subPropertyOf, V ''p2'')],+ rhead = (V ''c1'', PI rdfs_subClassOf, V ''c2'') \<rparr>"+definition r_scm_avf1 :: hrule where+ "r_scm_avf1 = \<lparr> rname = ''scm-avf1'',+ rbody = [(V ''c1'', PI owl_allValuesFrom, V ''y1''),+ (V ''c1'', PI owl_onProperty, V ''p''),+ (V ''c2'', PI owl_allValuesFrom, V ''y2''),+ (V ''c2'', PI owl_onProperty, V ''p''),+ (V ''y1'', PI rdfs_subClassOf, V ''y2'')],+ rhead = (V ''c1'', PI rdfs_subClassOf, V ''c2'') \<rparr>"+(* ROW 22. THE HEAD IS REVERSED RELATIVE TO ROW 20, AND THAT IS CORRECT.+ allValuesFrom is ANTITONE in the property: if IEXT p1 subset IEXT p2 and+ ICEXT ci = {x : for all y, (x,y) in IEXT pi --> y in ICEXT c}, then ICEXT c2 subset+ ICEXT c1, so it is c2 that is the subclass. Verified semantically in+ OO_Builtin_Sound (D_avf_mono2), not by trusting the fixture. A transcription that+ "tidies" this into symmetry with row 20 introduces an UNSOUND rule. *)+definition r_scm_avf2 :: hrule where+ "r_scm_avf2 = \<lparr> rname = ''scm-avf2'',+ rbody = [(V ''c1'', PI owl_allValuesFrom, V ''y''),+ (V ''c1'', PI owl_onProperty, V ''p1''),+ (V ''c2'', PI owl_allValuesFrom, V ''y''),+ (V ''c2'', PI owl_onProperty, V ''p2''),+ (V ''p1'', PI rdfs_subPropertyOf, V ''p2'')],+ rhead = (V ''c2'', PI rdfs_subClassOf, V ''c1'') \<rparr>"+definition r_scm_dom1 :: hrule where+ "r_scm_dom1 = \<lparr> rname = ''scm-dom1'',+ rbody = [(V ''p'', PI rdfs_domain, V ''c1''),+ (V ''c1'', PI rdfs_subClassOf, V ''c2'')],+ rhead = (V ''p'', PI rdfs_domain, V ''c2'') \<rparr>"+definition r_scm_dom2 :: hrule where+ "r_scm_dom2 = \<lparr> rname = ''scm-dom2'',+ rbody = [(V ''p2'', PI rdfs_domain, V ''c''),+ (V ''p1'', PI rdfs_subPropertyOf, V ''p2'')],+ rhead = (V ''p1'', PI rdfs_domain, V ''c'') \<rparr>"+definition r_scm_rng1 :: hrule where+ "r_scm_rng1 = \<lparr> rname = ''scm-rng1'',+ rbody = [(V ''p'', PI rdfs_range, V ''c1''),+ (V ''c1'', PI rdfs_subClassOf, V ''c2'')],+ rhead = (V ''p'', PI rdfs_range, V ''c2'') \<rparr>"+definition r_scm_rng2 :: hrule where+ "r_scm_rng2 = \<lparr> rname = ''scm-rng2'',+ rbody = [(V ''p2'', PI rdfs_range, V ''c''),+ (V ''p1'', PI rdfs_subPropertyOf, V ''p2'')],+ rhead = (V ''p1'', PI rdfs_range, V ''c'') \<rparr>"++definition builtin_table :: rtable where+ "builtin_table = [r_rdfs2, r_rdfs3, r_rdfs5, r_rdfs7, r_rdfs9, r_rdfs11,+ r_prp_trp, r_prp_symp, r_prp_inv1, r_prp_inv2, r_eq_sym,+ r_scm_eqc1a, r_scm_eqc1b, r_scm_eqp1a, r_scm_eqp1b,+ r_cls_svf1, r_cls_avf, r_cls_hv1, r_cls_hv2,+ r_scm_svf1, r_scm_svf2, r_scm_avf1, r_scm_avf2,+ r_scm_dom1, r_scm_dom2, r_scm_rng1, r_scm_rng2]"++lemma builtin_table_length: "length builtin_table = 27"+ by (simp add: builtin_table_def)++lemma builtin_index_4: "builtin_table ! 4 = r_rdfs9"+ by (simp add: builtin_table_def)++section \<open>The verdict\<close>++(* DECISION M33 and U13. The verdict compares the supplied table to the embedded table+ as an ORDERED LIST, element-wise on (name, body, head), variable names literal, with+ no alpha-renaming and no permutation tolerance. A permuted or renamed built-in table+ therefore receives the WEAKER verdict. The error direction is conservative; do not+ make this cleverer.++ WHY THIS MATTERS MORE THAN ANYTHING ELSE IN THE FILE. Without the distinction this+ layer is a machine for turning an assumption into a fact with a proof attached. A+ one-line user rule reading "every supplier is compliant" -- which is exactly the extra+ row that tests/fixtures/horn/user_rules.tsv appends, and it exists to exercise this --+ makes certificates check green for ever. The theorem that applies in that case,+ horn_certificate_sound, concludes entails_under, which is a claim about the user's+ assumptions and not about the world. *)++datatype verdict = Entailed | EntailedUnderSuppliedRules++definition verdict_of :: "rtable \<Rightarrow> verdict" where+ "verdict_of R = (if R = builtin_table then Entailed else EntailedUnderSuppliedRules)"++enddiff --git a/isabelle/OO_Export.thy b/isabelle/OO_Export.thynew file mode 100644index 00000000..f99ef925--- /dev/null+++ b/isabelle/OO_Export.thy@@ -0,0 +1,50 @@+(* OO_Export.thy -- code generation.++ THE TRUST BOUNDARY, stated rather than implied.+ INSIDE: the Isabelle kernel; OO_Format, OO_Check, OO_Parse (the executable part);+ OO_Semantics, OO_Sound, OO_Builtin_Sound (the theorems); and the code+ generator itself, which is TRUSTED, NOT VERIFIED -- exactly as the compiler+ is on any other side of any comparison.+ OUTSIDE: file IO, splitting bytes on LF and TAB, exit codes, JSON, and the claim that+ the engine's asserted.tsv is the store it says it is.++ OO_Semantics MUST NEVER ENTER THE EXPORT CLOSURE. It quantifies over an arbitrary+ domain type and over interpretations, and export_code fails on any constant lacking+ code equations. If a single exported constant came to mention sat, this build would+ break -- and that breakage is a feature, because it is what keeps the running checker+ free of the model theory. *)++theory OO_Export+ imports OO_Parse+begin++(* Byte-level conversion for the untrusted driver. The verified core is over+ string = char list (DECISION M38), so the driver must turn native SML bytes into+ Isabelle chars and back. char_of is total on 0..255, so every byte round-trips and a+ non-ASCII UTF-8 IRI is carried through unchanged -- which is the whole reason for+ M38. Note the driver must use SML's OWN String.explode on a native byte string, not+ Isabelle's, which is the one that raises on non-ASCII. *)++definition chr_of_nat :: "nat \<Rightarrow> char" where "chr_of_nat n = char_of n"+definition nat_of_chr :: "char \<Rightarrow> nat" where "nat_of_chr c = of_char c"++lemma chr_nat_roundtrip: "n < 256 \<Longrightarrow> nat_of_chr (chr_of_nat n) = n"+ by (simp add: chr_of_nat_def nat_of_chr_def)++(* Sanity: the things that must be executable, are. *)+value "length builtin_table"+value "verdict_of builtin_table"++export_code+ run_check run_check_lenient+ check_cert check_cert_lenient accepts+ verdict_of builtin_table+ parse_rules parse_graph parse_cert+ Ok Rejected ParseError Entailed EntailedUnderSuppliedRules+ R_index_out_of_range R_arity_mismatch R_binding_incomplete R_binding_dup_key+ R_body_mismatch R_premise_unknown R_head_mismatch+ Iri Bnode Lit V Tm+ nat_of_integer integer_of_nat chr_of_nat nat_of_chr+ in SML module_name OOHorn file_prefix "oo_horn"++enddiff --git a/isabelle/OO_Fixtures.thy b/isabelle/OO_Fixtures.thynew file mode 100644index 00000000..c7ed97ed--- /dev/null+++ b/isabelle/OO_Fixtures.thy@@ -0,0 +1,293 @@+(* OO_Fixtures.thy -- the verified checker run on the REAL fixture bytes.++ NOTE THE DIFFERENT TRUST BASIS. Everything in this file is proved "by eval", which+ runs the code generator and the ML runtime rather than the kernel's inference engine.+ These are TESTS, not part of the soundness argument. No theorem in OO_Sound,+ OO_Builtin_Sound, OO_NonVacuity or OO_Pipeline depends on this file or on eval.+ They are here so that the fixture results are a BUILD GATE: if any of them changes,+ this session stops building.++ The data below was generated mechanically from tests/fixtures/horn/*.tsv and from+ isabelle/fixtures-added/*.tsv, field by field. It is not retyped.++ WHAT THIS DEMONSTRATES, AND WHAT IT DOES NOT. Checking a Horn certificate is purely+ syntactic; the semantics is never consulted. Two checkers built on wildly different+ and even contradictory model theories will agree on every row of this table.+ AGREEMENT HERE IS HYGIENE, NOT EVIDENCE THAT TWO FORMALISATIONS AGREE. The evidence+ is in OO_Builtin_Sound (which arms, from which conditions) and OO_NonVacuity (whether+ the conditions describe anything). *)++theory OO_Fixtures+ imports OO_Pipeline+begin++section \<open>Fixture data, transcribed from the TSV files\<close>+++definition f_asserted :: "string list list" where+ "f_asserted =+ [ [''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/A>''],+ [''<http://ex.org/A>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/B>''] ]"++definition f_builtin_rules :: "string list list" where+ "f_builtin_rules =+ [ [''rdfs2'', ''2'', ''?s'', ''?p'', ''?o'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#domain>'', ''?c'', ''?s'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?c''],+ [''rdfs3'', ''2'', ''?s'', ''?p'', ''?o'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#range>'', ''?c'', ''?o'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?c''],+ [''rdfs5'', ''2'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?b'', ''?b'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?c'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?c''],+ [''rdfs7'', ''2'', ''?s'', ''?p'', ''?o'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?q'', ''?s'', ''?q'', ''?o''],+ [''rdfs9'', ''2'', ''?x'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?a'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?b'', ''?x'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?b''],+ [''rdfs11'', ''2'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?b'', ''?b'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c''],+ [''prp-trp'', ''3'', ''?p'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://www.w3.org/2002/07/owl#TransitiveProperty>'', ''?x'', ''?p'', ''?y'', ''?y'', ''?p'', ''?z'', ''?x'', ''?p'', ''?z''],+ [''prp-symp'', ''2'', ''?p'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://www.w3.org/2002/07/owl#SymmetricProperty>'', ''?x'', ''?p'', ''?y'', ''?y'', ''?p'', ''?x''],+ [''prp-inv1'', ''2'', ''?p'', ''<http://www.w3.org/2002/07/owl#inverseOf>'', ''?q'', ''?x'', ''?p'', ''?y'', ''?y'', ''?q'', ''?x''],+ [''prp-inv2'', ''2'', ''?p'', ''<http://www.w3.org/2002/07/owl#inverseOf>'', ''?q'', ''?x'', ''?q'', ''?y'', ''?y'', ''?p'', ''?x''],+ [''eq-sym'', ''1'', ''?a'', ''<http://www.w3.org/2002/07/owl#sameAs>'', ''?b'', ''?b'', ''<http://www.w3.org/2002/07/owl#sameAs>'', ''?a''],+ [''scm-eqc1'', ''1'', ''?a'', ''<http://www.w3.org/2002/07/owl#equivalentClass>'', ''?b'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?b''],+ [''scm-eqc1'', ''1'', ''?a'', ''<http://www.w3.org/2002/07/owl#equivalentClass>'', ''?b'', ''?b'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?a''],+ [''scm-eqp1'', ''1'', ''?a'', ''<http://www.w3.org/2002/07/owl#equivalentProperty>'', ''?b'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?b''],+ [''scm-eqp1'', ''1'', ''?a'', ''<http://www.w3.org/2002/07/owl#equivalentProperty>'', ''?b'', ''?b'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?a''],+ [''cls-svf1'', ''4'', ''?r'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?r'', ''<http://www.w3.org/2002/07/owl#someValuesFrom>'', ''?c'', ''?x'', ''?p'', ''?y'', ''?y'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?c'', ''?x'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?r''],+ [''cls-avf'', ''4'', ''?r'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?r'', ''<http://www.w3.org/2002/07/owl#allValuesFrom>'', ''?c'', ''?x'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?r'', ''?x'', ''?p'', ''?y'', ''?y'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?c''],+ [''cls-hv1'', ''3'', ''?r'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?r'', ''<http://www.w3.org/2002/07/owl#hasValue>'', ''?v'', ''?x'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?r'', ''?x'', ''?p'', ''?v''],+ [''cls-hv2'', ''3'', ''?r'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?r'', ''<http://www.w3.org/2002/07/owl#hasValue>'', ''?v'', ''?x'', ''?p'', ''?v'', ''?x'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?r''],+ [''scm-svf1'', ''5'', ''?c1'', ''<http://www.w3.org/2002/07/owl#someValuesFrom>'', ''?y1'', ''?c1'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?c2'', ''<http://www.w3.org/2002/07/owl#someValuesFrom>'', ''?y2'', ''?c2'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?y1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?y2'', ''?c1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c2''],+ [''scm-svf2'', ''5'', ''?c1'', ''<http://www.w3.org/2002/07/owl#someValuesFrom>'', ''?y'', ''?c1'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p1'', ''?c2'', ''<http://www.w3.org/2002/07/owl#someValuesFrom>'', ''?y'', ''?c2'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p2'', ''?p1'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?p2'', ''?c1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c2''],+ [''scm-avf1'', ''5'', ''?c1'', ''<http://www.w3.org/2002/07/owl#allValuesFrom>'', ''?y1'', ''?c1'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?c2'', ''<http://www.w3.org/2002/07/owl#allValuesFrom>'', ''?y2'', ''?c2'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?y1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?y2'', ''?c1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c2''],+ [''scm-avf2'', ''5'', ''?c1'', ''<http://www.w3.org/2002/07/owl#allValuesFrom>'', ''?y'', ''?c1'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p1'', ''?c2'', ''<http://www.w3.org/2002/07/owl#allValuesFrom>'', ''?y'', ''?c2'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p2'', ''?p1'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?p2'', ''?c2'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c1''],+ [''scm-dom1'', ''2'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#domain>'', ''?c1'', ''?c1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c2'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#domain>'', ''?c2''],+ [''scm-dom2'', ''2'', ''?p2'', ''<http://www.w3.org/2000/01/rdf-schema#domain>'', ''?c'', ''?p1'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?p2'', ''?p1'', ''<http://www.w3.org/2000/01/rdf-schema#domain>'', ''?c''],+ [''scm-rng1'', ''2'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#range>'', ''?c1'', ''?c1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c2'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#range>'', ''?c2''],+ [''scm-rng2'', ''2'', ''?p2'', ''<http://www.w3.org/2000/01/rdf-schema#range>'', ''?c'', ''?p1'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?p2'', ''?p1'', ''<http://www.w3.org/2000/01/rdf-schema#range>'', ''?c''] ]"++definition f_user_rules :: "string list list" where+ "f_user_rules =+ [ [''rdfs2'', ''2'', ''?s'', ''?p'', ''?o'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#domain>'', ''?c'', ''?s'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?c''],+ [''rdfs3'', ''2'', ''?s'', ''?p'', ''?o'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#range>'', ''?c'', ''?o'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?c''],+ [''rdfs5'', ''2'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?b'', ''?b'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?c'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?c''],+ [''rdfs7'', ''2'', ''?s'', ''?p'', ''?o'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?q'', ''?s'', ''?q'', ''?o''],+ [''rdfs9'', ''2'', ''?x'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?a'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?b'', ''?x'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?b''],+ [''rdfs11'', ''2'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?b'', ''?b'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c''],+ [''prp-trp'', ''3'', ''?p'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://www.w3.org/2002/07/owl#TransitiveProperty>'', ''?x'', ''?p'', ''?y'', ''?y'', ''?p'', ''?z'', ''?x'', ''?p'', ''?z''],+ [''prp-symp'', ''2'', ''?p'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://www.w3.org/2002/07/owl#SymmetricProperty>'', ''?x'', ''?p'', ''?y'', ''?y'', ''?p'', ''?x''],+ [''prp-inv1'', ''2'', ''?p'', ''<http://www.w3.org/2002/07/owl#inverseOf>'', ''?q'', ''?x'', ''?p'', ''?y'', ''?y'', ''?q'', ''?x''],+ [''prp-inv2'', ''2'', ''?p'', ''<http://www.w3.org/2002/07/owl#inverseOf>'', ''?q'', ''?x'', ''?q'', ''?y'', ''?y'', ''?p'', ''?x''],+ [''eq-sym'', ''1'', ''?a'', ''<http://www.w3.org/2002/07/owl#sameAs>'', ''?b'', ''?b'', ''<http://www.w3.org/2002/07/owl#sameAs>'', ''?a''],+ [''scm-eqc1'', ''1'', ''?a'', ''<http://www.w3.org/2002/07/owl#equivalentClass>'', ''?b'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?b''],+ [''scm-eqc1'', ''1'', ''?a'', ''<http://www.w3.org/2002/07/owl#equivalentClass>'', ''?b'', ''?b'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?a''],+ [''scm-eqp1'', ''1'', ''?a'', ''<http://www.w3.org/2002/07/owl#equivalentProperty>'', ''?b'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?b''],+ [''scm-eqp1'', ''1'', ''?a'', ''<http://www.w3.org/2002/07/owl#equivalentProperty>'', ''?b'', ''?b'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?a''],+ [''cls-svf1'', ''4'', ''?r'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?r'', ''<http://www.w3.org/2002/07/owl#someValuesFrom>'', ''?c'', ''?x'', ''?p'', ''?y'', ''?y'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?c'', ''?x'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?r''],+ [''cls-avf'', ''4'', ''?r'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?r'', ''<http://www.w3.org/2002/07/owl#allValuesFrom>'', ''?c'', ''?x'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?r'', ''?x'', ''?p'', ''?y'', ''?y'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?c''],+ [''cls-hv1'', ''3'', ''?r'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?r'', ''<http://www.w3.org/2002/07/owl#hasValue>'', ''?v'', ''?x'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?r'', ''?x'', ''?p'', ''?v''],+ [''cls-hv2'', ''3'', ''?r'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?r'', ''<http://www.w3.org/2002/07/owl#hasValue>'', ''?v'', ''?x'', ''?p'', ''?v'', ''?x'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?r''],+ [''scm-svf1'', ''5'', ''?c1'', ''<http://www.w3.org/2002/07/owl#someValuesFrom>'', ''?y1'', ''?c1'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?c2'', ''<http://www.w3.org/2002/07/owl#someValuesFrom>'', ''?y2'', ''?c2'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?y1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?y2'', ''?c1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c2''],+ [''scm-svf2'', ''5'', ''?c1'', ''<http://www.w3.org/2002/07/owl#someValuesFrom>'', ''?y'', ''?c1'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p1'', ''?c2'', ''<http://www.w3.org/2002/07/owl#someValuesFrom>'', ''?y'', ''?c2'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p2'', ''?p1'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?p2'', ''?c1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c2''],+ [''scm-avf1'', ''5'', ''?c1'', ''<http://www.w3.org/2002/07/owl#allValuesFrom>'', ''?y1'', ''?c1'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?c2'', ''<http://www.w3.org/2002/07/owl#allValuesFrom>'', ''?y2'', ''?c2'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p'', ''?y1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?y2'', ''?c1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c2''],+ [''scm-avf2'', ''5'', ''?c1'', ''<http://www.w3.org/2002/07/owl#allValuesFrom>'', ''?y'', ''?c1'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p1'', ''?c2'', ''<http://www.w3.org/2002/07/owl#allValuesFrom>'', ''?y'', ''?c2'', ''<http://www.w3.org/2002/07/owl#onProperty>'', ''?p2'', ''?p1'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?p2'', ''?c2'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c1''],+ [''scm-dom1'', ''2'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#domain>'', ''?c1'', ''?c1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c2'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#domain>'', ''?c2''],+ [''scm-dom2'', ''2'', ''?p2'', ''<http://www.w3.org/2000/01/rdf-schema#domain>'', ''?c'', ''?p1'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?p2'', ''?p1'', ''<http://www.w3.org/2000/01/rdf-schema#domain>'', ''?c''],+ [''scm-rng1'', ''2'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#range>'', ''?c1'', ''?c1'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''?c2'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#range>'', ''?c2''],+ [''scm-rng2'', ''2'', ''?p2'', ''<http://www.w3.org/2000/01/rdf-schema#range>'', ''?c'', ''?p1'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?p2'', ''?p1'', ''<http://www.w3.org/2000/01/rdf-schema#range>'', ''?c''],+ [''every-supplier-is-compliant'', ''1'', ''?s'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/Supplier>'', ''?s'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/Compliant>''] ]"++definition f_short_rules :: "string list list" where+ "f_short_rules =+ [ [''rdfs2'', ''2'', ''?s'', ''?p'', ''?o'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#domain>'', ''?c'', ''?s'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?c''],+ [''rdfs3'', ''2'', ''?s'', ''?p'', ''?o'', ''?p'', ''<http://www.w3.org/2000/01/rdf-schema#range>'', ''?c'', ''?o'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''?c''],+ [''rdfs5'', ''2'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?b'', ''?b'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?c'', ''?a'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''?c''] ]"++definition f_good :: "string list list" where+ "f_good =+ [ [''4'', ''3'', ''x'', ''<http://ex.org/a>'', ''a'', ''<http://ex.org/A>'', ''b'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/A>'', ''<http://ex.org/A>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/B>''] ]"++definition f_bad_index :: "string list list" where+ "f_bad_index =+ [ [''99'', ''3'', ''x'', ''<http://ex.org/a>'', ''a'', ''<http://ex.org/A>'', ''b'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/A>'', ''<http://ex.org/A>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/B>''] ]"++definition f_bad_binding :: "string list list" where+ "f_bad_binding =+ [ [''4'', ''3'', ''x'', ''<http://ex.org/a>'', ''a'', ''<http://ex.org/WRONG>'', ''b'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/A>'', ''<http://ex.org/A>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/B>''] ]"++definition f_bad_conclusion :: "string list list" where+ "f_bad_conclusion =+ [ [''4'', ''3'', ''x'', ''<http://ex.org/a>'', ''a'', ''<http://ex.org/A>'', ''b'', ''<http://ex.org/Z>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/A>'', ''<http://ex.org/A>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/B>''] ]"++definition f_bad_premise :: "string list list" where+ "f_bad_premise =+ [ [''4'', ''3'', ''x'', ''<http://ex.org/ghost>'', ''a'', ''<http://ex.org/A>'', ''b'', ''<http://ex.org/B>'', ''<http://ex.org/ghost>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/B>'', ''<http://ex.org/ghost>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/A>'', ''<http://ex.org/A>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/B>''] ]"++definition f_bad_self :: "string list list" where+ "f_bad_self =+ [ [''4'', ''3'', ''x'', ''<http://ex.org/a>'', ''a'', ''<http://ex.org/A>'', ''b'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/B>'', ''<http://ex.org/A>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/B>''] ]"++definition f_asserted_chain :: "string list list" where+ "f_asserted_chain =+ [ [''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/A>''],+ [''<http://ex.org/A>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/B>''],+ [''<http://ex.org/B>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/C>''] ]"++definition f_bad_self_chain :: "string list list" where+ "f_bad_self_chain =+ [ [''4'', ''3'', ''x'', ''<http://ex.org/a>'', ''a'', ''<http://ex.org/B>'', ''b'', ''<http://ex.org/C>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/C>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/B>'', ''<http://ex.org/B>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/C>''],+ [''4'', ''3'', ''x'', ''<http://ex.org/a>'', ''a'', ''<http://ex.org/A>'', ''b'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/A>'', ''<http://ex.org/A>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/B>''] ]"++definition f_good_chain :: "string list list" where+ "f_good_chain =+ [ [''4'', ''3'', ''x'', ''<http://ex.org/a>'', ''a'', ''<http://ex.org/A>'', ''b'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/A>'', ''<http://ex.org/A>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/B>''],+ [''4'', ''3'', ''x'', ''<http://ex.org/a>'', ''a'', ''<http://ex.org/B>'', ''b'', ''<http://ex.org/C>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/C>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/B>'', ''<http://ex.org/B>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/C>''] ]"++definition f_bad_order :: "string list list" where+ "f_bad_order =+ [ [''4'', ''3'', ''x'', ''<http://ex.org/a>'', ''a'', ''<http://ex.org/A>'', ''b'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/B>'', ''<http://ex.org/A>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/A>''] ]"++definition f_bad_dup_key :: "string list list" where+ "f_bad_dup_key =+ [ [''4'', ''4'', ''x'', ''<http://ex.org/a>'', ''x'', ''<http://ex.org/zzz>'', ''a'', ''<http://ex.org/A>'', ''b'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/B>'', ''<http://ex.org/a>'', ''<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'', ''<http://ex.org/A>'', ''<http://ex.org/A>'', ''<http://www.w3.org/2000/01/rdf-schema#subClassOf>'', ''<http://ex.org/B>''] ]"++definition f_asserted_gen :: "string list list" where+ "f_asserted_gen =+ [ [''<http://ex.org/x>'', ''<http://ex.org/p>'', ''<http://ex.org/y>''],+ [''<http://ex.org/p>'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''_:bq''] ]"++definition f_generalized :: "string list list" where+ "f_generalized =+ [ [''3'', ''4'', ''s'', ''<http://ex.org/x>'', ''p'', ''<http://ex.org/p>'', ''o'', ''<http://ex.org/y>'', ''q'', ''_:bq'', ''<http://ex.org/x>'', ''_:bq'', ''<http://ex.org/y>'', ''<http://ex.org/x>'', ''<http://ex.org/p>'', ''<http://ex.org/y>'', ''<http://ex.org/p>'', ''<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>'', ''_:bq''] ]"+++section \<open>The parser recovers the built-in table exactly (M33)\<close>++(* If this failed, every certificate would silently receive the WEAKER verdict, and+ nothing else in the suite would notice. *)+lemma parsed_builtin_is_the_builtin_table:+ "parse_rules f_builtin_rules = Some builtin_table"+ by eval++lemma parsed_user_table_is_not_the_builtin_table:+ "parse_rules f_user_rules \<noteq> Some builtin_table"+ by eval++section \<open>The shipped fixtures\<close>++lemma fx_good_builtin:+ "run_check f_builtin_rules f_asserted f_good = Ok Entailed"+ by eval++(* THE ASSUMPTION-INTO-FACT GUARD. user_rules.tsv is builtin_rules.tsv plus one row+ reading "every supplier is compliant". The certificate is the SAME one, and it still+ checks green -- but the verdict word changes, and with it which theorem applies. *)+lemma fx_good_user_rules_gets_the_weaker_verdict:+ "run_check f_user_rules f_asserted f_good = Ok EntailedUnderSuppliedRules"+ by eval++lemma fx_good_short_rules:+ "run_check f_short_rules f_asserted f_good = Rejected 0 R_index_out_of_range"+ by eval++lemma fx_bad_index:+ "run_check f_builtin_rules f_asserted f_bad_index = Rejected 0 R_index_out_of_range"+ by eval++lemma fx_bad_binding:+ "run_check f_builtin_rules f_asserted f_bad_binding = Rejected 0 (R_body_mismatch 0)"+ by eval++lemma fx_bad_conclusion:+ "run_check f_builtin_rules f_asserted f_bad_conclusion = Rejected 0 (R_body_mismatch 1)"+ by eval++lemma fx_bad_premise:+ "run_check f_builtin_rules f_asserted f_bad_premise = Rejected 0 (R_premise_unknown 0)"+ by eval++lemma fx_bad_self:+ "run_check f_builtin_rules f_asserted f_bad_self = Rejected 0 (R_body_mismatch 0)"+ by eval++section \<open>FINDING: bad_self.tsv does not test what its name says\<close>++(* bad_self.tsv is REJECTED by the strict discipline (above) and ACCEPTED by the lenient+ one (below), with the ABSOLUTE verdict. That is not a bug in either: the instantiated+ body of rdfs9 under this binding is exactly the two triples of asserted.tsv, and the+ instantiated head is exactly the claimed conclusion, so the conclusion really is+ entailed and accepting it is SOUND (horn_certificate_sound_lenient says so). The+ file's only defect is that its CITED premise list names its own conclusion instead of+ the asserted triple it actually used.++ Two consequences, both worth carrying into any differential test.+ 1. This fixture does NOT exercise self-support. It is caught by the positional+ premise check and by nothing else. The property it is named for -- that a step+ cannot be discharged by a later step's conclusion -- CANNOT be tested by any+ single-line certificate, and every shipped certificate fixture is one line.+ isabelle/fixtures-added/bad_self_chain.tsv is the two-step test; see below.+ 2. This is the sharpest predicted point of disagreement with any other+ implementation, and it lands on a SHIPPED fixture rather than on a hypothetical+ one. An implementation that re-derives from the known set instead of comparing+ against the cited premises will ACCEPT bad_self.tsv. Such an implementation is+ not unsound; it is less strict. Do not "fix" the stricter one. *)++lemma fx_bad_self_is_accepted_leniently:+ "run_check_lenient f_builtin_rules f_asserted f_bad_self = Ok Entailed"+ by eval++section \<open>Added fixtures: the properties the shipped set cannot reach\<close>++(* THE ONLY REAL TEST OF THE STRICT-PREFIX DISCIPLINE (M27, trap T8). Two steps, in+ which step 0 cites step 1's conclusion as a premise. Under strict prefix visibility+ the known set for step 0 is the asserted graph alone, so the forward reference is+ unknown and the certificate is rejected. Under a closure pass -- build the graph plus+ all conclusions once, then check every step against it -- it would be ACCEPTED, and a+ two-step cycle could certify itself. No single-line fixture can distinguish these. *)+lemma fx_chain_forward_reference_is_rejected:+ "run_check f_builtin_rules f_asserted_chain f_bad_self_chain+ = Rejected 0 (R_premise_unknown 0)"+ by eval++(* The control: the SAME two steps in dependency order are accepted. This is what makes+ the previous lemma a test of ORDER rather than of content. *)+lemma fx_chain_in_order_is_accepted:+ "run_check f_builtin_rules f_asserted_chain f_good_chain = Ok Entailed"+ by eval++(* Conflict C11 isolated: premises transposed, both asserted. Strict rejects, lenient+ accepts, and both are sound. *)+lemma fx_order_strict_rejects:+ "run_check f_builtin_rules f_asserted f_bad_order = Rejected 0 (R_body_mismatch 0)"+ by eval+lemma fx_order_lenient_accepts:+ "run_check_lenient f_builtin_rules f_asserted f_bad_order = Ok Entailed"+ by eval++(* Uncertainty U10 isolated: a duplicate binding key, with two different values. map_of+ is silently first-wins, so a checker that does not test for duplicates accepts this.+ Rejecting is this formalisation's choice (M25) and it is a strictness, not a+ soundness requirement -- the lenient run accepts it and is still sound. *)+lemma fx_dup_key_strict_rejects:+ "run_check f_builtin_rules f_asserted f_bad_dup_key = Rejected 0 R_binding_dup_key"+ by eval+lemma fx_dup_key_lenient_accepts:+ "run_check_lenient f_builtin_rules f_asserted f_bad_dup_key = Ok Entailed"+ by eval++(* M2 and M31: a GENERALIZED triple. rdfs7 with ?q bound to a blank node yields a+ conclusion with a blank node in PREDICATE position, which cannot be written in+ concrete RDF. It is accepted, because no RDF well-formedness condition exists+ anywhere in this development. An implementation that rejects it has imported a+ well-formedness side condition the specification does not state. *)+lemma fx_generalized_triple_is_accepted:+ "run_check f_builtin_rules f_asserted_gen f_generalized = Ok Entailed"+ by eval++section \<open>Strict implies lenient, checked on the data as well as proved\<close>++(* strict_implies_lenient is a theorem (OO_Sound). These rows are the instances where+ the implication is strict, i.e. where lenient accepts and strict does not. *)+lemma fx_strictness_gap_is_exactly_three_rows:+ "(run_check_lenient f_builtin_rules f_asserted f_bad_self = Ok Entailed+ \<and> run_check_lenient f_builtin_rules f_asserted f_bad_order = Ok Entailed+ \<and> run_check_lenient f_builtin_rules f_asserted f_bad_dup_key = Ok Entailed)+ \<and> (run_check f_builtin_rules f_asserted f_bad_self \<noteq> Ok Entailed+ \<and> run_check f_builtin_rules f_asserted f_bad_order \<noteq> Ok Entailed+ \<and> run_check f_builtin_rules f_asserted f_bad_dup_key \<noteq> Ok Entailed)"+ by eval++enddiff --git a/isabelle/OO_Format.thy b/isabelle/OO_Format.thynew file mode 100644index 00000000..bc59fe87--- /dev/null+++ b/isabelle/OO_Format.thy@@ -0,0 +1,192 @@+(* OO_Format.thy -- syntax of terms, triples, rule patterns, rules and certificate steps.++ INDEPENDENT SECOND FORMALISATION. Nothing under lean/ was read, listed, grepped or+ reasoned about by the author of this file. Sources used: RDF 1.1 Semantics (W3C REC+ 25 Feb 2014), OWL 2 Web Ontology Language Profiles (W3C REC 11 Dec 2012) section 4.3,+ OWL 2 RDF-Based Semantics (W3C REC 11 Dec 2012) section 5, and the fixture DATA under+ tests/fixtures/horn/.++ This theory carries NO semantics. It is pure syntax, so that the checker (OO_Check)+ can be executable and the model theory (OO_Semantics) can be classical, with the two+ meeting only in OO_Sound. *)++theory OO_Format+ imports Main "HOL-Library.Code_Target_Nat"+begin++section \<open>Terms\<close>++(* DECISION M1. Terms are opaque byte strings, compared by syntactic equality. No+ datatype-aware comparison of literals.+ Rests on: no rule in the fixture table is datatype-sensitive, and OWL 2 Profiles+ section 4.3 states the RL/RDF rules over triple patterns without any value-space+ side condition. SCOPED CLAIM: if cls-maxc2 (which compares two object terms for+ equality of VALUE) is ever added, "01"^^xsd:nonNegativeInteger is one value and two+ terms and this decision becomes unsound for that rule.++ DECISION M38. string = char list, NOT String.literal. String.literal is ASCII-only+ in the logic (typedef literal = "{cs. ALL c:set cs. ~ digit7 c}") and its generated+ SML raises on a non-ASCII byte, so a UTF-8 IRI would exist in the running checker with+ no counterpart in the logical type and the theorem would not apply to that run.+ Verified against the Isabelle2025-2 sources on this machine. *)++datatype rdf_term = Iri string | Bnode string | Lit string++type_synonym triple = "rdf_term \<times> rdf_term \<times> rdf_term"+type_synonym graph = "triple set"++(* DECISION M2. Generalized triples: any term in any position, subject and predicate+ included. There is NO RDF well-formedness side condition anywhere in this+ development.+ Rests on: OWL 2 Profiles section 4.3, which permits blank nodes and literals in all+ positions of the RL/RDF rules, and RDF 1.1 Semantics Appendix A (generalized RDF).+ Consequence: a conclusion may be a triple that cannot be written in concrete RDF.+ That is deliberate; see M31. *)++section \<open>Vocabulary\<close>++(* The IRIs whose meaning the built-in table depends on. These are bare IRIs, with the+ N-Triples angle brackets stripped: see DECISION D-PARSE-2 in OO_Parse. RDF 1.1+ Semantics section 5 maps IRIs, not their concrete syntax, so IS is a function on+ IRIs and not on N-Triples spellings. *)++definition rdf_type :: string where+ "rdf_type = ''http://www.w3.org/1999/02/22-rdf-syntax-ns#type''"+definition rdfs_Class :: string where+ "rdfs_Class = ''http://www.w3.org/2000/01/rdf-schema#Class''"+definition rdfs_subClassOf :: string where+ "rdfs_subClassOf = ''http://www.w3.org/2000/01/rdf-schema#subClassOf''"+definition rdfs_subPropertyOf :: string where+ "rdfs_subPropertyOf = ''http://www.w3.org/2000/01/rdf-schema#subPropertyOf''"+definition rdfs_domain :: string where+ "rdfs_domain = ''http://www.w3.org/2000/01/rdf-schema#domain''"+definition rdfs_range :: string where+ "rdfs_range = ''http://www.w3.org/2000/01/rdf-schema#range''"+definition owl_sameAs :: string where+ "owl_sameAs = ''http://www.w3.org/2002/07/owl#sameAs''"+definition owl_equivalentClass :: string where+ "owl_equivalentClass = ''http://www.w3.org/2002/07/owl#equivalentClass''"+definition owl_equivalentProperty :: string where+ "owl_equivalentProperty = ''http://www.w3.org/2002/07/owl#equivalentProperty''"+definition owl_inverseOf :: string where+ "owl_inverseOf = ''http://www.w3.org/2002/07/owl#inverseOf''"+definition owl_SymmetricProperty :: string where+ "owl_SymmetricProperty = ''http://www.w3.org/2002/07/owl#SymmetricProperty''"+definition owl_TransitiveProperty :: string where+ "owl_TransitiveProperty = ''http://www.w3.org/2002/07/owl#TransitiveProperty''"+definition owl_Restriction :: string where+ "owl_Restriction = ''http://www.w3.org/2002/07/owl#Restriction''"+definition owl_onProperty :: string where+ "owl_onProperty = ''http://www.w3.org/2002/07/owl#onProperty''"+definition owl_someValuesFrom :: string where+ "owl_someValuesFrom = ''http://www.w3.org/2002/07/owl#someValuesFrom''"+definition owl_allValuesFrom :: string where+ "owl_allValuesFrom = ''http://www.w3.org/2002/07/owl#allValuesFrom''"+definition owl_hasValue :: string where+ "owl_hasValue = ''http://www.w3.org/2002/07/owl#hasValue''"++section \<open>Rule patterns and rules\<close>++datatype pat = V string | Tm rdf_term+type_synonym pat_triple = "pat \<times> pat \<times> pat"++(* DECISION M36. A W3C rule whose consequent is a conjunction is split into one Horn+ arm per conjunct. scm-eqc1 and scm-eqp1 each become two rows.+ Rests on: OWL 2 Profiles Table 9, where scm-eqc1 licenses both C1 sco C2 and+ C2 sco C1; and the fixture, which has already taken this reading (rows 11/12 and+ 13/14 share a name).++ DECISION M-NAME (this file). rname is a LABEL, not a key. Two rows may carry the+ same name. Nothing in the checker or the semantics looks a rule up by name. *)++record hrule =+ rname :: string+ rbody :: "pat_triple list"+ rhead :: "pat_triple"++type_synonym rtable = "hrule list"++(* DECISION M23. The rule index is 0-based into an ORDERED list.+ Rests on: the fixture good.tsv cites index 4, and row 5 of builtin_rules.tsv counting+ from one -- that is rdfs9, whose body (?x type ?a), (?a sco ?b) and head (?x type ?b)+ are exactly what good.tsv's binding and premises instantiate. Verified field by+ field against the fixture; no other reading makes good.tsv check.++ DECISION M27/M28. sprem lists the premises the step cites, in the SUPPLIED TABLE's+ body order, not any W3C table's order. The fixture's rows 0-5 reverse the W3C order+ and rows 15-18 swap the first two atoms, so body order is a property of the table+ that is in force and of nothing else. *)++record hstep =+ sidx :: nat+ sbind :: "(string \<times> rdf_term) list"+ sconcl :: triple+ sprem :: "triple list"++section \<open>Instantiation at two levels\<close>++(* DECISION M-BIND (conflict C9 in the brief). Two representations of a binding, with a+ bridge.++ The SEMANTICS quantifies over a TOTAL function string => rdf_term. That is the right+ notion for rule satisfaction: a rule is satisfied when every substitution making the+ body true makes the head true, and nothing should turn on which variables a+ substitution happens to mention.++ The CHECKER carries the finite association list that the certificate file supplies,+ because that is what is executable.++ tot_of bridges them. Lemmas B1/B2 in OO_Sound show the finite map and its total+ extension agree wherever the finite map is defined, which is everywhere the checker+ looks. *)++type_synonym bnd = "string \<Rightarrow> rdf_term"++fun ap :: "bnd \<Rightarrow> pat \<Rightarrow> rdf_term" where+ "ap \<sigma> (V x) = \<sigma> x"+| "ap \<sigma> (Tm c) = c"++fun apt :: "bnd \<Rightarrow> pat_triple \<Rightarrow> triple" where+ "apt \<sigma> (s,p,q) = (ap \<sigma> s, ap \<sigma> p, ap \<sigma> q)"++(* DECISION M24. Binding keys are written WITHOUT the leading question mark; rule+ variables are written WITH it. Rests on the fixture: good.tsv's binding keys are+ x, a, b while builtin_rules.tsv row 4 writes ?x, ?a, ?b. The question mark is+ stripped at parse time (OO_Parse), so by the time a pattern reaches ipat the+ variable name is the bare one. If this were wrong nothing would instantiate and+ every certificate would be rejected: the error is loud, not silent. *)++fun ipat :: "(string \<times> rdf_term) list \<Rightarrow> pat \<Rightarrow> rdf_term option" where+ "ipat \<beta> (Tm c) = Some c"+| "ipat \<beta> (V x) = map_of \<beta> x"++definition iptriple :: "(string \<times> rdf_term) list \<Rightarrow> pat_triple \<Rightarrow> triple option" where+ "iptriple \<beta> tp =+ (case tp of (s,p,q) \<Rightarrow>+ (case ipat \<beta> s of None \<Rightarrow> None | Some a \<Rightarrow>+ (case ipat \<beta> p of None \<Rightarrow> None | Some b \<Rightarrow>+ (case ipat \<beta> q of None \<Rightarrow> None | Some c \<Rightarrow> Some (a,b,c)))))"++lemma iptriple_simp [simp]:+ "iptriple \<beta> (s,p,q) =+ (case ipat \<beta> s of None \<Rightarrow> None | Some a \<Rightarrow>+ (case ipat \<beta> p of None \<Rightarrow> None | Some b \<Rightarrow>+ (case ipat \<beta> q of None \<Rightarrow> None | Some c \<Rightarrow> Some (a,b,c))))"+ by (simp add: iptriple_def)++fun pat_vars1 :: "pat \<Rightarrow> string list" where+ "pat_vars1 (V x) = [x]"+| "pat_vars1 (Tm _) = []"++fun pat_var_list :: "pat_triple \<Rightarrow> string list" where+ "pat_var_list (s,p,q) = pat_vars1 s @ pat_vars1 p @ pat_vars1 q"++definition rule_var_list :: "hrule \<Rightarrow> string list" where+ "rule_var_list r = remdups (concat (map pat_var_list (rbody r @ [rhead r])))"++(* The total extension of a finite binding. The default is never reached on any+ variable the checker consults; see coverage_implied in OO_Sound. *)+definition tot_of :: "(string \<times> rdf_term) list \<Rightarrow> bnd" where+ "tot_of \<beta> = (\<lambda>v. case map_of \<beta> v of Some t \<Rightarrow> t | None \<Rightarrow> Iri [])"++enddiff --git a/isabelle/OO_NonVacuity.thy b/isabelle/OO_NonVacuity.thynew file mode 100644index 00000000..c88c3289--- /dev/null+++ b/isabelle/OO_NonVacuity.thy@@ -0,0 +1,348 @@+(* OO_NonVacuity.thy -- the conditions are satisfiable, and satisfiable NON-DEGENERATELY.++ A soundness theorem over an unsatisfiable model class proves nothing: if no+ interpretation met the 26 conditions, every triple would be entailed and the checker+ could accept anything. That is the standing obligation. It is easy to discharge+ BADLY, and this file is arranged so that the bad discharge is visible.++ THE WEAK WITNESS, and why it is not enough. The one-point interpretation W (below)+ satisfies every condition, so the class is non-empty. But W makes ICEXT constant and+ IC the whole universe, so c_sco_bwd, c_dom_bwd and c_rng_bwd -- the BACKWARD halves of+ RBS Table 5.8, which twelve of the 27 arms depend on -- are satisfied by collapse+ rather than by construction. Worse, the only triple W fails to satisfy is one whose+ subject is a LITERAL with no denotation, so the refutation turns entirely on the+ partiality of IL (M3) and says nothing about the IRI-only case, which is the+ interesting one.++ THE REAL WITNESS is M3. It is a model of the ACTUAL FIXTURE GRAPH+ tests/fixtures/horn/asserted.tsv; it has IC non-empty, so the Table 5.8 backward+ conditions are LIVE rather than vacuous; it satisfies the conclusion the fixture+ certificate derives, as soundness requires; and it refutes an IRI-only triple over+ that same non-empty graph. *)++theory OO_NonVacuity+ imports OO_Builtin_Sound+begin++section \<open>N1: the weak witness, recorded with its weakness\<close>++definition W :: "unit interp" where+ "W = \<lparr> IR = UNIV, IP = UNIV, IEXT = (\<lambda>x. UNIV),+ IS = (\<lambda>u. ()), IB = (\<lambda>b. ()), IL = (\<lambda>l. None) \<rparr>"++lemma W_simps [simp]:+ "IR W = UNIV" "IP W = UNIV" "IEXT W x = UNIV"+ "IS W u = ()" "IB W b = ()" "IL W l = None"+ by (simp_all add: W_def)++lemma W_ICEXT [simp]: "ICEXT W y = UNIV" by (simp add: ICEXT_def)+lemma W_IC [simp]: "IC W = UNIV" by (simp add: IC_def)++theorem conditions_satisfiable: "owl_rl_interp W"+ by (simp add: owl_rl_interp_def+ c_type_IP_def c_sco_IP_def c_spo_IP_def+ c_sco_fwd_def c_sco_bwd_def c_spo_fwd_def c_spo_bwd_def+ c_sco_trans_def c_spo_trans_def+ c_dom_fwd_def c_dom_bwd_def c_rng_fwd_def c_rng_bwd_def+ c_sameAs_fwd_def c_eqc_fwd_def c_eqp_fwd_def c_inv_fwd_def+ c_sym_fwd_def c_trp_fwd_def c_svf_def c_avf_def c_hv_def+ c_restr_IC_def c_svf_typ_def c_avf_typ_def c_onp_typ_def)++(* W also satisfies the domain conditions, so the model class stays non-empty when the+ bridge theorem T4 adds them back. *)+lemma W_wf: "wf_interp W" by (simp add: wf_interp_def)++section \<open>The fixture IRIs, transcribed from tests/fixtures/horn/asserted.tsv\<close>++(* Angle brackets stripped: see DECISION D-PARSE-2 in OO_Parse. ex_C does not occur in+ any fixture; it is the fresh IRI whose triple M3 refutes. *)++definition ex_a :: string where "ex_a = ''http://ex.org/a''"+definition ex_A :: string where "ex_A = ''http://ex.org/A''"+definition ex_B :: string where "ex_B = ''http://ex.org/B''"+definition ex_C :: string where "ex_C = ''http://ex.org/C''"++definition fixture_graph :: "triple list" where+ "fixture_graph = [ (Iri ex_a, Iri rdf_type, Iri ex_A),+ (Iri ex_A, Iri rdfs_subClassOf, Iri ex_B) ]"++section \<open>N3: a non-degenerate model of the fixture graph\<close>++(* THE CONSTRUCTION, AND WHY IT IS NOT OBVIOUS. Once IC is non-empty the backward halves+ of Table 5.8 bite, and they are close to circular: c_spo_bwd forces+ (p1,p2) into IEXT(I(rdfs:subPropertyOf)) whenever p1, p2 are in IP and IEXT p1 is+ contained in IEXT p2 -- and I(rdfs:subPropertyOf) is itself in IP, by c_spo_IP, so the+ set being defined occurs on both sides of its own defining condition, once+ monotonically and once antitonically. A naive "collapse everything" interpretation+ does not solve it.++ The circularity is broken by SEPARATING THE KINDS. Property elements, class elements,+ the individual and the junk element are distinct constructors, and the three property+ extensions T3, S3, Q3 live in disjoint parts of the pair space. Then no two of them+ are comparable under containment except reflexively, the defining condition for Q3+ collapses to the DIAGONAL on IP, and the diagonal is a fixpoint of it. Verified+ below, case by case, rather than asserted.++ Every unused vocabulary IRI is sent to the single junk element zz with EMPTY+ extension. That is what makes sameAs, equivalentClass, equivalentProperty, inverseOf,+ someValuesFrom, allValuesFrom, hasValue, onProperty, domain, range, Restriction,+ SymmetricProperty and TransitiveProperty all vacuous at once -- and it is sound+ precisely because nothing in the condition set FORCES a pair into any of those+ extensions. Checked: only c_sco_bwd, c_spo_bwd, c_dom_bwd and c_rng_bwd have a+ consequent that asserts membership, and their consequents name subClassOf,+ subPropertyOf, domain and range. domain and range are handled by showing their+ antecedents false. *)++datatype E = pT | pS | pQ | cA | cB | cls | ia | zz++definition T3 :: "(E \<times> E) set" where+ "T3 = {(ia,cA), (ia,cB), (cA,cls), (cB,cls)}"+definition S3 :: "(E \<times> E) set" where+ "S3 = {(cA,cA), (cA,cB), (cB,cA), (cB,cB)}"+definition Q3 :: "(E \<times> E) set" where+ "Q3 = {(pT,pT), (pS,pS), (pQ,pQ)}"++definition M3 :: "E interp" where+ "M3 = \<lparr> IR = UNIV,+ IP = {pT, pS, pQ},+ IEXT = (\<lambda>x. if x = pT then T3 else if x = pS then S3+ else if x = pQ then Q3 else {}),+ IS = (\<lambda>u. if u = ex_a then ia+ else if u = ex_A then cA+ else if u = ex_B then cB+ else if u = rdf_type then pT+ else if u = rdfs_subClassOf then pS+ else if u = rdfs_subPropertyOf then pQ+ else if u = rdfs_Class then cls+ else zz),+ IB = (\<lambda>b. zz),+ IL = (\<lambda>l. None) \<rparr>"++lemma M3_IP [simp]: "IP M3 = {pT, pS, pQ}" by (simp add: M3_def)+lemma M3_IR [simp]: "IR M3 = UNIV" by (simp add: M3_def)+lemma M3_IB [simp]: "IB M3 b = zz" by (simp add: M3_def)+lemma M3_IL [simp]: "IL M3 l = None" by (simp add: M3_def)++lemma M3_IEXT [simp]:+ "IEXT M3 pT = T3" "IEXT M3 pS = S3" "IEXT M3 pQ = Q3"+ "IEXT M3 cA = {}" "IEXT M3 cB = {}" "IEXT M3 cls = {}"+ "IEXT M3 ia = {}" "IEXT M3 zz = {}"+ by (simp_all add: M3_def)++lemma M3_IS [simp]:+ "IS M3 ex_a = ia" "IS M3 ex_A = cA" "IS M3 ex_B = cB"+ "IS M3 rdf_type = pT" "IS M3 rdfs_subClassOf = pS"+ "IS M3 rdfs_subPropertyOf = pQ" "IS M3 rdfs_Class = cls"+ "IS M3 ex_C = zz"+ "IS M3 rdfs_domain = zz" "IS M3 rdfs_range = zz"+ "IS M3 owl_sameAs = zz" "IS M3 owl_equivalentClass = zz"+ "IS M3 owl_equivalentProperty = zz" "IS M3 owl_inverseOf = zz"+ "IS M3 owl_SymmetricProperty = zz" "IS M3 owl_TransitiveProperty = zz"+ "IS M3 owl_Restriction = zz" "IS M3 owl_onProperty = zz"+ "IS M3 owl_someValuesFrom = zz" "IS M3 owl_allValuesFrom = zz"+ "IS M3 owl_hasValue = zz"+ by (simp_all add: M3_def ex_a_def ex_A_def ex_B_def ex_C_def+ rdf_type_def rdfs_Class_def rdfs_subClassOf_def rdfs_subPropertyOf_def+ rdfs_domain_def rdfs_range_def owl_sameAs_def owl_equivalentClass_def+ owl_equivalentProperty_def owl_inverseOf_def owl_SymmetricProperty_def+ owl_TransitiveProperty_def owl_Restriction_def owl_onProperty_def+ owl_someValuesFrom_def owl_allValuesFrom_def owl_hasValue_def)++lemma M3_ICEXT_raw: "ICEXT M3 y = {x. (x,y) \<in> T3}"+ by (simp add: ICEXT_def)++lemma M3_ICEXT [simp]:+ "ICEXT M3 pT = {}" "ICEXT M3 pS = {}" "ICEXT M3 pQ = {}"+ "ICEXT M3 cA = {ia}" "ICEXT M3 cB = {ia}" "ICEXT M3 cls = {cA, cB}"+ "ICEXT M3 ia = {}" "ICEXT M3 zz = {}"+ by (auto simp: M3_ICEXT_raw T3_def)++lemma M3_IC [simp]: "IC M3 = {cA, cB}" by (simp add: IC_def)++subsection \<open>Each condition, discharged separately so a failure names itself\<close>++lemma M3_type_IP: "c_type_IP M3" by (simp add: c_type_IP_def)+lemma M3_sco_IP: "c_sco_IP M3" by (simp add: c_sco_IP_def)+lemma M3_spo_IP: "c_spo_IP M3" by (simp add: c_spo_IP_def)++lemma M3_sco_fwd: "c_sco_fwd M3"+ unfolding c_sco_fwd_def by (auto simp: S3_def)++lemma M3_sco_bwd: "c_sco_bwd M3"+ unfolding c_sco_bwd_def by (auto simp: S3_def)++lemma M3_sco_trans: "c_sco_trans M3"+ unfolding c_sco_trans_def by (auto simp: S3_def)++(* The fixpoint. Q3 is exactly the diagonal on IP, and the nine cases below are the+ check that it IS a fixpoint of the condition rather than merely a plausible guess. *)+lemma M3_spo_fwd: "c_spo_fwd M3"+ unfolding c_spo_fwd_def by (auto simp: Q3_def)++lemma M3_spo_bwd: "c_spo_bwd M3"+ unfolding c_spo_bwd_def+proof (intro allI impI)+ fix p1 p2 :: E+ assume a1: "p1 \<in> IP M3" and a2: "p2 \<in> IP M3" and sub: "IEXT M3 p1 \<subseteq> IEXT M3 p2"+ from a1 have c1: "p1 = pT \<or> p1 = pS \<or> p1 = pQ" by auto+ from a2 have c2: "p2 = pT \<or> p2 = pS \<or> p2 = pQ" by auto+ from c1 c2 sub show "(p1,p2) \<in> IEXT M3 (IS M3 rdfs_subPropertyOf)"+ by (elim disjE) (auto simp: T3_def S3_def Q3_def)+qed++lemma M3_spo_trans: "c_spo_trans M3"+ unfolding c_spo_trans_def by (auto simp: Q3_def)++(* domain and range: the extension of the junk element is empty, so the consequent is+ False, and the proof must show the ANTECEDENT is false for every p in IP and c in IC.+ It is, because every property extension has a first (resp. second) component outside+ ICEXT cA = ICEXT cB = {ia}. *)+lemma M3_dom_fwd: "c_dom_fwd M3" unfolding c_dom_fwd_def by simp+lemma M3_rng_fwd: "c_rng_fwd M3" unfolding c_rng_fwd_def by simp++lemma M3_dom_bwd: "c_dom_bwd M3"+ unfolding c_dom_bwd_def+proof (intro allI impI)+ fix p c :: E+ assume a1: "p \<in> IP M3" and a2: "c \<in> IC M3"+ and h: "\<forall>x y. (x,y) \<in> IEXT M3 p \<longrightarrow> x \<in> ICEXT M3 c"+ have icx: "ICEXT M3 c = {ia}" using a2 by auto+ have False+ proof -+ from a1 consider (t) "p = pT" | (s) "p = pS" | (q) "p = pQ" by auto+ then show False+ proof cases+ case t+ have m: "(cA, cls) \<in> IEXT M3 p" using t by (simp add: T3_def)+ from h m have "cA \<in> ICEXT M3 c" by blast+ with icx show False by simp+ next+ case s+ have m: "(cA, cA) \<in> IEXT M3 p" using s by (simp add: S3_def)+ from h m have "cA \<in> ICEXT M3 c" by blast+ with icx show False by simp+ next+ case q+ have m: "(pT, pT) \<in> IEXT M3 p" using q by (simp add: Q3_def)+ from h m have "pT \<in> ICEXT M3 c" by blast+ with icx show False by simp+ qed+ qed+ then show "(p,c) \<in> IEXT M3 (IS M3 rdfs_domain)" by simp+qed++lemma M3_rng_bwd: "c_rng_bwd M3"+ unfolding c_rng_bwd_def+proof (intro allI impI)+ fix p c :: E+ assume a1: "p \<in> IP M3" and a2: "c \<in> IC M3"+ and h: "\<forall>x y. (x,y) \<in> IEXT M3 p \<longrightarrow> y \<in> ICEXT M3 c"+ have icx: "ICEXT M3 c = {ia}" using a2 by auto+ have False+ proof -+ from a1 consider (t) "p = pT" | (s) "p = pS" | (q) "p = pQ" by auto+ then show False+ proof cases+ case t+ have m: "(ia, cA) \<in> IEXT M3 p" using t by (simp add: T3_def)+ from h m have "cA \<in> ICEXT M3 c" by blast+ with icx show False by simp+ next+ case s+ have m: "(cA, cA) \<in> IEXT M3 p" using s by (simp add: S3_def)+ from h m have "cA \<in> ICEXT M3 c" by blast+ with icx show False by simp+ next+ case q+ have m: "(pT, pT) \<in> IEXT M3 p" using q by (simp add: Q3_def)+ from h m have "pT \<in> ICEXT M3 c" by blast+ with icx show False by simp+ qed+ qed+ then show "(p,c) \<in> IEXT M3 (IS M3 rdfs_range)" by simp+qed++lemma M3_sameAs_fwd: "c_sameAs_fwd M3" unfolding c_sameAs_fwd_def by simp+lemma M3_eqc_fwd: "c_eqc_fwd M3" unfolding c_eqc_fwd_def by simp+lemma M3_eqp_fwd: "c_eqp_fwd M3" unfolding c_eqp_fwd_def by simp+lemma M3_inv_fwd: "c_inv_fwd M3" unfolding c_inv_fwd_def by simp+lemma M3_sym_fwd: "c_sym_fwd M3" unfolding c_sym_fwd_def by simp+lemma M3_trp_fwd: "c_trp_fwd M3" unfolding c_trp_fwd_def by simp+lemma M3_svf: "c_svf M3" unfolding c_svf_def by simp+lemma M3_avf: "c_avf M3" unfolding c_avf_def by simp+lemma M3_hv: "c_hv M3" unfolding c_hv_def by simp+lemma M3_restr_IC: "c_restr_IC M3" unfolding c_restr_IC_def by simp+lemma M3_svf_typ: "c_svf_typ M3" unfolding c_svf_typ_def by simp+lemma M3_avf_typ: "c_avf_typ M3" unfolding c_avf_typ_def by simp+lemma M3_onp_typ: "c_onp_typ M3" unfolding c_onp_typ_def by simp++theorem M3_is_a_model: "owl_rl_interp M3"+ unfolding owl_rl_interp_def+ by (simp add: M3_type_IP M3_sco_IP M3_spo_IP M3_sco_fwd M3_sco_bwd+ M3_spo_fwd M3_spo_bwd M3_sco_trans M3_spo_trans+ M3_dom_fwd M3_dom_bwd M3_rng_fwd M3_rng_bwd+ M3_sameAs_fwd M3_eqc_fwd M3_eqp_fwd M3_inv_fwd M3_sym_fwd M3_trp_fwd+ M3_svf M3_avf M3_hv M3_restr_IC M3_svf_typ M3_avf_typ M3_onp_typ)++(* M3 also satisfies the domain conditions of RBS Table 5.1, so it witnesses+ satisfiability for the bridge theorem T4 as well as for entails. *)+theorem M3_wf: "wf_interp M3" by (simp add: wf_interp_def)++(* THE POINT OF M3: the Table 5.8 backward conditions are LIVE in it, not vacuous. A+ witness with IC empty satisfies c_sco_bwd, c_dom_bwd and c_rng_bwd by having nothing+ to quantify over, and therefore provides NO evidence that those conditions -- which+ twelve of the 27 arms depend on -- are jointly satisfiable alongside the rest. *)+theorem M3_is_not_degenerate:+ "IC M3 \<noteq> {}" and "ICEXT M3 cA \<noteq> {}" and "IEXT M3 (IS M3 rdfs_subClassOf) \<noteq> {}"+ by (simp_all add: S3_def)++subsection \<open>What M3 makes true, and what it makes false\<close>++lemma M3_sat_asserted_1: "sat M3 (Iri ex_a, Iri rdf_type, Iri ex_A)"+ by (simp add: T3_def)+lemma M3_sat_asserted_2: "sat M3 (Iri ex_A, Iri rdfs_subClassOf, Iri ex_B)"+ by (simp add: S3_def)++theorem M3_models_fixture_graph: "models M3 (set fixture_graph)"+ by (simp add: models_def fixture_graph_def T3_def S3_def)++(* Consistency check on the whole development: the conclusion the fixture certificate+ good.tsv derives by rdfs9 MUST be true here, since soundness says so. If this failed,+ either the checker or the semantics would be wrong. *)+theorem M3_sat_the_certified_conclusion: "sat M3 (Iri ex_a, Iri rdf_type, Iri ex_B)"+ by (simp add: T3_def)++(* Refutation 1: an IRI-only triple, over the NON-EMPTY fixture graph. Nothing here+ turns on the partiality of IL. *)+theorem M3_refutes_fresh_class: "\<not> sat M3 (Iri ex_a, Iri rdf_type, Iri ex_C)"+ by (simp add: T3_def)++(* Refutation 2: exercises the IP clause of the truth condition (M5) specifically. The+ predicate owl:sameAs denotes zz, which is not in IP, so the triple is false however+ its subject and object are related. Under a truth clause that omits the IP+ requirement this triple would be false only for a different reason, and under one that+ cases on the predicate it might not be false at all. *)+theorem M3_refutes_sameAs: "\<not> sat M3 (Iri ex_a, Iri owl_sameAs, Iri ex_a)"+ by simp++section \<open>The headline non-vacuity results\<close>++theorem entailment_is_not_trivial:+ "\<not> entails TYPE(E) (set fixture_graph) (Iri ex_a, Iri rdf_type, Iri ex_C)"+ unfolding entails_def+ using M3_is_a_model M3_models_fixture_graph M3_refutes_fresh_class by blast++(* Entailment from a larger graph is easier, so a refutation over the fixture graph+ gives the empty-graph refutation for free. Recorded because the brief's suggested+ separate empty-graph witness is subsumed by this one. *)+theorem entailment_is_not_trivial_empty:+ "\<not> entails TYPE(E) {} (Iri ex_a, Iri rdf_type, Iri ex_C)"+ unfolding entails_def+ using M3_is_a_model M3_refutes_fresh_class by (auto simp: models_def)++theorem the_IP_clause_has_content:+ "\<not> entails TYPE(E) (set fixture_graph) (Iri ex_a, Iri owl_sameAs, Iri ex_a)"+ unfolding entails_def+ using M3_is_a_model M3_models_fixture_graph M3_refutes_sameAs by blast++enddiff --git a/isabelle/OO_Parse.thy b/isabelle/OO_Parse.thynew file mode 100644index 00000000..aed1557a--- /dev/null+++ b/isabelle/OO_Parse.thy@@ -0,0 +1,191 @@+(* OO_Parse.thy -- from TSV field lists to the datatypes. EXECUTABLE.++ The untrusted driver does the file IO and the splitting on LF and TAB; it hands this+ theory a list of rows, each a list of byte strings. Everything from there on is+ verified. Splitting is the only logic outside the theorem, and it is four lines --+ which is only possible because the format has NO ESCAPING LAYER: an N-Triples spelling+ cannot contain a raw TAB or LF, so no unescaping is needed and no real logic is+ pushed into untrusted code. *)++theory OO_Parse+ imports OO_Check+begin++section \<open>Decimal naturals\<close>++definition digit_of :: "char \<Rightarrow> nat option" where+ "digit_of c = (let k = of_char c :: nat in if 48 \<le> k \<and> k \<le> 57 then Some (k - 48) else None)"++fun parse_nat_acc :: "nat \<Rightarrow> string \<Rightarrow> nat option" where+ "parse_nat_acc acc [] = Some acc"+| "parse_nat_acc acc (c # cs) =+ (case digit_of c of None \<Rightarrow> None | Some d \<Rightarrow> parse_nat_acc (acc * 10 + d) cs)"++definition parse_nat :: "string \<Rightarrow> nat option" where+ "parse_nat s = (if s = [] then None else parse_nat_acc 0 s)"++section \<open>Terms and patterns\<close>++(* DECISION D-PARSE-2, AND IT IS A REAL CHOICE. The N-Triples delimiters are STRIPPED:+ <IRI> becomes Iri IRI, _:b becomes Bnode b, anything else becomes Lit with the field+ kept VERBATIM (a literal's quotes, language tag and datatype suffix are part of the+ term and are never decomposed -- M1 says terms are opaque).+ Rests on RDF 1.1 Semantics section 5, where IS maps IRIs, not their concrete syntax;+ keeping the angle brackets would make IS a function on N-Triples spellings instead.++ WHY THE CHOICE IS SAFE FOR A DIFFERENTIAL TEST, and this is worth stating because it+ looks like a place two implementations could diverge: the same function is applied to+ the rule file, the graph file and the certificate file, so it is a RENAMING of terms+ that is applied uniformly. The checker compares terms only for equality. Any+ injective renaming therefore leaves every accept/reject decision unchanged. The+ choice is visible only in the SEMANTICS, where it decides which string IS is applied+ to -- and there it is the faithful one.++ Dispatch is on the first byte and, for IRIs, the last: a field that opens with < but+ does not close with > is NOT an IRI and falls through to Lit rather than being+ silently truncated. *)++definition parse_term :: "string \<Rightarrow> rdf_term" where+ "parse_term s =+ (if s \<noteq> [] \<and> hd s = CHR ''<'' \<and> last s = CHR ''>'' \<and> 2 \<le> length s+ then Iri (butlast (tl s))+ else if take 2 s = ''_:'' then Bnode (drop 2 s)+ else Lit s)"++(* DECISION M24, applied. A rule field beginning with ? is a VARIABLE and the question+ mark is stripped; every other rule field is a ground term. A certificate field is+ never a pattern, so parse_term is used there and a field spelled ?x in a graph or a+ certificate becomes the literal term ?x. That asymmetry is correct: rule fields are+ patterns, data fields are terms. *)++definition parse_pat :: "string \<Rightarrow> pat" where+ "parse_pat s = (if s \<noteq> [] \<and> hd s = CHR ''?'' then V (tl s) else Tm (parse_term s))"++section \<open>Grouping fields\<close>++fun group2 :: "'a list \<Rightarrow> ('a \<times> 'a) list option" where+ "group2 [] = Some []"+| "group2 [x] = None"+| "group2 (a # b # r) = (case group2 r of None \<Rightarrow> None | Some ts \<Rightarrow> Some ((a,b) # ts))"++fun group3 :: "'a list \<Rightarrow> ('a \<times> 'a \<times> 'a) list option" where+ "group3 [] = Some []"+| "group3 [x] = None"+| "group3 [x,y] = None"+| "group3 (a # b # c # r) = (case group3 r of None \<Rightarrow> None | Some ts \<Rightarrow> Some ((a,b,c) # ts))"++fun seq_opt :: "'a option list \<Rightarrow> 'a list option" where+ "seq_opt [] = Some []"+| "seq_opt (x # xs) =+ (case x of None \<Rightarrow> None+ | Some v \<Rightarrow> (case seq_opt xs of None \<Rightarrow> None | Some vs \<Rightarrow> Some (v # vs)))"++definition mk_pt :: "string \<times> string \<times> string \<Rightarrow> pat_triple" where+ "mk_pt f = (case f of (a,b,c) \<Rightarrow> (parse_pat a, parse_pat b, parse_pat c))"++definition mk_tr :: "string \<times> string \<times> string \<Rightarrow> triple" where+ "mk_tr f = (case f of (a,b,c) \<Rightarrow> (parse_term a, parse_term b, parse_term c))"++section \<open>Rows\<close>++(* Rule row: name TAB n TAB (3n body fields) TAB (3 head fields), so the field count is+ 5 + 3n. Re-verified against tests/fixtures/horn/builtin_rules.tsv: the invariant holds+ for all 27 rows, for all 28 rows of user_rules.tsv, and for all 3 of short_rules.tsv. *)++definition pat3_of :: "string list \<Rightarrow> pat_triple option" where+ "pat3_of fs = (if length fs = 3 then Some (mk_pt (fs ! 0, fs ! 1, fs ! 2)) else None)"++definition tr3_of :: "string list \<Rightarrow> triple option" where+ "tr3_of fs = (if length fs = 3 then Some (mk_tr (fs ! 0, fs ! 1, fs ! 2)) else None)"++definition parse_rule_row :: "string list \<Rightarrow> hrule option" where+ "parse_rule_row fs =+ (if length fs < 5 then None else+ (case parse_nat (fs ! 1) of None \<Rightarrow> None | Some n \<Rightarrow>+ (if length fs \<noteq> 5 + 3 * n then None else+ (case group3 (take (3 * n) (drop 2 fs)) of None \<Rightarrow> None | Some bs \<Rightarrow>+ (case pat3_of (drop (2 + 3 * n) fs) of None \<Rightarrow> None | Some h \<Rightarrow>+ Some \<lparr> rname = fs ! 0, rbody = map mk_pt bs, rhead = h \<rparr>)))))"++definition parse_graph_row :: "string list \<Rightarrow> triple option" where+ "parse_graph_row fs = tr3_of fs"++(* DECISION D-PARSE-3, AN INDEPENDENT FINDING THAT CONTRADICTS THE BRIEF THIS WORK WAS+ GIVEN. The brief asserts that a certificate line "cannot be fully parsed without the+ rule table", because the premise count m is not in the file and equals the length of+ the cited rule's body, so that parsing must be table-relative.++ THAT IS FALSE, and the arithmetic shows it. The field count is+ NF = 2 + 2k + 3 + 3m+ and k IS in the file, as field 2. So m = (NF - 5 - 2k) / 3 is recoverable from the+ line alone. Checked against good.tsv: NF = 17, k = 3, giving m = 2, which is the body+ length of rule 4 (rdfs9). Parsing is therefore TABLE-INDEPENDENT, and the table is+ consulted only by the checker.++ The consequence is not cosmetic. Under table-relative parsing an out-of-range rule+ index makes the line unparseable, which forces it to be reported as a PARSE ERROR+ (exit 2). Under this reading it parses cleanly and is REJECTED by check_step with+ R_index_out_of_range (exit 1), which is what the fixture bad_index.tsv should get and+ what a rejection ought to be. If another implementation reports exit 2 for+ bad_index.tsv, this is why, and it is a difference of parser architecture rather than+ of judgement about the certificate.++ A wrong premise count is then caught by the checker as R_arity_mismatch, comparing the+ parsed premise list against the cited rule's actual body length. *)++definition parse_cert_row :: "string list \<Rightarrow> hstep option" where+ "parse_cert_row fs =+ (if length fs < 5 then None else+ (case parse_nat (fs ! 0) of None \<Rightarrow> None | Some i \<Rightarrow>+ (case parse_nat (fs ! 1) of None \<Rightarrow> None | Some k \<Rightarrow>+ (if length fs < 5 + 2 * k then None else+ (case group2 (take (2 * k) (drop 2 fs)) of None \<Rightarrow> None | Some bp \<Rightarrow>+ (case tr3_of (take 3 (drop (2 + 2 * k) fs)) of None \<Rightarrow> None | Some c \<Rightarrow>+ (case group3 (drop (5 + 2 * k) fs) of None \<Rightarrow> None | Some ps \<Rightarrow>+ Some \<lparr> sidx = i,+ sbind = map (\<lambda>q. (fst q, parse_term (snd q))) bp,+ sconcl = c,+ sprem = map mk_tr ps \<rparr>)))))))"++definition parse_rules :: "string list list \<Rightarrow> rtable option" where+ "parse_rules ls = seq_opt (map parse_rule_row ls)"++definition parse_graph :: "string list list \<Rightarrow> triple list option" where+ "parse_graph ls = seq_opt (map parse_graph_row ls)"++definition parse_cert :: "string list list \<Rightarrow> hstep list option" where+ "parse_cert ls = seq_opt (map parse_cert_row ls)"++section \<open>The whole run, as one function\<close>++(* DECISION M-EXIT (C12, U11). Three outcomes, mapped by the driver to exit codes:+ Ok v -> 0, and the verdict word is v+ Rejected j e -> 1, naming the first failing step and why+ ParseError -> 2+ A differential test should compare the ACCEPT/REJECT BIT and the VERDICT WORD as+ primary, and the exit code and reason as secondary with a declared tolerance. *)++datatype outcome = Ok verdict | Rejected nat reason | ParseError++definition run_check ::+ "string list list \<Rightarrow> string list list \<Rightarrow> string list list \<Rightarrow> outcome" where+ "run_check rl gl cl =+ (case parse_rules rl of None \<Rightarrow> ParseError | Some R \<Rightarrow>+ (case parse_graph gl of None \<Rightarrow> ParseError | Some G \<Rightarrow>+ (case parse_cert cl of None \<Rightarrow> ParseError | Some C \<Rightarrow>+ (case check_cert R G C of+ None \<Rightarrow> Ok (verdict_of R)+ | Some (j,e) \<Rightarrow> Rejected j e))))"++(* The lenient bit, computed alongside so a report can carry both (conflict C11). *)+definition run_check_lenient ::+ "string list list \<Rightarrow> string list list \<Rightarrow> string list list \<Rightarrow> outcome" where+ "run_check_lenient rl gl cl =+ (case parse_rules rl of None \<Rightarrow> ParseError | Some R \<Rightarrow>+ (case parse_graph gl of None \<Rightarrow> ParseError | Some G \<Rightarrow>+ (case parse_cert cl of None \<Rightarrow> ParseError | Some C \<Rightarrow>+ (case check_cert_lenient R G C of+ None \<Rightarrow> Ok (verdict_of R)+ | Some (j,e) \<Rightarrow> Rejected j e))))"++enddiff --git a/isabelle/OO_Pipeline.thy b/isabelle/OO_Pipeline.thynew file mode 100644index 00000000..f420c4bc--- /dev/null+++ b/isabelle/OO_Pipeline.thy@@ -0,0 +1,74 @@+(* OO_Pipeline.thy -- what the TOOL's output means, as opposed to what the checker's+ output means. This is the theorem a user of the binary actually relies on: if the+ report says "entailed", the conclusion of every step is entailed by the asserted+ graph. *)++theory OO_Pipeline+ imports OO_Parse OO_Builtin_Sound+begin++lemma run_check_accepts:+ assumes ok: "run_check rl gl cl = Ok v"+ and pr: "parse_rules rl = Some R"+ and pg: "parse_graph gl = Some G"+ and pc: "parse_cert cl = Some C"+ shows "check_cert R G C = None \<and> v = verdict_of R"+ using assms by (simp add: run_check_def split: option.splits prod.splits)++lemma run_check_lenient_accepts:+ assumes ok: "run_check_lenient rl gl cl = Ok v"+ and pr: "parse_rules rl = Some R"+ and pg: "parse_graph gl = Some G"+ and pc: "parse_cert cl = Some C"+ shows "check_cert_lenient R G C = None \<and> v = verdict_of R"+ using assms by (simp add: run_check_lenient_def split: option.splits prod.splits)++(* The conditional guarantee: whatever table was supplied, every certified conclusion+ holds in every interpretation that satisfies the asserted graph AND those rules. *)+theorem run_check_sound:+ assumes ok: "run_check rl gl cl = Ok v"+ and pr: "parse_rules rl = Some R"+ and pg: "parse_graph gl = Some G"+ and pc: "parse_cert cl = Some C"+ and mem: "s \<in> set C"+ shows "entails_under TYPE('d) R (set G) (sconcl s)"+proof -+ have chk: "check_cert R G C = None" using run_check_accepts[OF ok pr pg pc] by simp+ show ?thesis by (rule horn_certificate_sound[OF chk mem])+qed++(* THE ABSOLUTE GUARANTEE, and the only one that may be read as a claim about the world.+ Note that R does not appear: the verdict word Entailed is itself what establishes+ that the supplied table was the built-in one (T5), so a reader of the report does not+ have to take the rule file on trust. *)+theorem run_check_entailed_sound:+ assumes ok: "run_check rl gl cl = Ok Entailed"+ and pr: "parse_rules rl = Some R"+ and pg: "parse_graph gl = Some G"+ and pc: "parse_cert cl = Some C"+ and mem: "s \<in> set C"+ shows "entails TYPE('d) (set G) (sconcl s)"+proof -+ from run_check_accepts[OF ok pr pg pc]+ have chk: "check_cert R G C = None" and v: "Entailed = verdict_of R" by auto+ from v have RB: "R = builtin_table" using verdict_honest by metis+ from chk RB have "check_cert builtin_table G C = None" by simp+ then show ?thesis by (rule entails_of_builtin[OF _ mem])+qed++theorem run_check_lenient_entailed_sound:+ assumes ok: "run_check_lenient rl gl cl = Ok Entailed"+ and pr: "parse_rules rl = Some R"+ and pg: "parse_graph gl = Some G"+ and pc: "parse_cert cl = Some C"+ and mem: "s \<in> set C"+ shows "entails TYPE('d) (set G) (sconcl s)"+proof -+ from run_check_lenient_accepts[OF ok pr pg pc]+ have chk: "check_cert_lenient R G C = None" and v: "Entailed = verdict_of R" by auto+ from v have RB: "R = builtin_table" using verdict_honest by metis+ from chk RB have "check_cert_lenient builtin_table G C = None" by simp+ then show ?thesis by (rule entails_of_builtin_lenient[OF _ mem])+qed++enddiff --git a/isabelle/OO_Semantics.thy b/isabelle/OO_Semantics.thynew file mode 100644index 00000000..ece855ee--- /dev/null+++ b/isabelle/OO_Semantics.thy@@ -0,0 +1,378 @@+(* OO_Semantics.thy -- interpretations, truth of a triple, the semantic conditions, and+ the two entailment relations.++ THIS THEORY MUST NEVER ENTER THE CODE-GENERATION CLOSURE. It quantifies over an+ arbitrary domain type and over interpretations; export_code would fail on any constant+ that mentions sat. That breakage is a feature: it is what keeps the executable+ checker free of the model theory.++ Primary sources, quoted where a decision turns on the wording:+ RDF11 = RDF 1.1 Semantics, W3C Recommendation 25 February 2014.+ RBS = OWL 2 Web Ontology Language RDF-Based Semantics (Second Edition),+ W3C Recommendation 11 December 2012.+ PROF = OWL 2 Web Ontology Language Profiles (Second Edition),+ W3C Recommendation 11 December 2012. *)++theory OO_Semantics+ imports OO_Format+begin++section \<open>Interpretations\<close>++(* DECISION M3. IL is PARTIAL, and therefore den is partial.+ Rests on RDF11 section 5, which lists among the components of a simple interpretation+ "A partial mapping IL from literals into IR", and states that if IL(E) is undefined+ then any triple containing that literal is false.+ WHY IT MATTERS: totalising IL would delete every interpretation in which some literal+ fails to denote. The model class shrinks, every soundness theorem over it is weaker+ while looking identical, and the proof assistant reports success throughout. The cost+ of being faithful is one option.++ DECISION M4. Blank nodes are RIGID: IB is a component of the interpretation, and+ entailment quantifies over IB along with everything else.+ Rests on RDF11 section 5.1. NOTE THE DIRECTION OF SAFETY, which is easy to get+ backwards. Write |=2 for the relation defined here and |=1 for the W3C's+ "for every I there EXISTS an assignment A". Then |=2 implies |=1: given I and a+ witness A with [I+A] |= G, |=2 yields [I+A] |= t, so A itself witnesses |=1. The+ converse fails: G = { _:b rdf:type ex:A } |=1 ( _:c rdf:type ex:A ) by re-choosing the+ witness, but not |=2, since IB b and IB c are unrelated. So |=2 is STRICTLY SMALLER,+ a soundness theorem proved for it is STRONGER, and it transfers to the W3C relation+ for free. Stated frankly: the theorem below is not literally the W3C's graph+ entailment relation, it implies it.++ DECISION M6. IEXT is total on the domain in the representation. Every condition+ below relativises to IP exactly where the specification's quantifier does, and nowhere+ else. Rests on RDF11 section 5 item 3, which gives IEXT as a mapping from IP. *)++record 'd interp =+ IR :: "'d set"+ IP :: "'d set"+ IEXT :: "'d \<Rightarrow> ('d \<times> 'd) set"+ IS :: "string \<Rightarrow> 'd"+ IB :: "string \<Rightarrow> 'd"+ IL :: "string \<Rightarrow> 'd option"++fun den :: "'d interp \<Rightarrow> rdf_term \<Rightarrow> 'd option" where+ "den I (Iri u) = Some (IS I u)"+| "den I (Bnode b) = Some (IB I b)"+| "den I (Lit l) = IL I l"++(* DECISION M5. Truth of a triple requires the PREDICATE's denotation to lie in IP, and+ this is the SINGLE truth condition for every triple whatever its predicate.+ Rests on RDF11 section 5, verbatim: "if E is a ground triple s p o . then I(E) = true+ if I(s), I(p) and I(o) are all defined and <I(s),I(o)> is in IEXT(I(p)), otherwise+ I(E)= false", together with section 5's statement that IEXT is a mapping FROM IP,+ so I(p) in IP is what makes IEXT(I(p)) the relevant extension.++ WHY IT MATTERS, and it is the sharpest trap in the whole exercise: drop the IP clause+ and triples become true whose predicate denotes a non-property. Seven rows of the+ built-in table (rdfs2, rdfs3, cls-hv2, scm-eqc1 twice, scm-eqp1 twice) have a head+ predicate that no body triple forces into IP; without this clause that proof+ obligation VANISHES rather than being discharged, and the vanishing is invisible to+ any accept/reject comparison because the checker never consults the semantics.++ NOTE that there is no case distinction on the predicate here. A formalisation that+ gives rdfs:subClassOf, rdfs:subPropertyOf, rdfs:domain or rdfs:range triples their own+ truth clause is not an RDF semantics: RDF11 section 5 gives ONE truth condition for+ all triples, and the vocabulary's meaning enters only through conditions on IEXT. *)++fun sat :: "'d interp \<Rightarrow> triple \<Rightarrow> bool" where+ "sat I (s,p,q) =+ (\<exists>a b c. den I s = Some a \<and> den I p = Some b \<and> den I q = Some c+ \<and> b \<in> IP I \<and> (a,c) \<in> IEXT I b)"++definition models :: "'d interp \<Rightarrow> graph \<Rightarrow> bool" where+ "models I G = (\<forall>t \<in> G. sat I t)"++(* DECISION M7. ICEXT and IC are DEFINITIONS, not conditions.+ Rests on RDF11 section 9, which introduces ICEXT(y) = {x : <x,y> in IEXT(I(rdf:type))}+ as an abbreviation, and on RBS Table 5.2, which gives rdfs:Class the row "= IC".+ A definition cannot shrink the model class; a condition can. *)++definition ICEXT :: "'d interp \<Rightarrow> 'd \<Rightarrow> 'd set" where+ "ICEXT I y = {x. (x,y) \<in> IEXT I (IS I rdf_type)}"++definition IC :: "'d interp \<Rightarrow> 'd set" where+ "IC I = ICEXT I (IS I rdfs_Class)"++(* DECISION M22 (conflict C6). wf_interp collects the DOMAIN conditions -- IR nonempty,+ IP contained in IR, IEXT into IR x IR, IS/IB/IL landing in IR. They are faithful:+ RBS Table 5.1 gives "IP | S | subset of IR" and IEXT(x) subset of IR x IR. They are+ nevertheless NOT conjuncts of owl_rl_interp, because NO arm of the built-in table+ consumes any of them. Leaving them out enlarges the model class, which makes+ entails HARDER to establish and the soundness theorem STRONGER.+ wf_interp is used only in the bridge theorem entails_simple (T4), which says the+ result still applies to genuine simple interpretations.++ DECISION M-SORT (trap T5). There is deliberately NO condition separating classes from+ properties, and the domain is a single untyped set. Rests on RDF11 section 9+ verbatim: "RDFS does not partition the universe into disjoint categories of classes,+ properties and individuals ... it also permits classes which contain themselves and+ properties which apply to themselves." A Description-Logic-trained formaliser adds+ IP inter IC = {} without noticing; that would shrink the model class. *)++definition wf_interp :: "'d interp \<Rightarrow> bool" where+ "wf_interp I \<longleftrightarrow>+ IR I \<noteq> {} \<and> IP I \<subseteq> IR I+ \<and> (\<forall>x. IEXT I x \<subseteq> IR I \<times> IR I)+ \<and> (\<forall>u. IS I u \<in> IR I) \<and> (\<forall>b. IB I b \<in> IR I)+ \<and> (\<forall>l v. IL I l = Some v \<longrightarrow> v \<in> IR I)"++section \<open>Semantic conditions, one per specification table row\<close>++(* DECISION M8. Exactly THREE consequences of the axiomatic triple tables are imported,+ not the tables themselves.+ Rests on RDF11 sections 8 and 9, which assert among the RDF and RDFS axiomatic triples+ rdf:type rdf:type rdf:Property .+ rdf:Alt rdfs:subClassOf rdfs:Container .+ rdfs:isDefinedBy rdfs:subPropertyOf rdfs:seeAlso .+ (all three re-read in the Recommendation while writing this file). Truth of a triple+ requires its predicate's denotation to be in IP (M5), so each axiomatic triple yields+ exactly one IP membership. PROF section 4.3 declines to include the axiomatic+ triples, so importing the whole tables would be a strengthening the profile does not+ make; importing these three consequences is the minimum the table needs.+ Consumed by exactly seven rows: rdfs2, rdfs3, cls-hv2 (rdf:type);+ scm-eqc1 arms a and b (rdfs:subClassOf); scm-eqp1 arms a and b (rdfs:subPropertyOf). *)++definition c_type_IP :: "'d interp \<Rightarrow> bool" where+ "c_type_IP I \<longleftrightarrow> IS I rdf_type \<in> IP I"+definition c_sco_IP :: "'d interp \<Rightarrow> bool" where+ "c_sco_IP I \<longleftrightarrow> IS I rdfs_subClassOf \<in> IP I"+definition c_spo_IP :: "'d interp \<Rightarrow> bool" where+ "c_spo_IP I \<longleftrightarrow> IS I rdfs_subPropertyOf \<in> IP I"++(* DECISION M9, THE LARGEST SINGLE DECISION. RBS Table 5.8 is an IFF for all four of+ rdfs:subClassOf, rdfs:subPropertyOf, rdfs:domain and rdfs:range (the "iff" cell spans+ all four rows; re-fetched and confirmed verbatim while writing this file). Both+ directions are therefore encoded, split into separately named halves so that the+ consumption of each is visible to a reviewer.+ The target semantics is consequently OWL 2 RDF-BASED, not RDFS. Twelve arms --+ scm-eqc1 (x2), scm-eqp1 (x2), scm-svf1, scm-svf2, scm-avf1, scm-avf2, scm-dom1,+ scm-dom2, scm-rng1, scm-rng2 -- are UNPROVABLE without the "if" (backward) direction,+ because each concludes a subClassOf, subPropertyOf, domain or range triple that no+ body triple asserts. The verdict word "entailed" means: true in every interpretation+ satisfying these conditions and the asserted graph. It does NOT mean "RDFS entailed"+ and it does NOT mean "true in every interpretation" simpliciter.++ TRAP T2, guarded here: the membership conjuncts (c1 in IC, p in IP) are dropped in the+ forward direction by nobody, because there they are a consequence; dropping them from+ the BACKWARD direction would be a strengthening, forcing a subClassOf triple between+ any two things with nested extensions including non-classes. It looks like tidying,+ it makes the proofs easier, and it never fails. They are kept. *)++definition c_sco_fwd :: "'d interp \<Rightarrow> bool" where+ "c_sco_fwd I \<longleftrightarrow> (\<forall>c1 c2. (c1,c2) \<in> IEXT I (IS I rdfs_subClassOf) \<longrightarrow>+ c1 \<in> IC I \<and> c2 \<in> IC I \<and> ICEXT I c1 \<subseteq> ICEXT I c2)"+definition c_sco_bwd :: "'d interp \<Rightarrow> bool" where+ "c_sco_bwd I \<longleftrightarrow> (\<forall>c1 c2. c1 \<in> IC I \<longrightarrow> c2 \<in> IC I \<longrightarrow> ICEXT I c1 \<subseteq> ICEXT I c2 \<longrightarrow>+ (c1,c2) \<in> IEXT I (IS I rdfs_subClassOf))"++definition c_spo_fwd :: "'d interp \<Rightarrow> bool" where+ "c_spo_fwd I \<longleftrightarrow> (\<forall>p1 p2. (p1,p2) \<in> IEXT I (IS I rdfs_subPropertyOf) \<longrightarrow>+ p1 \<in> IP I \<and> p2 \<in> IP I \<and> IEXT I p1 \<subseteq> IEXT I p2)"+definition c_spo_bwd :: "'d interp \<Rightarrow> bool" where+ "c_spo_bwd I \<longleftrightarrow> (\<forall>p1 p2. p1 \<in> IP I \<longrightarrow> p2 \<in> IP I \<longrightarrow> IEXT I p1 \<subseteq> IEXT I p2 \<longrightarrow>+ (p1,p2) \<in> IEXT I (IS I rdfs_subPropertyOf))"++(* DECISION M10. Transitivity of subClassOf and subPropertyOf is kept as a separate+ condition even though Table 5.8's iff makes it derivable.+ Rests on RDF11 section 9, where transitivity is a condition in its own right.+ Kept for DIAGNOSTIC value: the six rdfs* arms then sit in a strictly weaker fragment+ than the twelve arms that need Table 5.8's backward direction, and the consumption map+ in OO_Builtin_Sound shows exactly which arm needs which.++ DECISION M11. Reflexivity of subClassOf and subPropertyOf is NOT encoded. No arm+ consumes it, and encoding it would shrink the model class for nothing. *)++definition c_sco_trans :: "'d interp \<Rightarrow> bool" where+ "c_sco_trans I \<longleftrightarrow> (\<forall>a b c. (a,b) \<in> IEXT I (IS I rdfs_subClassOf) \<longrightarrow>+ (b,c) \<in> IEXT I (IS I rdfs_subClassOf) \<longrightarrow> (a,c) \<in> IEXT I (IS I rdfs_subClassOf))"+definition c_spo_trans :: "'d interp \<Rightarrow> bool" where+ "c_spo_trans I \<longleftrightarrow> (\<forall>a b c. (a,b) \<in> IEXT I (IS I rdfs_subPropertyOf) \<longrightarrow>+ (b,c) \<in> IEXT I (IS I rdfs_subPropertyOf) \<longrightarrow> (a,c) \<in> IEXT I (IS I rdfs_subPropertyOf))"++definition c_dom_fwd :: "'d interp \<Rightarrow> bool" where+ "c_dom_fwd I \<longleftrightarrow> (\<forall>p c. (p,c) \<in> IEXT I (IS I rdfs_domain) \<longrightarrow>+ p \<in> IP I \<and> c \<in> IC I \<and> (\<forall>x y. (x,y) \<in> IEXT I p \<longrightarrow> x \<in> ICEXT I c))"+definition c_dom_bwd :: "'d interp \<Rightarrow> bool" where+ "c_dom_bwd I \<longleftrightarrow> (\<forall>p c. p \<in> IP I \<longrightarrow> c \<in> IC I \<longrightarrow>+ (\<forall>x y. (x,y) \<in> IEXT I p \<longrightarrow> x \<in> ICEXT I c) \<longrightarrow> (p,c) \<in> IEXT I (IS I rdfs_domain))"++definition c_rng_fwd :: "'d interp \<Rightarrow> bool" where+ "c_rng_fwd I \<longleftrightarrow> (\<forall>p c. (p,c) \<in> IEXT I (IS I rdfs_range) \<longrightarrow>+ p \<in> IP I \<and> c \<in> IC I \<and> (\<forall>x y. (x,y) \<in> IEXT I p \<longrightarrow> y \<in> ICEXT I c))"+definition c_rng_bwd :: "'d interp \<Rightarrow> bool" where+ "c_rng_bwd I \<longleftrightarrow> (\<forall>p c. p \<in> IP I \<longrightarrow> c \<in> IC I \<longrightarrow>+ (\<forall>x y. (x,y) \<in> IEXT I p \<longrightarrow> y \<in> ICEXT I c) \<longrightarrow> (p,c) \<in> IEXT I (IS I rdfs_range))"++(* DECISION M12. owl:sameAs: the FORWARD direction only.+ RBS Table 5.9 gives "iff a1 = a2" (confirmed verbatim). Both readings are faithful;+ this is a weakest-conditions choice, not a correctness one. The converse would force+ owl:sameAs to hold reflexively across the ENTIRE universe, and NO arm of this table+ consumes that: eq-ref is absent, and eq-sym needs only the forward direction (from+ (x,y) in IEXT(sameAs) get x = y, so (y,x) = (x,y) in IEXT, and sameAs in IP comes from+ the premise's own truth via M5). Symmetry alone would be the true minimum and is+ implied by what is written here. *)++definition c_sameAs_fwd :: "'d interp \<Rightarrow> bool" where+ "c_sameAs_fwd I \<longleftrightarrow> (\<forall>a b. (a,b) \<in> IEXT I (IS I owl_sameAs) \<longrightarrow> a = b)"++(* DECISION M13. equivalentClass, equivalentProperty, inverseOf: forward direction only.+ RBS Tables 5.9 and 5.12 give iffs; the converses are consumed by nothing.++ DECISION M14. inverseOf keeps BOTH INCLUSIONS of the set equality and BOTH IP+ conjuncts. prp-inv1 and prp-inv2 have head predicates (?q and ?p respectively) that+ no body triple forces into IP, so the IP conjuncts are load-bearing; and the two arms+ use opposite inclusions. RBS Table 5.12: owl:inverseOf subset of IP x IP, with+ IEXT(p1) = { <x,y> : <y,x> in IEXT(p2) }. *)++definition c_eqc_fwd :: "'d interp \<Rightarrow> bool" where+ "c_eqc_fwd I \<longleftrightarrow> (\<forall>c1 c2. (c1,c2) \<in> IEXT I (IS I owl_equivalentClass) \<longrightarrow>+ c1 \<in> IC I \<and> c2 \<in> IC I \<and> ICEXT I c1 = ICEXT I c2)"+definition c_eqp_fwd :: "'d interp \<Rightarrow> bool" where+ "c_eqp_fwd I \<longleftrightarrow> (\<forall>p1 p2. (p1,p2) \<in> IEXT I (IS I owl_equivalentProperty) \<longrightarrow>+ p1 \<in> IP I \<and> p2 \<in> IP I \<and> IEXT I p1 = IEXT I p2)"+definition c_inv_fwd :: "'d interp \<Rightarrow> bool" where+ "c_inv_fwd I \<longleftrightarrow> (\<forall>p1 p2. (p1,p2) \<in> IEXT I (IS I owl_inverseOf) \<longrightarrow>+ p1 \<in> IP I \<and> p2 \<in> IP I \<and> IEXT I p1 = {(x,y). (y,x) \<in> IEXT I p2})"++(* DECISION M15. SymmetricProperty and TransitiveProperty: the universally quantified+ part only, NOT the "p in IP" conjunct. RBS Table 5.13 reads+ "x in ICEXT(owl:SymmetricProperty) iff x in IP and for all y,z ...". The IP conjunct+ is dropped because in both prp-symp and prp-inv the head predicate is the SAME ?p that+ the body's own triple (?x ?p ?y) already forces into IP through M5. Keeping it would+ be faithful but redundant; dropping it is the weaker condition. *)++definition c_sym_fwd :: "'d interp \<Rightarrow> bool" where+ "c_sym_fwd I \<longleftrightarrow> (\<forall>p. p \<in> ICEXT I (IS I owl_SymmetricProperty) \<longrightarrow>+ (\<forall>x y. (x,y) \<in> IEXT I p \<longrightarrow> (y,x) \<in> IEXT I p))"+definition c_trp_fwd :: "'d interp \<Rightarrow> bool" where+ "c_trp_fwd I \<longleftrightarrow> (\<forall>p. p \<in> ICEXT I (IS I owl_TransitiveProperty) \<longrightarrow>+ (\<forall>x y z. (x,y) \<in> IEXT I p \<longrightarrow> (y,z) \<in> IEXT I p \<longrightarrow> (x,z) \<in> IEXT I p))"++(* DECISION M16, THE SHARPEST TRAP (T1). RBS Table 5.6: the OUTER connective is an+ IF-THEN, and the CONSEQUENT is a SET EQUALITY. Both are load-bearing and they pull in+ opposite directions, which is why this row is so easy to get wrong.++ The specification says twice that the outer connective is an implication: "All the+ semantic conditions are 'if-then' conditions, since the corresponding OWL 2 language+ constructs are class expressions". Tables 5.8 and 5.9 three sections away ARE iffs,+ and a formaliser carrying that habit into 5.6 shrinks the model class while every+ proof still succeeds.++ The consequent really is an EQUALITY, and both inclusions are consumed:+ superset half -- cls-svf1 and cls-hv2 (conclude membership in the restriction);+ subset half -- cls-avf and cls-hv1 (read a consequence off membership);+ both halves -- scm-svf1, scm-svf2, scm-avf1, scm-avf2.+ Writing only the subset inclusion is the SAFE error: cls-svf1, cls-hv2, scm-svf* and+ scm-avf* simply refuse to go through. The DANGEROUS moment is the repair -- faced+ with a failing cls-svf1 the natural move is to add a fresh axiom asserting the missing+ direction in slightly different words. That is a strengthening in a place the+ specification did not strengthen, it turns everything green, and nobody writes it+ down. The equality is written here, once, as the specification has it. *)++definition c_svf :: "'d interp \<Rightarrow> bool" where+ "c_svf I \<longleftrightarrow> (\<forall>z c p. (z,c) \<in> IEXT I (IS I owl_someValuesFrom) \<longrightarrow>+ (z,p) \<in> IEXT I (IS I owl_onProperty) \<longrightarrow>+ ICEXT I z = {x. \<exists>y. (x,y) \<in> IEXT I p \<and> y \<in> ICEXT I c})"+definition c_avf :: "'d interp \<Rightarrow> bool" where+ "c_avf I \<longleftrightarrow> (\<forall>z c p. (z,c) \<in> IEXT I (IS I owl_allValuesFrom) \<longrightarrow>+ (z,p) \<in> IEXT I (IS I owl_onProperty) \<longrightarrow>+ ICEXT I z = {x. \<forall>y. (x,y) \<in> IEXT I p \<longrightarrow> y \<in> ICEXT I c})"+definition c_hv :: "'d interp \<Rightarrow> bool" where+ "c_hv I \<longleftrightarrow> (\<forall>z a p. (z,a) \<in> IEXT I (IS I owl_hasValue) \<longrightarrow>+ (z,p) \<in> IEXT I (IS I owl_onProperty) \<longrightarrow>+ ICEXT I z = {x. (x,a) \<in> IEXT I p})"++(* DECISION M17 and M18. The typing rows of RBS Tables 5.2 and 5.3 are MANDATORY, and+ five arms cannot be proved without them. Re-fetched verbatim while writing this file:+ Table 5.2: owl:Restriction | ICEXT(...) SUBSET of IC (subset, never equality)+ Table 5.3: owl:someValuesFrom | subset of ICEXT(owl:Restriction) x IC+ owl:allValuesFrom | subset of ICEXT(owl:Restriction) x IC+ owl:onProperty | subset of ICEXT(owl:Restriction) x IP+ scm-svf1, scm-svf2, scm-avf1 and scm-avf2 conclude a rdfs:subClassOf triple, and+ c_sco_bwd's antecedent demands c1, c2 in IC; nothing else in the condition set supplies+ it, because those rules' premises mention only someValuesFrom/allValuesFrom/onProperty.+ cls-hv1's head predicate is the variable ?p, forced into IP only by the onProperty row.+ M18: Table 5.2 writes SUBSET for owl:Restriction, not equality, and that is what is+ written here. *)++definition c_restr_IC :: "'d interp \<Rightarrow> bool" where+ "c_restr_IC I \<longleftrightarrow> ICEXT I (IS I owl_Restriction) \<subseteq> IC I"+definition c_svf_typ :: "'d interp \<Rightarrow> bool" where+ "c_svf_typ I \<longleftrightarrow> (\<forall>z c. (z,c) \<in> IEXT I (IS I owl_someValuesFrom) \<longrightarrow>+ z \<in> ICEXT I (IS I owl_Restriction) \<and> c \<in> IC I)"+definition c_avf_typ :: "'d interp \<Rightarrow> bool" where+ "c_avf_typ I \<longleftrightarrow> (\<forall>z c. (z,c) \<in> IEXT I (IS I owl_allValuesFrom) \<longrightarrow>+ z \<in> ICEXT I (IS I owl_Restriction) \<and> c \<in> IC I)"+definition c_onp_typ :: "'d interp \<Rightarrow> bool" where+ "c_onp_typ I \<longleftrightarrow> (\<forall>z p. (z,p) \<in> IEXT I (IS I owl_onProperty) \<longrightarrow>+ z \<in> ICEXT I (IS I owl_Restriction) \<and> p \<in> IP I)"++(* The model class. Note what is NOT a conjunct: wf_interp (M22), any sortal separation+ (M-SORT), reflexivity of subClassOf (M11), the converse of sameAs (M12), the+ axiomatic triple TABLES as opposed to three of their consequences (M8), and the+ Table 5.2 equality ICEXT(rdf:Property) = IP -- which is spec-faithful but consumed by+ no arm, so adding it would only shrink the model class. *)++definition owl_rl_interp :: "'d interp \<Rightarrow> bool" where+ "owl_rl_interp I \<longleftrightarrow>+ c_type_IP I \<and> c_sco_IP I \<and> c_spo_IP I+ \<and> c_sco_fwd I \<and> c_sco_bwd I \<and> c_spo_fwd I \<and> c_spo_bwd I+ \<and> c_sco_trans I \<and> c_spo_trans I+ \<and> c_dom_fwd I \<and> c_dom_bwd I \<and> c_rng_fwd I \<and> c_rng_bwd I+ \<and> c_sameAs_fwd I \<and> c_eqc_fwd I \<and> c_eqp_fwd I \<and> c_inv_fwd I+ \<and> c_sym_fwd I \<and> c_trp_fwd I+ \<and> c_svf I \<and> c_avf I \<and> c_hv I+ \<and> c_restr_IC I \<and> c_svf_typ I \<and> c_avf_typ I \<and> c_onp_typ I"++section \<open>Entailment\<close>++(* DECISION M21 (conflict C10). The domain type is an explicit parameter, passed as+ TYPE('d) of type 'd itself. HOL cannot quantify over types inside a proposition, so+ the statement below is SCHEMATIC in 'd rather than a single proposition quantifying+ over all domain types. An impredicative-Prop system can write the quantifier+ directly, and its top-level statement will therefore LOOK different for reasons of+ logic, not of modelling. Recorded here so that a reviewer comparing two+ formalisations does not read a presentational difference as divergence.+ UNCERTAINTY U6, stated as unsure: whether the schematic HOL statement is equivalent to+ the set-theoretic "for all domains" statement is routine for range-restricted Horn+ rules but is NOT formalised here. *)++definition entails :: "'d itself \<Rightarrow> graph \<Rightarrow> triple \<Rightarrow> bool" where+ "entails TYPE('d) G t \<longleftrightarrow>+ (\<forall>I :: 'd interp. owl_rl_interp I \<longrightarrow> models I G \<longrightarrow> sat I t)"++(* DECISION M19 (trap T7). Rule satisfaction quantifies over TERM SUBSTITUTIONS, not+ over valuations into the domain. Rests on PROF section 4.3, which states the RL/RDF+ rules as schemas over triple patterns whose variables range over terms.+ NOTE THE DIRECTION OF SAFETY, which is the opposite of what "more faithful-sounding"+ suggests: quantifying over domain valuations would SHRINK the class of rule-satisfying+ interpretations, hence shrink the class quantified over in entails_under, hence make+ entailed_under_supplied_rules a WEAKER claim than it appears. Term substitutions is+ the safe side. *)++definition sat_rule :: "'d interp \<Rightarrow> hrule \<Rightarrow> bool" where+ "sat_rule I R \<longleftrightarrow>+ (\<forall>\<sigma>. (\<forall>u \<in> set (rbody R). sat I (apt \<sigma> u)) \<longrightarrow> sat I (apt \<sigma> (rhead R)))"++(* DECISION M20. entails_under carries NO vocabulary conditions and NO domain conditions+ WHATEVER. The user's rules are the only assumption, and the theorem says so.+ That asymmetry is deliberate and structural: it is what makes the two verdicts come+ apart as a matter of what is quantified over, rather than by convention in a report+ string. A one-line rule table reading "every supplier is compliant" then yields+ exactly what it should -- a conclusion true in every interpretation that satisfies+ that assumption, which is a claim about the user's assumption and not about the+ world. *)++definition entails_under :: "'d itself \<Rightarrow> rtable \<Rightarrow> graph \<Rightarrow> triple \<Rightarrow> bool" where+ "entails_under TYPE('d) Rs G t \<longleftrightarrow>+ (\<forall>I :: 'd interp. (\<forall>R \<in> set Rs. sat_rule I R) \<longrightarrow> models I G \<longrightarrow> sat I t)"++lemma entails_of_entails_under:+ assumes tbl: "\<And>I :: 'd interp. owl_rl_interp I \<Longrightarrow> \<forall>R \<in> set Rs. sat_rule I R"+ and eu: "entails_under TYPE('d) Rs G t"+ shows "entails TYPE('d) G t"+ using assms by (auto simp: entails_def entails_under_def)++enddiff --git a/isabelle/OO_Sound.thy b/isabelle/OO_Sound.thynew file mode 100644index 00000000..53619258--- /dev/null+++ b/isabelle/OO_Sound.thy@@ -0,0 +1,345 @@+(* OO_Sound.thy -- the generic soundness theorem.++ This is the only place the syntactic checker and the model theory meet. The theorem+ needs NO case analysis over rules, because there is no per-rule structure left in the+ checker: a rule is data, and the rules are the user's assumption. *)++theory OO_Sound+ imports OO_Check OO_Semantics+begin++section \<open>Tier B: the finite binding and its total extension agree\<close>++lemma B1:+ assumes "ipat \<beta> p = Some t"+ shows "ap (tot_of \<beta>) p = t"+ using assms by (cases p) (auto simp: tot_of_def)++lemma B2:+ assumes "iptriple \<beta> tp = Some u"+ shows "apt (tot_of \<beta>) tp = u"+proof (cases tp rule: prod_cases3)+ case (fields s p q)+ then obtain a b c where+ A: "ipat \<beta> s = Some a" and Bb: "ipat \<beta> p = Some b" and C: "ipat \<beta> q = Some c"+ and U: "u = (a,b,c)"+ using assms by (auto split: option.splits)+ show ?thesis using fields U B1[OF A] B1[OF Bb] B1[OF C] by simp+qed++section \<open>Tier A: what the body check establishes\<close>++lemma body_strict_map:+ "body_strict \<beta> j bs ps = None \<Longrightarrow> map (apt (tot_of \<beta>)) bs = ps"+proof (induction bs arbitrary: j ps)+ case Nil+ then show ?case by (cases ps) auto+next+ case (Cons b bs)+ show ?case+ proof (cases ps)+ case Nil+ with Cons.prems show ?thesis by simp+ next+ case (Cons p ps')+ with Cons.prems have i: "iptriple \<beta> b = Some p"+ and r: "body_strict \<beta> (Suc j) bs ps' = None"+ by (auto split: if_splits)+ show ?thesis using Cons Cons.IH[OF r] B2[OF i] by simp+ qed+qed++lemma body_strict_inst:+ "body_strict \<beta> j bs ps = None \<Longrightarrow> \<forall>b \<in> set bs. iptriple \<beta> b \<noteq> None"+proof (induction bs arbitrary: j ps)+ case Nil+ then show ?case by simp+next+ case (Cons b bs)+ show ?case+ proof (cases ps)+ case Nil+ with Cons.prems show ?thesis by simp+ next+ case (Cons p ps')+ with Cons.prems have i: "iptriple \<beta> b = Some p"+ and r: "body_strict \<beta> (Suc j) bs ps' = None"+ by (auto split: if_splits)+ have hb: "iptriple \<beta> b \<noteq> None" using i by simp+ show ?thesis+ proof (rule ballI)+ fix c assume "c \<in> set (b # bs)"+ then consider (hd) "c = b" | (tl) "c \<in> set bs" by auto+ then show "iptriple \<beta> c \<noteq> None"+ proof cases+ case hd with hb show ?thesis by simp+ next+ case tl with Cons.IH[OF r] show ?thesis by blast+ qed+ qed+ qed+qed++lemma premises_known_all:+ "premises_known K j ps = None \<Longrightarrow> \<forall>p \<in> set ps. p \<in> K"+ by (induction ps arbitrary: j) (auto split: if_splits)++section \<open>Tier C: one step, then the induction that IS the no-self-support property\<close>++lemma check_step_parts:+ assumes "check_step R K s = None"+ shows "sidx s < length R"+ and "body_strict (sbind s) 0 (rbody (R ! sidx s)) (sprem s) = None"+ and "premises_known K 0 (sprem s) = None"+ and "iptriple (sbind s) (rhead (R ! sidx s)) = Some (sconcl s)"+ using assms+ by (auto simp: check_step_def Let_def not_le split: if_splits option.splits)++lemma check_step_sound:+ assumes ok: "check_step R K s = None"+ and kn: "\<And>t. t \<in> K \<Longrightarrow> sat I t"+ and rl: "\<And>r. r \<in> set R \<Longrightarrow> sat_rule I r"+ shows "sat I (sconcl s)"+proof -+ note P = check_step_parts[OF ok]+ have rmem: "R ! sidx s \<in> set R" using P(1) by simp+ have body: "map (apt (tot_of (sbind s))) (rbody (R ! sidx s)) = sprem s"+ using P(2) by (rule body_strict_map)+ have prem: "\<forall>p \<in> set (sprem s). p \<in> K" using P(3) by (rule premises_known_all)+ have "\<forall>u \<in> set (rbody (R ! sidx s)). sat I (apt (tot_of (sbind s)) u)"+ proof+ fix u assume u: "u \<in> set (rbody (R ! sidx s))"+ then have "apt (tot_of (sbind s)) u \<in> set (sprem s)"+ using body by (metis image_eqI list.set_map)+ then have "apt (tot_of (sbind s)) u \<in> K" using prem by blast+ then show "sat I (apt (tot_of (sbind s)) u)" by (rule kn)+ qed+ then have "sat I (apt (tot_of (sbind s)) (rhead (R ! sidx s)))"+ using rl[OF rmem] by (simp add: sat_rule_def)+ then show ?thesis using B2[OF P(4)] by simp+qed++(* THE INDUCTION BELOW IS THE NO-SELF-SUPPORT PROPERTY. It generalises over the known+ set K, and it is FALSE if check_from inserts the conclusion before checking the step:+ the step's own conclusion would then be available to discharge its own premises, and+ the hypothesis "every triple in K is true" would no longer be establishable at the+ recursive call. There is no separate test for this; the proof is the test. *)++lemma check_from_sound:+ assumes "check_from R K j ss = None"+ and "\<And>t. t \<in> K \<Longrightarrow> sat I t"+ and "\<And>r. r \<in> set R \<Longrightarrow> sat_rule I r"+ shows "\<forall>s \<in> set ss. sat I (sconcl s)"+ using assms+proof (induction ss arbitrary: K j)+ case Nil+ then show ?case by simp+next+ case (Cons s ss)+ from Cons.prems(1) have cs: "check_step R K s = None"+ and rest: "check_from R (insert (sconcl s) K) (Suc j) ss = None"+ by (auto split: option.splits)+ have h: "sat I (sconcl s)"+ using check_step_sound[OF cs Cons.prems(2) Cons.prems(3)] .+ have k': "\<And>t. t \<in> insert (sconcl s) K \<Longrightarrow> sat I t"+ using h Cons.prems(2) by auto+ show ?case using h Cons.IH[OF rest k' Cons.prems(3)] by simp+qed++section \<open>T1: the conditional verdict\<close>++theorem horn_certificate_sound:+ fixes G :: "triple list" and R :: rtable and C :: "hstep list"+ assumes ok: "check_cert R G C = None"+ and mem: "s \<in> set C"+ shows "entails_under TYPE('d) R (set G) (sconcl s)"+ unfolding entails_under_def+proof (intro allI impI)+ fix I :: "'d interp"+ assume rl: "\<forall>r \<in> set R. sat_rule I r" and m: "models I (set G)"+ have "\<forall>s \<in> set C. sat I (sconcl s)"+ proof (rule check_from_sound)+ show "check_from R (set G) 0 C = None" using ok by (simp add: check_cert_def)+ show "\<And>t. t \<in> set G \<Longrightarrow> sat I t" using m by (simp add: models_def)+ show "\<And>r. r \<in> set R \<Longrightarrow> sat_rule I r" using rl by blast+ qed+ then show "sat I (sconcl s)" using mem by blast+qed++section \<open>The lenient judgement is sound too, and strict implies lenient\<close>++(* Proving BOTH disciplines sound is what turns conflict C11 from a guess into a+ theorem: a differential disagreement on premise ORDER is then known in advance to be+ a difference of strictness with no soundness content, and neither side needs+ "fixing". *)++lemma body_lenient_sat:+ assumes "body_lenient \<beta> K j bs = None"+ and "\<And>t. t \<in> K \<Longrightarrow> sat I t"+ shows "\<forall>u \<in> set bs. sat I (apt (tot_of \<beta>) u)"+ using assms+proof (induction bs arbitrary: j)+ case Nil+ then show ?case by simp+next+ case (Cons b bs)+ from Cons.prems(1) obtain t where+ i: "iptriple \<beta> b = Some t" and tK: "t \<in> K"+ and r: "body_lenient \<beta> K (Suc j) bs = None"+ by (auto split: option.splits if_splits)+ have "sat I (apt (tot_of \<beta>) b)" using B2[OF i] tK Cons.prems(2) by simp+ then show ?case using Cons.IH[OF r Cons.prems(2)] by simp+qed++lemma check_step_lenient_sound:+ assumes ok: "check_step_lenient R K s = None"+ and kn: "\<And>t. t \<in> K \<Longrightarrow> sat I t"+ and rl: "\<And>r. r \<in> set R \<Longrightarrow> sat_rule I r"+ shows "sat I (sconcl s)"+proof -+ from ok have idx: "sidx s < length R"+ by (auto simp: check_step_lenient_def Let_def not_le split: if_splits)+ from ok idx have bl: "body_lenient (sbind s) K 0 (rbody (R ! sidx s)) = None"+ and hd: "iptriple (sbind s) (rhead (R ! sidx s)) = Some (sconcl s)"+ by (auto simp: check_step_lenient_def Let_def split: if_splits option.splits)+ have rmem: "R ! sidx s \<in> set R" using idx by simp+ have "\<forall>u \<in> set (rbody (R ! sidx s)). sat I (apt (tot_of (sbind s)) u)"+ using body_lenient_sat[OF bl kn] .+ then have "sat I (apt (tot_of (sbind s)) (rhead (R ! sidx s)))"+ using rl[OF rmem] by (simp add: sat_rule_def)+ then show ?thesis using B2[OF hd] by simp+qed++lemma check_from_lenient_sound:+ assumes "check_from_lenient R K j ss = None"+ and "\<And>t. t \<in> K \<Longrightarrow> sat I t"+ and "\<And>r. r \<in> set R \<Longrightarrow> sat_rule I r"+ shows "\<forall>s \<in> set ss. sat I (sconcl s)"+ using assms+proof (induction ss arbitrary: K j)+ case Nil+ then show ?case by simp+next+ case (Cons s ss)+ from Cons.prems(1) have cs: "check_step_lenient R K s = None"+ and rest: "check_from_lenient R (insert (sconcl s) K) (Suc j) ss = None"+ by (auto split: option.splits)+ have h: "sat I (sconcl s)"+ using check_step_lenient_sound[OF cs Cons.prems(2) Cons.prems(3)] .+ have k': "\<And>t. t \<in> insert (sconcl s) K \<Longrightarrow> sat I t" using h Cons.prems(2) by auto+ show ?case using h Cons.IH[OF rest k' Cons.prems(3)] by simp+qed++theorem horn_certificate_sound_lenient:+ fixes G :: "triple list" and R :: rtable and C :: "hstep list"+ assumes ok: "check_cert_lenient R G C = None"+ and mem: "s \<in> set C"+ shows "entails_under TYPE('d) R (set G) (sconcl s)"+ unfolding entails_under_def+proof (intro allI impI)+ fix I :: "'d interp"+ assume rl: "\<forall>r \<in> set R. sat_rule I r" and m: "models I (set G)"+ have "\<forall>s \<in> set C. sat I (sconcl s)"+ proof (rule check_from_lenient_sound)+ show "check_from_lenient R (set G) 0 C = None" using ok by (simp add: check_cert_lenient_def)+ show "\<And>t. t \<in> set G \<Longrightarrow> sat I t" using m by (simp add: models_def)+ show "\<And>r. r \<in> set R \<Longrightarrow> sat_rule I r" using rl by blast+ qed+ then show "sat I (sconcl s)" using mem by blast+qed++lemma body_strict_lenient:+ "body_strict \<beta> j bs ps = None \<Longrightarrow> \<forall>p \<in> set ps. p \<in> K \<Longrightarrow> body_lenient \<beta> K j' bs = None"+proof (induction bs arbitrary: j j' ps)+ case Nil+ then show ?case by simp+next+ case (Cons b bs)+ show ?case+ proof (cases ps)+ case Nil+ with Cons.prems show ?thesis by simp+ next+ case (Cons p ps')+ with Cons.prems(1) have i: "iptriple \<beta> b = Some p"+ and r: "body_strict \<beta> (Suc j) bs ps' = None"+ by (auto split: if_splits)+ have pK: "p \<in> K" using Cons.prems(2) Cons by simp+ have "\<forall>q \<in> set ps'. q \<in> K" using Cons.prems(2) Cons by simp+ then show ?thesis using i pK Cons.IH[OF r] by simp+ qed+qed++lemma strict_implies_lenient_step:+ "check_step R K s = None \<Longrightarrow> check_step_lenient R K s = None"+proof -+ assume ok: "check_step R K s = None"+ note P = check_step_parts[OF ok]+ have "\<forall>p \<in> set (sprem s). p \<in> K" using P(3) by (rule premises_known_all)+ then have "body_lenient (sbind s) K 0 (rbody (R ! sidx s)) = None"+ using body_strict_lenient[OF P(2)] by blast+ then show ?thesis using P(1) P(4) by (simp add: check_step_lenient_def Let_def)+qed++lemma strict_implies_lenient_from:+ "check_from R K j ss = None \<Longrightarrow> check_from_lenient R K j ss = None"+proof (induction ss arbitrary: K j)+ case Nil+ then show ?case by simp+next+ case (Cons s ss)+ from Cons.prems have cs: "check_step R K s = None"+ and rest: "check_from R (insert (sconcl s) K) (Suc j) ss = None"+ by (auto split: option.splits)+ show ?case+ using strict_implies_lenient_step[OF cs] Cons.IH[OF rest] by simp+qed++theorem strict_implies_lenient:+ "check_cert R G C = None \<Longrightarrow> check_cert_lenient R G C = None"+ by (simp add: check_cert_def check_cert_lenient_def strict_implies_lenient_from)++section \<open>The coverage check adds no strictness (M25, first half)\<close>++(* binding_covers is checked BEFORE the body and head checks, so it changes which REASON+ a rejected certificate is given. It cannot change the ACCEPT/REJECT bit, because the+ body and head checks already force every variable occurring in the rule to be bound.+ Recorded because over-checking (trap T11) manufactures differential disagreements that+ consume review time and find nothing; this one provably cannot. *)++lemma ipat_covers:+ "ipat \<beta> p \<noteq> None \<Longrightarrow> \<forall>v \<in> set (pat_vars1 p). map_of \<beta> v \<noteq> None"+ by (cases p) auto++lemma iptriple_parts:+ "iptriple \<beta> (s,p,q) \<noteq> None+ \<Longrightarrow> ipat \<beta> s \<noteq> None \<and> ipat \<beta> p \<noteq> None \<and> ipat \<beta> q \<noteq> None"+ by (auto split: option.splits)++lemma iptriple_covers:+ "iptriple \<beta> tp \<noteq> None \<Longrightarrow> \<forall>v \<in> set (pat_var_list tp). map_of \<beta> v \<noteq> None"+proof (cases tp rule: prod_cases3)+ case (fields s p q)+ assume "iptriple \<beta> tp \<noteq> None"+ with fields have "ipat \<beta> s \<noteq> None \<and> ipat \<beta> p \<noteq> None \<and> ipat \<beta> q \<noteq> None"+ using iptriple_parts by simp+ then show ?thesis using fields ipat_covers by auto+qed++lemma coverage_implied:+ assumes bs: "body_strict \<beta> 0 (rbody r) ps = None"+ and hd: "iptriple \<beta> (rhead r) = Some t"+ shows "binding_covers \<beta> r"+proof -+ have "\<forall>b \<in> set (rbody r). iptriple \<beta> b \<noteq> None"+ using bs by (rule body_strict_inst)+ then have body: "\<forall>b \<in> set (rbody r). \<forall>v \<in> set (pat_var_list b). map_of \<beta> v \<noteq> None"+ using iptriple_covers by blast+ have head: "\<forall>v \<in> set (pat_var_list (rhead r)). map_of \<beta> v \<noteq> None"+ using hd by (intro iptriple_covers) simp+ show ?thesis+ unfolding binding_covers_def rule_var_list_def+ using body head by (auto simp: list_all_iff)+qed++enddiff --git a/isabelle/README.md b/isabelle/README.mdnew file mode 100644index 00000000..11503900--- /dev/null+++ b/isabelle/README.md@@ -0,0 +1,69 @@+# `isabelle/` — an independent second formalisation of the Horn certificate checker++This directory is a second, independent formalisation of the OWL 2 RL/RDF Horn+certificate checker and its model theory, in Isabelle/HOL. It exists to test the one+thing a single machine-checked proof cannot test: whether the **definitions** are right.+A proof assistant rules out a bad argument; it says nothing about a bad definition, and a+semantics that is stronger than the specification makes every soundness theorem over it+weaker than it looks while every proof still succeeds.++It was written from the W3C primary sources and the fixture **data** only. Nothing under+`lean/` was read, listed, grepped, or reasoned about while it was written. A+transliteration would have been worthless here, because a shared definitional bug+survives translation untouched.++Every modelling decision is recorded as a comment at the point it is made, with the+specification clause it rests on. That list is what makes a later disagreement+diagnosable instead of merely embarrassing; start with `OO_Semantics.thy`.++## Build++Needs Isabelle2025-2.++ isabelle build -d isabelle -c OOHorn++The session checks everything, including the fixture results and an audit that fails the+build if any soundness or non-vacuity theorem depends on an oracle (`sorry` is the+oracle `Pure.skip_proof`, so this catches it).++## Run the checker++ isabelle/run_checker.sh RULES.tsv ASSERTED.tsv CERT.tsv++Exit 0 accepted, 1 rejected, 2 parse error. One JSON object on stdout carrying **both**+the strict and the lenient verdict. `OO_VERBOSE=1` keeps Poly/ML's chatter.++Regenerate `driver/oo_horn_generated.ML` from the theories with `isabelle/export.sh`.++## Run the differential matrix++ isabelle/differential_matrix.sh++One JSON line per input triple. Run the same matrix through the other checker and diff+the accept/reject bit and the verdict word.++## Files++| file | what it holds |+|---|---|+| `OO_Format.thy` | terms, triples, rule patterns, rules, steps, instantiation. No semantics. |+| `OO_Semantics.thy` | interpretations, truth of a triple, the 26 semantic conditions, both entailment relations. Never in the export closure. |+| `OO_Check.thy` | the executable checker and the built-in rule table. No semantics. |+| `OO_Sound.thy` | `horn_certificate_sound` — the conditional verdict. |+| `OO_Builtin_Sound.thy` | the 27 arms, and `entails_of_builtin` — the absolute verdict. |+| `OO_NonVacuity.thy` | witness models; entailment is not the trivial relation. |+| `OO_Parse.thy` | TSV field lists to datatypes. Executable. |+| `OO_Pipeline.thy` | what the tool's own output means, end to end. |+| `OO_Fixtures.thy` | the checker run on the real fixture bytes, as build gates. Uses `eval`; no soundness theorem depends on it. |+| `OO_Audit.thy` | the oracle gate, and a check that the gate can fail. |+| `OO_Export.thy` | code generation. |+| `driver/` | the untrusted SML driver, and the generated core. |+| `fixtures-added/` | fixtures for properties the shipped set cannot reach. |++## Trust boundary++Inside: the Isabelle kernel, the theories above, and the code generator — which is+trusted, not verified, exactly as a compiler is on any other side of any comparison.++Outside: file IO, splitting bytes on LF and TAB, exit codes, JSON, and the claim that+the engine's `asserted.tsv` is the store it says it is.diff --git a/isabelle/ROOT b/isabelle/ROOTnew file mode 100644index 00000000..f74539e5--- /dev/null+++ b/isabelle/ROOT@@ -0,0 +1,21 @@+session OOHorn = HOL ++ description "+ Independent second formalisation, in Isabelle/HOL, of the OWL 2 RL/RDF Horn+ certificate checker and its model theory. Built from the W3C primary sources and+ the fixture DATA only; no part of the project's Lean layer was read.+ "+ options [document = false]+ sessions+ "HOL-Library"+ theories+ OO_Format+ OO_Semantics+ OO_Check+ OO_Sound+ OO_Builtin_Sound+ OO_NonVacuity+ OO_Parse+ OO_Pipeline+ OO_Fixtures+ OO_Audit+ OO_Exportdiff --git a/isabelle/differential_matrix.sh b/isabelle/differential_matrix.shnew file mode 100755index 00000000..07e87a45--- /dev/null+++ b/isabelle/differential_matrix.sh@@ -0,0 +1,31 @@+#!/bin/sh+# Emit one JSON line per (rule table, asserted graph, certificate) triple, for the+# differential test against the other implementation. Run the SAME matrix through the+# other checker and diff the accept/reject bit and the verdict word.+#+# READ THIS BEFORE INTERPRETING THE RESULT. Checking a Horn certificate is purely+# syntactic: neither side consults its semantics. Two checkers built on contradictory+# model theories will agree on every row here. AGREEMENT IS HYGIENE, NOT EVIDENCE THAT+# THE DEFINITIONS AGREE. The evidence lives in which arms each side can discharge and+# from which conditions (isabelle/OO_Builtin_Sound.thy) and in whether the conditions+# describe anything at all (isabelle/OO_NonVacuity.thy).+set -e+HERE=$(cd "$(dirname "$0")" && pwd)+FX=${OO_FIXTURES:-$HERE/../tests/fixtures/horn}+ADD=$HERE/fixtures-added++row() { "$HERE/run_checker.sh" "$1" "$2" "$3" || true; }++row "$FX/builtin_rules.tsv" "$FX/asserted.tsv" "$FX/good.tsv"+row "$FX/user_rules.tsv" "$FX/asserted.tsv" "$FX/good.tsv"+row "$FX/short_rules.tsv" "$FX/asserted.tsv" "$FX/good.tsv"+row "$FX/builtin_rules.tsv" "$FX/asserted.tsv" "$FX/bad_index.tsv"+row "$FX/builtin_rules.tsv" "$FX/asserted.tsv" "$FX/bad_binding.tsv"+row "$FX/builtin_rules.tsv" "$FX/asserted.tsv" "$FX/bad_conclusion.tsv"+row "$FX/builtin_rules.tsv" "$FX/asserted.tsv" "$FX/bad_premise.tsv"+row "$FX/builtin_rules.tsv" "$FX/asserted.tsv" "$FX/bad_self.tsv"+row "$FX/builtin_rules.tsv" "$ADD/asserted_chain.tsv" "$ADD/bad_self_chain.tsv"+row "$FX/builtin_rules.tsv" "$ADD/asserted_chain.tsv" "$ADD/good_chain.tsv"+row "$FX/builtin_rules.tsv" "$FX/asserted.tsv" "$ADD/bad_order.tsv"+row "$FX/builtin_rules.tsv" "$FX/asserted.tsv" "$ADD/bad_dup_key.tsv"+row "$FX/builtin_rules.tsv" "$ADD/asserted_gen.tsv" "$ADD/generalized.tsv"diff --git a/isabelle/driver/oo_horn_driver.sml b/isabelle/driver/oo_horn_driver.smlnew file mode 100644index 00000000..c07dc7a7--- /dev/null+++ b/isabelle/driver/oo_horn_driver.sml@@ -0,0 +1,92 @@+(* oo_horn_driver.sml -- the UNTRUSTED driver. NO THEOREM COVERS THIS FILE.++ It does file IO, splits bytes on LF and TAB, converts bytes to and from the verified+ core's char type, prints a report, and chooses an exit code. Splitting is the only+ logic in it, and it is four lines -- which is possible only because the format has no+ escaping layer: an N-Triples spelling cannot contain a raw TAB or LF, so nothing has+ to be unescaped and no real logic is pushed outside the theorem.++ Note it uses SML's OWN String.explode on a native byte string, not Isabelle's. *)++fun toChar c = OOHorn.chr_of_nat (OOHorn.nat_of_integer (IntInf.fromInt (Char.ord c)));+fun toStr s = List.map toChar (String.explode s);+fun fromChar c = Char.chr (IntInf.toInt (OOHorn.integer_of_nat (OOHorn.nat_of_chr c)));+fun fromStr cs = String.implode (List.map fromChar cs);+fun natToInt n = IntInf.toInt (OOHorn.integer_of_nat n);++fun readFile path =+ let val s = TextIO.openIn path+ val d = TextIO.inputAll s+ in TextIO.closeIn s; d end;++(* the whole of the untrusted parsing *)+fun splitOn c s = String.fields (fn x => x = c) s;+fun rows text =+ List.map (fn line => List.map toStr (splitOn #"\t" line))+ (List.filter (fn l => l <> "") (splitOn #"\n" text));++fun reasonStr r = case r of+ OOHorn.R_index_out_of_range => "index_out_of_range"+ | OOHorn.R_arity_mismatch => "arity_mismatch"+ | OOHorn.R_binding_incomplete => "binding_incomplete"+ | OOHorn.R_binding_dup_key => "binding_dup_key"+ | OOHorn.R_body_mismatch j => "body_mismatch:" ^ Int.toString (natToInt j)+ | OOHorn.R_premise_unknown j => "premise_unknown:" ^ Int.toString (natToInt j)+ | OOHorn.R_head_mismatch => "head_mismatch";++fun verdictStr v = case v of+ OOHorn.Entailed => "entailed"+ | OOHorn.EntailedUnderSuppliedRules => "entailed_under_supplied_rules";++fun outcomeStr oc = case oc of+ OOHorn.Ok v => "ok " ^ verdictStr v+ | OOHorn.Rejected (j,r) => "rejected step=" ^ Int.toString (natToInt j) ^+ " reason=" ^ reasonStr r+ | OOHorn.ParseError => "parse_error";++fun exitCode oc = case oc of+ OOHorn.Ok _ => 0+ | OOHorn.Rejected _ => 1+ | OOHorn.ParseError => 2;++fun report rulesF assertedF certF =+ let+ val R = rows (readFile rulesF)+ val G = rows (readFile assertedF)+ val C = rows (readFile certF)+ val strict = OOHorn.run_check R G C+ val lenient = OOHorn.run_check_lenient R G C+ in+ print ("{\"rules\":\"" ^ rulesF ^+ "\",\"asserted\":\"" ^ assertedF ^+ "\",\"certificate\":\"" ^ certF ^+ "\",\"strict\":\"" ^ outcomeStr strict ^+ "\",\"lenient\":\"" ^ outcomeStr lenient ^+ "\",\"checker\":\"isabelle-OOHorn\"" ^+ ",\"absolute_theorem\":\"OOHorn.run_check_entailed_sound\"" ^+ ",\"conditional_theorem\":\"OOHorn.run_check_sound\"}\n");+ exitCode strict+ end;++(* OS.Process.exit only offers success and failure, so exact exit codes go through+ Posix.Process.exit. *)+fun exitWith 0 = OS.Process.exit OS.Process.success+ | exitWith n = Posix.Process.exit (Word8.fromInt n);++fun getEnv k = case OS.Process.getEnv k of SOME v => v | NONE => "";++fun mainEnv () =+ let+ val r = getEnv "OO_RULES"+ val a = getEnv "OO_ASSERTED"+ val c = getEnv "OO_CERT"+ in+ if r = "" orelse a = "" orelse c = ""+ then (print "usage: set OO_RULES, OO_ASSERTED and OO_CERT\n"; exitWith 3)+ else exitWith (report r a c)+ end;++fun main () =+ case CommandLine.arguments () of+ [r,a,c] => exitWith (report r a c)+ | _ => mainEnv ();diff --git a/isabelle/driver/oo_horn_generated.ML b/isabelle/driver/oo_horn_generated.MLnew file mode 100644index 00000000..cf9efd12--- /dev/null+++ b/isabelle/driver/oo_horn_generated.ML@@ -0,0 +1,1957 @@+(* GENERATED BY isabelle build -e FROM isabelle/OO_Export.thy -- DO NOT EDIT.+ Regenerate with isabelle/export.sh. Isabelle2025-2, session OOHorn. *)+structure OOHorn : sig+ type char+ datatype rdf_term = Iri of char list | Bnode of char list | Lit of char list+ datatype pat = V of char list | Tm of rdf_term+ type 'a hrule_ext+ type nat+ type 'a set+ datatype reason = R_index_out_of_range | R_arity_mismatch |+ R_binding_incomplete | R_binding_dup_key | R_body_mismatch of nat |+ R_premise_unknown of nat | R_head_mismatch+ datatype verdict = Entailed | EntailedUnderSuppliedRules+ datatype outcome = Ok of verdict | Rejected of nat * reason | ParseError+ type 'a hstep_ext+ val integer_of_nat : nat -> IntInf.int+ val nat_of_integer : IntInf.int -> nat+ val check_cert :+ unit hrule_ext list ->+ (rdf_term * (rdf_term * rdf_term)) list ->+ unit hstep_ext list -> (nat * reason) option+ val accepts :+ unit hrule_ext list ->+ (rdf_term * (rdf_term * rdf_term)) list -> unit hstep_ext list -> bool+ val parse_rules : ((char list) list) list -> (unit hrule_ext list) option+ val parse_graph :+ ((char list) list) list -> ((rdf_term * (rdf_term * rdf_term)) list) option+ val parse_cert : ((char list) list) list -> (unit hstep_ext list) option+ val builtin_table : unit hrule_ext list+ val verdict_of : unit hrule_ext list -> verdict+ val run_check :+ ((char list) list) list ->+ ((char list) list) list -> ((char list) list) list -> outcome+ val chr_of_nat : nat -> char+ val nat_of_chr : char -> nat+ val check_cert_lenient :+ unit hrule_ext list ->+ (rdf_term * (rdf_term * rdf_term)) list ->+ unit hstep_ext list -> (nat * reason) option+ val run_check_lenient :+ ((char list) list) list ->+ ((char list) list) list -> ((char list) list) list -> outcome+end = struct++type 'a equal = {equal : 'a -> 'a -> bool};+val equal = #equal : 'a equal -> 'a -> 'a -> bool;++fun eq A_ a b = equal A_ a b;++fun equal_lista A_ [] (x21 :: x22) = false+ | equal_lista A_ (x21 :: x22) [] = false+ | equal_lista A_ (x21 :: x22) (y21 :: y22) =+ eq A_ x21 y21 andalso equal_lista A_ x22 y22+ | equal_lista A_ [] [] = true;++fun equal_list A_ = {equal = equal_lista A_} : ('a list) equal;++fun equal_bool false p = not p+ | equal_bool true p = p+ | equal_bool p false = not p+ | equal_bool p true = p;++datatype char = Chara of bool * bool * bool * bool * bool * bool * bool * bool;++fun equal_chara (Chara (x1, x2, x3, x4, x5, x6, x7, x8))+ (Chara (y1, y2, y3, y4, y5, y6, y7, y8)) =+ equal_bool x1 y1 andalso+ (equal_bool x2 y2 andalso+ (equal_bool x3 y3 andalso+ (equal_bool x4 y4 andalso+ (equal_bool x5 y5 andalso+ (equal_bool x6 y6 andalso+ (equal_bool x7 y7 andalso equal_bool x8 y8))))));++val equal_char = {equal = equal_chara} : char equal;++datatype rdf_term = Iri of char list | Bnode of char list | Lit of char list;++fun equal_rdf_terma (Bnode x2) (Lit x3) = false+ | equal_rdf_terma (Lit x3) (Bnode x2) = false+ | equal_rdf_terma (Iri x1) (Lit x3) = false+ | equal_rdf_terma (Lit x3) (Iri x1) = false+ | equal_rdf_terma (Iri x1) (Bnode x2) = false+ | equal_rdf_terma (Bnode x2) (Iri x1) = false+ | equal_rdf_terma (Lit x3) (Lit y3) = equal_lista equal_char x3 y3+ | equal_rdf_terma (Bnode x2) (Bnode y2) = equal_lista equal_char x2 y2+ | equal_rdf_terma (Iri x1) (Iri y1) = equal_lista equal_char x1 y1;++datatype pat = V of char list | Tm of rdf_term;++fun equal_pata (V x1) (Tm x2) = false+ | equal_pata (Tm x2) (V x1) = false+ | equal_pata (Tm x2) (Tm y2) = equal_rdf_terma x2 y2+ | equal_pata (V x1) (V y1) = equal_lista equal_char x1 y1;++val equal_pat = {equal = equal_pata} : pat equal;++fun equal_proda A_ B_ (x1, x2) (y1, y2) = eq A_ x1 y1 andalso eq B_ x2 y2;++fun equal_prod A_ B_ = {equal = equal_proda A_ B_} : ('a * 'b) equal;++fun equal_unita u v = true;++val equal_unit = {equal = equal_unita} : unit equal;++val equal_rdf_term = {equal = equal_rdf_terma} : rdf_term equal;++datatype num = One | Bit0 of num | Bit1 of num;++val one_integera : IntInf.int = (1 : IntInf.int);++type 'a one = {one : 'a};+val one = #one : 'a one -> 'a;++val one_integer = {one = one_integera} : IntInf.int one;++type 'a zero = {zero : 'a};+val zero = #zero : 'a zero -> 'a;++val zero_integer = {zero = (0 : IntInf.int)} : IntInf.int zero;++type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool};+val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool;+val less = #less : 'a ord -> 'a -> 'a -> bool;++val ord_integer =+ {less_eq = (fn a => fn b => IntInf.<= (a, b)),+ less = (fn a => fn b => IntInf.< (a, b))}+ : IntInf.int ord;++type 'a zero_neq_one = {one_zero_neq_one : 'a one, zero_zero_neq_one : 'a zero};+val one_zero_neq_one = #one_zero_neq_one : 'a zero_neq_one -> 'a one;+val zero_zero_neq_one = #zero_zero_neq_one : 'a zero_neq_one -> 'a zero;++val zero_neq_one_integer =+ {one_zero_neq_one = one_integer, zero_zero_neq_one = zero_integer} :+ IntInf.int zero_neq_one;++datatype 'a hrule_ext =+ Hrule_ext of char list * (pat * (pat * pat)) list * (pat * (pat * pat)) * 'a;++fun equal_hrule_exta A_ (Hrule_ext (rnamea, rbodya, rheada, morea))+ (Hrule_ext (rname, rbody, rhead, more)) =+ equal_lista equal_char rnamea rname andalso+ (equal_lista (equal_prod equal_pat (equal_prod equal_pat equal_pat)) rbodya+ rbody andalso+ (equal_proda equal_pat (equal_prod equal_pat equal_pat) rheada+ rhead andalso+ eq A_ morea more));++fun equal_hrule_ext A_ = {equal = equal_hrule_exta A_} : 'a hrule_ext equal;++datatype nat = Nat of IntInf.int;++datatype 'a set = Set of 'a list | Coset of 'a list;++datatype reason = R_index_out_of_range | R_arity_mismatch | R_binding_incomplete+ | R_binding_dup_key | R_body_mismatch of nat | R_premise_unknown of nat |+ R_head_mismatch;++datatype verdict = Entailed | EntailedUnderSuppliedRules;++datatype outcome = Ok of verdict | Rejected of nat * reason | ParseError;++datatype 'a hstep_ext =+ Hstep_ext of+ nat * (char list * rdf_term) list * (rdf_term * (rdf_term * rdf_term)) *+ (rdf_term * (rdf_term * rdf_term)) list * 'a;++fun integer_of_nat (Nat x) = x;++fun plus_nat m n = Nat (IntInf.+ (integer_of_nat m, integer_of_nat n));++val one_nat : nat = Nat (1 : IntInf.int);++fun suc n = plus_nat n one_nat;++fun max A_ a b = (if less_eq A_ a b then b else a);++fun minus_nat m n =+ Nat (max ord_integer (0 : IntInf.int)+ (IntInf.- (integer_of_nat m, integer_of_nat n)));++fun equal_nat m n = (((integer_of_nat m) : IntInf.int) = (integer_of_nat n));++val zero_nat : nat = Nat (0 : IntInf.int);++fun nth (x :: xs) n =+ (if equal_nat n zero_nat then x else nth xs (minus_nat n one_nat));++fun drop n [] = []+ | drop n (x :: xs) =+ (if equal_nat n zero_nat then x :: xs else drop (minus_nat n one_nat) xs);++fun null [] = true+ | null (x :: xs) = false;++fun last (x :: xs) = (if null xs then x else last xs);++fun maps f [] = []+ | maps f (x :: xs) = f x @ maps f xs;++fun take n [] = []+ | take n (x :: xs) =+ (if equal_nat n zero_nat then [] else x :: take (minus_nat n one_nat) xs);++fun map_of A_ [] k = NONE+ | map_of A_ ((l, v) :: ps) k = (if eq A_ l k then SOME v else map_of A_ ps k);++fun removeAll A_ x [] = []+ | removeAll A_ x (y :: xs) =+ (if eq A_ x y then removeAll A_ x xs else y :: removeAll A_ x xs);++fun membera A_ [] y = false+ | membera A_ (x :: xs) y = eq A_ x y orelse membera A_ xs y;++fun inserta A_ x xs = (if membera A_ xs x then xs else x :: xs);++fun insert A_ x (Set xs) = Set (inserta A_ x xs)+ | insert A_ x (Coset xs) = Coset (removeAll A_ x xs);++fun member A_ x (Set xs) = membera A_ xs x+ | member A_ x (Coset xs) = not (membera A_ xs x);++fun pi u = Tm (Iri u);++fun butlast [] = []+ | butlast (x :: xs) = (if null xs then [] else x :: butlast xs);++fun hd (x21 :: x22) = x21;++fun tl [] = []+ | tl (x21 :: x22) = x22;++fun remdups A_ [] = []+ | remdups A_ (x :: xs) =+ (if membera A_ xs x then remdups A_ xs else x :: remdups A_ xs);++fun distinct A_ [] = true+ | distinct A_ (x :: xs) = not (membera A_ xs x) andalso distinct A_ xs;++fun map f [] = []+ | map f (x21 :: x22) = f x21 :: map f x22;++fun ipat beta (Tm c) = SOME c+ | ipat beta (V x) = map_of (equal_list equal_char) beta x;++fun length_tailrec [] n = n+ | length_tailrec (x :: xs) n = length_tailrec xs (suc n);++fun size_list xs = length_tailrec xs zero_nat;++fun less_eq_nat m n = IntInf.<= (integer_of_nat m, integer_of_nat n);++fun nat_of_integer k = Nat (max ord_integer (0 : IntInf.int) k);++fun parse_term s =+ (if not (null s) andalso+ (equal_chara (hd s)+ (Chara (false, false, true, true, true, true, false, false)) andalso+ (equal_chara (last s)+ (Chara (false, true, true, true, true, true, false, false)) andalso+ less_eq_nat (nat_of_integer (2 : IntInf.int)) (size_list s)))+ then Iri (butlast (tl s))+ else (if equal_lista equal_char (take (nat_of_integer (2 : IntInf.int)) s)+ [Chara (true, true, true, true, true, false, true, false),+ Chara (false, true, false, true, true, true, false, false)]+ then Bnode (drop (nat_of_integer (2 : IntInf.int)) s) else Lit s));++fun parse_pat s =+ (if not (null s) andalso+ equal_chara (hd s)+ (Chara (true, true, true, true, true, true, false, false))+ then V (tl s) else Tm (parse_term s));++fun mk_pt f = let+ val (a, (b, c)) = f;+ in+ (parse_pat a, (parse_pat b, parse_pat c))+ end;++fun mk_tr f = let+ val (a, (b, c)) = f;+ in+ (parse_term a, (parse_term b, parse_term c))+ end;++fun is_none NONE = true+ | is_none (SOME x) = false;++fun group2 [] = SOME []+ | group2 [x] = NONE+ | group2 (a :: b :: r) =+ (case group2 r of NONE => NONE | SOME ts => SOME ((a, b) :: ts));++fun group3 [] = SOME []+ | group3 [x] = NONE+ | group3 [x, y] = NONE+ | group3 (a :: b :: c :: r) =+ (case group3 r of NONE => NONE | SOME ts => SOME ((a, (b, c)) :: ts));++fun tr3_of fs =+ (if equal_nat (size_list fs) (nat_of_integer (3 : IntInf.int))+ then SOME (mk_tr+ (nth fs zero_nat,+ (nth fs one_nat, nth fs (nat_of_integer (2 : IntInf.int)))))+ else NONE);++fun sconcl (Hstep_ext (sidx, sbind, sconcl, sprem, more)) = sconcl;++fun equal_option A_ NONE (SOME x2) = false+ | equal_option A_ (SOME x2) NONE = false+ | equal_option A_ (SOME x2) (SOME y2) = eq A_ x2 y2+ | equal_option A_ NONE NONE = true;++fun premises_known k j [] = NONE+ | premises_known k j (p :: ps) =+ (if member+ (equal_prod equal_rdf_term (equal_prod equal_rdf_term equal_rdf_term))+ p k+ then premises_known k (suc j) ps else SOME (R_premise_unknown j));++fun pat_vars1 (V x) = [x]+ | pat_vars1 (Tm uu) = [];++fun pat_var_list (s, (p, q)) = pat_vars1 s @ pat_vars1 p @ pat_vars1 q;++fun rhead (Hrule_ext (rname, rbody, rhead, more)) = rhead;++fun rbody (Hrule_ext (rname, rbody, rhead, more)) = rbody;++fun rule_var_list r =+ remdups (equal_list equal_char) (maps pat_var_list (rbody r @ [rhead r]));++fun list_all p [] = true+ | list_all p (x :: xs) = p x andalso list_all p xs;++fun binding_covers beta r =+ list_all (fn v => not (is_none (map_of (equal_list equal_char) beta v)))+ (rule_var_list r);++fun fst (x1, x2) = x1;++fun sprem (Hstep_ext (sidx, sbind, sconcl, sprem, more)) = sprem;++fun sbind (Hstep_ext (sidx, sbind, sconcl, sprem, more)) = sbind;++fun sidx (Hstep_ext (sidx, sbind, sconcl, sprem, more)) = sidx;++fun iptriple beta tp =+ let+ val (s, (p, q)) = tp;+ in+ (case ipat beta s of NONE => NONE+ | SOME a =>+ (case ipat beta p of NONE => NONE+ | SOME b =>+ (case ipat beta q of NONE => NONE | SOME c => SOME (a, (b, c)))))+ end;++fun body_strict beta j [] [] = NONE+ | body_strict beta j [] (p :: ps) = SOME R_arity_mismatch+ | body_strict beta j (b :: bs) [] = SOME R_arity_mismatch+ | body_strict beta j (b :: bs) (p :: ps) =+ (if equal_option+ (equal_prod equal_rdf_term (equal_prod equal_rdf_term equal_rdf_term))+ (iptriple beta b) (SOME p)+ then body_strict beta (suc j) bs ps else SOME (R_body_mismatch j));++fun check_step r k s =+ (if less_eq_nat (size_list r) (sidx s) then SOME R_index_out_of_range+ else let+ val ra = nth r (sidx s);+ val b = sbind s;+ in+ (if not (distinct (equal_list equal_char) (map fst b))+ then SOME R_binding_dup_key+ else (if not (binding_covers b ra) then SOME R_binding_incomplete+ else (case body_strict b zero_nat (rbody ra) (sprem s)+ of NONE =>+ (case premises_known k zero_nat (sprem s)+ of NONE =>+ (if equal_option+ (equal_prod equal_rdf_term+ (equal_prod equal_rdf_term equal_rdf_term))+ (iptriple b (rhead ra)) (SOME (sconcl s))+ then NONE else SOME R_head_mismatch)+ | SOME a => SOME a)+ | SOME a => SOME a)))+ end);++fun check_from r k j [] = NONE+ | check_from r k j (s :: ss) =+ (case check_step r k s+ of NONE =>+ check_from r+ (insert+ (equal_prod equal_rdf_term+ (equal_prod equal_rdf_term equal_rdf_term))+ (sconcl s) k)+ (suc j) ss+ | SOME e => SOME (j, e));++fun check_cert r g ss = check_from r (Set g) zero_nat ss;++fun accepts r g ss = is_none (check_cert r g ss);++val rdfs_domain : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, false, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (false, false, false, true, false, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (true, false, false, true, false, true, true, false),+ Chara (false, true, true, true, false, true, true, false)];++val rdf_type : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, false, false, false, true, true, false, false),+ Chara (true, false, false, true, true, true, false, false),+ Chara (true, false, false, true, true, true, false, false),+ Chara (true, false, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, false, true, true, true, true, false),+ Chara (false, true, true, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (false, false, false, true, true, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (false, true, true, true, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (true, false, false, true, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, true, false, false, true, true, false)];++val r_rdfs2 : unit hrule_ext =+ Hrule_ext+ ([Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ [(V [Chara (true, true, false, false, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (true, true, true, true, false, true, true, false)])),+ (V [Chara (false, false, false, false, true, true, true, false)],+ (pi rdfs_domain,+ V [Chara (true, true, false, false, false, true, true, false)]))],+ (V [Chara (true, true, false, false, true, true, true, false)],+ (pi rdf_type,+ V [Chara (true, true, false, false, false, true, true, false)])),+ ());++val rdfs_range : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, false, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (false, false, false, true, false, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (false, true, true, true, false, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, false, true, false, false, true, true, false)];++val r_rdfs3 : unit hrule_ext =+ Hrule_ext+ ([Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false)],+ [(V [Chara (true, true, false, false, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (true, true, true, true, false, true, true, false)])),+ (V [Chara (false, false, false, false, true, true, true, false)],+ (pi rdfs_range,+ V [Chara (true, true, false, false, false, true, true, false)]))],+ (V [Chara (true, true, true, true, false, true, true, false)],+ (pi rdf_type,+ V [Chara (true, true, false, false, false, true, true, false)])),+ ());++val rdfs_subPropertyOf : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, false, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (false, false, false, true, false, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, true, false, true, true, true, false),+ Chara (false, true, false, false, false, true, true, false),+ Chara (false, false, false, false, true, false, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (true, false, false, true, true, true, true, false),+ Chara (true, true, true, true, false, false, true, false),+ Chara (false, true, true, false, false, true, true, false)];++val r_rdfs5 : unit hrule_ext =+ Hrule_ext+ ([Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, true, false, true, true, false, false)],+ [(V [Chara (true, false, false, false, false, true, true, false)],+ (pi rdfs_subPropertyOf,+ V [Chara (false, true, false, false, false, true, true, false)])),+ (V [Chara (false, true, false, false, false, true, true, false)],+ (pi rdfs_subPropertyOf,+ V [Chara (true, true, false, false, false, true, true, false)]))],+ (V [Chara (true, false, false, false, false, true, true, false)],+ (pi rdfs_subPropertyOf,+ V [Chara (true, true, false, false, false, true, true, false)])),+ ());++val r_rdfs7 : unit hrule_ext =+ Hrule_ext+ ([Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, true, false, true, true, false, false)],+ [(V [Chara (true, true, false, false, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (true, true, true, true, false, true, true, false)])),+ (V [Chara (false, false, false, false, true, true, true, false)],+ (pi rdfs_subPropertyOf,+ V [Chara (true, false, false, false, true, true, true, false)]))],+ (V [Chara (true, true, false, false, true, true, true, false)],+ (V [Chara (true, false, false, false, true, true, true, false)],+ V [Chara (true, true, true, true, false, true, true, false)])),+ ());++val rdfs_subClassOf : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, false, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (false, false, false, true, false, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, true, false, true, true, true, false),+ Chara (false, true, false, false, false, true, true, false),+ Chara (true, true, false, false, false, false, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, true, true, false, false, true, false),+ Chara (false, true, true, false, false, true, true, false)];++val r_rdfs9 : unit hrule_ext =+ Hrule_ext+ ([Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, false, true, true, true, false, false)],+ [(V [Chara (false, false, false, true, true, true, true, false)],+ (pi rdf_type,+ V [Chara (true, false, false, false, false, true, true, false)])),+ (V [Chara (true, false, false, false, false, true, true, false)],+ (pi rdfs_subClassOf,+ V [Chara (false, true, false, false, false, true, true, false)]))],+ (V [Chara (false, false, false, true, true, true, true, false)],+ (pi rdf_type,+ V [Chara (false, true, false, false, false, true, true, false)])),+ ());++fun pat3_of fs =+ (if equal_nat (size_list fs) (nat_of_integer (3 : IntInf.int))+ then SOME (mk_pt+ (nth fs zero_nat,+ (nth fs one_nat, nth fs (nat_of_integer (2 : IntInf.int)))))+ else NONE);++fun seq_opt [] = SOME []+ | seq_opt (x :: xs) =+ (case x of NONE => NONE+ | SOME v =>+ (case seq_opt xs of NONE => NONE | SOME vs => SOME (v :: vs)));++val owl_sameAs : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, false, false, false, false, false, true, false),+ Chara (true, true, false, false, true, true, true, false)];++val r_eq_sym : unit hrule_ext =+ Hrule_ext+ ([Chara (true, false, true, false, false, true, true, false),+ Chara (true, false, false, false, true, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, false, true, true, true, true, false),+ Chara (true, false, true, true, false, true, true, false)],+ [(V [Chara (true, false, false, false, false, true, true, false)],+ (pi owl_sameAs,+ V [Chara (false, true, false, false, false, true, true, false)]))],+ (V [Chara (false, true, false, false, false, true, true, false)],+ (pi owl_sameAs,+ V [Chara (true, false, false, false, false, true, true, false)])),+ ());++val r_rdfs11 : unit hrule_ext =+ Hrule_ext+ ([Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false),+ Chara (true, false, false, false, true, true, false, false)],+ [(V [Chara (true, false, false, false, false, true, true, false)],+ (pi rdfs_subClassOf,+ V [Chara (false, true, false, false, false, true, true, false)])),+ (V [Chara (false, true, false, false, false, true, true, false)],+ (pi rdfs_subClassOf,+ V [Chara (true, true, false, false, false, true, true, false)]))],+ (V [Chara (true, false, false, false, false, true, true, false)],+ (pi rdfs_subClassOf,+ V [Chara (true, true, false, false, false, true, true, false)])),+ ());++fun of_bool A_ false = zero (zero_zero_neq_one A_)+ | of_bool A_ true = one (one_zero_neq_one A_);++fun integer_of_char (Chara (b0, b1, b2, b3, b4, b5, b6, b7)) =+ IntInf.+ (IntInf.* (IntInf.+ (IntInf.* (IntInf.+ (IntInf.* (IntInf.+ (IntInf.* (IntInf.+ (IntInf.* (IntInf.+ (IntInf.* (IntInf.+ (IntInf.* (of_bool+ zero_neq_one_integer+ b7, (2 : IntInf.int)), of_bool zero_neq_one_integer+ b6), (2 : IntInf.int)), of_bool zero_neq_one_integer+ b5), (2 : IntInf.int)), of_bool+ zero_neq_one_integer+ b4), (2 : IntInf.int)), of_bool zero_neq_one_integer+ b3), (2 : IntInf.int)), of_bool zero_neq_one_integer+ b2), (2 : IntInf.int)), of_bool+ zero_neq_one_integer+ b1), (2 : IntInf.int)), of_bool zero_neq_one_integer b0);++fun nat_of_char c = Nat (integer_of_char c);++fun digit_of c =+ let+ val k = nat_of_char c;+ in+ (if less_eq_nat (nat_of_integer (48 : IntInf.int)) k andalso+ less_eq_nat k (nat_of_integer (57 : IntInf.int))+ then SOME (minus_nat k (nat_of_integer (48 : IntInf.int))) else NONE)+ end;++val owl_allValuesFrom : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (false, true, true, false, true, false, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, false, true, false, true, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (false, true, true, false, false, false, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false)];++val owl_onProperty : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, true, true, false, true, true, false),+ Chara (false, false, false, false, true, false, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (true, false, false, true, true, true, true, false)];++val r_cls_avf : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, false, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (false, true, true, false, false, true, true, false)],+ [(V [Chara (false, true, false, false, true, true, true, false)],+ (pi owl_onProperty,+ V [Chara (false, false, false, false, true, true, true, false)])),+ (V [Chara (false, true, false, false, true, true, true, false)],+ (pi owl_allValuesFrom,+ V [Chara (true, true, false, false, false, true, true, false)])),+ (V [Chara (false, false, false, true, true, true, true, false)],+ (pi rdf_type,+ V [Chara (false, true, false, false, true, true, true, false)])),+ (V [Chara (false, false, false, true, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (true, false, false, true, true, true, true, false)]))],+ (V [Chara (true, false, false, true, true, true, true, false)],+ (pi rdf_type,+ V [Chara (true, true, false, false, false, true, true, false)])),+ ());++val owl_hasValue : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (false, false, false, true, false, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (false, true, true, false, true, false, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, false, true, false, true, true, true, false),+ Chara (true, false, true, false, false, true, true, false)];++val r_cls_hv1 : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, false, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (false, false, false, true, false, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ [(V [Chara (false, true, false, false, true, true, true, false)],+ (pi owl_onProperty,+ V [Chara (false, false, false, false, true, true, true, false)])),+ (V [Chara (false, true, false, false, true, true, true, false)],+ (pi owl_hasValue,+ V [Chara (false, true, true, false, true, true, true, false)])),+ (V [Chara (false, false, false, true, true, true, true, false)],+ (pi rdf_type,+ V [Chara (false, true, false, false, true, true, true, false)]))],+ (V [Chara (false, false, false, true, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (false, true, true, false, true, true, true, false)])),+ ());++val r_cls_hv2 : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, false, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (false, false, false, true, false, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ [(V [Chara (false, true, false, false, true, true, true, false)],+ (pi owl_onProperty,+ V [Chara (false, false, false, false, true, true, true, false)])),+ (V [Chara (false, true, false, false, true, true, true, false)],+ (pi owl_hasValue,+ V [Chara (false, true, true, false, true, true, true, false)])),+ (V [Chara (false, false, false, true, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (false, true, true, false, true, true, true, false)]))],+ (V [Chara (false, false, false, true, true, true, true, false)],+ (pi rdf_type,+ V [Chara (false, true, false, false, true, true, true, false)])),+ ());++val owl_TransitiveProperty : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (false, false, true, false, true, false, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (false, true, true, true, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (true, false, false, true, false, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (false, false, false, false, true, false, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (true, false, false, true, true, true, true, false)];++val r_prp_trp : unit hrule_ext =+ Hrule_ext+ ([Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false)],+ [(V [Chara (false, false, false, false, true, true, true, false)],+ (pi rdf_type, pi owl_TransitiveProperty)),+ (V [Chara (false, false, false, true, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (true, false, false, true, true, true, true, false)])),+ (V [Chara (true, false, false, true, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (false, true, false, true, true, true, true, false)]))],+ (V [Chara (false, false, false, true, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (false, true, false, true, true, true, true, false)])),+ ());++fun times_nat m n = Nat (IntInf.* (integer_of_nat m, integer_of_nat n));++fun parse_nat_acc acc [] = SOME acc+ | parse_nat_acc acc (c :: cs) =+ (case digit_of c of NONE => NONE+ | SOME d =>+ parse_nat_acc+ (plus_nat (times_nat acc (nat_of_integer (10 : IntInf.int))) d) cs);++fun parse_nat s = (if null s then NONE else parse_nat_acc zero_nat s);++fun less_nat m n = IntInf.< (integer_of_nat m, integer_of_nat n);++fun parse_rule_row fs =+ (if less_nat (size_list fs) (nat_of_integer (5 : IntInf.int)) then NONE+ else (case parse_nat (nth fs one_nat) of NONE => NONE+ | SOME n =>+ (if not (equal_nat (size_list fs)+ (plus_nat (nat_of_integer (5 : IntInf.int))+ (times_nat (nat_of_integer (3 : IntInf.int)) n)))+ then NONE+ else (case group3+ (take (times_nat (nat_of_integer (3 : IntInf.int))+ n)+ (drop (nat_of_integer (2 : IntInf.int)) fs))+ of NONE => NONE+ | SOME bs =>+ (case pat3_of+ (drop (plus_nat+(nat_of_integer (2 : IntInf.int))+(times_nat (nat_of_integer (3 : IntInf.int)) n))+ fs)+ of NONE => NONE+ | SOME h =>+ SOME (Hrule_ext+ (nth fs zero_nat, map mk_pt bs, h, ())))))));++fun parse_rules ls = seq_opt (map parse_rule_row ls);++fun parse_graph_row fs = tr3_of fs;++fun parse_graph ls = seq_opt (map parse_graph_row ls);++fun snd (x1, x2) = x2;++fun parse_cert_row fs =+ (if less_nat (size_list fs) (nat_of_integer (5 : IntInf.int)) then NONE+ else (case parse_nat (nth fs zero_nat) of NONE => NONE+ | SOME i =>+ (case parse_nat (nth fs one_nat) of NONE => NONE+ | SOME k =>+ (if less_nat (size_list fs)+ (plus_nat (nat_of_integer (5 : IntInf.int))+ (times_nat (nat_of_integer (2 : IntInf.int)) k))+ then NONE+ else (case group2+ (take (times_nat+(nat_of_integer (2 : IntInf.int)) k)+ (drop (nat_of_integer (2 : IntInf.int)) fs))+ of NONE => NONE+ | SOME bp =>+ (case tr3_of+ (take (nat_of_integer (3 : IntInf.int))+ (drop+(plus_nat (nat_of_integer (2 : IntInf.int))+ (times_nat (nat_of_integer (2 : IntInf.int)) k))+fs))+ of NONE => NONE+ | SOME c =>+ (case group3+(drop (plus_nat (nat_of_integer (5 : IntInf.int))+ (times_nat (nat_of_integer (2 : IntInf.int)) k))+ fs)+ of NONE => NONE+ | SOME ps =>+ SOME (Hstep_ext+ (i, map (fn q => (fst q, parse_term (snd q))) bp, c, map mk_tr ps,+ ())))))))));++fun parse_cert ls = seq_opt (map parse_cert_row ls);++val owl_equivalentProperty : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, false, false, false, true, true, true, false),+ Chara (true, false, true, false, true, true, true, false),+ Chara (true, false, false, true, false, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (false, true, true, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, false, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (true, false, false, true, true, true, true, false)];++val r_scm_eqp1b : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, false, false, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ [(V [Chara (true, false, false, false, false, true, true, false)],+ (pi owl_equivalentProperty,+ V [Chara (false, true, false, false, false, true, true, false)]))],+ (V [Chara (false, true, false, false, false, true, true, false)],+ (pi rdfs_subPropertyOf,+ V [Chara (true, false, false, false, false, true, true, false)])),+ ());++val r_scm_eqp1a : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, false, false, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ [(V [Chara (true, false, false, false, false, true, true, false)],+ (pi owl_equivalentProperty,+ V [Chara (false, true, false, false, false, true, true, false)]))],+ (V [Chara (true, false, false, false, false, true, true, false)],+ (pi rdfs_subPropertyOf,+ V [Chara (false, true, false, false, false, true, true, false)])),+ ());++val owl_equivalentClass : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, false, false, false, true, true, true, false),+ Chara (true, false, true, false, true, true, true, false),+ Chara (true, false, false, true, false, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (false, true, true, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (true, true, false, false, false, false, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, true, true, true, false)];++val r_scm_eqc1b : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, false, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ [(V [Chara (true, false, false, false, false, true, true, false)],+ (pi owl_equivalentClass,+ V [Chara (false, true, false, false, false, true, true, false)]))],+ (V [Chara (false, true, false, false, false, true, true, false)],+ (pi rdfs_subClassOf,+ V [Chara (true, false, false, false, false, true, true, false)])),+ ());++val r_scm_eqc1a : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, false, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ [(V [Chara (true, false, false, false, false, true, true, false)],+ (pi owl_equivalentClass,+ V [Chara (false, true, false, false, false, true, true, false)]))],+ (V [Chara (true, false, false, false, false, true, true, false)],+ (pi rdfs_subClassOf,+ V [Chara (false, true, false, false, false, true, true, false)])),+ ());++val owl_someValuesFrom : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (false, true, true, false, true, false, true, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, false, true, false, true, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (false, true, true, false, false, false, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false)];++val r_scm_svf2 : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ [(V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi owl_someValuesFrom,+ V [Chara (true, false, false, true, true, true, true, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi owl_onProperty,+ V [Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ (pi owl_someValuesFrom,+ V [Chara (true, false, false, true, true, true, true, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ (pi owl_onProperty,+ V [Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)])),+ (V [Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi rdfs_subPropertyOf,+ V [Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)]))],+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi rdfs_subClassOf,+ V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)])),+ ());++val r_scm_svf1 : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ [(V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi owl_someValuesFrom,+ V [Chara (true, false, false, true, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi owl_onProperty,+ V [Chara (false, false, false, false, true, true, true, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ (pi owl_someValuesFrom,+ V [Chara (true, false, false, true, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ (pi owl_onProperty,+ V [Chara (false, false, false, false, true, true, true, false)])),+ (V [Chara (true, false, false, true, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi rdfs_subClassOf,+ V [Chara (true, false, false, true, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)]))],+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi rdfs_subClassOf,+ V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)])),+ ());++val r_scm_rng2 : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, true, true, true, false, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ [(V [Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ (pi rdfs_range,+ V [Chara (true, true, false, false, false, true, true, false)])),+ (V [Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi rdfs_subPropertyOf,+ V [Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)]))],+ (V [Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi rdfs_range,+ V [Chara (true, true, false, false, false, true, true, false)])),+ ());++val r_scm_rng1 : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, true, true, true, false, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ [(V [Chara (false, false, false, false, true, true, true, false)],+ (pi rdfs_range,+ V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi rdfs_subClassOf,+ V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)]))],+ (V [Chara (false, false, false, false, true, true, true, false)],+ (pi rdfs_range,+ V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)])),+ ());++val r_scm_dom2 : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ [(V [Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ (pi rdfs_domain,+ V [Chara (true, true, false, false, false, true, true, false)])),+ (V [Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi rdfs_subPropertyOf,+ V [Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)]))],+ (V [Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi rdfs_domain,+ V [Chara (true, true, false, false, false, true, true, false)])),+ ());++val r_scm_dom1 : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (false, false, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ [(V [Chara (false, false, false, false, true, true, true, false)],+ (pi rdfs_domain,+ V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi rdfs_subClassOf,+ V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)]))],+ (V [Chara (false, false, false, false, true, true, true, false)],+ (pi rdfs_domain,+ V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)])),+ ());++val r_scm_avf2 : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ [(V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi owl_allValuesFrom,+ V [Chara (true, false, false, true, true, true, true, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi owl_onProperty,+ V [Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ (pi owl_allValuesFrom,+ V [Chara (true, false, false, true, true, true, true, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ (pi owl_onProperty,+ V [Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)])),+ (V [Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi rdfs_subPropertyOf,+ V [Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)]))],+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ (pi rdfs_subClassOf,+ V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)])),+ ());++val r_scm_avf1 : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, true, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, false, false, false, false, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ [(V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi owl_allValuesFrom,+ V [Chara (true, false, false, true, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi owl_onProperty,+ V [Chara (false, false, false, false, true, true, true, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ (pi owl_allValuesFrom,+ V [Chara (true, false, false, true, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)])),+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ (pi owl_onProperty,+ V [Chara (false, false, false, false, true, true, true, false)])),+ (V [Chara (true, false, false, true, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi rdfs_subClassOf,+ V [Chara (true, false, false, true, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)]))],+ (V [Chara (true, true, false, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ (pi rdfs_subClassOf,+ V [Chara (true, true, false, false, false, true, true, false),+ Chara (false, true, false, false, true, true, false, false)])),+ ());++val owl_SymmetricProperty : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (true, true, false, false, true, false, true, false),+ Chara (true, false, false, true, true, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, false, false, true, false, true, true, false),+ Chara (true, true, false, false, false, true, true, false),+ Chara (false, false, false, false, true, false, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (true, false, false, true, true, true, true, false)];++val r_prp_symp : unit hrule_ext =+ Hrule_ext+ ([Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, false, true, true, true, true, false),+ Chara (true, false, true, true, false, true, true, false),+ Chara (false, false, false, false, true, true, true, false)],+ [(V [Chara (false, false, false, false, true, true, true, false)],+ (pi rdf_type, pi owl_SymmetricProperty)),+ (V [Chara (false, false, false, true, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (true, false, false, true, true, true, true, false)]))],+ (V [Chara (true, false, false, true, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (false, false, false, true, true, true, true, false)])),+ ());++val owl_inverseOf : char list =+ [Chara (false, false, false, true, false, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, true, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, true, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (true, true, false, false, true, true, false, false),+ Chara (false, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, true, false, false, true, true, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (false, true, false, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (false, false, false, false, true, true, false, false),+ Chara (true, true, true, false, true, true, false, false),+ Chara (true, true, true, true, false, true, false, false),+ Chara (true, true, true, true, false, true, true, false),+ Chara (true, true, true, false, true, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, false, true, false, false),+ Chara (true, false, false, true, false, true, true, false),+ Chara (false, true, true, true, false, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, true, false, false, true, true, false),+ Chara (true, true, true, true, false, false, true, false),+ Chara (false, true, true, false, false, true, true, false)];++val r_prp_inv2 : unit hrule_ext =+ Hrule_ext+ ([Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, false, false, true, false, true, true, false),+ Chara (false, true, true, true, false, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (false, true, false, false, true, true, false, false)],+ [(V [Chara (false, false, false, false, true, true, true, false)],+ (pi owl_inverseOf,+ V [Chara (true, false, false, false, true, true, true, false)])),+ (V [Chara (false, false, false, true, true, true, true, false)],+ (V [Chara (true, false, false, false, true, true, true, false)],+ V [Chara (true, false, false, true, true, true, true, false)]))],+ (V [Chara (true, false, false, true, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (false, false, false, true, true, true, true, false)])),+ ());++val r_prp_inv1 : unit hrule_ext =+ Hrule_ext+ ([Chara (false, false, false, false, true, true, true, false),+ Chara (false, true, false, false, true, true, true, false),+ Chara (false, false, false, false, true, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, false, false, true, false, true, true, false),+ Chara (false, true, true, true, false, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ [(V [Chara (false, false, false, false, true, true, true, false)],+ (pi owl_inverseOf,+ V [Chara (true, false, false, false, true, true, true, false)])),+ (V [Chara (false, false, false, true, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (true, false, false, true, true, true, true, false)]))],+ (V [Chara (true, false, false, true, true, true, true, false)],+ (V [Chara (true, false, false, false, true, true, true, false)],+ V [Chara (false, false, false, true, true, true, true, false)])),+ ());++val r_cls_svf1 : unit hrule_ext =+ Hrule_ext+ ([Chara (true, true, false, false, false, true, true, false),+ Chara (false, false, true, true, false, true, true, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (true, false, true, true, false, true, false, false),+ Chara (true, true, false, false, true, true, true, false),+ Chara (false, true, true, false, true, true, true, false),+ Chara (false, true, true, false, false, true, true, false),+ Chara (true, false, false, false, true, true, false, false)],+ [(V [Chara (false, true, false, false, true, true, true, false)],+ (pi owl_onProperty,+ V [Chara (false, false, false, false, true, true, true, false)])),+ (V [Chara (false, true, false, false, true, true, true, false)],+ (pi owl_someValuesFrom,+ V [Chara (true, true, false, false, false, true, true, false)])),+ (V [Chara (false, false, false, true, true, true, true, false)],+ (V [Chara (false, false, false, false, true, true, true, false)],+ V [Chara (true, false, false, true, true, true, true, false)])),+ (V [Chara (true, false, false, true, true, true, true, false)],+ (pi rdf_type,+ V [Chara (true, true, false, false, false, true, true, false)]))],+ (V [Chara (false, false, false, true, true, true, true, false)],+ (pi rdf_type,+ V [Chara (false, true, false, false, true, true, true, false)])),+ ());++val builtin_table : unit hrule_ext list =+ [r_rdfs2, r_rdfs3, r_rdfs5, r_rdfs7, r_rdfs9, r_rdfs11, r_prp_trp, r_prp_symp,+ r_prp_inv1, r_prp_inv2, r_eq_sym, r_scm_eqc1a, r_scm_eqc1b, r_scm_eqp1a,+ r_scm_eqp1b, r_cls_svf1, r_cls_avf, r_cls_hv1, r_cls_hv2, r_scm_svf1,+ r_scm_svf2, r_scm_avf1, r_scm_avf2, r_scm_dom1, r_scm_dom2, r_scm_rng1,+ r_scm_rng2];++fun verdict_of r =+ (if equal_lista (equal_hrule_ext equal_unit) r builtin_table then Entailed+ else EntailedUnderSuppliedRules);++fun run_check rl gl cl =+ (case parse_rules rl of NONE => ParseError+ | SOME r =>+ (case parse_graph gl of NONE => ParseError+ | SOME g =>+ (case parse_cert cl of NONE => ParseError+ | SOME c =>+ (case check_cert r g c of NONE => Ok (verdict_of r)+ | SOME (a, b) => Rejected (a, b)))));++fun bit_cut_integer k =+ (if ((k : IntInf.int) = (0 : IntInf.int)) then ((0 : IntInf.int), false)+ else let+ val (r, s) =+ IntInf.divMod (IntInf.abs k, IntInf.abs (2 : IntInf.int));+ in+ ((if IntInf.< ((0 : IntInf.int), k) then r+ else IntInf.- (IntInf.~ r, s)),+ ((s : IntInf.int) = (1 : IntInf.int)))+ end);++fun char_of_integer k = let+ val (q0, b0) = bit_cut_integer k;+ val (q1, b1) = bit_cut_integer q0;+ val (q2, b2) = bit_cut_integer q1;+ val (q3, b3) = bit_cut_integer q2;+ val (q4, b4) = bit_cut_integer q3;+ val (q5, b5) = bit_cut_integer q4;+ val (q6, b6) = bit_cut_integer q5;+ val (_, a) = bit_cut_integer q6;+ in+ Chara (b0, b1, b2, b3, b4, b5, b6, a)+ end;++fun char_of_nat x = (char_of_integer o integer_of_nat) x;++fun chr_of_nat n = char_of_nat n;++fun nat_of_chr c = nat_of_char c;++fun body_lenient beta k j [] = NONE+ | body_lenient beta k j (b :: bs) =+ (case iptriple beta b of NONE => SOME R_binding_incomplete+ | SOME t =>+ (if member+ (equal_prod equal_rdf_term+ (equal_prod equal_rdf_term equal_rdf_term))+ t k+ then body_lenient beta k (suc j) bs else SOME (R_premise_unknown j)));++fun check_step_lenient r k s =+ (if less_eq_nat (size_list r) (sidx s) then SOME R_index_out_of_range+ else let+ val ra = nth r (sidx s);+ val b = sbind s;+ in+ (case body_lenient b k zero_nat (rbody ra)+ of NONE =>+ (if equal_option+ (equal_prod equal_rdf_term+ (equal_prod equal_rdf_term equal_rdf_term))+ (iptriple b (rhead ra)) (SOME (sconcl s))+ then NONE else SOME R_head_mismatch)+ | SOME a => SOME a)+ end);++fun check_from_lenient r k j [] = NONE+ | check_from_lenient r k j (s :: ss) =+ (case check_step_lenient r k s+ of NONE =>+ check_from_lenient r+ (insert+ (equal_prod equal_rdf_term+ (equal_prod equal_rdf_term equal_rdf_term))+ (sconcl s) k)+ (suc j) ss+ | SOME e => SOME (j, e));++fun check_cert_lenient r g ss = check_from_lenient r (Set g) zero_nat ss;++fun run_check_lenient rl gl cl =+ (case parse_rules rl of NONE => ParseError+ | SOME r =>+ (case parse_graph gl of NONE => ParseError+ | SOME g =>+ (case parse_cert cl of NONE => ParseError+ | SOME c =>+ (case check_cert_lenient r g c of NONE => Ok (verdict_of r)+ | SOME (a, b) => Rejected (a, b)))));++end; (*struct OOHorn*)diff --git a/isabelle/export.sh b/isabelle/export.shnew file mode 100755index 00000000..f0ecba19--- /dev/null+++ b/isabelle/export.sh@@ -0,0 +1,13 @@+#!/bin/sh+# Regenerate driver/oo_horn_generated.ML from the verified theories.+set -e+HERE=$(cd "$(dirname "$0")" && pwd)+TMP=$(mktemp -d)+isabelle build -d "$HERE" -e OOHorn+isabelle export -d "$HERE" -x "OOHorn.OO_Export:code/oo_horn.ML" -O "$TMP" OOHorn+{ echo "(* GENERATED BY isabelle build -e FROM isabelle/OO_Export.thy -- DO NOT EDIT."+ echo " Regenerate with isabelle/export.sh. Isabelle2025-2, session OOHorn. *)"+ cat "$TMP/OOHorn.OO_Export/code/oo_horn.ML"+} > "$HERE/driver/oo_horn_generated.ML"+rm -rf "$TMP"+echo "wrote $HERE/driver/oo_horn_generated.ML"diff --git a/isabelle/fixtures-added/asserted_chain.tsv b/isabelle/fixtures-added/asserted_chain.tsvnew file mode 100644index 00000000..a9d5366d--- /dev/null+++ b/isabelle/fixtures-added/asserted_chain.tsv@@ -0,0 +1,3 @@+<http://ex.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ex.org/A>+<http://ex.org/A> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://ex.org/B>+<http://ex.org/B> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://ex.org/C>diff --git a/isabelle/fixtures-added/asserted_gen.tsv b/isabelle/fixtures-added/asserted_gen.tsvnew file mode 100644index 00000000..2a0c75dc--- /dev/null+++ b/isabelle/fixtures-added/asserted_gen.tsv@@ -0,0 +1,2 @@+<http://ex.org/x> <http://ex.org/p> <http://ex.org/y>+<http://ex.org/p> <http://www.w3.org/2000/01/rdf-schema#subPropertyOf> _:bqdiff --git a/isabelle/fixtures-added/bad_dup_key.tsv b/isabelle/fixtures-added/bad_dup_key.tsvnew file mode 100644index 00000000..1dd1c8aa--- /dev/null+++ b/isabelle/fixtures-added/bad_dup_key.tsv@@ -0,0 +1 @@+4 4 x <http://ex.org/a> x <http://ex.org/zzz> a <http://ex.org/A> b <http://ex.org/B> <http://ex.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ex.org/B> <http://ex.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ex.org/A> <http://ex.org/A> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://ex.org/B>diff --git a/isabelle/fixtures-added/bad_order.tsv b/isabelle/fixtures-added/bad_order.tsvnew file mode 100644index 00000000..e0a9b556--- /dev/null+++ b/isabelle/fixtures-added/bad_order.tsv@@ -0,0 +1 @@+4 3 x <http://ex.org/a> a <http://ex.org/A> b <http://ex.org/B> <http://ex.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ex.org/B> <http://ex.org/A> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://ex.org/B> <http://ex.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ex.org/A>diff --git a/isabelle/fixtures-added/bad_self_chain.tsv b/isabelle/fixtures-added/bad_self_chain.tsvnew file mode 100644index 00000000..988c3a94--- /dev/null+++ b/isabelle/fixtures-added/bad_self_chain.tsv@@ -0,0 +1,2 @@+4 3 x <http://ex.org/a> a <http://ex.org/B> b <http://ex.org/C> <http://ex.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ex.org/C> <http://ex.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ex.org/B> <http://ex.org/B> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://ex.org/C>+4 3 x <http://ex.org/a> a <http://ex.org/A> b <http://ex.org/B> <http://ex.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ex.org/B> <http://ex.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ex.org/A> <http://ex.org/A> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://ex.org/B>diff --git a/isabelle/fixtures-added/generalized.tsv b/isabelle/fixtures-added/generalized.tsvnew file mode 100644index 00000000..e8698e8f--- /dev/null+++ b/isabelle/fixtures-added/generalized.tsv@@ -0,0 +1 @@+3 4 s <http://ex.org/x> p <http://ex.org/p> o <http://ex.org/y> q _:bq <http://ex.org/x> _:bq <http://ex.org/y> <http://ex.org/x> <http://ex.org/p> <http://ex.org/y> <http://ex.org/p> <http://www.w3.org/2000/01/rdf-schema#subPropertyOf> _:bqdiff --git a/isabelle/fixtures-added/good_chain.tsv b/isabelle/fixtures-added/good_chain.tsvnew file mode 100644index 00000000..e9bfe156--- /dev/null+++ b/isabelle/fixtures-added/good_chain.tsv@@ -0,0 +1,2 @@+4 3 x <http://ex.org/a> a <http://ex.org/A> b <http://ex.org/B> <http://ex.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ex.org/B> <http://ex.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ex.org/A> <http://ex.org/A> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://ex.org/B>+4 3 x <http://ex.org/a> a <http://ex.org/B> b <http://ex.org/C> <http://ex.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ex.org/C> <http://ex.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ex.org/B> <http://ex.org/B> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://ex.org/C>diff --git a/isabelle/run_checker.sh b/isabelle/run_checker.shnew file mode 100755index 00000000..87a130c8--- /dev/null+++ b/isabelle/run_checker.sh@@ -0,0 +1,31 @@+#!/bin/sh+# Run the verified checker.+# usage: run_checker.sh RULES.tsv ASSERTED.tsv CERT.tsv+# Exit 0 = accepted, 1 = rejected, 2 = parse error, 3 = usage or no Poly/ML.+#+# stdout is exactly one JSON object carrying BOTH the strict and the lenient verdict+# (see the comments on conflict C11 in OO_Check.thy). A differential test should+# compare the accept/reject bit and the verdict word as primary, and the reason and the+# exit code as secondary with a declared tolerance.+#+# Poly/ML prints compiler warnings about the GENERATED code to stdout; they are filtered+# out here. Set OO_VERBOSE=1 to see everything.+HERE=$(cd "$(dirname "$0")" && pwd)+POLY=${POLY:-$(ls -d /Applications/Isabelle*.app/contrib/polyml-*/*/poly 2>/dev/null | head -1)}+[ -x "$POLY" ] || { echo "poly not found; set POLY=/path/to/poly" >&2; exit 3; }+[ $# -eq 3 ] || { echo "usage: $0 RULES.tsv ASSERTED.tsv CERT.tsv" >&2; exit 3; }++if [ -n "$OO_VERBOSE" ]; then+ OO_RULES="$1" OO_ASSERTED="$2" OO_CERT="$3" \+ exec "$POLY" -q --use "$HERE/driver/oo_horn_generated.ML" \+ --use "$HERE/driver/oo_horn_driver.sml" --eval 'mainEnv ()'+fi++TMP=$(mktemp "${TMPDIR:-/tmp}/oo_horn.XXXXXX")+OO_RULES="$1" OO_ASSERTED="$2" OO_CERT="$3" \+"$POLY" -q --use "$HERE/driver/oo_horn_generated.ML" \+ --use "$HERE/driver/oo_horn_driver.sml" --eval 'mainEnv ()' >"$TMP" 2>/dev/null+code=$?+grep '^{"rules"' "$TMP" || { echo "no report produced; rerun with OO_VERBOSE=1" >&2; code=3; }+rm -f "$TMP"+exit $code