<!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>Towards Incorporating Normative Requirements In Autonomous Systems Using Datalog</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Mahrokh Mirani</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>GSSI (Gran Sasso Science Institute)</institution>
          ,
          <addr-line>L'Aquila</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2025</year>
      </pub-date>
      <abstract>
        <p>The increasing integration of AI components in autonomous systems, particularly multi-robot systems, poses new regulatory challenges under the EU AI Act. In this work, we address the formalization and analysis of normative (SLEEC) requirements-those capturing social, legal, ethical, empathetic, and cultural constraintsessential for ensuring compliance with such regulations. We focus on the problem of obligation inference, which refers to selecting the necessary obligations, while considering a set of normative rules. We demonstrate our approach through an extension of NASA's FRET tool, as a proof of concept. This extension enables the user to specify, formalize, and translate SLEEC rules into both LTL and Datalog for runtime monitoring and decisionmaking.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>Normative requirements are non-functional requirements that specify social, ethical or legal
constraints of a system. As the AI systems become more pervasive and interact with humans on a daily
basis, they need to satisfy critical properties, respecting more human-centred values. Such properties
are usually extracted by experts in fields other than formal verification, e.g., lawyers, psychologists,
philosophers, etc. This highlights the elicitation and formalization of these properties as a primary
concern.</p>
      <p>The AI Act is the recent regulation adopted in the European Union countries to ensure safer and
more secure use of artificial intelligence technologies. The European Union’s regulation on AI classifies
systems into four groups according to the risks they pose to users. These four levels are: 1. Unacceptable
risk (e.g., social scoring systems), 2. High risk (e.g., medical devices), 3. Limited risk (e.g., deepfakes),
and 4. Minimal or no risk. Each of these groups is treated with the necessary regulations to provide
safety. Most of the AI Act targets systems with high risk (the second group). It includes many systems,
including those used as safety components or for profiling individuals. These systems should provide
enough evidence to prove compliance with requirements and remain compliant during all stages of the
deployment of the system. However, it is not explained how this compliance should be checked by the
providers of these systems. This raises the need for developing new testing methods and adapting the
existing ones to focus on the specific needs of this domain.</p>
      <p>
        Multi-robot systems often incorporate AI components for tasks such as autonomous
decisionmaking, bringing them under the scope of the AI Act regulations. This brings up the problem of
analyzing these systems and checking their compliance with the requirements. This problem can be
broken into various sub-problems, e.g., requirement elicitation, formalization, consistency checking,
validation and verification. Bennaceur et. al. in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] count the main activities in the requirement
engineering process as elicitation, modelling and analysis, assurance, and management and evolution.
Each of these steps has its respective challenges and open issues in the field of robotic systems. For
example, for the elicitation process, FRET (Formal Requirements Elicitation Tool) is a tool proposed to
ifll the gaps between requirements in natural language and formal specification of them by
introducing a structured specification language close to English. For the analysis of the requirements, many
tools and techniques are proposed to monitor, test, and in some cases formally verify requirements in a
robotic system. However, there is no integrated solution for the specification and analysis of normative
requirements in robotic areas.
      </p>
      <p>The autonomous systems that incorporate AI components usually have to follow dynamic
decisionmaking procedures, and in many cases, this process has to be done in real time. This makes the
efifciency of the decision-making process of high importance. In this work, we also try to tackle the
eficient decision-making problem by incorporating optimized logical reasoning techniques. In
section 2, we will give a background on normative requirements and tools and methods used for our
purpose. In Section 3, the main approach to the problem is explained, and finally, in the section 4,
challenges and future directions are discussed.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Background</title>
      <p>In this section, we will explain the current state of the art for SLEEC requirements and previous works
on how to perform logical reasoning with them. We will also give a short introduction of Datalog,
which we have used for eficient obligation inference.</p>
      <sec id="sec-2-1">
        <title>2.1. Normative Requirement Specification</title>
        <p>
          Specifying and formalizing the normative requirements for AI can be challenging due to the
ambiguities of these requirements and Townsend et. al. [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] introduce a procedure to elicit SLEEC properties
from high-level principles considering the capabilities and limitations of the robot agent. Their
proposed approach consists of five steps as follows:
        </p>
        <sec id="sec-2-1-1">
          <title>1. Identifying Norms and Normative Principles</title>
          <p>2. Mapping Principles to Agent Capabilities
