<!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 />
    <article-meta>
      <title-group>
        <article-title>Integration of Logical English and s(CASP)</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Galileo Sartor</string-name>
          <email>galileo.sartor@unito.it</email>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jacinto Dávila</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Marco Billi</string-name>
          <email>marco.billi3@unibo.it</email>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Giuseppe Contissa</string-name>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Giuseppe Pisano</string-name>
          <email>g.pisano@unibo.it</email>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Robert Kowalski</string-name>
          <email>r.kowalski@imperial.ac.uk</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Contratos Lógicos. C.A. and Universidad de Los Andes Mérida</institution>
          ,
          <country country="VE">Venezuela</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Department of Computing, Imperial College</institution>
          ,
          <addr-line>London</addr-line>
          ,
          <country country="UK">UK</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Department of Computing, University of Turin</institution>
          ,
          <addr-line>Turin</addr-line>
        </aff>
        <aff id="aff3">
          <label>3</label>
          <institution>Department of Law, University of Bologna</institution>
          ,
          <addr-line>Bologna</addr-line>
        </aff>
      </contrib-group>
      <abstract>
        <p>This paper demonstrates the use of Logical English as a logic programming language that can be interpreted by the s(CASP) reasoner. It shows how legal knowledge and unknown information can be expressed in a form of English that can be easily understood by users without any technical training and with only a basic knowledge of English. This research has been undertaken in the context of the CrossJustice Project.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Logic Programming</kwd>
        <kwd>Prolog</kwd>
        <kwd>Controlled Natural Language</kwd>
        <kwd>Legal Rule Modelling</kwd>
        <kwd>Explainable AI</kwd>
        <kwd>Logical English</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>The goal of this paper is to explore the use of Logical English (LE) and s(CASP) in the CrossJustice
system, and to assess their use both for drafting legal norms in logical form and for making the
system more accessible for users who lack a technical background in computing or symbolic
logic.</p>
      <p>
        The focus of the CrossJustice Project[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] is to develop a platform for normative harmonization
assessment and automated legal support for European criminal procedural rights of suspected
and accused persons. In the following sections we will analyse a short example from the
CrossJustice knowledge base, rewritten in LE, and interpreted by s(CASP). We will show how
to draft rules in LE and how these rules are converted into s(CASP), to take advantage of the
explanation system of s(CASP). We will explore the utility for the legal domain of the ability
in s(CASP) to reason with unknown information, represented by abductive (or assumable)
predicates and restricted by the use of constraints.
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. Background</title>
      <p>
        Logical English (LE)[
        <xref ref-type="bibr" rid="ref2 ref3 ref4">2, 3, 4</xref>
        ] is a general-purpose computer language1, which is designed to be
eficiently executed by computer, yet easily understandable by a reader of English without any
technical training. Programs and other kinds of knowledge are expressed in LE in the form of
facts and rules of the logical form conclusion if conditions, and they are executed by translating
them into a logic programming language such Prolog or s(CASP).
      </p>
      <p>An LE document consists of a knowledge base of facts and rules, scenarios, queries and
templates. The templates are declarations of the predicates contained in the knowledge base
and scenarios, such as</p>
      <p>*a person* has *a right* according to *an article*.</p>
      <p>A template identifies a predicate and its variable argument places. The argument places are
identified by a simple noun phrase surrounded by asterisks and starting with an indefinite article
"a" or "an". The predicate itself is represented by the rest of the template. The templates are
used to identify instances of the predicates in the knowledge base and elsewhere. For example,
the template above can be used to identify a sentence such as:</p>
      <p>Mario has the right to interpretation according to article 3.
as an instance of a predicate, which is translated into Prolog or s(CASP) resulting in the symbolic
representation:</p>
      <p>has_according_to(‘Mario’, ‘right_to_interpretation’, ‘Article_3’).</p>
      <p>The translation can be processed by any Prolog or s(CASP) implementation. We use a SWI-Prolog
SWISH Web Platform with support for LE and s(CASP) for this processing.</p>
      <p>
        Logical English can be used to model legal norms in logical form. As argued, for example, by
