<!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>Action Languages and COVID-19: Lessons Learned?</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Marcello Balduccini</string-name>
          <email>marcellob@elementalcognition.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Michael Barborak</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>David Ferrucci</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Elemental Cognition</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>We recently conducted an exercise in which we evaluated the use of RAC and action languages to formalize policies related to covid19. In this paper, we summarize the most salient lessons we learned from this exercise. We believe our findings are relevant not only to this specific domain, but also to policy formalization in general and possibly even to tasks beyond policy formalization.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>or receives a positive antibody test. Action language statements are typically
terse and are stated at a high level of abstraction, often close to that of the
original specification. Reasoning mechanisms can be used to draw a variety of
conclusions.</p>
      <p>
        In this exercise, we used a variant of action language AL [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] for modeling
various realistic policies reflecting those in use by companies and institutions.
Reasoning mechanisms were used to make decisions about a user’s fitness and
to explain such decisions to the user. The goal of the exercise was to determine
if RAC, and specifically action languages, are suitable for the task. We believe
that the exercise is relevant not only to the specific domain of covid-19 policies,
but also to policy formalization in general and possibly to other domains. Next,
we discuss our findings.
      </p>
      <p>Lesson 1: Another Case for the Use of RAC in Practical Applications. The
outcome of the exercise was largely positive. The use of RAC substantially simplified
and sped up the task of implementing policies. We found that all policies of
interest – some of which having considerable complexity – can be implemented
solely using state constraints. Observations were used to model the results of
tests and users’ answers to questionnaires. To evaluate development speed, we
compared the time it took to implement the same policy using RAC vs using an
imperative paradigm. The implementors had comparably extensive experience in
the use of RAC and of imperative languages, respectively. Implementing policies
using RAC was consistently 7 times faster than implementing them imperatively.
In further experiments, other subjects, with extensive imperative programming
experience and little or no prior knowledge of declarative programming, were
asked to implement policies of similar complexity to the previous ones. In a
preliminary 2-hour session, they were introduced to transition diagrams, fluents
and the informal semantics of RAC statements. The programmers were able to
produce satisfactory RAC policy implementations immediately. The ability to
easily and clearly define sophisticated reasoning mechanisms made it possible to
automatically generate explanations for the decisions produced by the policies
and to make them accessible even to non-expert users.</p>
      <p>
        Lesson 2: Traditional Action Language Constructs Had to Be Extended.
Similarly to [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ], observations were assumed correct and were the source of state
change.1 As one might expect, policy implementation required the use of both
inertial and defined fluents, e.g. being fit-for-access is often conveniently
modeled by a positively defined fluent that defaults to false unless explicitly set by
a law. However, traditional action language constructs2 are insuficient to
conveniently capture statements whose validity has a certain duration, e.g. “after
international travel, one is not allowed access to the ofice for 14 days.”
Formalizing such statements requires “wall-clock” time and changing the value of fluents
1 Details on the approach are beyond the scope of this short report.
2 If one were to look outside of the context of action languages, then a promising path
is that of [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], which is based on Event Calculus.
without intervening observations. Action languages such as H [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], while suitable,
have a complex semantics and can reduce performance considerably due to the
complexity of the underlying implementation. In all policies we studied, time
and change are simpler than in H and do not justify its use. Additive fluents [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]
ofer a potential solution, but it was not clear to us how to conveniently cause
value changes, even in combination with, e.g., triggers. For instance, the
statement “one is not allowed access to the ofice for 14 days” requires the ability to
count down the given amount of time and to cause a fluent, say, has_access to
be false for that duration. While additive fluents could be used to represent the
amount of time left, changing that value over time in a convenient way seems
less straightforward. An additional challenge is that one will also want
somehow to ensure that has_access is allowed to revert to true at the end of that
period, unless other conditions intervene. Thus, we (1) associated a constant
duration with state transitions3 and (2) introduced timed fluents , i.e. numerical
lfuents whose value decreases by a constant amount at every state transition
until they reach 0. The above statement can thus be encoded via a timed fluent
days_lef t_f rom(intl_travel), which causes has_access to be false if its value
is greater than 0, e.g.:
 f luent(days_lef t_f rom(intl_travel), timed).

 f luent(has_access, negatively_def ined).

 ¬has_access if days_lef t_f rom(intl_travel) &gt; 0.
      </p>
      <p>
        Lesson 3: Observations at Imprecise Times Require Dedicated Handling. Another
lesson learned was that the assumption frequently made in RAC that the time
associated with an observation is known is too strong. Some policy
questionnaires ask questions such as “were you in close contact with a sick individual in
the past 7 days?” Suppose an individual answers “yes” one day and “no” on the
next day (or two days later). Through commonsense, a human would be able to
pinpoint with fair precision when the contact occurred. Timed fluents could then
be used to track isolation periods. However, observations as they are normally
introduced in action languages do not support this. We had to extend the
observation mechanism to support observations over a time frame and we defined
their semantics to allow for drawing conclusions such as the above one. It should
be noted that the semantics can be defined entirely in terms of truth of fluents
in given states, which makes the extension fully modular w.r.t. the semantics of
action theories. Below, we give an example showing the encoding of the above
observations, expressed by means of newly defined keywords sometime_in_past
and never_in_past. Note how the expressions of the form obs(f, v, t), introduced
in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], extend elegantly to capture more sophisticated types of observations. The
sample encoding also includes a law stating that the subject has 14 days of
isolation left whenever the subject has been in close contact with a sick individual.
It is interesting to note the separation of concerns between observations and
3 Remarkably, this duration can be easily changed in due course thanks to the
elaboration tolerance aforded by action languages.
laws, which makes it possible for a knowledge engineer to write the law without
concerning himself/herself with the potential uncertainty in the observations.
 obs(close_contact, sometime_in_past(7), 10).

 obs(close_contact, never_in_past(7), 11).

 days_lef t_f rom(close_contact) = 14 if close_contact.
      </p>
      <p>
        Lesson 4: Explaining To Non-Experts Is Non-Trivial. Producing explanations for