3. Identifying SLEEC Concerns
4. Identifying and Resolving SLEEC Conflicts
5. Labelling, Identifying Impact, and Re‑assessing Complex Rules
In the first step, the goal is to extract a list of general norms and principles regarding the context of
the robot and its objectives. In the next step, the robot’s capabilities such as input or output devices
are taken into account. In this step, these capabilities are mapped with SLEEC principles and how they
can afect the principles. This step may also result in recognizing the need for supporting additional
capabilities. In the third step, SLEEC concerns are derived regarding the system processes. Especially,
the legal concerns that might be related to the system at hand should be listed in this step, alongside
other cultural, social, empathetic, and ethical concerns. During the fourth step, the conflicting norms
are extracted and stakeholders need to decide in which cases which norm is superior and based on
that which action should be taken. In the last step, the SLEEC rule should be labelled based on the
norms that it considers in each case and be reevaluated across other SLEEC concerns. In the case of
further conflicts, the last three steps should be repeated as many times as needed until there are no
more exceptions to be added.</p>
          <p>
            The resulting SLEEC rule consists of a general case with a recursive set of exceptions that are expressed
with the structure “unless ... in which case ...”. This structure is based on [
            <xref ref-type="bibr" rid="ref2">2</xref>
            ] who believe that moral
principles have exceptions that can be captured by “unless” and these cases don’t follow the normal
form. The resulting SLEEC rule is in the following form, and consecutive works also follow the same
pattern:
          </p>
          <p>IF  0 THEN DO  0,
UNLESS  1 IN WHICH CASE DO  1,
UNLESS  2 IN WHICH CASE DO  2,</p>
          <p>…
UNLESS   IN WHICH CASE DO   .
(1)</p>
        </sec>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Obligation Inference</title>
        <p>The problem of obligation inference is to compute the output response based on a set of inputs and
a set of rules, in a way that no rule is violated. To better understand the problem, here is the formal
definition of it:
Definition 2.1. The problem of obligation inference is defined as follows: Given a set of FRETish-SLEEC
rules, an observation set  1( 1⃗), … ,   ( ⃗), and an obligation ( ⃗ 0), is ( ⃗ 0)entailed?
Considering the SLEEC format introduced in section 2.1, the goal is to find eficient ways to perform
the obligation inference. In this format, { 0,  1, … ,   } is the set of observations and { 0,  1, … ,   } is
the set of obligations to compute.</p>
        <p>There are two diferent parses for this pattern, and diferent works in the literature use them
arbitrarily. The diference is shown in table 1. Ultimately, they are equivalent from a computational
perspective. however, it is left to the authors to decide between them according to simplicity and
comprehensibility for the user. To avoid confusion, we use the first one for the rest of this paper, but
everything can be extended to include the other parsing too.</p>
        <p>IF  0 THEN ((…(DO  0),
UNLESS  1 IN WHICH CASE DO  1),
UNLESS  2 IN WHICH CASE DO  2),</p>
        <p>…