[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], some of the needs for legal modelling are (1) isomorphism, understood as a correspondence
between the legal source and the knowledge base, preserving possible interpretations, references
and connections, and (2) defeasibility, which enables reasoning with rules and exceptions, where
the efect of a legal rule may be blocked by the applicability of another rule.
      </p>
      <p>
        In this paper we focus on the integration of LE and s(CASP) [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], which builds on Answer
Set Programming (ASP), a well-known logic programming paradigm used to solve NP-hard
problems. s(CASP) executes ASP using an eficient top-down, SLD-like resolution procedure,
while also incorporating the generation of assumptions (i.e. abduction) and constraints on
which assumptions can be generated.
      </p>
      <p>The combination of LE and s(CASP) seems to be mutually beneficial. For example, the
common nouns used in the names of variables in LE can be used to assign types to arguments
of predicates in s(CASP) explanations. In the above example this would result in s(CASP)
explanations containing an explicit reference to: the person Mario.</p>
      <p>Recent developments have also introduced initial support for multiple languages in LE. Work
on this multi-language support can be a common efort useful to both LE and s(CASP).</p>
      <sec id="sec-2-1">
        <title>1https://github.com/LogicalContracts/LogicalEnglish/</title>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. The CrossJustice Example in Logical English</title>
      <p>
        The CrossJustice Project is an expert system containing a knowledge base about European and
