<!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>Generating FoCaLiZe Specifications from UML Models</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Messaoud Abbas</string-name>
          <email>abbasmessaoud@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Choukri-Bey Ben-Yelles Renaud Rioboo</string-name>
          <email>Renaud.Rioboo@ensiie.fr</email>
          <email>choukri.ben-yelles@iut-valence.fr</email>
          <email>choukri.ben-yelles@iut-valence.fr Renaud.Rioboo@ensiie.fr</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>USTHB. LSI, BP32 EL-Alia, Algiers &amp;, College of Sciences and Technology</institution>
          ,
          <addr-line>El-Oued Univ. BP789 RP</addr-line>
          ,
          <country country="DZ">Algeria.</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Univ. Grenoble Alpes</institution>
          ,
          <addr-line>LCIS, CPR CEDRIC ENSIIE, Rue Barthe ́le ́my de Laffemas Square de la Re ́sistance, F-26901 Valence</addr-line>
          ,
          <country country="FR">France.</country>
          <addr-line>F-91025 Evry</addr-line>
          ,
          <country country="FR">France.</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2014</year>
      </pub-date>
      <fpage>2</fpage>
      <lpage>4</lpage>
      <abstract>
        <p>UML is the defacto standard language to graphically describe systems in an object oriented way. Once an application has been modeled, Model Driven Architecture (MDA) techniques can be applied to generate code from such models. Because UML lacks formal basis to analyze and check model consistency, it is pertinent to choose a formal target language (in the MDA process) to enable proofs and verification techniques. To achieve this goal, we have associated to UML the FoCaLiZe language, an object-oriented development environment using a proof-based formal approach. In this paper, we propose a formal transformation of a subset of UML constructors composed of UML class diagrams annotated with OCL constraints into FoCaLiZe specification. Thanks to FoCaLiZe design and architectural features, the proposed mapping directly supports most of UML features such as multiple inheritance, function redefinition, late-binding, template and template binding which are not provided through other formal tools.</p>
      </abstract>
      <kwd-group>
        <kwd>UML</kwd>
        <kwd>OCL</kwd>
        <kwd>FoCaLiZe</kwd>
        <kwd>Formal verification</kwd>
        <kwd>Modeling</kwd>
        <kwd>Semantics</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        The Unified Modeling Language (UML) [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] is the
defacto standard to graphically and intuitively describe
systems in an object oriented way. Currently, it is
supported by a wide variety of tools, ranging from analysis,
testing, simulation to code generation and transformation.
The Object Constraint Language (OCL) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] is the current
formal standard of the Object Management Group. An
OCL constraint is a precise statement which may be
attached to any UML element. Using UML and OCL,
we can only describe models and specify constraints upon
them. No formal proof is available in a UML/OCL context
to check the consistency of UML models or to check
whether OCL properties hold in UML models.
      </p>
      <p>
        In the last few years several approaches have been
carried out in order to provide supporting tools to
generate (using MDA techniques) a reliable software from an
UML/OCL model and check its properties. In particular,
several studies have focused on the transformation of
UML/OCL models into formal methods. The most used
formal tools are the B language [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], the Alloy formal
tool [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], the Maude system [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] and the Isabelle/HOL [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]
among several others.
      </p>
      <p>
        In this paper, we present a translation from UML/OCL