UNLESS   IN WHICH CASE DO   ).</p>
        <p>(giving highest priority to   )</p>
        <p>IF  0 THEN (DO  0,
UNLESS  1 IN WHICH CASE (DO  1,
UNLESS  2 IN WHICH CASE (DO  2,</p>
        <p>…
UNLESS   IN WHICH CASE (DO   )…)).</p>
        <p>(giving highest priority to  0)</p>
        <p>
          Troquard et. al. [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] ofer a transformation of these SLEEC rules into classical logic. Here we explain
briefly how this is done. In this compilation, each line of the formula is broken into a logical clause and
satisfaction of the conjunction of these clauses results in satisfaction of the formula. For each line, the
status of all of the previous lines needs to be checked. One obligation will be conducted only if the next
unless does not happen. So obligation   depends on the satisfaction of all the previous observations
( 0,  1, … ,   ) and also dissatisfaction of  +1 . Therefore, the transformation for the formula 1 is the
following:
 =
[ ⋀
0≤≤−1
(( ⋀ (  ) ∧ ¬ +1 ) →   )]
0≤≤
(2)
∧ [( ⋀
0≤≤
        </p>
        <p>(  )) →   ]</p>
      </sec>
      <sec id="sec-2-3">
        <title>2.3. Datalog</title>
        <p>
          Datalog is a declarative programming language for logical inference. It is diferent from Prolog in that
it is specifically developed to perform inference on sets of data. Souflé is a high-performance Datalog
engine designed especially for program analysis, and has proved to show good performance on large
datasets [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ].
        </p>
        <p>A program in the Souflé implementation of Datalog must contain the declaration of all relations used
in the program. It also needs to specify explicitly which relations constitute the inputs and outputs. The
body of the rules are defined in the program as conjunctions (shown by character ’,’) and disjunctions
(shown by character ’;’) between relations. For example, consider the case that a relation A for a number
is true if that number satisfies both relations B and C. We have relations B, C and want to derive A.
This can be defined using the following program:</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Current Work</title>
      <p>A relation without inputs can be used as a constant.</p>
      <p>As explained before, the eficiency in the decision-making process by AI is of high importance. We
try to address this problem by transforming the SLEEC rules into Datalog logic programs and then
employing Souflé for logical inference.</p>
      <p>In this section, the explanations are developed through an example. Consider an assistant robot
helping to take care of a patient in a nursing home. It is a well-known example in the literature. This
robot has to respect some rights of the user. Stakeholders reach a SLEEC rule after discussing the
priority of various rights of the user. The resulting rule is as follows:</p>
      <sec id="sec-3-1">
        <title>If the user asks to open the window, then open the window, Unless the user is underdressed, in which case do not open the window and inform the user of the reason behind this inaction, unless the user is highly distressed, in which case open the window.</title>
        <p>FRET (Formal Requirement Elicitation Tool) is a tool developed by NASA for the elicitation,
formalization and understanding of requirements. It is widely used in industry for formalizing requirements
and generating future- and past-time LTL formulas. It also ofers realizability checking and interactive
simulation of the requirements. We added an extension to this tool to formulate SLEEC rules and
generate future-time LTL formulae. In addition, this extension provides the user with the Datalog code
for obligation inference and runtime monitoring of the requirements.</p>
        <p>In this extension of FRET, the SLEEC rule for the assistant robot can be specified as:
If ask_open(u,w) then open(w), unless underdressed(u) in which case not_open(w) &amp;
inform(u), unless highly_distressed(u) in which case open(w)
Based on the compilation explained in section 2.2, the following logical rule is obtained:
 _(,  ) ∧ ¬   () → ( ) ∧
 _(,  ) ∧    () ∧ ¬ℎℎ _  () →   () ∧ 
 _(,  ) ∧    () ∧ ℎℎ _  () → ( )
_( ) ∧
(3)</p>
        <sec id="sec-3-1-1">
          <title>3.1. Obligation Inference</title>
          <p>To generate the Datalog code for the obligation inference, one Datalog rule is generated for every
obligation. The formula 2 is broken into n+1 implications, and if the conditions of an obligation are
satisfied, then this obligation gets the value “true” in the outputs. To evaluate these conditions,
observations are treated as input data for the Datalog program. This data should be supplied by the system,
for example, via sensors.</p>
          <p>The rules for deriving obligations are expressed as logical operations over predicates. As customary,
constants are represented as predicates by introducing an auxiliary variable. For instance, if a rule
states that support should be called when the temperature exceeds 30 degrees, it would be expressed
in our extension as follows:
IF temperature(t:number) &amp; t &gt; 30 THEN callSupport()
The Datalog rule to compute this obligation will be generated as follows:
callSupport() :- temperature(t), t &gt; 30.</p>
        </sec>
        <sec id="sec-3-1-2">
          <title>3.2. Runtime Monitoring</title>
          <p>The goal of the runtime monitor is to observe the system while running and raise a warning whenever
a violation of the rules happens. For this purpose, the runtime monitoring works in two steps. In the
ifrst step, the same as the previous section, obligation inference is done. This time, in addition to input
data, the observed actions are another group of inputs. The second step compares the observed actions
and the inferred obligations, and if an inferred obligation does not happen, a violation has occurred.</p>
          <p>Formally, a new boolean predicate is introduced for each obligation, and its value is set to “true”, if
and only if that obligation is inferred to be done, but it is not observed to be done in reality. These
predicates are introduced as the outputs of the program.</p>
          <p>For example, if a rule contains an obligation called  () , then an input    _ ()
and an output called   _ _ () are defined, and the following rule is added to the
monitoring program:
violation_of_callSupport() :- callSupport() , ! observed_callSupport() .</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusions and Future Directions</title>
      <p>We try to tackle the problem of obligation inference and runtime monitoring specific to normative
requirements. We use Datalog as an inference engine to decide on obligations in an AI system. This
approach shows a good performance considering the data complexity and rule complexity. So far,
we have limited these rules to only include predicates as both observations and obligations. In a
realworld scenario, many requirements demand a notion of time. For example, some obligations need to be
carried out within a certain amount of time, but in our work, we have forced the obligation predicate
to take efect immediately. This issue can be solved by defining timed predicates and enforcing the
timing constraints internally to the system. However, explicit times can be more practical in some
contexts and can put an extra focus on timing during the requirement engineering process.</p>
      <p>It is also needed to define sequences of actions with a specific ordering. A very common example
of such an obligation is known as patrolling, which means a sequence of locations that a robot should
visit in order. For that purpose, it is also needed to have a temporal logic like LTL to be able to monitor
a program.</p>
    </sec>
    <sec id="sec-5">
      <title>Declaration on Generative AI</title>
      <p>The author afirms that no generative artificial intelligence (AI) tools were employed in the conception,
analysis, writing, or revision of this manuscript. All content and interpretations presented herein are
the sole work of the author.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>A.</given-names>
            <surname>Bennaceur</surname>
          </string-name>
          , T. T. Tun,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Yu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Nuseibeh</surname>
          </string-name>
          , Requirements Engineering, Springer International Publishing, Cham,
          <year>2019</year>
          , pp.
          <fpage>51</fpage>
          -
          <lpage>92</lpage>
          . URL: https://doi.org/10.1007/978-3-
          <fpage>030</fpage>
          -00262-
          <issue>6</issue>
          _2. doi:
          <volume>10</volume>
          .1007/ 978- 3-
          <fpage>030</fpage>
          - 00262-
          <issue>6</issue>
          _
          <fpage>2</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>B.</given-names>
            <surname>Townsend</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Paterson</surname>
          </string-name>
          , T. T. Arvind, G. Nemirovsky,
          <string-name>
            <given-names>R.</given-names>
            <surname>Calinescu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Cavalcanti</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Habli</surname>
          </string-name>
          , A. Thomas,
          <article-title>From pluralistic normative principles to autonomous-agent rules</article-title>
          ,
          <source>Minds and Machines</source>
          <volume>32</volume>
          (
          <year>2022</year>
          )
          <fpage>683</fpage>
          -
          <lpage>715</lpage>
          . URL: https://doi.org/10.1007/s11023-022-09614-w. doi:
          <volume>10</volume>
          .1007/ s11023- 022- 09614- w.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>N.</given-names>
            <surname>Troquard</surname>
          </string-name>
          ,
          <string-name>
            <surname>M. De Sanctis</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          <string-name>
            <surname>Inverardi</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          <string-name>
            <surname>Pelliccione</surname>
            ,
            <given-names>G. L.</given-names>
          </string-name>
          <string-name>
            <surname>Scoccia</surname>
          </string-name>
          , Social, legal, ethical, empathetic, and
          <article-title>cultural rules: Compilation and reasoning</article-title>
          ,
          <source>Proceedings of the AAAI Conference on Artificial Intelligence</source>
          <volume>38</volume>
          (
          <year>2024</year>
          )
          <fpage>22385</fpage>
          -
          <lpage>22392</lpage>
          . URL: https://ojs.aaai.org/index.php/AAAI/article/ view/30245. doi:
          <volume>10</volume>
          .1609/aaai.v38i20.
          <fpage>30245</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>H.</given-names>
            <surname>Jordan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Scholz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Subotić</surname>
          </string-name>
          , Souflé:
          <article-title>On synthesis of program analyzers</article-title>
          , in: Computer Aided Verification: 28th International Conference,
          <string-name>
            <surname>CAV</surname>
          </string-name>
          <year>2016</year>
          , Toronto, ON, Canada,
          <source>July 17-23</source>
          ,
          <year>2016</year>
          , Proceedings,
          <source>Part II 28</source>
          , Springer,
          <year>2016</year>
          , pp.
          <fpage>422</fpage>
          -
          <lpage>430</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>