<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <issn pub-type="ppub">1613-0073</issn>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Reasoner for ℰ ℒ++</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Atalay Mert Ileri</string-name>
          <email>atalay@ksu.edu</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Hande Küçük McGinty</string-name>
          <email>hande@ksu.edu</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Kansas State University, Department of Computer Science</institution>
          ,
          <addr-line>Koncordant Lab, Manhattan, KS 66503</addr-line>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2024</year>
      </pub-date>
      <fpage>13</fpage>
      <lpage>15</lpage>
      <abstract>
        <p>Over the past two decades, the Web Ontology Language (OWL) has been instrumental in advancing the development of ontologies and knowledge graphs, providing a structured framework that enhances the semantic integration of data. However, the reliability of deductive reasoning within these systems remains challenging, as evidenced by inconsistencies among popular reasoners in competitions. This evidence underscores the limitations of current testing-based methodologies, particularly in high-stakes domains such as healthcare. To mitigate these issues, in this study, we have developed VEL, a formally verified ℰ ℒ++ reasoner equipped with machine-checkable correctness proofs that ensure the validity of outputs across all possible inputs. This formalization, based on the algorithm of Baader et al.[1], has been transformed into executable OCaml code using the Coq proof assistant's extraction capabilities. In addition to producing a correct implementation, our work uncovered two errors in the published completeness proof that required a modification to the original algorithm.</p>
      </abstract>
      <kwd-group>
        <kwd>verified reasoner</kwd>
        <kwd>reasoning</kwd>
        <kwd>formal verification</kwd>
        <kwd>knowledge graph</kwd>
        <kwd>trustworthy AI</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>CEUR
ceur-ws.org</p>
    </sec>
    <sec id="sec-2">
      <title>1. Introduction</title>
      <p>
        Knowledge graphs and ontologies can integrate diverse data sources semantically rigorously,
adhering to well-established W3C standards [
        <xref ref-type="bibr" rid="ref2 ref3">2, 3</xref>
        ]. They bridge human conceptualization and