national laws relating to the rights granted to suspect or accused persons. The system is now
available for public use [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. The user of the system completes a form stating the relevant facts
of their case, and is then shown an answer, with references to the relevant legal texts. In the
CrossJustice project, all the legal norms have been encoded in Prolog, which has proved to be
well-suited to the requirements of the legal context, and which can be enhanced with additional
features[
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] implemented in Prolog, such as the LE interface described in this paper.
      </p>
      <p>
        The running example in this paper focuses on Articles 3(1), 3(2) and 3(3) of Directive 2010/64.
Article 3(1) states that suspected or accused persons are to be provided with a written translation
of all essential documents in a legal case, if they do not speak the language of the proceedings.
Articles 3(2) and 3(3) give examples of what constitutes an essential document, such as a decision
depriving a person of their liberty, a charge or indictment, or a judgement. In addition, Article
3(3) states that the court has the power to decree that any document may be considered essential
for the defence of the person. This open concept[
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] of an essential document is left vague on
purpose, giving the courts the discretion to interpret the same concept diferently within the
diferent legal traditions of the diferent EU member States.
      </p>
      <p>In our example, we have used the English language to translate the above-mentioned articles
from the European directive into Logical English. However, LE potentially supports the drafting
of programs in multiple natural languages. The goal of the following LE rule is to verify whether
a person, such as Mario, has the right to translation of essential documents, according to Article
3.</p>
      <sec id="sec-3-1">
        <title>Listing 1: Does a person have a right to translation?</title>
        <p>1 a p e r s o n has the r i g h t t o t r a n s l a t i o n o f an e s s e n t i a l document a c c o r d i n g t o A r t i c l e 3 _1
2 i f the language o f the p r o c e e d i n g s o f the p e r s o n i s a g i v e n language
3 and a document needed by the p e r s o n i s r e c o g n i s e d as an e s s e n t i a l document
4 and i t i s not the c a s e t h a t
5 the p e r s o n u n d e r s t a n d s the g i v e n language .</p>
        <p>The LE knowledge base also includes rules representing the the open list of essential document
types, which are stated explicitly in the legal text.</p>
        <p>In the interest of facilitating the translation from LE into s(CASP), we have expressed each
essential document type by means of a separate rule, although in LE it is also possible to express
the same information with a single rule, with each condition listed as an alternative using
disjunction.</p>
        <p>We have also implemented a rule, representing Article 1 of the Directive, which states that all
rights referred to in the Directive shall apply to persons who are made aware by the competent
authorities of a Member State, that they are suspected or accused of having committed a criminal
ofence, from the start of the proceedings until its conclusion.</p>
        <p>In order to reason with the times referred to in this rule, we have added an additional rule
representing the event calculus for reasoning about the relationship between the time of an
event and the times of the fluents (i.e. time-varying facts) that start or end upon the occurrence
of the event.</p>
        <p>It is clear from these examples of rules written in LE that, although still verbose, the use
of natural language connectors (if, and, or) and the use of the same words in LE templates
as in the legal source can help a person with no background in computer programming to
understand the LE rules and thus to understand the legal conditions for the applicability of the
rules. This understanding is closely related to what we referred to previously as an isomorphic
representation of knowledge.</p>
        <p>Finally, an LE document contains one or more scenarios and one or more queries. For example:
Listing 2: A case scenario</p>
        <p>The facts on lines 5 and 9 are used together with the event calculus to derive that the
proceedings take place at every time between the start at 2000 − 05 − 13 and the end at
2001 − 01 − 08.</p>
        <p>In an LE document the goal or goals are defined in a specific query section, and in this case
the goal is to verify whether the user has the right to translation on a date, 2000 − 07 − 01,
which comes after the start of the proceedings and before the proceedings have ended. In the
query the variables are identified by keywords such as which (as well as by a and an), and they
are instantiated in the answer.
3.1. s(CASP) translation
In this section we remark upon some of the issues that arise concerning the translation of rules
from LE into s(CASP). For example, the s(CASP) rules generated by this translation can be seen
in listing 3.</p>
      </sec>
      <sec id="sec-3-2">
        <title>Listing 3: Translation into Prolog</title>
        <p>1 h a s _ a c c o r d i n g _ t o ( A , t h e _ r i g h t _ t o _ t r a n s l a t i o n _ o f _ a n _ e s s e n t i a l _ d o c u m e n t , ’ A r t i c l e _ 3 _ 1 ’ )
: −
2 t h e _ l a n g u a g e _ o f _ t h e _ p r o c e e d i n g s _ o f _ i s ( A , B ) ,
3 n e e d e d _ b y _ i s _ r e c o g n i s e d _ a s _ a n _ e s s e n t i a l _ d o c u m e n t ( _ , A ) ,
4 not u n d e r s t a n d s ( A , B ) .</p>
        <p>
          Here negation in LE is translated into negation by failure in s(CASP), which derives that
a condition does not hold if it cannot be shown that the condition does hold. In addition
to negation by failure, s(CASP) also supports reasoning with an explicit form of negation
which expresses that the opposite (or contrary) of a predicate does hold (i.e., so-called strong
negation)[
          <xref ref-type="bibr" rid="ref10">10</xref>
          ]. The combination of the two kinds of negations makes it possible to express such
expressions as "the contrary of a condition does not hold".
        </p>
        <p>s(CASP) generates explanation trees in English using a directive #pred in the s(CASP) program
to map predicates into readable English sentences. The translation of LE into s(CASP) translates
the LE templates into these #pred directives.</p>
        <p>
          One of the most interesting features of s(CASP) for legal reasoning is the possibility of
defining predicates as unknown (or "abducible"), which allows the user to state that a certain
fact is neither certainly true nor certainly false[
          <xref ref-type="bibr" rid="ref11">11</xref>
          ]. The s(CASP) reasoner can solve a query
by using assumptions, which are instances of these abducible predicates. In this example it is
unknown whether the authority has deemed the document as essential in the proceeding.
        </p>
      </sec>
      <sec id="sec-3-3">
        <title>Listing 4: Handling unknowns</title>
        <p>1 i t i s unknown whether the a u t h o r i t y has d e c i d e d t h a t
2 the document D1 needed by Mario c o n c e r n s e s s e n t i a l document .</p>
        <p>The LE to s(CASP) translator produces the abducible statement of listing 5.</p>
      </sec>
      <sec id="sec-3-4">
        <title>Listing 5: Translation into sCASP</title>
        <p>1 # a b d u c i b l e t h e _ a u t h o r i t y _ h a s _ d e c i d e d _ t h a t ( n e e d e d _ b y _ i s _ o f _ t y p e ( ’D1 ’ , ’ Mario ’ ,
e s s e n t i a l _ d o c u m e n t ) ) .</p>
        <p>During the process of query evaluation, when the s(CASP) reasoner encounters an abducible
