<!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>A Controlled Language for the Specification of Contracts</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Gordon J. Pace!</string-name>
          <email>gordon.pace@um.edu.mt</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Michael Rosner!!</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Malta</institution>
          ,
          <addr-line>Msida MSD2080</addr-line>
          ,
          <country country="MT">Malta</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Controlled natural languages have been used to enable the direct translation from natural language specications into a formal description. In this abstract we make a case for such an approach to write contracts, and translating into a temporal deontic logic. Combining both temporal behaviour and deontic behaviour is challenging both from a natural language and a formal logic perspective. We present both a logic and a controlled natural language and outline how the two can be linked.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>– Only the owner of a job has permission to cancel the job.
– The system is forbidden from producing a result if it has been cancelled by the
owner.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Underlying Logic Representation Language</title>
      <p>
        The challenge to formalise deontic logic, to reason about normative concepts such as
obligations and permissions, has been the hot topic of research for various decades. The
main challenge is that it is very easy to describe paradoxical situations using deontic
concepts [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Introducing the concept of time, introduces more paradoxes [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Various
axiomatizations have been proposed, as an attempt to deal with the paradoxes, however,
one of the more effective approaches has been that of restricting the syntax [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Since
our aim is to reason about contracts derived from natural language texts, and which
could thus include paradoxes or contradictions, we opt for a more general logic, which
could then be restricted, syntactically or semantically, to weed out potential problems.
      </p>
      <p>Contracts are sometimes seen as properties which should be satised by a system.
This view however, does not enable (i) reasoning about the contract eg ‘What are the
currently undischarged obligations in the contract?’; or (ii) reasoning about exceptional
cases in a contract eg ‘Whenever clause (a) is violated, the user is prohibited from
obtaining the service’. The introduction of explicit prohibition, obligation and permission
clauses into a contract is thus essential to enable reasoning about it. Furthermore, such
clauses have to be associated to a particular agent participating in the contract.</p>
      <p>The deontic logic includes obligation, permission and prohibition (O(α : e), P (α :
e) and F (α : e)), non-deterministic choice (+), conjunction (&amp;), conditional (c 1"α#c2),
generalised sequential composition (c2""c##c1, which starts with c, and then follows it up
with c1 or c2 depending on whether it was satised or violated) and timing information
(c[b,e]):
contract ::= !time | ⊥time | O(agent : action) | P (agent : action) | F (agent : action)
| contract + contract | contract &amp; contract | contract ! action " contract
| contract !!contract ""contract | contract[time,time]</p>
      <p>Using these operators and x-point denitions, other operators can be dened: (i)
one branch conditional: e → c ≡ c " e # #0; (ii) sequential composition: c1; c2 ≡
c2 ""c1 ##⊥0; (iii) the always operator: !(c) ≡ c &amp; #1; !(c); and (iv) the sometimes
operator: ♦(c) ≡ c + #1; ♦(c). Furthermore, the complement of an action or an agent
can be expressed in the logic using a bar over the object. The examples given earlier
can be written in the following manner:
– Upon accepting a job, the system guarantees that the results will be available within
an hour unless cancelled in the meantime:
!(acceptj → O(system : (resultj + cancelj))[0,1hr])
– Only the owner of a job has permission to cancel the job:</p>
      <p>!(P (ownerj : cancelj) &amp; F (ownerj : cancelj))
– The system is forbidden from producing a result if it has been cancelled by the
owner: !(cancelj → F (system : (♦(resultj ))))</p>
      <p>
        The logic proposed shares much in avour with CL [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] and other action-based
deontic logics. One can construct observer formulae (one for each actor), using which one
can model-check contracts [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], and perform contract analysis. The temporal side of the
logic is based on timed regular expressions [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Although, as in timed regular
expression, a continuous time domain may be used, at the moment we restrict the time to a
discrete domain for analysis techniques. Through the use of a trace semantics of the
logic, standard model checking techniques can be used to check for validity.
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Remarks on a Possible Controlled Language</title>
      <p>In this section we take the numbered examples of section 1 and propose some
simplications which reduce both syntactic complexity and, more importantly, the potential
for ambiguity.
1. original: Upon accepting a job, the system guarantees that the results will be
available within an hour unless cancelled in the meantime.
controlled if SYSTEM accepts Job, then during one hour it is
obligatory that SYSTEM make available results of Job unless
SOMEONE cancels Job.
comment: There are three events: accepting a job, results being available, and
a cancellation. There is also a contractual obligation concerning the second
event, but this is discharged if the cancellation takes place. This sentence
displays the classical problem of attachment ambiguity. There is also a problem of
ellipsis. The main problems are (a) the attachment of the time adverbial within
an hour and (b) the object of the the cancellation. Regarding the attachment,
the adverbial could attach to either the availability of the results, or to the
obligation concerning the availability of results (cf. within an hour I promise to
go vs. I promise to go within an hour). Regarding the object of the
cancellation, this could be the job or the results. We should note that in section 2, both
these ambiguities have been resolved: attachment is to the obligation has been
favoured, whilst the object of the results is assumed to be the results.</p>
      <p>
        Several problems can be solved by allowing proper names into the language.
Predened ones, like SYSTEM, are notated using all capital letters, whilst
arbitrary ones, like Job, are used to enforce coreference, have an initial capital
letter. A second major change is a rationalised event syntax based on a simple
agent-action-object format. The easy cases are underlined above. The complex
case revolves around is obliged, which can usefully be treated as an event
(strictly it is a state) whose object is itself an event. We have carefully
controlled the syntax and placement of the time adverbials, and, last but not least,
the position of unless is immediately after the statement of the obligation.
2. original: Only the owner of a job has permission to cancel the job.
controlled: it is permitted that only owner of Job cancels Job.
comment: The syntax is basically uncontroversial but there is an issue about the
anaphoric status of denite noun phrases. Although it would be possible,
following Fuchs-et-al. [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], to deal with this using DRT ((cf. Kamp and Reyle [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]),
we feel that the introduction of proper names offers a much simpler solution.
The logical representation suggested in section 2 is being driven by the word
only is straightforward to engineer using techniques from unication
grammar.
3. original: The system is forbidden from producing a result if it has been cancelled
by the owner.
controlled If owner of Job cancels Job, it is forbidden that SYSTEM
produces result of Job
comment: The main problem with the original sentence is that it the syntax is
complex, and the word it ambiguously refers to either the system or result or
producing a result”, or, if we consider all three sentences to be part of a
discourse, the job mentioned in the second sentence. Although it has been argued
that this particular case could be resolved by semantic constraints or or by the
use of heuristics (cf. ACE [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]), we feel that all these problems can be avoided
by adopting the controlled language being suggested.
      </p>
      <p>Space limitations prevent a proper discussion of the grammar. Instead we illustrate
some proposed parse trees for key phrases in our examples.</p>
      <sec id="sec-3-1">
        <title>PART OF EXAMPLE 1</title>
        <p>================= s</p>
        <p>______________________|_______________________
durip_n_g__t_-|ao_d_nd_v_e__n_|p___h_o_unr ip_tr_o_____ia__su__x____vm_|goo|__db___el___ip___gp___aa__tr__ot__r__y____t__ch__oa__mt_p__|sSa_Yg_Snn_|e_Tpo|n|_n_Em_t_M______m__a__kv__a_e__cs___ti__v_im|_|g_op__a_nl__v_e__a||-__isa_e_lj_va_eb_nl_te__r_e_sn__|upn__lo__tb__sj__nne_|||poc_omt_f_p____p_|p___n|_pn
Job</p>
      </sec>
      <sec id="sec-3-2">
        <title>EXAMPLE 3</title>
        <p>
          =========
The examples above have been generated using a PC-PATR, a version of PATR2 (Shieber
[
          <xref ref-type="bibr" rid="ref9">9</xref>
          ]). Unication grammar formalisms such as PATR2 facilitate the transformation of
parse tree fragments shown into attribute-value structures that can be regarded as
notational variants of the formulae presented in section 2 of this paper.
        </p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Conclusions</title>
      <p>In this abstract we have outlined the proposal for a controlled natural language and
a deontic logic to enable specication and reasoning about contracts in an automatic
fashion. A number of challenges still remain to be addressed.</p>
      <p>In the translation from the sublanguage to logic, one can nd a direct
correspondence between the subgrammar and the logic. We plan to use contract analysis
techniques similar to ones we have recently developed for CL to enable contract sanity
checking, including discovery of conict analysis and superuous clauses. These
techniques can provide feedback to the contract translation from the natural sublanguage
into logic, for example, for the resolution of ambiguities.</p>
      <p>
        The main aim of transforming logic to language is to make it more
understandable to those unfamiliar with logic. The transformation is clearly a problem of Natural
Language Generation (NLG) which is generally recognised (cf. Reiter and Dale [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ])
to involve large numbers of realisation choices. These can of course be by-passed by
adopting a suitably strict generation algorithm. The extent to which this compromises
naturalness is a factor that will need to be carefully evaluated in the contracts domain.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Pulman</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Controlled language for knowledge representation</article-title>
          .
          <source>In: Proceedings of the First International Workshop on Controlled Language Applications</source>
          , Leuven, Belgium (
          <year>1996</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2. Meyer,
          <string-name>
            <given-names>J.J.C.</given-names>
            ,
            <surname>Dignum</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Wieringa</surname>
          </string-name>
          ,
          <string-name>
            <surname>R.:</surname>
          </string-name>
          <article-title>The paradoxes of deontic logic revisited: A computer science perspective (or: Should computer scientists be bothered by the concerns of philosophers?)</article-title>
          .
          <source>Technical Report UU-CS-1994-38</source>
          , Department of Information and Computing Sciences, Utrecht University (
          <year>1994</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Pace</surname>
            ,
            <given-names>G.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schneider</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          :
          <article-title>Challenges in the specication of full contracts</article-title>
          .
          <source>In: Proceedings of Integrated Formal Methods (iFM'09)</source>
          . LNCS, Springer (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Prisacariu</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schneider</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          :
          <article-title>A formal language for electronic contracts</article-title>
          .
          <source>In: 9th IFIP International Conference on Formal Methods for Open Object-Based Distributed Systems (FMOODS'07)</source>
          . Volume 4468 of LNCS., Springer (
          <year>2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Pace</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Prisacariu</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schneider</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          :
          <article-title>Model checking contracts -a case study</article-title>
          .
          <source>In: 5th International Symposium on Automated Technology for Verication and Analysis (ATVA'07)</source>
          . Volume 4762 of LNCS., Tokyo, Japan, Springer-Verlag (
          <year>2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Asarin</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Caspi</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Maler</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          :
          <article-title>Timed regular expressions</article-title>
          .
          <source>Journal of the ACM</source>
          <volume>49</volume>
          (
          <issue>2</issue>
          ) (
          <year>2002</year>
          )
          <fpage>172</fpage>
          -
          <lpage>206</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Fuchs</surname>
            ,
            <given-names>N.E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kaljurand</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kuhn</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          :
          <article-title>Attempto Controlled English for Knowledge Representation</article-title>
          . In Baroglio,
          <string-name>
            <given-names>C.</given-names>
            ,
            <surname>Bonatti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.A.</given-names>
            , Ma!uszyn´ski, J.,
            <surname>Marchiori</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Polleres</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Schaffert</surname>
          </string-name>
          , S., eds.
          <source>: Reasoning Web, Fourth International Summer School 2008. Number 5224 in Lecture Notes in Computer Science</source>
          , Springer (
          <year>2008</year>
          )
          <fpage>104</fpage>
          -
          <lpage>124</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Kamp</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Reyle</surname>
            ,
            <given-names>U.</given-names>
          </string-name>
          : From Discourse to Logic:
          <article-title>Introduction to Model-theoretic Semantics of Natural Language, Formal Logic and Discourse Representation Theory</article-title>
          .
          <source>Studies in Linguistics and Philosophy</source>
          . Springer (
          <year>1993</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Shieber</surname>
            ,
            <given-names>S.:</given-names>
          </string-name>
          <article-title>An Introduction to Unication-Based Approaches to Grammar</article-title>
          . CSLI Publications, Stanford University, California (
          <year>1986</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Reiter</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dale</surname>
          </string-name>
          , R.:
          <article-title>Building natural language generation systems</article-title>
          .
          <source>Studies in natural language processing</source>
          . Cambridge University Press, Cambridge, U.K. ; New York (
          <year>2000</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>