<!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>(Re)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>Alessia Fidelangeli</string-name>
          <email>alessia.fidelangeli2@unibo.it</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Giuseppe Pisano</string-name>
          <email>g.pisano@unibo.it</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Universidad de Los Andes</institution>
          ,
          <addr-line>Mérida</addr-line>
          ,
          <country country="VE">Venezuela</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Bologna</institution>
          ,
          <addr-line>Bologna</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>University of Turin</institution>
          ,
          <addr-line>Torino</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>This paper describes the continuing use of Logical English as a logic programming language that can be interpreted by the s(CASP) reasoner. It builds upon the previous work, and proceeds to add the possibility of expressing global constraints in a form of English that can be easily understood by users, even without any specific technical training. In particular we will integrate constraints in a legal knowledge base, and demonstrate its use. We will then tackle the possibility of integrating the Event Calculus in LE, and querying the system with s(CASP). In conclusion, we will discuss the ongoing work in integrating LE and s(CASP), and assess the process, with it's results and dificulties.</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>s(CASP)</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        like procedure for ASP semantics. However, our original work in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] did not provide a way to
express global constraints in LE, and thus in s(CASP).
      </p>
      <p>In ASP global constraints can be expressed with the syntax:</p>
      <p>: − p, q
with the intended aim to discard all the models containing both the literals p and q. LE has
been extended to also allow the encoding of these constraints in natural language with the
construct:</p>
      <p>it must not be true that p and q
where p and q represent a template in the language. For example, it is possible to write
sentences as intuitive and easy to understand as it must not be true that a person is infallible and
the person is capable of making mistakes. We will examine in Section 2 the potential applications
within the legal field.</p>
      <p>
        Event Calculus (EC) [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] is a very well known formalism to model and reasoning about events
and their logical causes and consequences. A theory of change is normally made from the
combination of the basic axioms of EC with rules that describe how events initiate and terminate
lfuents, i.e. properties of a system that may change through time. Many experiments have been
performed in the LP and ASP communities around EC. In LE, we are aiming at supporting the
description of those rules, leaving the axioms of the EC to work implicitly behind the scene.
The following listing 1 could be a first approximation to those supporting axioms in the syntax
of Prolog/ASP:
      </p>
      <sec id="sec-1-1">
        <title>Listing 1: Event Calculus Basic Axioms in s(CASP)</title>
        <p>Notice the time variables “constrained” by the use of the #&lt;, #=&lt; operators in s(CASP). This
is a particularly powerful device that ASP brings to the users of EC, as it is now possible to
reason about partially or totally undefined times.</p>
        <p>In the following sections we will analyse two examples written in LE and interpreted by
s(CASP). In Section 2 we explore LE’s utility for the legal domain and the added features given
by s(CASP) integration. In Section 3, we show how LE can already be used to describe the rules
of a particular domain that could be combined, transparently to users, with those basic axioms
of EC to reason about events, fluents and their timing. Section 4 concludes the work.</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>2. Global constraints: The NILDE Project</title>
      <p>
        Logical English can be used to model legal norms in logical form. As argued, for example, by