condition as a subgoal, it checks whether the condition is explicitly negated by a constraint in
the knowledge base. If it is not explicitly negated, then the reasoning continues, both under the
assumption that the abducible subgoal is true, and under the alternative assumption that the
abducible subgoal is not true.
3.1.1. Possible issues in the s(CASP) translation
In defining the translation from LE to s(CASP), we have encountered a few limitations, which
can be overcome by extending the s(CASP) parser and reasoner.</p>
        <p>The first limitation of s(CASP) is that it admits only one negated literal in a negative condition.
In contrast, in Prolog it is possible to negate a conjunction (or disjunction) of literals. This
limitation is most likely derived from the necessity to easily generate duals for all the predicates
defined in the knowledge base, which is the way s(CASP) implements constructive negation.</p>
        <p>The second related limitation is that s(CASP) does not support disjunction in the body of
rules. The use of disjunction in the body of rules can be avoided in general, by writing instead
multiple rules with the same head, as we do in the definition of "essential document" in the
running example. It would be useful and closer (more isomorphic) to the original legal text
to allow disjunctions in the body of rules. But this could complicate the generation of dual
predicates.</p>
        <p>The third limitation is that explanations in s(CASP) do not translate meta-predicates, which
are predicates that have other predicates as arguments, into natural language. For example,
the event calculus employs a meta-predicate to express that a fluent holds at a time, where the
lfuent itself is another predicate (in this case a predicate expressing that a person has the right
to translation), and this fluent is not translated into English in s(CASP) explanations.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Results and Justification</title>
      <p>Finally, we compare explanations in LE with explanations in s(CASP). In both cases, as in other
rule-based systems, explanations display the rules used in solving a goal during the course of a
problem-solving session, and they are one of the most important requirements for expert AI
systems in the legal domain.
without abduction, and uses the same facts given in the scenario. The other explanation, in 2,
uses abduction to assume that the judge exercises the discretionary power, expressed in Article
3(3), to deem that document D1 is essential to the defence of Mario. The use of abduction is
highlighted in green.</p>
      <p>Because meta-predicates are not translated into natural language in s(CASP), the resulting
s(CASP) explanation is not easy for an untrained user to read.</p>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusions</title>
      <p>The open source nature of both LE and s(CASP) facilitates a cross-fertilization of ideas and
approaches of the kind presented in this paper.</p>
      <p>On the one hand, certain features of Prolog (and thus LE) are not yet included in s(CASP),
such as the inclusion of disjunction in the body of the rules. Although it is possible to represent
complex rules without the use of disjunction, the inclusion of disjunction would enhance the
ability of s(CASP) to represent legal texts isomorphically.</p>
      <p>On the other hand, the ability of s(CASP) to reason abductively with predicates whose truth
values are unknown, is very useful in legal reasoning, especially when considering the multiple
sources of law and their validity relative to one another. Future work extending the translation
from LE to Prolog, to include abduction, may prove fruitful, especially when combined with
extensions to include reasoning by means of argumentation.</p>
    </sec>
    <sec id="sec-6">
      <title>6. Acknowledgements</title>
      <p>We are grateful to Jan Wielemaker for adapting the original s(CASP) system to run on the
SWISH platform2, enabling us to do the work presented in this paper.</p>
      <p>This work has been supported by the H2020 ERC Project “CompuLaw” (G.A. 833647), and the