a given conclusion is a heavily researched task [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] (see also [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] for an interesting
and related approach, whose relation with ours is yet to be investigated). As we
observed, producing explanations that can be understood by a non-expert user
(often in an adversarial posture – “why can’t I play the match?!”) adds another
layer of complexity. In our approach, an explanation for a given conclusion is
obtained by recursively extracting the relevant dependencies from the dependency
graph of the answer set program that implements the theory. This yields what
amounts to a “proof tree” for the conclusion. The information is then graphically
presented to the user, allowing the user to expand branches of the tree as
desired. However, parts of the tree may be meaningless to a non-expert. Consider
a (heavily simplified) situation in which inertial fluent ai (“assumed infectious”)
is first made true via state constraint “ ai if covid_positive” and persists in the
following time steps due to inertia. A naïve rendition of the proof tree for ai
would include a number of claims “ ai holds because it held in the previous step,”
which provide little insight to a non-expert user. Leveraging the fact that users
will look at the explanation through the lens of commonsense, we found it more
efective to omit the parts of the explanation related to inertia (as well as policy
fragments) and provide the final part of the explanation, e.g. “because you tested
positive to covid.” Users will often infer the missing links, and can ask HR for
clarifications if needed. In many cases, the natural language associated with the
explanations must also be tuned to convey enough/appropriate information, e.g.
“because you tested positive to covid-19 on Tuesday.” We found that all of the
above can be conveniently achieved by introducing rules defining special
predicates nlg (for associating natural language with an explanation), hide (drop a
given component of the explanation) and self _evident (the current component
is self-evident and should not be expanded further). The rules’ bodies check the
truth value of fluents in a corresponding state to determine how to best treat a
component of the explanation. The user interface can then use the information
to tailor the presentation of the proof tree. In fact, the approach can be further
refined to customize the presentation for a class of users, e.g. non-expert, HR,
or developer.
      </p>
      <p>Acknowledgments. We would like to thank the anonymous reviewers for their
valuable suggestions and comments.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>1. https://www.cdc.gov/coronavirus/2019-ncov/community/guidance-businessresponse.html</mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Aguado</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cabalar</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fandinno</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Muniz</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Perez</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Suarez</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          :
          <article-title>A RuleBased System for Explainable Donor-Patient Matching in Liver Transplantation</article-title>
          .
          <source>In: 35th International Conference on Logic Programming (ICLP19)</source>
          (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Baral</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gelfond</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Reasoning Agents In Dynamic Domains</article-title>
          .
          <source>In: Workshop on Logic-Based Artificial Intelligence</source>
          . pp.
          <fpage>257</fpage>
          -
          <lpage>279</lpage>
          . Kluwer Academic Publishers (
          <year>Jun 2000</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Chintabathina</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Watson</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          :
          <article-title>Logic Programming, Knowledge Representation, and Nonmonotonic Reasoning: Essays Dedicated to Michael Gelfond on the Occasion of His 65th Birthday, chap</article-title>
          .
          <source>A New Incarnation of Action Language H</source>
          , pp.
          <fpage>560</fpage>
          -
          <lpage>575</lpage>
          .
          <source>Lecture Notes in Artificial Intelligence (LNCS)</source>
          , Springer Verlag, Berlin (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Fandinno</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schulz</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Answering the âĂĲWhyâĂİ in Answer Set Programming - A Survey of Explanation Approaches</article-title>
          .
          <source>Journal of Theory and Practice of Logic Programming (TPLP) 19(2)</source>
          ,
          <fpage>114</fpage>
          -
          <lpage>203</lpage>
          (
          <year>Mar 2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Gelfond</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lifschitz</surname>
            ,
            <given-names>V.: Action</given-names>
          </string-name>
          <string-name>
            <surname>Languages</surname>
          </string-name>
          .
          <source>Electronic Transactions on AI</source>
          <volume>3</volume>
          (
          <issue>16</issue>
          ) (
          <year>1998</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Inclezan</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gelfond</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>Modular action language</article-title>
          .
          <source>Journal of Theory and Practice of Logic Programming (TPLP) 16(2)</source>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Kowalski</surname>
            ,
            <given-names>R.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sadri</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          :
          <article-title>Reactive Computing as Model Generation</article-title>
          .
          <source>New Generation Computing</source>
          <volume>33</volume>
          (
          <issue>1</issue>
          ),
          <fpage>33</fpage>
          -
          <lpage>67</lpage>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Lee</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lifschitz</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          :
          <article-title>Additive Fluents</article-title>
          . In: Provetti,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Son</surname>
          </string-name>
          , T.C. (eds.)
          <article-title>Answer Set Programming: Towards Eficient and Scalable Knowledge Representation and Reasoning</article-title>
          .
          <source>AAAI 2001 Spring Symposium Series (Mar</source>
          <year>2001</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Son</surname>
            ,
            <given-names>T.C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pontelli</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gelfond</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Balduccini</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>An Answer Set Programming Framework for Reasoning about Truthfulness of Statements by Agents</article-title>
          .
          <source>In: 32nd International Conference on Logic Programming (ICLP16)</source>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>