[
        <xref ref-type="bibr" rid="ref7">7</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>With respect to isomorphism, there may be conditions in the knowledge base that appear in
multiple diferent rules. This happens because the rules are independent from one another, so
there is a certain attention one needs to have in modelling the right sequence of statements.
This is mainly an issue in domains such as the legal one, where the choice is often to try and
maximise isomorphism. However, the application of legal provisions frequently depends on
general conditions, that apply to a whole document, or to a larger section of the document.</p>
      <p>We will now see how this issue could be addressed by introducing global constraints, and
how this can help a legal expert in writing a knowledge base in Logical English.</p>
      <p>We used Logical English and s(CASP) to model legal rules in the field of tax law in the NILDE
project. In particular the choice was made to model sections of the conventions against double
taxation between Italy and France.</p>
      <p>The addition of features from s(CASP) in this knowledge base presents a number of advantages,
such as:
• having incomplete (or unknown) information, and leveraging the abducibles to present
the possible solutions;
• adding constraints in the knowledge base to improve eficiency and readability;
• leveraging the s(CASP) explanation module to show the Answer Set and it’s natural
language explanation.</p>
      <p>All this remains possible while also relying on the natural language structure of Logical
English to make the knowledge base itself easier to read and write.</p>
      <p>Here we will focus on the use of global constraints, in particular to set rules that are defined
globally. This simplifies the rules themselves, as it is no longer necessary to carry these
conditions in multiple diferent rules, making it easier for the legal expert in charge of writing
the rules in a way that is more natural.</p>
      <sec id="sec-2-1">
        <title>2.1. The NILDE Project</title>
        <p>The objective of the NILDE project is to create a computable model of the French-Italian
convention against double taxation in Logical English. Conventions against double taxation are
bilateral tax treaties which are binding only for the states which signed them. The objective of
these conventions is to decide on the allocation of taxing rights between the two states: they
specify the state which can tax a certain income, the withholding taxes that can be applied,
and other measures afecting taxation in cross-border situations. Conventions against double
taxation cover taxes on income and taxes on capital, as these taxes are usually personal taxes
and rely on worldwide taxation for residents, thus potentially generating double taxation.
Through the attribution of taxing rights to one of the two states double taxation is avoided. The
French-Italian convention entered into force on 1 May 1992 and it covers several Italian and
French taxes on income or capital.</p>
        <p>NILDE’s knowledge base is in development, and will enable the user to understand which
state is entitled to tax a certain income. This assessment is done on the basis of a number of
facts that the user has to provide as input (as we will see in the example code, represented as
the scenario). These facts are, for example: where the taxpayer is resident, what is the source of
the income, in which country is that source located, etc. The main goal of the questions is to
provide the system with the necessary knowledge to tell the user which state is entitled to tax a
certain income (e.g., the income received by an Italian resident in relation to the rental of an
immovable property located in France is taxable in France). The solution will then be provided
to the user both concisely and with the identification of the intermediate steps and facts that
led to the solution.</p>
        <p>We decided to model the area of conventions against double taxation in Logical English
as these legal sources provide for a closed and self-standing regulatory system, with limited
references to national sources. So, modeling a limited number of rules, it is possible to have
a system which provides answers to taxpayers acting in transnational situations. Moreover,
such conventions have a clear structure and this simplifies the modeling phase. In addition,
the text of most conventions is unlikely to be modified or updated, which reduces the risk of
changes in the system that would require modifications of the modeled rules. Finally, most of
the conventions drafted between western countries are concluded on the basis of the OECD
Model Convention. This is the basis for negotiation and application of bilateral tax treaties
between OECD countries. Hence, the work done with NILDE may be used to model other
conventions based on the same OECD Model.</p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. LE and s(CASP) example</title>
        <p>In the NILDE knowledge base there are many diferent rules that may determine where the
interested party may be taxed for a specific income. As mentioned in Section 2.1, a legal expert
was given the task of formalising the convention against double taxation between Italy and
France.</p>
        <p>The convention applies only if a person is resident in one of the two states (i.e., the “state of
residence”), while producing or receiving income in or from the other (i.e., the “state of source”).
In fact, if the income is produced in the state where the person is resident there is no need to
rely on a convention to decide whether the state of source or the state of residence has the right
to tax that income. This condition is not made explicit in the rules of the convention but and is
assumed as a given.</p>
        <p>The issue then rises: how to model this in a way that is eficient and clear to read and
understand?</p>
        <p>An initial solution was to add entry point rules, that had this condition, and then called the
other rules. While this works, there might be more to gain from having global constraints, so
that you know that the constraint is applied to every query.</p>
        <p>What we ended up with was a (small) set of rules that defined which state the income was
originating from (i.e. state of source), then added a global constraint that negated the possibility
for the subject to be resident and receiving the income from the same state.</p>
        <sec id="sec-2-2-1">
          <title>Listing 2: Sample from the NILDE knowledge base</title>
          <p>In Listing 2 the rule in line 32, it must not be true that ..., defines the global constraint. In this
example the goal is to determine that the State in which the person is resident, and the one where
a particular income is produced are not the same. This condition would have previously been
included in the specific rule, but since the knowledge base is fairly large it is more convenient
to write it separately as a constraint.</p>
          <p>In the generated s(CASP) program the global constraint is translated as:</p>
          <p>In this way the constraints that apply to larger portions of the knowledge base can be
expressed separately, thus being more isomorphic to the original source document.</p>
          <p>Figure 1 shows s(CASP justification) for the query at line 33 in Listing 2. Marco’s income is
taxable in Italy as per Article 6 of the Convention since the source of income is in Italy and he
is resident in France.</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Event Calculus: The Fox and the Crow</title>
      <p>
        The ancient fable of the fox and the crow, written around the sixth century B.C. and attributed
to Aesop, is a fantastic pedagogical resource. In [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] (chapter 3), Kowalski uses it to illustrate
how to formalise the beliefs of a proactive agent and how she would reason with those beliefs
to deduce plans to achieve her goals.
      </p>
      <p>Here we state the beliefs of the fox in LE, but restricted only to her knowledge of how to get
the crow to release a cheese he holds and how she, the fox, could have it. The rules in listing 3
describe the relevant beliefs in LE.</p>
      <p>These rules are automatically mapped into the s(CASP) syntax, as shown in listing 4 (with
some minor editing of the variables names in the query):</p>
      <p>By combining these sources3 with the basic axioms of EC (shown in the previous section),
s(CASP) can answer that very general query about who has what object when, as shown in
Fig 3, a query which a regular Prolog engine cannot answer:</p>
    </sec>
    <sec id="sec-4">
      <title>4. Opportunities for a better integration LE-s(CASP)-SWISH</title>
      <p>
        This paper extends the work in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] on the use of Logical English as a logic programming
