=Paper= {{Paper |id=Vol-494/paper-26 |storemode=property |title=A Framework to Model Norm Dynamics in Answer Set Programming |pdfUrl=https://ceur-ws.org/Vol-494/famaspaper8.pdf |volume=Vol-494 |dblpUrl=https://dblp.org/rec/conf/mallow/PanagiotidiNV09 }} ==A Framework to Model Norm Dynamics in Answer Set Programming== https://ceur-ws.org/Vol-494/famaspaper8.pdf
  A framework to model norm dynamics in Answer
                 Set Programming
                          Sofia Panagiotidi and Juan Carlos Nieves and Javier Vázquez-Salceda
                                       Knowledge Engineering and Machine Learning Group
                                           Universitat Politecnica de Catalunya, Spain
                                           {panagiotidi,jcnieves,jvazquez}@lsi.upc.edu


   Abstract—This paper presents ongoing work in the formal             policies. Still, the work lacks support for time. Insight into
definition and implementation of a normative framework in              intelligent decision and possible prediction of desired or non-
Answer Set Programming. The framework uses as basis an                 desired behaviours in advance seems to be absent too.
existing action language and enriches it with a formal definition
of norms (implementing standard deontic operators such as                 We are aware of the work in [8] in which the authors present
obligations and permissions). Properties of a norm’s lifecycle         a language for implementing multi-agent systems consisting of
such as active, inactive, violated are specified. We argue that such   individual agents that interact with a computational organiza-
properties can serve as a reasoning basis for the agent’s cycle.       tion specified in terms of roles, norms and sanctions. Still,
A partial implementation of the framework is then presented.           this piece of work adopts an organisation-centered view more
An example is used in order to illustrate the application of the
principles presented.                                                  on the flexible role enactment within a BDI cycle while ours
                                                                       assumes a static role enactment and focuses on a decision
                        I. I NTRODUCTION                               making mechanism inferring possible future action taking and
   The field of normative systems is an active area where              violated states.
researchers try to find formalisations and mechanisms to model            In the last two decades, one of the most successful logic
and reason about normative statements. There is a lot of               programming approach has been Answer Set Programming
formal work on the formalisation of norms, typically based             (ASP) [9]. ASP is the realization of much theoretical work
in variants of monadic or dyadic Deontic Logic. In this way,           on Non-monotonic Reasoning and Artificial Intelligence appli-
normative systems predefine the desired behaviour in terms             cations. It represents a new paradigm for logic programming
of deontic concepts (obligations, prohibitions, permissions),          that allows, using the concept of negation as failure, to handle
which typically are extended with other concepts such as               problems with default knowledge and produce non-monotonic
deadlines, violations and sanctions. But there is few work on          reasoning. Since its inception, ASP has been regarded as the
how to bring these theories into practice.                             computational embodiment of Nonmonotonic Reasoning and
   One of the main barriers for the use of deontic-like for-           a primary candidate for an effective knowledge representation
malisations is the lack of operational semantics [1]. Without          tool. This view has been boosted by the emergence of highly
clear operational semantics an agent cannot clearly reason             efficient solvers for ASP [10], [11], [12]. The efficiency of the
about the influence of these norms in its practical reasoning          answer set solvers has allowed to increase the list of ASP’s
mechanism. Some attempts have been made to reduce deontic              practical applications, e.g., planning [13], Bioinformatics [14],
formalisations of norms into operational formalisations based          [15], argumentation theory [16], etc. Answer Set Programming
on, e.g. dynamic Logic [2] or Linear Temporal Logic [3], but           does not represent a conventional logic programming approach
often such formalisations cannot really be used at execution           as PROLOG. Usually an answer set program P can be
time.                                                                  regarded as a specification of a given problem where each
   Other attempts focus on extending existing operational              answer set (a model) of P represents a possible solutions of
formalisms with some normative concepts. These attempts                the given problem.
mainly concern the design of action languages based on the                In this paper (Figure 1) we propose, based on a previous
effects of axioms and drawing inferences from the axioms and           normative formalisation [17], a methodology to represent
concentrate on ways of reasoning about actions. [4] presents an        such normative frameworks in Answer Set Programming.
action description language capable of expressing causal laws          This representation can be used as a basis for decision
which describe effects of actions as well as statements about          making procedures as well as planning methodologies.
values of fluents in possible states of the world. Work of the         We use as example the obligations between two actors (a
same authors covers some aspects of reasoning over dynamic             Insurance Company and a Repair Company) defined in a
domains [5] and representation and reasoning over properties           electronic contract. This contract is composed by deontic
of actions [6]. In [7] the authors intent to provide a logic based     clauses which will become norms of the expected behaviour
language in order to represent authorizations and obligation           of the contractual parties. Therefore each instantiated contract
policies within dynamic environments as well as methods for            becomes a normative context at execution time.
checking compliance of performed actions with the defined
                                                                         IV we detail the action and normative language used and
                                                                         define formal properties of the framework with respect to the
                                                                         aforementioned. A partial implementation of the action and
                                                                         normative language in Answer Set Programming is provided
                                                                         in sections V and VI and parts of the motivating example
                                                                         presented in the beginning are cited in section VIII. We
                                                                         conclude in section IX and summarise future work.
                                                                                             II. BACKGROUND
                                                                           In this section, we present some basic definitions w.r.t.
                                                                         normal programs and the stable model semantics.
                                                                         A. Syntax
                                                                            A signature L is a finite set of elements that we call atoms.
                                                                         A literal is either an atom a, called positive literal; or the
                                                                         negation of an atom not a, called negative literal. Given a set
      Fig. 1.   Architecture of the normative framework implementation   of atoms {a1 , ..., an }, we write not {a1 , ..., an } to denote the
                                                                         set of atoms {not a1 , ..., not an }. A normal clause, C, is a
   The work is at a preliminary state. Still, integrated within an       clause of the form
agent’s operating cycle, such a framework can operate as the
                                                                                   a ← b1 , . . . , bn , not bn+1 , . . . , not bn+m
brain of the agent [18], providing the necessary information
over the current state of the world such as pending norms                where a and each of the bi are atoms for 1 ≤ i ≤ n + m.
and currently violated obligations. Additional layers of plan-           In a slight abuse of notation we will denote such a clause by
ning rules and preferred choices might lead to the desired               the formula a ← B + ∪ not B − where the set {b1 , . . . , bn }
intelligence and flexibility an agent needs to perform in a              will be denoted by B + , and the set {bn+1 , . . . , bn+m } will be
normative environment. We define several layers of abstraction           denoted by B − . We define a normal program P , as a finite
(Figure 1). An agent (possibly interacting with an ontology)             set of normal clauses.
can interpret the environment it operates in through an action              If the body of a normal clause is empty, then the clause is
language. The deontic restrictions (which in this paper come             known as a fact and can be denoted just by a ← . or simply
from a contract, but in other scenario could come from a                 a. We write LP , to denote the set of atoms that appear in
Institutional specification) provide guidelines over the agent’s         the clauses of P . We denote by HEAD(P ) the set {a|a ←
behaviour and are formalised through a deontic framework.                B + , not B − ∈ P }.
   Generic rules over the interpretation of norms, the                   B. Stable model semantics.
interpretation of the action language and planning rules
                                                                            The stable model semantics was defined in terms of the
defined with respect to the action language might be added on
                                                                         so called Gelfond-Lifschitz reduction [19] and it is usually
top of the previous in order to be able to extract information
                                                                         studied in the context of syntax dependent transformations
over the agent’s state, know the possible actions to take,
                                                                         on programs. The following definition of a stable model for
predict possible violations and foresee future paths. Our
                                                                         normal programs was presented in [19]:
interest and focus can be summarised in the following four:
                                                                            Let P be any normal program. For any set S ⊆ LP , let P S
                                                                         be the definite program obtained from P by deleting
  • An action language representation                                       (i)    each rule that has a formula not l in its body with
  • Contract (viewed as a set of norms) representation                             l ∈ S, and then
  • Generic rules over the norm lifecycle
                                                                            (ii)   all formulæ of the form not l in the bodies of the
  • Generic planning and choice rules
                                                                                   remaining rules.
                                                                         Clearly P S does not contain not. Hence S is a stable model
   Currently, the three first of the above are implemented while         of P if and only if S is a minimal model of P S .
the fourth and equally interesting issue is under research. In              In order to illustrate this definition let us consider the
this paper we are aiming to provide the functionality of the             following example:
aforementioned as well as some preliminary planning rules.                  Let S = {b} and P be the following logic program:
We argue that the implemented layers leave further space                      b ← not a.                   b ← >.
for future research over the agent’s planning capabilities and                c ← not b.                   c ← a.
behavioural choices.                                                     We can see that P S is:
   The rest of the paper is structured as follows. Section II                 b ← >.                   c ← a.
defines the stable model semantics which is the basis for                Notice that P S has three models: {b}, {b, c} and {a, b, c}.
Answer Set Programming. In section III we present a simple               Since the minimal model amongst these models is {b}, we
motivating example which supports our work while in section              can say that S is a stable model of P .
                         III. E XAMPLE                               called postcondition of the action a) and p1 , ..., pn , q1 , ..., qr
   The focus of interest of this example is to show how a            are fluents (also called preconditions of the action a) in F .
contract and a set of instantiated norms over the repair of             We assume a set of initial observations O that consists of
a car operate within the domain and normative environment            value propositions of the following form:
implemented in ASP. Such a case is useful to demonstrate how
reasoning and planning over the norms defined in a contract            f    after    a1 , ..., am               (4.2)
can be done throughout its execution.
   Our scenario is as follows: Two actors, a Repair Company          where f is a fluent literal and a1 , ..., am are actions.
and a Client create a contract (RepairContract) over the             Intuitively that means that f will hold after the execution of
repair of a broken car. Initially, the Client takes the car to the   a1 , ..., am .
Repair Company. Once the car is there, the Repair Company            When a1 , ..., am is an empty sequence then we write:
has to repair it. Whenever it is repaired, the Client has to pay
a previously agreed price. Once the car is repaired, the client      initially   f              (4.3)
has the right to make a complaint.
   Figure 2 depicts a pseudo-diagram including the interesting       We also condense a set of value propositions of the
states that the process will go into.                                form {initially f1 , ..., initially fn } by

                                                                     initially   f1 , ..., fn           (4.4)

                                                                     The role of effect propositions is to define a transition
                                                                     function from states and actions to states. Given a domain
                                                                     description D, such a transition function Φ should satisfy the
                                                                     following properties. For all actions α, fluents g, and states
                                                                     σ:

                                                                       • if D includes an effect proposition of the form (4.1)
                                                                         where f is the fluent g and p1 , ..., pn , ¬q1 , ..., ¬qr hold
                   Fig. 2.     Pseudo states diagram                     in σ then g ∈ Φ(α, σ);
                                                                       • if D includes an effect proposition of the form

  The focus of interest of this example is to show how the               (4.1) where f is a negative fluent literal ¬g and
norms of an electronic contract (explicitly expressed as clauses         p1 , ..., pn , ¬q1 , ..., ¬qr hold in σ then g 6∈ Φ(α, σ);
in the contract) can be mapped into ASP rules and, in a                • if D does not include such effect propositions then

combination with an appropriate action language, to reason               g ∈ Φ(α, σ) iff g ∈ σ;
over, plan future actions and detect violations within the
agent’s scope.                                                          If such a transition function exists, then we say that D is
                                                                     consistent, and refer to its transition function by ΦD . Given
                    IV. L ANGUAGE USED
                                                                     a consistent domain description D the set of observations O
A. Actions                                                           is used to determine the states corresponding to the initial
   The action description in our approach is done as in most         situation, referred to as the initial states and denoted by σ0 .
action description languages. In this work we use the formal-        While D determines a unique transition function, an O may
isation of [6] but adapt several rules to fit our requirements.      not always lead to a unique initial state.
   Thus the alphabet of the action language A consists of
two nonempty disjoint sets of symbols F and A. They are              We say σ0 is an initial state corresponding to a consistent
called the set of fluents and the set of actions. Fluents express    domain description D and a set of observations O, if for all
the property of an object in a state of the world. A fluent          observations of the form (4.2) in O, the fluent literal f holds
or fluent literal (e.g. car_at_shop) is a positive literal or a      in the state Φ(αm , Φ(αm−1 , ...Φ(α1 , σ0 )...)) (We will denote
strongly negated literal (a fluent preceded by ¬). A state σ         this state by [αm , ..., α1 ]σ0 ). We then say that (σ0 , ΦD )
is a collection of fluents. We say a fluent f holds in a state σ     satisfies O.
if f ∈ σ. We say a fluent literal ¬f holds in σ if f 6∈ σ.
   An action domain description D within the action language         Given a consistent domain description D and a set of
A consists of effect propositions of the following form:             observations O, we refer to the pair (ΦD , σ0 ) where ΦD
                                                                     is the transition function of D and σ0 is an initial state
  a   causes f      if       p1 , ..., pn , ¬q1 , ..., ¬qr   (4.1)   corresponding to (D, O) as a model of (D, O). We say (D,
                                                                     O) is consistent if it has a model and say it is complete if it
where a is an action in A, f is a fluent literal in F (also          has a unique model.
                                                                      if it gets violated. Such properties of norms with respect to a
We say a consistent domain description D in the presence of           normative environment are implemented in section VI.
a set of observations O entails a query Q of the form (4.2)
if for all initial states σ corresponding to (D, O), the fluent       We assume a set of norms DS. A norm N in DS is
literal f holds in the state [αm , ..., α1 ]σ0 ]. We denote this as   represented as a tuple of the form [17]:
D |=O Q.
                                                                       (4.5)
let’s assume that the set of actions A         =
{repair(Actor), pay(Actor), complain(Actor)}, the                     such that:
set of fluents                                                          • N ormT ype ∈ {obligation, permission}
                                                                        • DeonticStatement is an action a in the set of actions
F = {car_at_shop, repaired(Actor),                                        Anorm subset of A
paid(Actor), complained(Actor)}                                         • an       ActivatingCondition           is     of       the       type:
                                                                          k1 , ..., kn , ¬l1 , ..., ¬ln , where k1 , ..., kn , l1 , ..., ln are
and that the domain description consists of the following:                fluents in F
                                                                        • a        DisactCondition            is     of         the        type:
repair(Actor) causes repaired(Actor) if car_at_shop                       u1 , ..., un , ¬v1 , ..., ¬vn ,   where     u1 , ..., un , v1 , ..., vn
                                                                          are fluents in F
pay(Actor) causes paid(Actor)                                           • a      M aintenanceCondition is of the type:
                                                                          w1 , ..., wn , ¬z1 , ..., ¬zn , where w1 , ..., wn , z1 , ..., zn
complain(Actor) causes complained(Actor)                                  are fluents in F
                                                                        • a Actor is the actor responsible for the deontic statement
Also suppose we have a set of observations

O = {initially car_at_shop, ¬repaired(rc),                              The definition and semantics of permissions are not trivial.
¬ paid(cl), ¬ complained(cl)}. 2                                      For example, it is dubious whether their existence can
                                                                      be assumed within the context of an environment without
A set of observations O is said to be initial state complete,         obligations. In [21] the authors discuss the different types of
if O only consists of propositions of the form (4.3) and for          permissions and their role in deontic logic. We assume that
all fluents, either initially f is in O, or initially ¬ f is in O,    permissions are an explicit indication on what an actor can
but not both.                                                         perform. As in standard deontic logic we assume further that
                                                                      whenever there is an obligation it is always implied that the
                                                                      same is a permission too (Oa → Pa , axiom D of deontic
B. Deontic statements                                                 logic).
   Norms (clauses) express agreements between parties in the
form of deontic statements. In order to express the clauses we        Example 2: Figure 3 depicts the formal representation
have adopted a variation [20] [17] of the norm representation         of the deontic statements within the contract of the example
defined in [3].                                                       presented in the third section. 2
   Since norms may have normative force only in certain                  Below we give some definitions with respect to the action
situations, they are associated with an activation condition.         language and the deontic statements. Let a norm N be in the
Norms are thus typically abstract, and are instantiated when          form of (4.5) and σ be a state.
the norm’s activation condition holds. Once a norm has been
instantiated, it remains active, irrespective of its activation         • N is activated in σ iff k1 , ..., kn , ¬l1 , ..., ¬ln hold in
condition, until a specific expiration condition holds. When              σ. We denote this as D |=DS, O,σ activated(N ). In
the expiration condition occurs, the norm is assumed no                   the contrary case, N is not activated. We denote this as
longer to have normative force. Independent of these two                  D |=DS, O,σ ¬activated(N ).
conditions is the norm’s normative goal, which is used                  • N is disactivated in σ iff u1 , ..., un , ¬v1 , ..., ¬vn hold in
to identify when the norm is violated (in the case of an                  σ. We denote this as D |=DS, O,σ disactivated(N ). In
obligation), or what the agent is actually allowed to do                  the contrary case, N is not disactivated. We denote this
(in the case of a permission). Obligations and permissions                as D |=DS, O,σ ¬disactivated(N ).
are the two norm types on which our framework focuses.                  • N      is violated in σ iff at least one of
For every norm there is a maintenance condition which, if                 w1 , ..., wn , ¬z1 , ..., ¬zn does not hold in σ. We
does not hold while the norm is active then a violation is                denote this as D |=DS, O,σ             violated(N ). In the
considered to be taking place. Finally, for every norm there              contrary case, N is not violated. We denote this as
exists another one (violation norm) indicating what happens               D |=DS, O,σ ¬violated(N ).
                                                                       and the set of norms DS in example 2. O is an initial state
                                                                       complete. Then the initial state corresponding to (D, O) will
                                                                       be

                                                                       σ0 = {initially car_at_shop, ¬repaired(rc),
                                                                       ¬ paid(cl), ¬ complained(cl)}.

                                                                       Then:

                                                                       D |=DS, O activated(NRC2 ) since activated(NRC2 )
                                                                       holds in the state [repair(rc)]σ0 .

                                                                       D |=DS, O activated(NRC3 ) since activated(NRC3 )
                                                                       holds in the state [repair(rc)]σ0 .

                                                                       where NRC2 is the norm RC2 and NRC3 is the norm
                                                                       RC3. 2

                                                                       Proposition 1: Let D be a consistent domain description, O
                                                                       be an initial state complete set of observations and DS a set
                                                                       of deontic statements. If (D, O) is consistent then ∀N ∈ DS
                                                                       and for any state σ reached by ΦD :
                                                                         • D       |=DS,O,σ     activated(N ) or D          |=DS,O,σ
                                                                            ¬activated(N )
                                                                         • D      |=DS,O,σ disactivated(N ) or D |=DS,O,σ
                                                                            ¬disactivated(N )
                                                                         • D |=DS,O,σ violated(N ) or D |=DS,O,σ ¬violated(N )



                                                                       C. Temporal Projection
                                                                          Planning: In the case of planning we are given a domain
                                                                       description D, a set of observations about the initial state
                                                                       O, a collection of deontic statements DS and a collection
                                                                       of fluent literals G = {g1 , ..., gh } which we will refer to as
                                                                       goal. We are required to find a sequence of actions aa , ..., an
     Fig. 3.   Formal representation of norms in the Repair Contract
                                                                       such that for all 1 ≤ i ≤ h, D |=O gi after a1 , ..., an and for
                                                                       all states σ passed throughout the execution of the actions,
  Queries with respect to norms consist of value propositions          6 ∃σ such that D |=DS,O,σ violated(N ).
of the form:

    activated(N ) after a1 , ..., am                                                V. R EPRESENTATION OF ACTIONS
    disactivated(N ) after a1 , ..., am                        (4.6)      Given an action domain description D, a set of observations
    violated(N ) after a1 , ..., am                                    O and a set of deontic statements DS we construct a program
                                                                       that partially implements the above. The basic elements and
where N is a deontic statement of the form (4.5), and                  definitions of types are (πbasic ). The program putting into
a1 , ..., am are actions in A.                                         effect (D, O) consists of three parts namely πef , πobs , πin
   We say a consistent domain description D in the                     which represent the effect propositions, observations and
presence of a set of observations O and a set of norms                 inertia rules. In addition, πnorm and (πlc ) partly implement
DS entails a query Q of the form (4.6) if for all                      the norms specification and norm lifeycle. We denote the
initial states σ0 corresponding to (D,O) the proposition               union of πbasic ∪ πef ∪ πobs ∪ πin ∪ πnorm ∪ πlc as π.
activated(N ), disactivated(N ), violated(N )          holds
respectively in the state [αm , ..., α1 ]σ0 . We denote this           In addition to the approach of [6], we assume that actions are
as D |=DS, O Q.                                                        durative. That is, they have a starting and ending time and
                                                                       a duration which is the interval between the two. For this,
Example 3: Let’s assume the set of actions A, the set                  we use predicates like started and teminated to indicate
of fluents F and the set of observations O in example 1                the time that an action starts being executed and the time it
terminates.
                                                                     (3) Inertia rules (πin ). Besides the above, we have the
                                                                     following inertia rules. The first one makes sure that if no
                                                                     action is executed during a timestep then a fluent will keep
A. Basic elements                                                    holding a true value at the next timestep if it already holds
   We introduce here some predicates (πbasic ) which avoid           true at the current timestep. The second one makes sure that
the program to have weakly restricted rules.                         if a fluent holds a true value and the action that is performed
                                                                     at some timestep does not make it false, then in the next
(1) The predicate f luent. For every fluent f ∈ F we                 timestep it will also hold true. The third one says that if no
add the following rule to the program.                               action is executed during a timestep then a fluent will keep
                                                                     holding a flse value at the next timestep if it already holds
  f luent(f ) ← .                                                    false at the current timestep. The fourth one makes sure that
                                                                     if a fluent holds a false value and the action that is performed
(2) The predicate action. For every action a ∈ A we                  at some timestep does not make it true, then in the next
add a rule:                                                          timestep it will also hold false.

  action(a) ← .
                                                                     holds(F, T + 1) ← holds(F, T ), not terminated(A, T ).
(3) The predicate time. The predicate is used to represent
number of distinct times which in their turn represent the
                                                                     holds(F, T + 1) ← holds(F, T ), terminated(A, T ),
time flow. Initially time(T ) where T is a constant.
                                                                                        not ab(F, A, T ).
B. Action rules
                                                                     ¬ holds(F, T + 1) ← not holds(F, T ),
   (1) Translating effect propositions (πef ). The effect
                                                                                        not terminated(A, T ).
propositions in D are translated as follows. For every effect
proposition of the form (4.1) if f is a fluent in F then the
                                                                     ¬ holds(F, T + 1) ← not holds(F, T ), terminated(A, T ),
following rules are created:
                                                                                        not ab(F, A, T ).
holds(f, T + 1) ← terminated(a, T ), time(T ).
                                                                     The following proposition demonstrates how the holds
ab(f, a, T ) ← terminated(a, T ), time(T ).                          predicate of π will hold a true value at some time step if f
                                                                     holds true at some state σ reached by the function ΦD .
else if f is the negative fluent literal ¬g then the following
rules are created:                                                   Proposition 2: Let D be a consistent domain description
                                                                     and O be an initial complete set of observations such that
¬ holds(g, T + 1) ← terminated(a, T ), time(T ).                     (D, O) is consistent. Let (σ0 , ΦD ) be the unique model
                                                                     of (D, O) and M a stable model of π. If f is a fluent in F then
ab(g, a, T ) ← terminated(a, T ), time(T ).
                                                                     f ∈ ΦD (αn , ..., ΦD (α1 , σ0 )) iff holds(f, T ) ∈ M for
Intuitively, predicate holds indicates whether a fluent’s            some T ∈ N.
value is true or false throughout time. The ab predicate
represents changes of a fluent’s value at some specific              (4) Executability rules. It is assumed that every action
timestep.                                                            might be executed whenever the conditions are fulfiled. We
                                                                     use the predicate executable to model the state where the
(2) Translating observations (πobs ). We intentionally omit          preconditions of action are fulfiled and the action might be
observations of the type (4.2) and assume that all observations      executed.
are of the type (4.3). The value propositions in O then are
translated as follows. For every value proposition of the form       Thus, for every effect proposition of the form (4.1) the
(4.3) if f is a positive fluent literal then the following rule is   following is created:
made:
holds(f, 1) ← .
                                                                       executable(a, T ) ← holds(p1 , T ), ..., holds(pn , T ),
else if f is the negative fluent literal ¬g then the following                             not holds(q1 , T ), ..., not holds(qn , T ),
rule is created:                                                                           time(T ).

¬ holds(g, 1) ← .
     VI. R EPRESENTATION OF D EONTIC S TATEMENTS                  where t is a constant.
   We assume that for every norm N of the form (4.5) a
unique id id is assigned to it. In order to represent a norm, a   The generic rule
rule of the respective type below is made (πnorm ).               started(Action, T ) ← obligation_activated(Id, Action, T ),
                                                                                        executable(Action, T ), time(T ),
activating_condition(id, a, T ) ← holds(k1 , T ), ...,                                  action(Action), obligation_id(Id).
                                  holds(kn , T ),
                                  not holds(l1 , T ), ...,
                                  not holds(ln , T ),             ensures that an action starts whenever it is executable and an
                                  time(T ).                       obligation to execute it becomes active.

disact_condition(id, a, T ) ← holds(u1 , T ), ...,
                            holds(un , T ),
                            not holds(v1 , T ), ...,              terminated(Action, T 2) ← started(Action, T 1),
                            not holds(vn , T ),                              estimated_time(Action, EstimatedT ime),
                            time(T ).                                        T 2 = T 1 + EstimatedT ime,
                                                                             time(T 2), time(T 1).
maintain_cond(id, a, T ) ← holds(w1 , T ), ...,
                           holds(wn , T ),                        The generic rule
                           not holds(z1 , T ), ...,
                           not holds(zn , T ),                    violation(Id, Action, T ) ← active(Id, Action, T ),
                           action(Action), time(T ).                          not maintain_cond(Id, Action, T ),
                                                                              action(Action), time(T ), obligation_id(Id).

Keeping in mind the normative semantics described in IV-B
we define the rules that implement a norm’s lifecycle (πlc ).     detects a violation whenever a clause is active and the
                                                                  maintenance condition is not true.
obligation_activated(Id, Action, T ) ←
           activating_condition(Id, Action, T ),                  The following propositions ensure the correctness of
           not active(Id, Action, T − 1),                         the program π implementing the norm’s lifecycle properties.
           action(Action), time(T ),
           obligation_id(Id).
                                                                  Proposition 3: Let D be a consistent domain description,
obligation_disactivated(Id, Action, T ) ←                         O be an initial state complete set of observations such that
           disact_condition(Id, Action, T ),                      (D, O) is consistent, DS a set of norms and M a stable
           active(Id, Action, T − 1),                             model of π. If there is a state σ reached by ΦD such that
           action(Action), time(T ),                              D |=DS,O,σ activated(N ) then there is a T ∈ N such that
           obligation_id(Id).                                     activating_condition(id, a, T ) ∈ M where id is the unique
                                                                  identifier of the norm N and a is the DeonticStatement of
The two rules below define when an obligation is active.
                                                                  the norm N .

active(Id, Action, T ) ←                                          Proposition 4: Let D be a consistent domain description,
           obligation_activated(Id, Action, T ),                  O be an initial state complete set of observations such that
           action(Action), time(T ),                              (D, O) is consistent, DS a set of norms and M a stable
           obligation_id(Id).                                     model of π. If there is a state σ reached by ΦD such that
                                                                  D |=DS,O,σ disactivated(N ) then there is a T ∈ N such
active(Id, Action, T ) ← active(Id, Action, T − 1),               that disact_condition(id, a, T ) ∈ M where id is the unique
           not obligation_disactivated(Action, T ),               identifier of the norm N and a is the DeonticStatement of
           action(Action), time(T ), obligation_id(Id).           the norm N .
           VII. R EPRESENTATION OF P LANNING                      Proposition 5: Let D be a consistent domain description,
  We assume that for every action we have an estimated            O be an initial state complete set of observations such that
duration on its execution time:                                   (D, O) is consistent, DS a set of norms and M a stable
                                                                  model of π. If there is a state σ reached by ΦD such that
  estimated_time(a, t) ← .                                        D |=DS,O,σ violated(N ) then there is a T ∈ N such that
                                                                  maintain_cond(id, a, T ) and active(id, a, T ) ∈ M where
id is the unique identifier of the norm N and a is the            and taken into consideration while advancing with the use
DeonticStatement of the norm N .                                  of the framework in order to reach conclusions on the future
                                                                  states. A formal notion of goal needs to be introduced in
Example 4: Let D, O, DS be the domain description,                order to reach a desired state. Another interesting aspect to
observations and deontic statements of the examples               be examined is the use of weighted rules when reasoning
1 and 2, π the program modeling D,               O and            with respect to norms against the possible effects of one or
DS and M one of its stable models. As seen in                     more violations. This will ensure that each agent can make
the example 3, in the state σ = [repair(rc)]σ0                    decisions on execution time based not only on a set of norms
activated(NRC2 ) will hold. Thus, there for some T ∈ N            indicating a desired behaviour but also on criteria such as
activating_condition(idRC2 , repair(rc), T ) ∈ M where            desires, preferences and time constraints.
idRC2 is the unique identifier of the norm RC2.
                                                                                       X. ACKNOWLEDGEMENTS
                      VIII. E XAMPLE                                This research has been funded by the FP7-215890 ALIVE
  In our example, the initial observation can be:                 project, funded by the European Commission. Javier Vázquez-
                                                                  Salceda’s work has been also partially funded by the "Ramón
holds(at_shop, 0).                                                y Cajal" program of the Spanish Ministry of Education and
                                                                  Science.
time(0..30).
                                                                                               R EFERENCES
The model will include the following:
                                                                   [1] J. Vázquez-Salceda and F. Dignum, “Modelling electronic
                                                                       organizations,” Multi-Agent Systems and Applications III: 3rd.
obligation_activated(rc1, repair(rc), 0)                               International/Central and Eastern European Conference on
obligation_disactivated(rc1, repair(rc), 10)                           Multi-Agent Systems -CEEMAS’03, Lecture Notes in Artificial
                                                                       Intelligence 2691, pp. 584–593, 2003. [Online]. Available:
                                                                       http://people.cs.uu.nl/dignum/papers/harmonia-CEEMAS03.pdf
obligation_activated(rc2, pay(cl), 10)                             [2] J.-J. C. Meyer and R. J. Wieringa, “Deontic logic: a concise overview,”
obligation_disactivated(rc2, pay(cl), 11)                              pp. 3–16, 1993.
                                                                   [3] H. Aldewereld, Autonomy vs. Conformity: an Institutional Perspective
                                                                       on Norms and Protocols. PhD thesis, Utrecht University, 2007.
action_started(repair(rc), 0)                                      [4] C. Baral, M. Gelfond, and A. Provetti, “Representing actions: Laws,
action_f inished(repair(rc), 10)                                       observations and hypotheses,” The Journal of Logic Programming,
                                                                       vol. 31, no. 1-3, pp. 201–243, 1997.
                                                                   [5] C. Baral and M. Gelfond, “Reasoning agents in dynamic domains,” 2000,
action_started(pay(cl), 10)                                            pp. 257–279.
action_f inished(pay(cl), 11)                                      [6] M. Gelfond and V. Lifschitz, “Representing action and change by logic
                                                                       programs,” Journal of logic programming, 1993.
                                                                   [7] M. Gelfond and J. Lobo, “Authorization and obligation policies in
For further information and the ASP code, the reader                   dynamic systems,” Proceedings of the 24th International Conference
is referred to the web page where the code is hosted:                  on Logic Programming, pp. 22–36, 2008.
http://www.lsi.upc.edu/ panagiotidi/aspcode                        [8] N. Tinnemeier, M. Dastani, and J.-J. Meyer, “Roles and norms for
                                                                       programming agent organizations,” in AAMAS ’09: Proceedings of The
  IX. C ONCLUSIONS , D ISCUSSION AND F UTURE W ORK                     8th International Conference on Autonomous Agents and Multiagent
                                                                       Systems.     Richland, SC: International Foundation for Autonomous
   Assuming the environment that an agent operates can be              Agents and Multiagent Systems, 2009, pp. 121–128.
                                                                   [9] C. Baral, Knowledge Representation, Reasoning and Declarative Prob-
modelled by an action languange, norms impose restrictions             lem Solving. Cambridge: Cambridge University Press, 2003.
on the behaviour of the agent. This paper presents ongoing        [10] S.       DLV,        “Vienna        University       of     Technology,”
work on the formal specification and development of a                  http://www.dbai.tuwien.ac.at/proj/dlv/, 1996.
framework that enables to model an action language with           [11] S.      SMODELS,          “Helsinki     University     of   Technology,”
                                                                       http://www.tcs.hut.fi/Software/smodels/, 1995.
respect to a normative environment. Semantics of the action       [12] Potassco, “University of Potsdam,” http://potassco.sourceforge.net/,
language are based on [6] and the language is partially                2007.
implemented and further enriched with temporal projection.        [13] T. Eiter, W. Faber, N. Leone, G. Pfeifer, and A. Polleres, “A logic
                                                                       programming approach to knowledge-state planning, ii: The DLVk
The deontic statements such as obligations and permissions as          system.” Artif. Intell., vol. 144, no. 1-2, pp. 157–211, 2003.
well as properties related to the norm’s lifecycle (activation,   [14] S. Dworschak, S. Grell, V. Nikiforova, T. Schaub, and J. Selbig,
disactivation, violation) are formalised and implemented               “Modeling Biological Networks by Action Languages via Answer Set
according to [20]. An attempt to define and apply planning             Programming,” Constraints, vol. 13, no. 1, pp. 21–65, 2008.
                                                                  [15] C. Baral, K. Chancellor, N. Tran, N. Tran, A. M. Joy, and M. E. Berens,
techniques within the formal model and the implementation              “A knowledge based approach for representing and reasoning about
is made.                                                               signaling networks,” in ISMB/ECCB (Supplement of Bioinformatics),
                                                                       2004, pp. 15–22.
                                                                  [16] J. C. Nieves, M. Osorio, and U. Cortés, “Preferred Extensions as Stable
This piece of work can be extended in various directions.              Models,” Theory and Practice of Logic Programming, vol. 8, no. 4, pp.
Formal aspects of planning need to be carefully considered             527–543, July 2008.
[17] N. Oren, S. Panagiotidi, J. Vázquez-Salceda, S. Modgil, M. Luck,
     and S. Miles, “Towards a formalisation of electronic contracting en-
     vironments,” Coordination, Organization, Institutions and Norms in
     Agent Systems, the International Workshop at AAAI 2008, pages 61-68,
     Chicago, Illinois, USA, 2008.
[18] R. Confalonieri, S. Alvarez-Napagao, S. Panagiotidi, J. Vázquez-
     Salceda, and S. Willmott, “A middleware architecture for
     building contract-aware agent-based services,” LECTURE NOTES
     IN COMPUTER SCIENCE, Jan 2008. [Online]. Available:
     http://www.springerlink.com/index/m84n55h118j86178.pdf
[19] M. Gelfond and V. Lifschitz, “The stable model semantics for logic
     programming.” R. Kowalski and K. Bowen, editors, 5th Conference on
     Logic Programming, pages 1070âĂŞ1080. MIT Press, 1988.
[20] S. Panagiotidi, J. Vázquez-Salceda, S. ÃAlvarez
                                                 ˛       Napagao, S. Ortega-
     Martorell, S. Willmott, R. Confalonieri, and P. Storms, “Intelligent con-
     tracting agents language,” Proceedings of the Symposium on Behaviour
     Regulation in Multi-Agent Systems -BRMAS’08-, Aberdeen, UK, April
     2008, 1988.
[21] G. Boella and L. van der Torre, “Permissions and obligations in
     hierarchical normative systems,” Proceedings of the 9th international
     conference on Artificial intelligence and law, pp. 109–118, 2003.