European Union’s Justice Programme (G.A. 847346) for the project “Knowledge, Advisory and
Capacity Building Information Tool for Criminal Procedural Rights in Judicial Cooperation”.</p>
      <sec id="sec-6-1">
        <title>2https://github.com/JanWielemaker/sCASP</title>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>M.</given-names>
            <surname>Billi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Calegari</surname>
          </string-name>
          , G. Contissa, G. Pisano, G. Sartor, G. Sartor,
          <article-title>Explainability through argumentation in logic programming</article-title>
          ,
          <source>in: CAUSAL'21: Workshop on Causal Reasoning and Explanation in Logic Programming</source>
          ,
          <year>2021</year>
          . URL: http://ceur-ws.
          <source>org/</source>
          Vol-
          <volume>2970</volume>
          /causalpaper2. pdf.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>R.</given-names>
            <surname>Kowalski</surname>
          </string-name>
          ,
          <article-title>Logical english</article-title>
          ,
          <source>Proceedings of Logic and Practice of Programming (LPOP)</source>
          (
          <year>2020</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>R.</given-names>
            <surname>Kowalski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Datoo</surname>
          </string-name>
          ,
          <article-title>Logical english meets legal english for swaps and derivatives</article-title>
          ,
          <source>Artificial Intelligence and Law</source>
          <volume>30</volume>
          (
          <year>2022</year>
          )
          <fpage>163</fpage>
          -
          <lpage>197</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>R.</given-names>
            <surname>Kowalski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Dávila</surname>
          </string-name>
          , C. L. CA,
          <string-name>
            <surname>M. Calejo</surname>
          </string-name>
          ,
          <article-title>Logical english for legal applications</article-title>
          , Conference: XAIF, Virtual Workshop on XAI in Finance (
          <year>2021</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>T. F.</given-names>
            <surname>Gordon</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Governatori</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Rotolo</surname>
          </string-name>
          ,
          <article-title>Rules and norms: Requirements for rule interchange languages in the legal domain</article-title>
          ,
          <source>in: Lecture Notes in Computer Science</source>
          , Springer Berlin Heidelberg,
          <year>2009</year>
          , pp.
          <fpage>282</fpage>
          -
          <lpage>296</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>642</fpage>
          -04985-9_
          <fpage>26</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>J.</given-names>
            <surname>Arias</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Carro</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Salazar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Marple</surname>
          </string-name>
          , G. Gupta,
          <article-title>Constraint answer set programming without grounding</article-title>
          ,
          <source>Theory and Practice of Logic Programming</source>
          <volume>18</volume>
          (
          <year>2018</year>
          )
          <fpage>337</fpage>
          -
          <lpage>354</lpage>
          . doi:
          <volume>10</volume>
          . 1017/S1471068418000285.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Crossjustice</surname>
            <given-names>platform</given-names>
          </string-name>
          , https://legalmachinelab.unibo.it/crossjustice,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>G.</given-names>
            <surname>Contissa</surname>
          </string-name>
          , G. Sartor,
          <article-title>Legal knowledge representation in the domain of private international law?</article-title>
          , volume
          <volume>2781</volume>
          <source>of CEUR Workshop Proceedings</source>
          , CEUR, Venice, Italy,
          <year>2020</year>
          , pp.
          <fpage>83</fpage>
          -
          <lpage>92</lpage>
          . URL: http://ceur-ws.
          <source>org/</source>
          Vol-
          <volume>2781</volume>
          /#paper8.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>H. L. A.</given-names>
            <surname>Hart</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H. L. A.</given-names>
            <surname>Hart</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Raz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Green</surname>
          </string-name>
          ,
          <source>The Concept of Law</source>
          , Oxford University Press,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>S. C.</given-names>
            <surname>Guy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Schwitter</surname>
          </string-name>
          ,
          <article-title>The PENG ASP system: architecture, language and authoring tool</article-title>
          ,
          <source>Language Resources and Evaluation</source>
          <volume>51</volume>
          (
          <year>2016</year>
          )
          <fpage>67</fpage>
          -
          <lpage>92</lpage>
          . doi:
          <volume>10</volume>
          .1007/ s10579-016-9338-7.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>J.</given-names>
            <surname>Morris</surname>
          </string-name>
          ,
          <article-title>Constraint Answer Set Programming as a Tool to Improve Legislative Drafting: A Rules as Code Experiment, Association for Computing Machinery</article-title>
          , New York, NY, USA,
          <year>2021</year>
          , p.
          <fpage>262</fpage>
          -
          <lpage>263</lpage>
          . URL: https://doi.org/10.1145/3462757.3466084.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>