language that can be interpreted by the s(CASP) reasoner. In particular, we added the possibility
of expressing global constraints in a form of English understandable by users without any specific
technical training, and showcased its potentialities in the legal domain. We also tackle the
possibility of integrating Event Calculus in LE, giving users the possibility to straightforwardly
reason about events, fluents and their timing.
      </p>
      <p>The points for improvement are still many and may require some technical agreements
between the s(CASP), SWISH and LE teams. There is an ongoing discussion about how to</p>
      <sec id="sec-4-1">
        <title>3https://swish.swi-prolog.org/p/foxec-scasp-extended.pl</title>
        <p>use the html and human outputs that SWISH produces for s(CASP), also in LE4, as a first step
towards the common handling of multiple natural languages. There is also another discussion
about provisions for secure access to a typical SWISH installation to support the use of libraries
and components in SWISH that must normally be left out of the sandbox5. Other issues, such
as discrepancies in syntax between s(CASP) standalone and SWISH-embedded s(CASP) must
also be addressed.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Acknowledgments</title>
      <p>The authors wish to thank Prof. Bob Kowalski, for his active leadership of the Logical English
project, and for his encouragement to explore its applications to many diferent domains.</p>
      <p>The work has been supported by the “CompuLaw” project, funded by the European Research
Council (ERC) under the European Union’s Horizon 2020 research and innovation programme
(Grant Agreement No. 833647), and the “NILDE” project, funded by the University of Bologna
under the AlmaIdea 2022 programme.</p>
      <sec id="sec-5-1">
        <title>4https://swi-prolog.discourse.group/t/reusing-html-and-human-output-from-scasp/6158/1</title>
        <p>5https://swi-prolog.discourse.group/t/pengines-js-pengine-create-call-certain-options-are-ignored/714/8</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <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="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>G.</given-names>
            <surname>Sartor</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Davila</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Billi</surname>
          </string-name>
          , G. Contissa, G. Pisano,
          <string-name>
            <given-names>R.</given-names>
            <surname>Kowalski</surname>
          </string-name>
          ,
          <article-title>Integration of logical english and s(casp)</article-title>
          , in: J.
          <string-name>
            <surname>Arias</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          <string-name>
            <surname>Calegari</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          <string-name>
            <surname>Dickens</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          <string-name>
            <surname>Faber</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <string-name>
            <surname>Fandinno</surname>
            , G. Gupta,
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Hecher</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Inclezan</surname>
            , E. LeBlanc,
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Morak</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          <string-name>
            <surname>Salazar</surname>
          </string-name>
          , J. Zangari (Eds.),
          <source>Proceedings of the International Conference on Logic Programming</source>
          <year>2022</year>
          <article-title>Workshops co-located with the 38th International Conference on Logic Programming (ICLP</article-title>
          <year>2022</year>
          ), Haifa, Israel,
          <source>July 31st - August 1st</source>
          ,
          <year>2022</year>
          , volume
          <volume>3193</volume>
          <source>of CEUR Workshop Proceedings, CEUR-WS.org</source>
          ,
          <year>2022</year>
          . URL: https://ceur-ws.
          <source>org/</source>
          Vol-
          <volume>3193</volume>
          /paper5GDE.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>R. A.</given-names>
            <surname>Kowalski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. J.</given-names>
            <surname>Sergot</surname>
          </string-name>
          ,
          <article-title>A logic-based calculus of events, New Generation Computing 4 (</article-title>
          <year>1989</year>
          )
          <fpage>67</fpage>
          -
          <lpage>95</lpage>
          . doi:
          <volume>10</volume>
          .1007/BF03037383.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <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="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>R.</given-names>
            <surname>Kowalski</surname>
          </string-name>
          , Computational Logic and Human Thinking: How to be artificially Intelligent, Cambridge University Press, London,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>