into the FoCaLiZe environment [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] following a compiling
approach (by translation). The choice of FoCaLiZe does
not solely rely on its formal aspects. Most of the UML
design and architectural features are presented in
FoCaLiZe [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. It also supports all necessary logical
constructors (8, 9, -&gt;, &lt;-&gt;, ^, _, . . . ) which enables a
natural transformation of OCL constraints into FoCaLiZe.
Our approach is motivated by the following arguments:
      </p>
      <p>First, we support the transformation of most of UML
conceptual and architectural features such as
encapsulation, inheritance (generalization/specialization) and
multiple inheritance, function redefinition, late-binding,
dependency, UML template (parameterized classes) and
template binding. Because these features are presented
in FoCaLiZe through its own constructs without need of
additional structures or invariants, we may keep the same
development semantics of UML. Most of UML design
and architectural features are not seamlessly considered
through the aforementioned formal methods, usually with
semantics loss of the original model and with deviation
from the incremental intuition development provided by
UML. In particular, multiple inheritance, function
redefinition, templates and template bindings are not supported.</p>
      <p>
        Second, the choice of FoCaLiZe environment is also
motivated by its functional paradigm (with no side
effects), by the power of its automated theorem prover
Zenon [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] and its proof checker Coq [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. Realizing
proofs with Zenon makes the user intervention much
easier since it manages to fulfill most of the proof
obligations automatically.
This document is organized as follows: section 2
presents FoCaLiZe and the UML/OCL concepts, sections
3 and 4 explain our transformation approach. In section 5
we present the framework that integrates UML/OCL
models and FoCaLiZe environment to check the consistency
of UML/OCL models. Section 6 presents a comparison
with related works.
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. FoCaLiZe and UML/OCL</title>
    </sec>
    <sec id="sec-3">
      <title>2.1. FoCaLiZe</title>
      <p>
        The FoCaLiZe [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] environment, initiated by T. Hardin
and R. Rioboo, is an integrated development
environment with formal features. A FoCaLiZe development is
organized as a hierarchy of species that may have
several roots. This hierarchy is built step by step
(incremental approach), starting with abstract specifications
and heading to concrete implementations using object
oriented features such as inheritance and parameterization. A
species groups together methods using ML-like types
and expressions:
      </p>
      <p>The carrier type (representation), describes
the data structure of the species. The representation
of a species can depend on the representation of other
species. It is mandatory and can either be explicitly
given or obtained by inheritance.</p>
      <p>Function declarations (signature), specify
functional types that will be defined later through
inheritance (no computational body is provided at this
stage).</p>
      <p>Function definitions (let), consist of optional
functional types together with computational bodies.
Properties (property), statements expressed by
a first-order formula specifying requirements to be
satisfied in the context of the species.</p>
      <p>
        Properties together with their proofs (theorem).
The general syntax of a species is given as follows:
species species name [(species parameters)]
= [ inherit species names] ;
[representation = rep type;]
signature f unction name : f unction type;
[local / logical] let [rec] f unction name =
f unction body;
property property name:prop specif ication;
theorem theorem name : theorem specif ication
proof = theorem proof ;
end ;;
As we mentioned above, species have object-oriented
flavors [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. We can create a species from scratch or
from other species using (multiple) inheritance. Through
inheritance, it is possible to associate a definition of
function to a signature or a proof to a property. Similarly,
it is possible to redefine a method even if it is already
used by an existing method. The late-binding mechanism
ensures that the selected method is always the latest
defined along the inheritance tree.
      </p>
      <p>A species is said to be complete if all declarations
have received definitions and all properties have received
proofs. The representations of complete species are
encapsulated through species interfaces. The interface
of a complete species is the list of its function types
and its logical statements. It corresponds to the end user
point of view, who needs only to know which functions
he can use, and which properties these functions have,
but doesn’t care about the details of the implementation.
When complete, a species can be implemented through
the creation of collections. A collection can hence be
seen as an abstract data type, only usable through the
methods of its interface. The following example presents
the widely used species Setoid. It models any
nonempty set with an equivalence relation on the equality (=)
method:
species Setoid = inherit Basic_object;
signature equal: Self-&gt;Self-&gt;bool;
signature element: Self;
property equal_reflexive:</p>
      <p>all x: Self, equal (x, x) ;
property equal_symmetric: all x y: Self,
equal(x, y) -&gt; equal (y, x) ;
property equal_transitive: all x y z: Self,
equal(x, y)-&gt; equal(y, z) -&gt; equal(x, z);
...
end;;</p>
    </sec>
    <sec id="sec-4">
      <title>2.2. UML/OCL concepts</title>
      <p>
        In this paper we focus on UML class diagrams. In order
to provide a formal framework for the transformation of
UML model into FoCaLiZe specifications, we propose an
abstract syntax for the UML considered constructs. The
vast majority of this syntax is extracted from the UML
Metamodel [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <p>A class is characterized by its name and contains
attributes and operations. Each attribute (instance or state
variable) of a class has a name and a specification which
is either a primitive type or another class of the model.
Specifications may describe multiple values of a type.
Each operation (method) has a name, parameters and a
specification. Parameters are pairs formed by names and
their types. A class diagram also contains binary relations
between classes which makes it possible to describe
generalization (inheritance), dependencies, parameterization
and binding relationship. Binary associations are also
considered. An association between two classes has a
name, roles, navigability features and multiplicities.</p>
      <p>
        The Object Constraint Language (OCL) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] allows us to
enhance UML graphical notations with logical formulas.
It is the current standard of the Object Management Group
(OMG). An OCL constraint may be attached to any UML
element (its context) to further specify it. We consider
class invariants and operation pre and post-conditions.
ocl constraint ::= context focl-stereotype : OCL-Expg+
context ::= context fclassContext j opContextg
ocl-stereotype ::= inv j pre j post
      </p>
      <p>
        OCL expressions have types which are either primitive
types or classes of the model [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. OCL also defines
set oriented types (collections, sets, ordered sets, bags
and sequences) in order to describe logical quantification
using an object oriented syntax.
      </p>
    </sec>
    <sec id="sec-5">
      <title>3. From UML class diagram to FoCaLiZe</title>
      <p>In what follows we will present the translation process
from UML into FoCaLiZe. Our UML model describes the
following element constructors: class and association.
For each constructor, a transformation rule is proposed.
During the transformation process we will maintain
two contexts, U for UML and F for FoCaLiZe. U
is defined as follows: For a given class named c n,</p>
      <p>U (c n) = (c n = Vc n), where Vc n is the value of the
class. A class value is a pair ( c n; bodyc n) composed
of the local context of the class and the body of the class.
The body of the class is composed of class attributes and
class operations. In other words, the body of the class c n
is expressed as follows (the trailing star sign denotes
several occurrences):
bodyc n = (Attrc n; Oprc n), where
Attrc n = f(att n : att type)g , att n is an attribute
name of the class c n and att type its type. Similarly
Oprc n = f(op n : op type)g where op n is an
operation name of the class c n and op type its parameters
and returned types. During the transformation process,
the local context U (c n) of the class c n is to be
enriched with all class identifiers appearing in the list P of
parameter declarations, the list H of classes from which
the current class inherits, and the list D of dependencies
(see class definition in section 3.1).</p>
      <p>In a symmetrical way, the FoCaLiZe typing context,
is defined as follows: For a given species named s n,</p>
      <p>F (s n) = (s n = Vs n), where Vs n is the value of
the species. A species value is a pair ( s n ; bodys n)
composed of the local context of the species together with
its body.</p>
      <p>A species body is composed of its representation (Rep),
signatures (Sig), function definitions (Let), properties
(P rop) and proofs (P roof ). The body of the species s n
is denoted:
bodys n = (Reps n; Sigs n; Lets n; P rops n; P roofs n)</p>
      <p>For an UML element U we will denote [[U ]] U ; F
its translation into FoCaLiZe. For an identifier ident,
upper(ident) returns ident with its first character
capitalized and lower(ident) returns ident with its first
character in lowercase.
[ &lt; class def &gt;] U ; F = species s n
( [ P] U ; F , [ T ] U ; F , [ D] U ; F )=</p>
      <p>inherit Setoid, [ H] U ; F ;
[ A] U ; F ; [ O] U ; F
end ;;</p>
      <p>where c n is the name of the class, P is a list of
parameter declarations, T is a list of substitutions of
formal parameters with actual parameters, H designates
the list of classes from which the current class inherits,
D is a list of dependencies, A the attribute list of the
class and O its operations (methods). For brevity we only
consider the case where P, T , H and D are empty and
focus on attributes and operations. Thus the class context
c n is empty and its body is simply the pair made of A
and O.</p>
      <p>Class definitions are then translated by the rule of
Figure 1. The derived species will be obtained after
translating [[P]] U ; F ; [[T ]] U ; F ; [[D]] U ; F ; [[H]] U ; F ;
[[A]]( U c n); F and [[O]]( U c n); F . These rules
enable us to enrich progressively the local context of the
current class c n, the local context of the derived species
s n and their bodies.
3.1.1. Instance variables. The set of instance variables
characterizes the state of an object. Let A be the list of
attributes of a class named c n:
0 vis1 attrN ame1 : typeExp1 [mult1] 1</p>
      <p>= def ault1 modif1
A = BBB : : : CCC
@ visn attrN amen : typeExpn [multn] A</p>
      <p>= def aultn modifn
where visi 2 f + , - , # , ~ g, (+ : Public, - : Private, # :
Protected, ~ : Package ). multi 2 f1 , 2 ... 1 g(if multi
is different from 1, the attribute is multivalued).
[ A] U ; F = ([ A1] attr
[ An] aUtt;r F ;(Attrc n A1), . . . ,</p>
      <p>U ;(Attrc n An); F )</p>
      <p>Each instance variable will be modeled by the signature
of its getter function. The transformation rule of the
attribute Ai is the following:
[ Ai] U ; F = signature get AttrN amei :</p>
      <p>Self -&gt; F ocT ypeExpi ;</p>
      <p>For complete species (derived from leaf classes), we
also generate the representation (carrier type) of the
species s n (derived from the class c n). It will be a
cartesian product grouping types modeling instance
variable types (F ocT ypeExp1, . . . F ocT ypeExpn).
3.1.2. Operations. UML class operations will be
translated into signatures of a species. Here, we distinguish
several cases according to the operation parameters and
stereotype:</p>
      <p>Let O = op1; op2; :::opn be the list of operations,
where each opi; i : 1::n has form:
opi = visi op sti opN amei
0 diri1 pN amei1 :</p>
      <p>typeExpi1 [multi1]
B : : :
@ dirim pN ameim :
typeExpim [multim]
1
C : returnT ypei [multi]
A
Visibilities visi are similar to those of attributes
(see section 3.1.1). The stereotype op sti is either
create or destroy. Multiplicities multij 2 f1 , 2 ...
1 g are the same as attribute multiplicities (see section
3.1.1). The parameter direction dirij is either in (by
default) or out. The pN ameij are parameter names of
the operation and typeExpij their types.</p>
      <p>The return type is returnT ypei and has multiplicity
multi. The corresponding FoCaLiZe functions will be
obtained by applying the rule:
[[O]] U ; F = [[op1]]opU ; F ;(Oprc n O1) . . .</p>
      <p>[[opn]]opU ; F ;(Oprc n On).</p>
      <p>For each opi, a signature (a function specified with
its type) is generated in the derived species. The general
transformation is presented as follows:
[ opi] U ; F = signature lower(opN amei) :
Self -&gt; F ocT ypeExpi1 -&gt;...</p>
      <p>F ocT ypeExpim -&gt; returnF ocT ypei;
where the keyword Self models the species entities
on which the function will be applied, the expressions
F ocT ypeExpi1 . . . F ocT ypeExpim are the
transformation of the expressions typeExpi1 . . . typeExpim
into FoCaLiZe and the returnF ocT ypei is the
corresponding FoCaLiZe type for the operation returned type
(returnT ypei).</p>
      <p>In order to illustrate the three preceding rules (classes,
instance variables and operations), we present the
transformation of the class Person in Table 1.</p>
      <p>In this example, the representation (carrier type) of the
species named PersonSpecies is (string*int).
It is the cartesian product of types of the attribute age
and the attribute name. The function newPerson
corresponds to the transformation of the class constructor. Even
if it is implicit (not declared) in the original class, we add
this function to the derived species.</p>
    </sec>
    <sec id="sec-6">
      <title>3.1.3. Inheritances and dependencies. Since the Fo</title>
      <p>
        CaLiZe specification language supports method
redefinition, inheritance, multiple inheritance, encapsulation and
late-binding features [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], we transform the inheritance
relationship of UML into inheritance relationship of
FoCaLiZe (see Figure 1). Let H be the list of inheritance
associated to the class named c n.
      </p>
      <p>H = H1, H2 . . . Hn, where each Hi = c ni and c ni,
i = 1::n are the class names from which c n inherits.
As we mentioned above, the inheritance list H of the class
c n is translated into an inheritance list of the species s n
derived from c n.</p>
      <p>An UML dependency is a relationship which indicates
that the specification of one class (the client) requires
other classes (suppliers).</p>
      <p>Let D be the list of dependencies associated to the class
named c n (the client).</p>
      <p>D = D1, D2 . . . Dn, where each Di = c ni and c ni,
i = 1::n are the supplier class names. In FoCaLiZe,
the parameterization of one species with other species
has exactly the same semantics of dependency in UML.
Hence, we transform UML dependencies into FoCaLiZe
parameterizations.</p>
      <p>For example, the class Circle requires to the class
Point to define its center. The transformations of the
example is the following:
species Point = ... end;;
species Circle (P is Point)=</p>
      <p>representation = P * float;
...</p>
      <p>end;;</p>
    </sec>
    <sec id="sec-7">
      <title>3.1.4. Template classes and template binding. Tem</title>
      <p>
        plate classes (parameterized classes), may be defined
in the same manner as parameterized species [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
Therefore, we transform a parameterized class into a
parameterized species.
      </p>
      <p>Let P be the list of parameters of the class named c n.
P = P1; P2; : : : Pn. Each Pi has form:
Pi = p ni : typeExpi, where p ni is the parameter
name and typeExpi its type.</p>
      <p>These parameters are transformed into parameters of the
species s n derived from the class c n.</p>
      <p>Template bindings specify how the class is constructed
by substituting the formal template parameters of the
target template classes with actual parameters.</p>
      <p>Table 2 presents the transformation of the template
Finite_List. It has two parameters: T of type Class
and I of type Integer. As it is described above, the first
UML
parameter is converted into a parameter of type Setoid
and the second to a parameter of type IntCollection
(which models integers in FoCaLiZe). The attribute data
of the class Finite_List is multivalued. It is
transformed through the type list in FoCaLiZe. Table 2, also
presents how the class Year (a list of 12 months) is
constructed through substitutions of the formal parameters
T:Class and I:Integer of the class Finite_List
by the actual parameters Month and 12 (T -&gt; Month
and I -&gt; 12), where Month is the class that models
the months of the year.</p>
      <p>
        To transform this binding, we create the species Year
by inheritance from the species Finite_List
(derived from the class Finite_List) and by
substitution of its parameters (T is Setoid) and (i in
IntCollection) by the parameters T is Month
(the species derived from the class Month) and
e = IntCollection!createInt(12). More
detail about the transformation of UML templates and
template binding is presented in our paper [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ].
      </p>
    </sec>
    <sec id="sec-8">
      <title>3.2. Associations</title>
      <p>A binary association AS between two classes has the
following form:</p>
      <p>AS = association ass n ass dir</p>
      <p>c lef t MU left; c right MU right end
where ass n indicates the association name, ass dir
the navigation direction which takes one of the values:
LeftToRight, RightToLeft or Both, c lef t and
c right represent the class names of the left and right
sides of the association, MU left is the multiplicity
associated to the c lef t class and MU right associated to the
c right class.</p>
      <p>Table 3 shows the transformation of the Review
association between the classes Person and Paper. The
Person end carries multiplicity 3 to specify that all
instances of the Paper class must be reviewed exactly by
3 persons. The Paper end has multiplicity * to express
that one person may review an arbitrary number of papers.</p>
    </sec>
    <sec id="sec-9">
      <title>4. From OCL to FoCaLiZe</title>
      <p>To transform OCL expressions we have built an
OCL framework library support. In this library, we
model OCL primitive types using FoCaLiZe
primitive types. For collection types, we have a species
named OCL_Collection(Obj is Setoid)
implementing OCL operations on collections (isEmpty,
size . . . ). Other kinds of collection (Set(T),
OrderedSet(T), Bag(T) and Sequence(T)) are
also described by species which are inherited from
OCL_Collection.</p>
      <p>All OCL constraints (invariants on classes and
pre/postconditions of class operations) are mapped into FoCaLiZe
properties (property or theorem). We have proposed
a formal transformation rule for each supported OCL
construct. The full description of these rules is beyond the
scope of this paper. Table 4 presents the transformation of
three OCL constraints specified on the class Person.</p>
    </sec>
    <sec id="sec-10">
      <title>5. Potential use of the framework</title>
      <p>From an UML/OCL model, an abstract FoCaLiZe
specification is generated (see Figure 2).</p>
      <p>When we compile the FoCaLiZe source, several proof
obligations are generated. In particular the proof of the
derived properties from associations and the derived
properties from OCL constraints. When a proof fails, the
FoCaLiZe compiler indicates the line of code responsible for
the error. The developer analyses the source to determine
the reason for the failure. There are two main kinds of
errors: either because of inappropriate proof hints given
UML</p>
      <p>UML
end;;
Where mult_left, mult_right and d are implemented at top level as follows:
let direction = Direction_collection!make_direction(Both);;
let mult_left = Range_collection!make_range(Unlimited_Nat!make(I(3)),</p>
      <p>Unlimited_Nat!make(I(3)));;
let mult_right = Range_collection!make_range(Unlimited_Nat!make(I(0)),</p>
      <p>Unlimited_Nat!make(Infini));;
Association is a general species models associations in our library support.</p>
      <p>OCL
rived from OCL constraints, since the proof of such
propby the developer, or because of inconsistencies in the orig- erties may use a conflicting properties (derived from other
inal UML/OCL model. The first reason leads to modify
OCL constraints) as hypothesis or axioms. Also, thanks
the FoCaLiZe source in order to provide a tractable proof to the direct transformation in our approach (FoCaLiZe
script for Zenon, while the second leads to correct and/or and UML share the same features semantics), UML
ercomplete the original UML/OCL model.
rors such as the violation of UML template semantics,
inheritance semantics, the dependency semantics or the</p>
      <p>OCL errors are detected when proving properties de- specification of incorrect values or types are automatically
International Conference on Advanced Aspects of Software Engineering
detected when FoCaLiZe compiler checks the derived
source. In the near future, our approach will be enhanced
by the transformation of behavioral diagrams such as
UML state diagram. The transition from one state to
another in UML state diagram defines a property that can
be contradictory with the property derived from the pre
and post-condition of the triggering event. This leads to
detect an inconsistency, either in the UML statechart or in
the OCL pre and post-condition.</p>
      <p>In order to clarify the proof framework of figure 2, we
present the proof of the class Person invariant presented
in table 4.</p>
      <p>After derivation of the species PersonSpecies
(from the class Person), we generate the species
Person_constraints which inherits from
PersonSpecies and contains theorems and properties
derived from the OCL constraints (for brevity, we only
focus on the property invariant_Person_2):
species Person_constraints =</p>
      <p>inherit PersonSpecies;
let get_name(p:Self):string = fst(p);
let equal (x: Self, y : Self): bool =</p>
      <p>(get_name(x) = get_name(y)) ;
. . .
theorem
invariant_Person_2 :</p>
      <p>all p1 p2 : Self,
˜˜(equal(p1, p2)) -&gt;
˜˜(get_name(p1) = get_name(p2))
proof = by definition of equal ;
end ;;
The symbols ˜˜ present the logical negation in
FoCaLiZe. In this example, we ask Zenon to find a
proof using the hint “by definition of equal”.</p>
      <p>Finally, the compilation of the above FoCaLiZe source
ensures the correctness of the specification. If no error
has occurred, this means that the compilation, code
generation and Coq verification were successful.</p>
    </sec>
    <sec id="sec-11">
      <title>6. Related works</title>
      <p>
        First, in the transformation from UML/OCL into B
language based tools such as UML2B [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ], UML-B [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ],
[
        <xref ref-type="bibr" rid="ref16">16</xref>
        ] and [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ], the inheritance mechanism is indirectly
considered through the clause Uses. The clause Uses
of B language (as its name indicates) corresponds to the
dependency feature of UML, which leads to add
supplementary invariants in the abstract machines derived from
the sub-classes [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ] to preserve the inheritance semantics
of UML. In B language, a formal parameter of an abstract
machine may only be of two kinds: scalar parameters or
set parameters [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. The formal parameters of an abstract
machine can not be an implementation or an other abstract
machine of the model. This limitation makes it difficult to
model the UML template with B constructs.
      </p>
      <p>
        Second, the works interested in using high order logic
(HOL) such as the HOL-OCL tool [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ] or those based
on rewriting logic and runtime checking tools such as the
use of the Maude system in [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ]. Also for this category
of tools, the UML multiple inheritance, late binding,
template and template binding are manufactured and not
perfectly supported. For example, in [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ] the inheritance
feature is indirectly transformed through the definition of
predicates isSubclass(A,B), which establish that a
class A is a subclass of another B. We can do the same
remark for the HOL-OCL tool [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ],
      </p>
      <p>
        The use of older works such as SMV model checker in
[
        <xref ref-type="bibr" rid="ref20">20</xref>
        ] and PROMELA in [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ] is limited to the verification
of isolated UML statecharts. We also find a
transformation from UML into LOTOS in [
        <xref ref-type="bibr" rid="ref22">22</xref>
        ], however the concept
of object references and dynamic links between objects
are not supported.
      </p>
      <p>
        In works such as [
        <xref ref-type="bibr" rid="ref23">23</xref>
        ] and [
        <xref ref-type="bibr" rid="ref24">24</xref>
        ], an UML class is
modeled by a signature (a set of atoms) of Alloy system.
The only supported architecture feature is the extends
(simple inheritance in UML) relationship between
signatures.
      </p>
      <p>
        Finally, works such as [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ] and rCOS [
        <xref ref-type="bibr" rid="ref26">26</xref>
        ] are
interested in providing formal semantics for UML. However,
they do not integrate proof tools.
      </p>
      <p>While inheritance is indirectly considered, the
multiple inheritance, UML templates and template bindings
are ignored in all the aforementioned works. Using
FoCaLiZe, we directly support the inheritance and
multiple inheritance features of UML through the clause
inherit which enables multiple inheritance and
latebinding mechanism.</p>
      <p>Through our approach, UML templates correspond
perfectly to parameterized species and UML template
bindings are similar to parameter substitutions in
FoCaLiZe. In fact, FoCaLiZe enables the use of a species as
a parameter of another species, even at the specification
level. Later on, the collection and late-binding
mechanisms ensure that all methods appearing in a species
(used as formal parameter) are indeed implemented and
all properties are proved.</p>
    </sec>
    <sec id="sec-12">
      <title>7. Conclusion and perspectives</title>
      <p>In this paper, we have presented a process to transform
an UML/OCL model composed of class diagrams and
OCL constraints into a FoCaLiZe specification. A
FoCaLiZe species is derived from each UML class, where
the representation of the derived species is a cartesian
product that represents the instance variables of the class.
Class operations are converted into methods of the derived
species. The OCL constraints correspond to FoCaLiZe
properties. A binary association between two classes is
translated into a species parameterized by the two derived
species, the corresponding multiplicities and by the
direction of the association navigation.</p>
      <p>To implement the presented approach, we propose to
use the XMI technology (XML Metadata Interchange)
through the UML2 Eclipse plug-in. We parse the XMI
document to translate it into our UML syntax (using
an XSLT stylesheet), so that it is possible to apply the
proposed transformation rules. These later ensure the
correctness of the transformation.</p>
      <p>The presented work provides a direct transformation
of most of UML specification features. In addition to
classes associations, it supports encapsulation, multiple
inheritance, late-binding, templates, template bindings
and dependency which permit to derive a formal
specification expressed through species hierarchy that keeps
the same incremental modeling provided by UML. To
our knowledge, there is no formal tool that supports the
above features as they are taken care of in the FoCaLiZe
environment.</p>
      <p>In the present work we have not taken into account
the dynamic aspect of UML models. In the next step,
we plan to add to our UML model, diagrams describing
the behavioral aspect of UML classes such as statechart
diagrams.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>OMG.</surname>
          </string-name>
          ,
          <source>“UML : Superstructure, version 2</source>
          .4,
          <string-name>
            <given-names>”</given-names>
            <surname>Jan</surname>
          </string-name>
          .
          <year>2011</year>
          , available at: http://www.omg.org/spec/UML/2.4/ Infrastructure.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2] OMG,
          <string-name>
            <surname>“</surname>
            <given-names>OCL</given-names>
          </string-name>
          :
          <article-title>Object constraint language 2</article-title>
          .3.1,
          <string-name>
            <given-names>”</given-names>
            <surname>Jan</surname>
          </string-name>
          .
          <year>2012</year>
          , available at: http://www.omg.org/spec/OCL.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>J.</given-names>
            <surname>Abrial</surname>
          </string-name>
          ., “
          <article-title>The B book</article-title>
          .”
          <year>1996</year>
          , cambridge University Press.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>D.</given-names>
            <surname>Jackson</surname>
          </string-name>
          ,
          <source>Software Abstractions: Logic</source>
          , Language, and
          <string-name>
            <surname>Anlysis</surname>
          </string-name>
          . The MIT Press,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>M.</given-names>
            <surname>Clavel</surname>
          </string-name>
          , F. Dura´n, S. Eker,
          <string-name>
            <given-names>P.</given-names>
            <surname>Lincoln</surname>
          </string-name>
          ,
          <string-name>
            <surname>N.</surname>
          </string-name>
          <article-title>Mart´ı-</article-title>
          <string-name>
            <surname>Oliet</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <string-name>
            <surname>Meseguer</surname>
            , and
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Talcott</surname>
          </string-name>
          ,
          <article-title>All about Maude a high performance logical framework: how to specify, program and verify systems in rewriting logic</article-title>
          .
          <source>SpringerVerlag</source>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>T.</given-names>
            <surname>Nipkow</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L. C.</given-names>
            <surname>Paulson</surname>
          </string-name>
          , and M. Wenzel, Isabelle/HOL:
          <article-title>a proof assistant for higher-order logic</article-title>
          . Springer,
          <year>2002</year>
          ., vol.
          <volume>2283</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>F. D.</given-names>
            <surname>Team</surname>
          </string-name>
          , “
          <source>FoCaLiZe : Tutorial and reference manual, version 0.8</source>
          .0,
          <string-name>
            <surname>”</surname>
            <given-names>CNAM</given-names>
          </string-name>
          /INRIA/LIP6,
          <year>2012</year>
          , available at: http://focalize.inria.fr.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>P.</given-names>
            <surname>Ayrault</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Hardin</surname>
          </string-name>
          , and
          <string-name>
            <given-names>F.</given-names>
            <surname>Pessaux</surname>
          </string-name>
          , “
          <article-title>Development life-cycle of critical software under Focal,”</article-title>
          <source>Electronic Notes in Theoretical Computer Science</source>
          , vol.
          <volume>243</volume>
          , pp.
          <fpage>15</fpage>
          -
          <lpage>31</lpage>
          .,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>S.</given-names>
            <surname>Fechter</surname>
          </string-name>
          , “
          <article-title>Se´mantique des traits oriente´s objet de focal,”</article-title>
          <source>Ph.D. dissertation, Universite´ PARIS 6</source>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>D.</given-names>
            <surname>Delahaye</surname>
          </string-name>
          ,
          <string-name>
            <surname>J.-F. E</surname>
          </string-name>
          <article-title>´tienne, and</article-title>
          <string-name>
            <given-names>V. V.</given-names>
            <surname>Donzeau-Gouge</surname>
          </string-name>
          ,
          <article-title>“Producing UML models from focal specifications: an application to airport security regulations</article-title>
          ,
          <source>” in Theoretical Aspects of Software Engineering</source>
          ,
          <year>2008</year>
          . TASE'
          <volume>08</volume>
          .
          <string-name>
            <surname>2nd</surname>
            <given-names>IFIP</given-names>
          </string-name>
          /IEEE International Symposium on. IEEE,
          <year>2008</year>
          , pp.
          <fpage>121</fpage>
          -
          <lpage>124</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>D.</given-names>
            <surname>Doligez</surname>
          </string-name>
          , “
          <article-title>The Zenon tool</article-title>
          ,” software and documentations freely available at http://focal.inria.fr/zenon/.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <fpage>coq</fpage>
          ., “
          <article-title>The coq proof assistant, Tutorial and reference manual,” INRIA -</article-title>
          <string-name>
            <surname>LIP - LRI - LIX - PPS</surname>
          </string-name>
          ,
          <year>2010</year>
          , distribution available at: http://coq.inria.fr/.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>M.</given-names>
            <surname>Abbas</surname>
          </string-name>
          ,
          <string-name>
            <surname>C.-B. Ben-Yelles</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>R.</given-names>
            <surname>Rioboo</surname>
          </string-name>
          , “
          <article-title>Modeling UML Template Classes with FoCaLiZe,” in Integrated Formal Methods</article-title>
          . Springer,
          <year>2014</year>
          , pp.
          <fpage>87</fpage>
          -
          <lpage>102</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>L.</given-names>
            <surname>Hazem</surname>
          </string-name>
          ,
          <string-name>
            <surname>N. Levy,</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.</given-names>
            <surname>Marcano-Kamenoff</surname>
          </string-name>
          , “UML2B :
          <article-title>Un outil pour la ge´ne´ration de mode`les formels</article-title>
          ,
          <source>” AFDL</source>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>C.</given-names>
            <surname>Snook</surname>
          </string-name>
          and
          <string-name>
            <given-names>M.</given-names>
            <surname>Butler</surname>
          </string-name>
          , “UML-B :
          <article-title>Formal modeling and design aided by UML,” ACM Transactions on Software Engineering</article-title>
          and Methodology, no.
          <issue>15</issue>
          , pp.
          <fpage>92</fpage>
          -
          <lpage>122</lpage>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>N.</given-names>
            <surname>Truong</surname>
          </string-name>
          and
          <string-name>
            <surname>S. J.</surname>
          </string-name>
          , “
          <article-title>Verification of UML model elements using B,” Information Science</article-title>
          and Engineering, no.
          <issue>22</issue>
          , pp.
          <fpage>357</fpage>
          -
          <lpage>373</lpage>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>J. GU</given-names>
            ,
            <surname>M. CHEN</surname>
          </string-name>
          , and
          <string-name>
            <surname>X. ZHOU</surname>
          </string-name>
          , “
          <article-title>Formal language B</article-title>
          and UML/OCL comparison,”
          <source>Computer Knowledge and Technology</source>
          , vol.
          <volume>34</volume>
          , p.
          <fpage>044</fpage>
          .,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>A.</given-names>
            <surname>Brucker</surname>
          </string-name>
          and
          <string-name>
            <given-names>B.</given-names>
            <surname>Wolff</surname>
          </string-name>
          ,
          <source>The HOL-OCL tool</source>
          ,
          <year>2007</year>
          , http://www.brucker.ch/.
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>F.</given-names>
            <surname>Dura</surname>
          </string-name>
          <article-title>´n, M. Gogolla</article-title>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Rolda</surname>
          </string-name>
          <article-title>´n, “Tracing properties of UML and OCL models with maude</article-title>
          ,
          <source>” arXiv preprint arXiv:1107.0068</source>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>G.</given-names>
            <surname>Kwon</surname>
          </string-name>
          , “
          <article-title>Rewrite rules and operational semantics for model checking UML statecharts,” in UML2000-The Unified Modeling Language</article-title>
          . Springer,
          <year>2000</year>
          , pp.
          <fpage>528</fpage>
          -
          <lpage>540</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>J.</given-names>
            <surname>Lilius</surname>
          </string-name>
          and
          <string-name>
            <given-names>I. P.</given-names>
            <surname>Paltor</surname>
          </string-name>
          , “
          <article-title>vUML: A tool for verifying UML models</article-title>
          ,” in
          <source>Automated Software Engineering</source>
          ,
          <year>1999</year>
          . 14th IEEE International Conference on. IEEE,
          <year>1999</year>
          , pp.
          <fpage>255</fpage>
          -
          <lpage>258</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [22]
          <string-name>
            <given-names>P. J.</given-names>
            <surname>Carreira</surname>
          </string-name>
          and
          <string-name>
            <given-names>M. E.</given-names>
            <surname>Costa</surname>
          </string-name>
          , “
          <article-title>Automatically verifying an object-oriented specification of the steam-boiler system</article-title>
          ,”
          <source>Science of Computer Programming</source>
          , vol.
          <volume>46</volume>
          , no.
          <issue>3</issue>
          , pp.
          <fpage>197</fpage>
          -
          <lpage>217</lpage>
          .,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          [23]
          <string-name>
            <given-names>A.</given-names>
            <surname>Cunha</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Garis</surname>
          </string-name>
          , and
          <string-name>
            <given-names>D.</given-names>
            <surname>Riesco</surname>
          </string-name>
          , “
          <article-title>Translating between Alloy specifications and UML class diagrams annotated with OCL,”</article-title>
          <source>Software &amp; Systems Modeling</source>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>21</lpage>
          .,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          [24]
          <string-name>
            <given-names>K.</given-names>
            <surname>Anastasakis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Bordbar</surname>
          </string-name>
          , G. Georg,
          <string-name>
            <surname>and I. Ray</surname>
          </string-name>
          , “
          <article-title>UML2Alloy: A challenging model transformation</article-title>
          ,
          <source>” in Model Driven Engineering Languages and Systems</source>
          . Springer,
          <year>2007</year>
          , pp.
          <fpage>436</fpage>
          -
          <lpage>450</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          [25]
          <string-name>
            <given-names>M.</given-names>
            <surname>Broy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Crane</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Dingel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Hartman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Rumpe</surname>
          </string-name>
          , and
          <string-name>
            <given-names>B.</given-names>
            <surname>Selic</surname>
          </string-name>
          , “
          <article-title>Formal semantics for uml,” Models in Software Engineering</article-title>
          , pp.
          <fpage>318</fpage>
          -
          <lpage>323</lpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          [26]
          <string-name>
            <given-names>J.</given-names>
            <surname>Yang</surname>
          </string-name>
          , “
          <article-title>A framework for formalizing uml models with formal language rCOS,” in Frontier of Computer Science</article-title>
          and Technology,
          <year>2009</year>
          . FCST'
          <volume>09</volume>
          . Fourth International Conference on. IEEE,
          <year>2009</year>
          , pp.
          <fpage>408</fpage>
          -
          <lpage>416</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref27">
        <mixed-citation>
          [27]
          <string-name>
            <given-names>C.</given-names>
            <surname>Dubois</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Hardin</surname>
          </string-name>
          , and
          <string-name>
            <given-names>V.</given-names>
            <surname>Donzeau-Gouge</surname>
          </string-name>
          , “
          <article-title>Building certified components within FOCAL,” Trends in Functional Programming</article-title>
          , vol.
          <volume>5</volume>
          , pp.
          <fpage>33</fpage>
          -
          <lpage>48</lpage>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>