machine understanding and provide a robust standard for recording provenance [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], making
results drawn from them inherently explainable and interpretable. However, continuous eforts
for a more reliable reasoning need to be established by the semantic web community [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
Reasoners are a group of software that are used to reach logical conclusions using knowledge
graphs and ontologies. However, like any other software system, the reasoner implementations
are susceptible to software bugs that undermine their correctness [
        <xref ref-type="bibr" rid="ref10 ref11 ref12 ref13 ref6 ref7 ref8 ref9">6, 7, 8, 9, 10, 11, 12, 13</xref>
        ]. A
competition from 2015 for reasoners showed that some of the widely used reasoners contain
bugs since the results of the diferent reasoners did not agree [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. This result, combined
with the increased usage of AI in critical domains like healthcare, shows that testing-based
methodologies are insuficient to provide strong correctness guarantees.
      </p>
      <p>To address this problem, in this paper, we introduce VEL, a formally verified
ℰ ℒ++ reasoner
with machine-checkable correctness proofs. Our proofs ensure the correctness of the output
https://www.koncordantlab.com/ (A. M. Ileri); https://www.koncordantlab.com/ (H. K. McGinty)</p>
      <p>
        © 2024 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0).
for each possible input. We based our formalization on the algorithm of Baader et al. [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]
and obtained an executable OCaml code through the extraction functionality of Coq proof
assistant [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ].
      </p>
    </sec>
    <sec id="sec-3">
      <title>2. Related Work</title>
      <p>
        Baader et al. use automated theorem proving to certify the results of the ELK reasoner for OWL2
EL [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ]. They implemented an algorithm that extracts a proof certificate from an ELK result
and checks its correctness using LFSC proof checker. This approach incurs time and memory
overheads due to certificate generation and proof checking at runtime and lacks support for
required extensions such as concrete domains. In contrast, our implementations do not incur
any runtime overhead since the correctness proofs of our implementations are statically checked.
Eliminating this overhead will make our reasoners more scalable compared to validation-based
approaches.
      </p>
      <p>
        Hidalgo-Doblado et al. formalize  ℒ  description logic and implement a formally verified
tableau-based reasoner in PVS [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]. Although it is a well-known description logic,  ℒ  does
not correspond to any OWL2 profile and lacks the support for datatypes and other extensions.
These limitations restrict the usability of their implementation in projects. Given these
limitations and lack of support, our work is guided by OWL2 and supports necessary extensions to
ensure our implementations’ widespread usability.
3. Formalization of ℰ ℒ++
The first step in implementing a verified reasoner is formalizing its logic, which consists of
formalizing the syntax, such as concept descriptions and constraints, as well as the semantics of
the logic. We formalized the logic parameterized by its primitives, such as names, to ensure its
reusability in other projects. The parameterized implementation allowed us to obtain theorems
agnostic to the encoding used to construct constraints, increasing the interoperability of the
resulting implementation with various systems.
      </p>
      <p>One challenging aspect of formalizing the language was formalizing concrete domains. We
formalized concrete domains as a Coq record with six definitions: domain as a nonempty
set of concrete domain elements, predicates as a set of predicate names, predicate arities as
a partial function from predicate names to natural numbers, apply function that computes
the application of a predicate, and satisfiability and implication functions that compute their
respective properties between conjunctions of predicate expressions.</p>
      <p>We formalized the provided model-theoretic semantics for ℰ ℒ++ . We first defined what we
call a base interpretation which maps each name to its corresponding structure in the model.
Then, we defined the interpretation function that recursively constructs the interpretation of a
concept description for a given base interpretation.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Formalization of Normalization and Classification</title>
      <p>Since normalization and classification use the same structure, namely, identifying a candidate
and applying the appropriate rule, we followed the same pattern in their formalization. We
formalized each rule in two parts: a predicate that encodes the condition and the application.
In our implementations, we use a higher-order function to identify a candidate that satisfies a
predicate, then apply the corresponding rule until no more candidates exist.</p>
      <p>Defining a recursive function in Coq requires proving it is well-founded, i.e., it will terminate
for all inputs. One way to do that is by providing a measure and proving that it decreases after
each recursive call. A measure based on the number of rule applications left was suficient for
most rules.</p>
      <p>We had to make one modification to the normalization rule that applies to constraints of the
form  ⊓  ⊑  where  or  are complex concept descriptions. The termination measure does
not decrease when the rule is applied to a constraint where both  and  are complex due to
generating a new candidate. We circumvented this problem by applying the rule twice when
both concept descriptions are complex.</p>
      <p>We implemented strings and rational numbers as examples of concrete domains. Due to
their complexity, we treated satisfiability and implication in those domains axiomatically and
implemented them as unverified OCaml code. We used Coq’s extraction functionality to obtain
an executable OCaml code of the reasoner.</p>
    </sec>
    <sec id="sec-5">
      <title>5. Proving Correctness</title>
      <p>Completeness proof was more challenging to mechanize than soundness proof. It required us to
define a new invariant, fix errors in the original proof, and employ non-constructive reasoning.</p>
      <p>Point 2 of Claim 1 in the original completeness proof involved a property that holds for the
ifnal classification but does not necessarily hold in every intermediate step. To mechanize the
proof, we defined a tree structure that encodes possible sequences of rule applications that
lead to the current state. This structure allowed us to mimic doing induction over selected rule
applications by doing induction over the trees.
5.1. Errors in Completeness Proofs
Our mechanization revealed two major errors in pen-and-paper completeness proofs. The
ifrst one is the non-transitivity of a relation assumed to be transitive. The second one is the
under-specification of a solution for concrete domain predicates. We explain each problem and
our solutions below.</p>
      <sec id="sec-5-1">
        <title>5.1.1. Non-transitivity</title>
        <p>Completeness proofs in Baader et. al. heavily rely on a relation defined with respect to a concept
name  denoted by ∼ . During our formalization, we discovered that ∼ is not transitive. The
problem stemmed from the fact that in some models of the knowledge base, the interpretation of
 can be empty. We fixed this error by introducing  -extensions to the algorithm that enforce
nonemptiness while preserving subsumption. A-extension adds {} ⊑ ∃  . constraint to the
CBox, where  and   are fresh individual and role names, respectively.</p>
      </sec>
      <sec id="sec-5-2">
        <title>5.1.2. Under-specification</title>
        <p>We identified another error in the statement of a lemma, originally called Claim 2, used in
constructing a counterexample model. Original lemma states that “For each concrete domain
and ∼ equivalence class, there exists a solution such that [...]”. However, this was too weak
to imply the desired properties. We fixed this error by reordering the quantification to “For
each ∼ equivalence class, there exists a solution such that, for each concrete domain [...]”
and further restricting the behavior of the solution to the feature names that appear in the
classification of the equivalence class.</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>6. Evaluation</title>
      <p>We evaluated our work in two axes. We measured the required proof efort by comparing the
number of lines of proof per line of implementation. Our 165 definitions consist of 1511 cloc.
Our 387 theorems consist of 16977 cloc, giving us 11.3x proof overhead.</p>
      <p>To evaluate the performance of our implementation, we measured run times on randomly
generated knowledge bases with fixed set of names. For concept inclusion tests, we kept the
number of role inclusion axioms at 10, and for role inclusion tests, we set the number of concept
inclusions to 20. Our algorithm’s runtimes are 4s for 20, 278s for 30, and 192s for 40 concept
inclusions; and 463s for 20, 6s for 30, and 2732s for 40 role inclusions. Our results indicates
that the structure of a knowledge base more impactful on the performance than its size. We
could not test our performance against the existing reasoners since interfacing with OWL is
not implemented yet.</p>
    </sec>
    <sec id="sec-7">
      <title>7. Conclusion</title>
      <p>The Semantic Web, over the past three decades, helped enhance a wide range of applications.
However, the varying sophistication of SW systems’ reasoning abilities highlights the need for
reliable reasoning algorithms, particularly in the context of the growing interest in Neurosymbolic
AI and Generative AI approaches that seek to utilize Semantic Web layers.</p>
      <p>In an attempt to address this gap, our work lays the foundation for formally verified reasoners
for Neurosymbolic AI applications. We believe that, in the cases of high-stakes application
domains, such as health, finance, and security, the benefit of increased trustworthiness outweighs
the increased development efort.</p>
      <p>As future work, we are planning to integrate our reasoner into Protègè ontology editor [18]
by creating a plugin to provide access to our reasoner for community use. We believe that
having an easy access to verified reasoners will contribute to the adoption of formal methods in
trustworthy AI. The second direction we will explore is reducing the trusted computing base by
implementing a verified parser that will convert an OWL file to a VEL knowledge base.
[18] M. A. Musen, The protégé project: a look back and a look forward, AI Matters 1 (2015)
4–12. URL: https://doi.org/10.1145/2757001.2757003. doi:10.1145/2757001.2757003.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>F.</given-names>
            <surname>Baader</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Brandt</surname>
          </string-name>
          ,
          <string-name>
            <surname>C.</surname>
          </string-name>
          <article-title>Lutz, Pushing the el envelope</article-title>
          ,
          <source>in: Proceedings of the 19th International Joint Conference on Artificial Intelligence</source>
          , IJCAI'
          <fpage>05</fpage>
          , Morgan Kaufmann Publishers Inc., San Francisco, CA, USA,
          <year>2005</year>
          , p.
          <fpage>364</fpage>
          -
          <lpage>369</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>R.</given-names>
            <surname>Cyganiak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Wood</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.</surname>
          </string-name>
          Lanthaler (Eds.),
          <source>RDF 1.1 Concepts</source>
          and
          <string-name>
            <given-names>Abstract</given-names>
            <surname>Syntax</surname>
          </string-name>
          ,
          <source>W3C Recommendation 25 February</source>
          <year>2014</year>
          ,
          <year>2014</year>
          . Available from http://www.w3.org/TR/rdf11- concepts/.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>H.</given-names>
            <surname>Knublauch</surname>
          </string-name>
          , D. Kontokostas (Eds.),
          <source>Shapes Constraint Language (SHACL)</source>
          ,
          <source>W3C Recommendation 20 July</source>
          <year>2017</year>
          ,
          <year>2017</year>
          . Https://www.w3.org/TR/shacl/.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>S.</given-names>
            <surname>Sahoo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>McGuinness</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Lebo</surname>
          </string-name>
          ,
          <string-name>
            <surname>PROV-O: The PROV Ontology</surname>
          </string-name>
          ,
          <source>W3C Recommendation, W3C</source>
          ,
          <year>2013</year>
          . Http://www.w3.org/TR/2013/REC-prov-o-
          <volume>20130430</volume>
          /.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>H. K.</surname>
          </string-name>
          <article-title>McGinty, KNowledge Acquisition and Representation Methodology (KNARM) and Its Applications</article-title>
          ,
          <source>Ph.D. thesis</source>
          , University of Miami,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <article-title>[6] rusdobr, [bug] reasoner fails to validate when integer is present in ontology iri</article-title>
          , https: //github.com/stardog-union/pellet/issues/49,
          <year>2024</year>
          . Accessed:
          <fpage>2024</fpage>
          -08-29.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          <article-title>[7] patrickwestphal, Got decimal type for integer value inferred via hasvalue restriction</article-title>
          , https://github.com/stardog-union/pellet/issues/38,
          <year>2017</year>
          . Accessed:
          <fpage>2024</fpage>
          -08-29.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <article-title>[8] tobias hammerschmidt, Literal.isdiferent can return wrong result for numeric literals</article-title>
          , https://github.com/stardog-union/pellet/issues/34,
          <year>2016</year>
          . Accessed:
          <fpage>2024</fpage>
          -08-29.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <surname>Christian-D</surname>
          </string-name>
          ,
          <article-title>Indexoutofboundsexception in betanode.java for rules with multiple atoms like p(?x,?x</article-title>
          ), p(?y, ?y), https://github.com/stardog-union/pellet/issues/4, 2014. Accessed:
          <fpage>2024</fpage>
          -08-29.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <article-title>leechuck2@gmail.com, Nullpointer exception when classifying fma</article-title>
          , https://github.com/ liveontologies/elk-reasoner/issues/35,
          <year>2015</year>
          . Accessed:
          <fpage>2024</fpage>
          -08-29.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          <article-title>[11] naditina, Nullpointer while classifying the el fragment of galen</article-title>
          , https://github.com/ liveontologies/elk-reasoner/issues/38,
          <year>2016</year>
          . Accessed:
          <fpage>2024</fpage>
          -08-29.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <article-title>JieyingChenChen, java.lang.outofmemoryerror: unable to create new native thread</article-title>
          , https: //github.com/liveontologies/elk-reasoner/issues/36,
          <year>2016</year>
          . Accessed:
          <fpage>2024</fpage>
          -08-29.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13] balhof, '
          <article-title>direct' subclasses are not included when 'all' subclasses are requested for anonymous class expressions</article-title>
          , https://github.com/liveontologies/elk-reasoner/issues/70,
          <year>2024</year>
          . Accessed:
          <fpage>2024</fpage>
          -08-29.
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>B.</given-names>
            <surname>Parsia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Matentzoglu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. S.</given-names>
            <surname>Gonçalves</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Glimm</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Steigmiller</surname>
          </string-name>
          ,
          <article-title>The owl reasoner evaluation (ore) 2015 competition report</article-title>
          ,
          <source>Journal of Automated Reasoning</source>
          <volume>59</volume>
          (
          <year>2017</year>
          )
          <fpage>455</fpage>
          -
          <lpage>482</lpage>
          . URL: https://api.semanticscholar.org/CorpusID:9446588.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>The</given-names>
            <surname>Coq Development Team</surname>
          </string-name>
          ,
          <source>The Coq Proof Assistant, version 8.19.2</source>
          ,
          <year>2024</year>
          . URL: https: //doi.org/10.5281/zenodo.1003420. doi:
          <volume>10</volume>
          .5281/zenodo.1003420.
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>F.</given-names>
            <surname>Baader</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Koopmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Tinelli</surname>
          </string-name>
          ,
          <article-title>First results on how to certify subsumptions computed by the el reasoner elk using the logical framework with side conditions, Description Logics (</article-title>
          <year>2020</year>
          ). URL: https://api.semanticscholar.org/CorpusID:221717879.
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>M. J.</given-names>
            <surname>Hidalgo-Doblado</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. A.</given-names>
            <surname>Alonso-Jiménez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Borrego-Díaz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F. J.</given-names>
            <surname>Martín-Mateos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. L.</given-names>
            <surname>Ruiz-Reina</surname>
          </string-name>
          ,
          <article-title>Formally verified tableau-based reasoners for a description logic</article-title>
          ,
          <source>J. Autom. Reason</source>
          .
          <volume>52</volume>
          (
          <year>2014</year>
          )
          <fpage>331</fpage>
          -
          <lpage>360</lpage>
          . URL: https://doi.org/10.1007/s10817-013-9291-8. doi:
          <volume>10</volume>
          .1007/ s10817- 013- 9291- 8.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>