diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/SSR_fi/VandVResults/FTA/ft.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/SSR_fi/VandVResults/FTA/ft.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5c24e91b072f6d4b1abbb9dc0711a0817673bdec
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/SSR_fi/VandVResults/FTA/ft.xml
@@ -0,0 +1,5 @@
+<fault-tree>
+    <gate type="NULL" name="Top_Level_Event" description="sensor1.sensed_speed_is_present = TRUE" probability="1.00e+000" page="Off">
+      <event name="true" description="true" probability="1.00e+000"/>
+    </gate>
+</fault-tree>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/OCRA/ocra_win64.exe b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/OCRA/ocra_win64.exe
new file mode 100644
index 0000000000000000000000000000000000000000..8ae22d9faf7cc9a068c3dbb88fe572fe05085d9d
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/OCRA/ocra_win64.exe differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/nuXmv/nuXmv_win64.exe b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/nuXmv/nuXmv_win64.exe
new file mode 100644
index 0000000000000000000000000000000000000000..07268846aa99940597f427c4b0d2a33c99273a3d
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/nuXmv/nuXmv_win64.exe differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/ocra.log b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/ocra.log
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/AUTHORS b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/AUTHORS
new file mode 100644
index 0000000000000000000000000000000000000000..959f0678525e7f8516c113534ea34fefa5d9c9f6
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/AUTHORS
@@ -0,0 +1,26 @@
+The xSAP development team
+-------------------------
+
+    Bittner Benjamin <bittner@fbk.eu>
+    Bozzano Marco <bozzano@fbk.eu>
+    Cavada Roberto <cavada@fbk.eu>
+    Cimatti Alessandro <cimatti@fbk.eu>
+    Fernandes Pires Anthony <anthony@fbk.eu>
+    Griggio Alberto <griggio@fbk.eu>
+    Micheli Andrea <amicheli@fbk.eu>
+    Roveri Marco <roveri@fbk.eu>
+    Tonetta Stefano <tonettas@fbk.eu>
+    Zampedri Gianni <zampedri@fbk.eu>
+
+Past contributors
+-----------------
+
+    Bonetti Luca
+    Dorigatti Michele
+    Gario Marco
+    Jochim Charles
+    Mariotti Alessandro
+    Mattarei Cristian
+    Mover Sergio
+    Villafiorita Adolfo
+    Zacco Gabriele
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/LICENSE.txt b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/LICENSE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..b137da20fa8b42f1e92747b20eaa2ee30f87fe09
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/LICENSE.txt
@@ -0,0 +1,108 @@
+Copyright (C) 2015 by Fondazione Bruno Kessler
+
+This License Agreement, including all exhibits ("License") is a legal
+agreement between you and Fondazione Bruno Kessler ("FBK" or "we") for
+the software "XSAP" and any data related to it, which may include
+source code, and any associated materials, text or binary files,
+associated media and "online" or electronic documentation and any
+updates we provide in our discretion (together, the "Software").
+
+By installing, copying, or otherwise using the Software, you agree to
+be bound by the terms of this License. If you do not agree, do not
+install, copy, or use the Software. The Software is protected by
+copyright and other intellectual property laws and is licensed, not
+sold.
+
+SCOPE OF RIGHTS:
+
+You may study, copy, compile and execute this Software only for
+academic, non-commercial reaserch purposes, subject to the restrictions
+in this License.
+
+You may not:
+- Modify this Software for any purpose.
+- Re-distribute this Software in any form for any purposes. Examples
+  of purposes would be running business operations, licensing,
+  leasing, or selling the Software, distributing the Software for use
+  with commercial or non-commercial products, using the Software in
+  the creation or use of commercial or non-commercial products.
+
+In return, we require that you agree:
+
+1. That you will not remove any Copyright or other notices from the
+   Software.
+
+2. That if any of the Software is in binary format, you will not
+   attempt to modify such portions of the Software, or to reverse
+   engineer or decompile them.
+
+3. That you will not: (i) use the Software or any component of the
+   Software or any program, code, application or technology created
+   through use of the Software (for example, an application or
+   program compiled using the included compilers) in a live
+   operating environment where it may be relied upon to perform in
+   the same manner as a commercially released product, or with data
+   that has not been sufficiently backed up.
+
+4. That FBK is granted back, a non-exclusive, irrevocable,
+   royalty-free, and sub-licensable license to, for any purpose,
+   reproduce, publicly perform or display, install, use, modify,
+   distribute, make and have made, sell and transfer modifications
+   to and/or derivative works of the Software or data that you
+   provide to FBK.
+
+5. That any feedback about the Software provided by you to us is
+   voluntarily given, and FBK shall be free to use the feedback as
+   it sees fit without obligation or restriction of any kind, even
+   if the feedback is designated by you as confidential.
+
+6. THAT THE SOFTWARE COMES "AS IS", WITH NO WARRANTIES. THIS MEANS
+   NO EXPRESS, IMPLIED OR STATUTORY WARRANTY, INCLUDING WITHOUT
+   LIMITATION, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
+   PARTICULAR PURPOSE, ANY WARRANTY AGAINST INTERFERENCE WITH YOUR
+   ENJOYMENT OF THE SOFTWARE OR ANY WARRANTY OF TITLE OR
+   NON-INFRINGEMENT. THERE IS NO WARRANTY THAT THIS SOFTWARE WILL
+   FULFILL ANY OF YOUR PARTICULAR PURPOSES OR NEEDS. ALSO, YOU MUST
+   PASS THIS DISCLAIMER ON WHENEVER YOU DISTRIBUTE THE SOFTWARE OR
+   DERIVATIVE WORKS.
+
+7. THAT NEITHER FBK NOR ANY CONTRIBUTOR TO THE SOFTWARE WILL BE
+   LIABLE FOR ANY DAMAGES RELATED TO THE SOFTWARE OR THIS LICENSE,
+   INCLUDING DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL OR INCIDENTAL
+   DAMAGES, TO THE MAXIMUM EXTENT THE LAW PERMITS, NO MATTER WHAT
+   LEGAL THEORY IT IS BASED ON. ALSO, YOU MUST PASS THIS LIMITATION
+   OF LIABILITY ON WHENEVER YOU DISTRIBUTE THE SOFTWARE OR
+   DERIVATIVE WORKS.
+
+8. That we have no duty of reasonable care or lack of negligence,
+   and we are not obligated to provide technical support or bug
+   fixes for the Software.
+
+9. That if you breach this License or if you sue anyone over
+   patents that you think may apply to or read on the Software or
+   anyone's use of the Software, this License (and your license and
+   rights obtained herein) terminate automatically. Upon any such
+   termination, you shall destroy all of your copies of the
+   Software immediately. Sections 4 through 9, 11 and 12 of this
+   License shall survive any termination of this License.
+
+10. That the patent rights, if any, granted to you in this License
+    only apply to the Software, not to any derivative works you
+    make.
+
+11. That the Software may be subject to European export
+    jurisdiction at the time it is licensed to you, and it may be
+    subject to additional export or import laws in other
+    places. You agree to comply with all such laws and regulations
+    that may apply to the Software after delivery of the software
+    to you.
+
+12. That all rights not expressly granted to you in this License
+    are reserved.
+
+13. That this License shall be construed and controlled by the laws
+    of European States, without regard to conflicts of law. If any
+    provision of this License shall be deemed unenforceable or
+    contrary to law, the rest of this License shall remain in full
+    effect and interpreted in an enforceable manner that most
+    nearly captures the intent of the original language.
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/LICENSE_AMASS_xSAP.txt b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/LICENSE_AMASS_xSAP.txt
new file mode 100644
index 0000000000000000000000000000000000000000..ee82fee75b80a12d31a2df1a91461c6c8c98f992
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/LICENSE_AMASS_xSAP.txt
@@ -0,0 +1,111 @@
+This License Agreement, including all exhibits ("License") is a legal
+agreement between any partner of the AMASS project ("you") and
+Fondazione Bruno Kessler ("FBK" or "we") for the software
+"xSAP" and any data related to it, which may include source
+code, and any associated materials, text or binary files, associated
+media and "online" or electronic documentation and any updates we
+provide in our discretion (together, the "Software").
+
+By installing, copying, or otherwise using the Software, you agree
+to be bound by the terms of this License. If you do not agree, do
+not install, copy, or use the Software. The Software is protected
+by copyright and other intellectual property laws and is licensed,
+not sold.
+
+SCOPE OF RIGHTS:
+
+You may use, copy, and reproduce this Software for any internal
+non-commercial purpose, subject to the restrictions in this
+License. Purposes must be related and permanently restricted to the
+usage within the AMASS project.
+
+
+You may not re-distribute this Software in any form for any
+purposes. Examples of purposes would be running business
+operations, licensing, leasing, or selling the Software,
+distributing the Software for use with commercial products, using
+the Software in the creation or use of commercial products.
+
+The use for scientific publications purposes of data or documents
+rising from the use of the Software requires a prior written agreement
+between the Parties.
+
+In return, we require that you agree:
+
+1. That you will not remove any Copyright or other notices from the
+   Software.
+
+2. That if any of the Software is in binary format, you will not
+   attempt to modify such portions of the Software, or to reverse
+   engineer or decompile them.
+
+3. That you will not: (i) use the Software or any component of the
+   Software or any program, code, application or technology created
+   through use of the Software (for example, an application or
+   program compiled using the included compilers) in a live
+   operating environment where it may be relied upon to perform in
+   the same manner as a commercially released product, or with data
+   that has not been sufficiently backed up.
+
+4. That FBK is granted back, a non-exclusive, irrevocable,
+   royalty-free, and sub-licensable license to, for any purpose,
+   reproduce, publicly perform or display, install, use, modify,
+   distribute, make and have made, sell and transfer modifications
+   to and/or derivative works of the Software or data that you
+   provide to FBK.
+
+5. That any feedback about the Software provided by you to us is
+   voluntarily given, and FBK shall be free to use the feedback as
+   it sees fit without obligation or restriction of any kind, even
+   if the feedback is designated by you as confidential.
+
+6. THAT THE SOFTWARE COMES "AS IS", WITH NO WARRANTIES. THIS MEANS
+   NO EXPRESS, IMPLIED OR STATUTORY WARRANTY, INCLUDING WITHOUT
+   LIMITATION, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
+   PARTICULAR PURPOSE, ANY WARRANTY AGAINST INTERFERENCE WITH YOUR
+   ENJOYMENT OF THE SOFTWARE OR ANY WARRANTY OF TITLE OR
+   NON-INFRINGEMENT. THERE IS NO WARRANTY THAT THIS SOFTWARE WILL
+   FULFILL ANY OF YOUR PARTICULAR PURPOSES OR NEEDS. ALSO, YOU MUST
+   PASS THIS DISCLAIMER ON WHENEVER YOU DISTRIBUTE THE SOFTWARE OR
+   DERIVATIVE WORKS.
+
+7. THAT NEITHER FBK NOR ANY CONTRIBUTOR TO THE SOFTWARE WILL BE
+   LIABLE FOR ANY DAMAGES RELATED TO THE SOFTWARE OR THIS LICENSE,
+   INCLUDING DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL OR INCIDENTAL
+   DAMAGES, TO THE MAXIMUM EXTENT THE LAW PERMITS, NO MATTER WHAT
+   LEGAL THEORY IT IS BASED ON. ALSO, YOU MUST PASS THIS LIMITATION
+   OF LIABILITY ON WHENEVER YOU DISTRIBUTE THE SOFTWARE OR
+   DERIVATIVE WORKS.
+
+8. That we have no duty of reasonable care or lack of negligence,
+   and we are not obligated to provide technical support or bug
+   fixes for the Software.
+
+9. That if you breach this License or if you sue anyone over
+   patents that you think may apply to or read on the Software or
+   anyone's use of the Software, this License (and your license and
+   rights obtained herein) terminate automatically. Upon any such
+   termination, you shall destroy all of your copies of the
+   Software immediately. Sections 4 through 9, 11 and 12 of this
+   License shall survive any termination of this License.
+
+10. That the patent rights, if any, granted to you in this License
+    only apply to the Software, not to any derivative works you
+    make.
+
+11. That the Software may be subject to European export
+    jurisdiction at the time it is licensed to you, and it may be
+    subject to additional export or import laws in other
+    places. You agree to comply with all such laws and regulations
+    that may apply to the Software after delivery of the software
+    to you.
+
+12. That all rights not expressly granted to you in this License
+    are reserved.
+
+13. That this License shall be construed and controlled by the laws
+    of European States, without regard to conflicts of law. If any
+    provision of this License shall be deemed unenforceable or
+    contrary to law, the rest of this License shall remain in full
+    effect and interpreted in an enforceable manner that most
+    nearly captures the intent of the original language.
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/NEWS b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/NEWS
new file mode 100644
index 0000000000000000000000000000000000000000..84e0ff931cdfd263e09f43bf32487fad54d9ea99
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/NEWS
@@ -0,0 +1,215 @@
+******************** xSAP 1.2.1 (2017/08/22)  ********************
+
+This is a new release, containing some bug fixes and new features
+
+----------------------------------------------------------------------
+* New features
+----------------------------------------------------------------------
+
+* Fault Tree Viewer now supports also xml input format
+* New functionality: TFPG filtering
+* xSAP now supports also Windows 32-bit architecture
+  All core tests have been successfully tested on a Windows 32-bit machine
+* Added description of manual fault extension flow in Chapter 3 of the
+  user manual
+* Added an example illustrating dynamic FTA and FMEA
+
+----------------------------------------------------------------------
+*  Bug fixes
+----------------------------------------------------------------------
+
+* Fixed an issue in generation of explanation traces in command
+  compute_fault_tree_param
+
+* Fixed an issue when invoking command compute_fault_tree_param
+  with infinite-state models
+
+* Fixed an issue in script synthesize_fd.py
+
+* Fixed an issue involving the proper use of `sscanf` function
+
+* Fixed a bug in the management of events in the definition of global
+  dynamics (fault extension flow)
+
+----------------------------------------------------------------------
+*  Known issues
+----------------------------------------------------------------------
+
+* Under Windows OS, export of a Fault Tree from the FT Viewer (both
+  image and pdf formats) produces a blank image/corrupted pdf
+
+
+******************** xSAP 1.2.0 (2016/09/21) ********************
+
+This is a major release, containing new features.
+
+----------------------------------------------------------------------
+* New features
+----------------------------------------------------------------------
+
+ o Diagnosability analysis
+
+   - Diagnosability analysis has been updated. Now it supports
+     specification of an LTL diagnosis condition, alarm specification
+     language (ASL) for exact delay, bounded delay and finite delay
+     patterns, and an LTL diagnosis context. A script has been added
+     to access this functionality.
+
+ o Generation of minimum observables set
+
+   - Generation of minimum observables set has been updated to match
+     the updates in diagnosability analysis. A script has been added
+     to access this functionality.
+
+ o Diagnoser Synthesis
+
+   - Added support for Context specificaiton and Fairness in the
+     synthesis algorithms.
+
+   - Top-level commands for synthesis have been simplified and a new
+     script (synthesise_fd.py) has been added.
+
+ o Antlr 3.4
+
+   - xSAP now fully supports a more recent (3.4) version of antlr
+
+
+----------------------------------------------------------------------
+*  Bug fixes
+----------------------------------------------------------------------
+
+* Various minor bugs have been fixed
+
+
+----------------------------------------------------------------------
+*  Known issues
+----------------------------------------------------------------------
+
+* Under Windows OS, export of a Fault Tree from the FT Viewer (both
+  image and pdf formats) produces a blank image/corrupted pdf. Issue
+  will be investigated for the next release
+
+----------------------------------------------------------------------
+* Superseded Commands
+----------------------------------------------------------------------
+
+The following commands have been removed:
+
+ - synth_set_composition_semantics: replaced by the environment
+   variable synth_asynchronous_composition_semantics;
+
+ - synth_edit_observables has been replaced by the option -o
+   in synth_FD;
+
+ - synth_edit_alarms_spec has been replaced by the option -f
+   in synth_FD.
+
+ - compute_optimal_observables has been replaced by
+   diag_optimize_observables_asl
+
+
+********************** xSAP 1.1.0 (2016/03/31) ***********************
+
+This is a major release, containing new features, and a few bug fixes.
+The documentation has been updated to cover the new features.
+
+----------------------------------------------------------------------
+* New features
+----------------------------------------------------------------------
+
+ o Fault library
+
+   - The library has been extended with new fault modes: random,
+     erroneous, delta-in and delta-out
+
+ o Fault Tree Analysis
+
+   - Probability computation using 'anytime' feature has been improved
+
+   - FT viewer export functionality has been improved
+
+ o FMEA analysis
+
+   - Output of FMEA table in XML format has been added
+
+ o TFPG analyses
+
+   - New analyses are available: tightening and tightness checking
+
+   - Synthesis of TFPGs has been improved
+
+o Examples
+
+   - Some new examples have been added to the distribution
+
+
+----------------------------------------------------------------------
+*  Bug fixes
+----------------------------------------------------------------------
+
+* The check_installation script and list of installation requirements
+  have been revised
+
+* Various minor bugs have been fixed
+
+
+----------------------------------------------------------------------
+*  Known issues
+----------------------------------------------------------------------
+
+* Under Windows OS, export of a Fault Tree from the FT Viewer (both
+  image and pdf formats) produces a blank image/corrupted pdf. Issue
+  will be investigated for the next release
+
+
+********************** xSAP 1.0.0 (2015/02/06) ***********************
+
+This is the first major release of xSAP, the eXtended Safety Assessment
+Platfor. It is  a tool for safety assessment of synchronous finite-state
+and infinite-state systems, based on symbolic model checking techniques.
+
+xSAP supersedes FSAP (http://fsap.fbk.eu/), the Formal Safety Analysis
+Platform. For details about license see xSAP s web page
+(https://xsap.fbk.eu/).
+
+----------------------------------------------------------------------
+* New features
+----------------------------------------------------------------------
+
+xSAP provides the following main capabilities:
+
+ o Library-based specification of faults, fault effects, and fault
+   dynamics
+
+ o Automatic model-extension with fault specifications
+
+ o Fault Tree Analysis (FTA) and generation of Minimal Cut Sets (MCS)
+   for dynamic systems, for both the monotonic and non-monotic case
+
+ o Failure Modes and Effect Analysis (FMEA)
+
+ o Fault propagation analysis based on Timed Failure Propagation
+   Graphs (TFPG)
+
+ o Common Cause Analysis (CCA)
+
+See xSAP web page (https://xsap.fbk.eu/) for the
+complete list of features.
+
+----------------------------------------------------------------------
+*  Bug fixes
+----------------------------------------------------------------------
+
+----------------------------------------------------------------------
+*  Documentation
+----------------------------------------------------------------------
+
+Programmers' manual is generated with doxygen (http://www.doxygen.org).
+For this reason documentation of all functions has been moved to the
+place of declaration (i.e. the header files).
+
+----------------------------------------------------------------------
+* Source Code
+----------------------------------------------------------------------
+
+xSAP source code is not publicly distributed.
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/README.txt b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/README.txt
new file mode 100644
index 0000000000000000000000000000000000000000..a393e77400fcc6741e6a1b96aae6d0bc819ae91a
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/README.txt
@@ -0,0 +1,117 @@
+This is version 1 of xSAP, the eXtended Safety Analysis Platform.
+
+----------------------------------------------------------------------------------
+
+xSAP is a tool for safety assessment of synchronous finite-state and
+infinite-state systems. It is based on symbolic model checking techniques.
+xSAP supersedes FSAP.
+
+xSAP provides the following main capabilities:
+
++ Library-based specification of faults, fault effects, and fault
+  dynamics
++ Automatic model-extension with fault specifications
++ Fault Tree Analysis (FTA) and generation of Minimal Cut Sets (MCS)
+  for dynamic systems, for both the monotonic and non-monotonic case
++ Failure Modes and Effects Analysis (FMEA)
++ Fault propagation analysis based on Timed Failure Propagation
+  Graphs (TFPG)
++ Common Cause Analysis (CCA)
+
+You can find further details on xSAP in the paper:
+
+  B. Bittner, M. Bozzano, R. Cavada, A. Cimatti, M. Gario,
+  A. Griggio, C. Mattarei, A. Micheli and G. Zampedri.
+  "The xSAP Safety Analysis Platform".
+  In Proc. TACAS'16.
+
+
+xSAP is Copyright by Fondazione Bruno Kessler 2015; it can be used
+only for non-commercial or academic purposes. See LICENSE.txt for
+complete licensing information.
+
+
+The list of xSAP users is open for registration and discussion
+
+          xsap-users@fbk.eu
+
+Visit http://xsap.fbk.eu/ for more detailed information and download.
+
+Other useful links:
+
+* Feature requests and bug reports: http://xsap.fbk.eu/index.php?n=BugReport.Home
+* Frequently asked questions: http://xsap.fbk.eu/index.php?n=FAQ.Home
+
+
+===========
+0. CONTENTS
+===========
+ 1. Prerequisites
+ 2. Binary distribution
+ 3. Files in the xSAP distribution
+
+
+==================================
+1. PREREQUISITES
+==================================
+
+Here follows the list of prerequisites for running xSAP:
+- cpp and/or m4 preprocessor
+- Python 2.7.x interpreter
+- lxml (version 3.2.3 or later)
+- gtk (version 2.22.1 or later)
+- pygobject
+- py2cairo
+- pygtk
+- matplotlib (version 1.3.1 or later)
+- networkx (version 1.8.1 or later)
+- graphviz (version 2.32 or later)
+- pygraphviz (version 1.2 or later)
+- goocanvas and pygoocanvas (version 1.x)
+
+
+==================================
+2. BINARY DISTRIBUTION
+==================================
+
+To install the binary distribution of xSAP follow the
+instructions below:
+
+1. Download the most recent version of xSAP from the address
+   listed above into a convenient directory, (e.g., /tmp).
+
+2. Move to the root directory where you want to install xSAP. Let's
+   say "/opt" and untar the distribution:
+
+        % cd /opt
+        % gzip -dc /tmp/xSAP-X.Y.Z.tar.gz | tar xf -
+
+   This command will create a directory "/opt/xSAP-X.Y.Z"
+   containing the xSAP files (X.Y.Z is the release number).
+
+3. Optionally, add the directory /opt/xSAP-X.Y.Z/bin to your command
+   search PATH environment variable. E.g. for bash shell:
+
+        % export PATH=${PATH}:/opt/xSAP-X.Y.Z/bin
+
+4. Now you are ready to run and enjoy xSAP.
+       % xSAP -int   # to run the interactive mode
+
+
+==================================
+3. FILES IN THE XSAP DISTRIBUTION
+==================================
+
+./README.txt                       -- This file
+./AUTHORS                          -- A file with the list of xSAP contributors
+./NEWS                             -- A file with the news about xSAP releases
+./LICENSE.txt                      -- License File
+./xSAP/bin                         -- A directory containing the xSAP
+                                      executables
+./xSAP/code                        -- Python compiled code
+./xSAP/data/fm_library             -- Fault Library schema
+./xSAP/data/schema                 -- TFPG and Fault Extension DTD files
+./xSAP/doc/user/xsap-manual.pdf    -- The PDF of the xSAP User Manual
+./xSAP/examples                    -- A collection of examples/files
+./xSAP/scripts                     -- A collection of python scripts to be used
+                                      with the tool
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/code-python2.7.egg b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/code-python2.7.egg
new file mode 100644
index 0000000000000000000000000000000000000000..bc31aed3818827d79b2493c5cb29ed9ade00f20a
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/code-python2.7.egg differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/__init__.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..5d8ba41bd87bc5f79646576361e8da1eecb3b86a
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/__init__.py
@@ -0,0 +1,152 @@
+""" @package antlr3
+@brief ANTLR3 runtime package
+
+This module contains all support classes, which are needed to use recognizers
+generated by ANTLR3.
+
+@mainpage
+
+\note Please be warned that the line numbers in the API documentation do not
+match the real locations in the source code of the package. This is an
+unintended artifact of doxygen, which I could only convince to use the
+correct module names by concatenating all files from the package into a single
+module file...
+
+Here is a little overview over the most commonly used classes provided by
+this runtime:
+
+@section recognizers Recognizers
+
+These recognizers are baseclasses for the code which is generated by ANTLR3.
+
+- BaseRecognizer: Base class with common recognizer functionality.
+- Lexer: Base class for lexers.
+- Parser: Base class for parsers.
+- tree.TreeParser: Base class for %tree parser.
+
+@section streams Streams
+
+Each recognizer pulls its input from one of the stream classes below. Streams
+handle stuff like buffering, look-ahead and seeking.
+
+A character stream is usually the first element in the pipeline of a typical
+ANTLR3 application. It is used as the input for a Lexer.
+
+- ANTLRStringStream: Reads from a string objects. The input should be a unicode
+  object, or ANTLR3 will have trouble decoding non-ascii data.
+- ANTLRFileStream: Opens a file and read the contents, with optional character
+  decoding.
+- ANTLRInputStream: Reads the date from a file-like object, with optional
+  character decoding.
+
+A Parser needs a TokenStream as input (which in turn is usually fed by a
+Lexer):
+
+- CommonTokenStream: A basic and most commonly used TokenStream
+  implementation.
+- TokenRewriteStream: A modification of CommonTokenStream that allows the
+  stream to be altered (by the Parser). See the 'tweak' example for a usecase.
+
+And tree.TreeParser finally fetches its input from a tree.TreeNodeStream:
+
+- tree.CommonTreeNodeStream: A basic and most commonly used tree.TreeNodeStream
+  implementation.
+  
+
+@section tokenstrees Tokens and Trees
+
+A Lexer emits Token objects which are usually buffered by a TokenStream. A
+Parser can build a Tree, if the output=AST option has been set in the grammar.
+
+The runtime provides these Token implementations:
+
+- CommonToken: A basic and most commonly used Token implementation.
+- ClassicToken: A Token object as used in ANTLR 2.x, used to %tree
+  construction.
+
+Tree objects are wrapper for Token objects.
+
+- tree.CommonTree: A basic and most commonly used Tree implementation.
+
+A tree.TreeAdaptor is used by the parser to create tree.Tree objects for the
+input Token objects.
+
+- tree.CommonTreeAdaptor: A basic and most commonly used tree.TreeAdaptor
+implementation.
+
+
+@section Exceptions
+
+RecognitionException are generated, when a recognizer encounters incorrect
+or unexpected input.
+
+- RecognitionException
+  - MismatchedRangeException
+  - MismatchedSetException
+    - MismatchedNotSetException
+    .
+  - MismatchedTokenException
+  - MismatchedTreeNodeException
+  - NoViableAltException
+  - EarlyExitException
+  - FailedPredicateException
+  .
+.
+
+A tree.RewriteCardinalityException is raised, when the parsers hits a
+cardinality mismatch during AST construction. Although this is basically a
+bug in your grammar, it can only be detected at runtime.
+
+- tree.RewriteCardinalityException
+  - tree.RewriteEarlyExitException
+  - tree.RewriteEmptyStreamException
+  .
+.
+
+"""
+
+# tree.RewriteRuleElementStream
+# tree.RewriteRuleSubtreeStream
+# tree.RewriteRuleTokenStream
+# CharStream
+# DFA
+# TokenSource
+
+# [The "BSD licence"]
+# Copyright (c) 2005-2008 Terence Parr
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+__version__ = '3.4'
+
+# This runtime is compatible with generated parsers using the following
+# API versions. 'HEAD' is only used by unittests.
+compatible_api_versions = ['HEAD', 1]
+
+from constants import *
+from dfa import *
+from exceptions import *
+from recognizers import *
+from streams import *
+from tokens import *
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/compat.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..5db1e6db50284b90032ce98fbf32604686ab1eef
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/compat.py
@@ -0,0 +1,48 @@
+"""Compatibility stuff"""
+
+# begin[licence]
+#
+# [The "BSD licence"]
+# Copyright (c) 2005-2008 Terence Parr
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# end[licence]
+
+try:
+    set = set
+    frozenset = frozenset
+except NameError:
+    from sets import Set as set, ImmutableSet as frozenset
+
+
+try:
+    reversed = reversed
+except NameError:
+    def reversed(l):
+        l = l[:]
+        l.reverse()
+        return l
+
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/constants.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/constants.py
new file mode 100644
index 0000000000000000000000000000000000000000..a440fbf21d8eef938460fd7474075b355299865e
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/constants.py
@@ -0,0 +1,57 @@
+"""ANTLR3 runtime package"""
+
+# begin[licence]
+#
+# [The "BSD licence"]
+# Copyright (c) 2005-2008 Terence Parr
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# end[licence]
+
+EOF = -1
+
+## All tokens go to the parser (unless skip() is called in that rule)
+# on a particular "channel".  The parser tunes to a particular channel
+# so that whitespace etc... can go to the parser on a "hidden" channel.
+DEFAULT_CHANNEL = 0
+
+## Anything on different channel than DEFAULT_CHANNEL is not parsed
+# by parser.
+HIDDEN_CHANNEL = 99
+
+# Predefined token types
+EOR_TOKEN_TYPE = 1
+
+##
+# imaginary tree navigation type; traverse "get child" link
+DOWN = 2
+##
+#imaginary tree navigation type; finish with a child list
+UP = 3
+
+MIN_TOKEN_TYPE = UP+1
+	
+INVALID_TOKEN_TYPE = 0
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/debug.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/debug.py
new file mode 100644
index 0000000000000000000000000000000000000000..c9953cf0e365160da42b60e0babcb5a1e69a7314
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/debug.py
@@ -0,0 +1,1137 @@
+# begin[licence]
+#
+#  [The "BSD licence"]
+#  Copyright (c) 2005-2009 Terence Parr
+#  All rights reserved.
+
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#  3. The name of the author may not be used to endorse or promote products
+#     derived from this software without specific prior written permission.
+
+#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+#  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+#  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+#  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+#  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+#  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+#  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# end[licence]
+
+import socket
+from antlr3 import Parser, TokenStream, RecognitionException, Token
+from antlr3.tree import CommonTreeAdaptor, TreeAdaptor, Tree
+
+class DebugParser(Parser):
+    def __init__(self, stream, state=None, dbg=None, *args, **kwargs):
+        # wrap token stream in DebugTokenStream (unless user already did so).
+        if not isinstance(stream, DebugTokenStream):
+            stream = DebugTokenStream(stream, dbg)
+
+        super(DebugParser, self).__init__(stream, state, *args, **kwargs)
+
+        # Who to notify when events in the parser occur.
+        self._dbg = None
+
+        self.setDebugListener(dbg)
+
+
+    def setDebugListener(self, dbg):
+	"""Provide a new debug event listener for this parser.  Notify the
+        input stream too that it should send events to this listener.
+	"""
+
+        if hasattr(self.input, 'dbg'):
+            self.input.dbg = dbg
+
+        self._dbg = dbg
+
+    def getDebugListener(self):
+        return self._dbg
+
+    dbg = property(getDebugListener, setDebugListener)
+
+
+    def beginResync(self):
+        self._dbg.beginResync()
+
+
+    def endResync(self):
+        self._dbg.endResync()
+
+
+    def beginBacktrack(self, level):
+        self._dbg.beginBacktrack(level)
+
+
+    def endBacktrack(self, level, successful):
+        self._dbg.endBacktrack(level,successful)
+
+
+    def reportError(self, exc):
+        Parser.reportError(self, exc)
+
+        if isinstance(exc, RecognitionException):
+            self._dbg.recognitionException(exc)
+
+
+class DebugTokenStream(TokenStream):
+    def __init__(self, input, dbg=None):
+        self.input = input
+        self.initialStreamState = True
+        # Track the last mark() call result value for use in rewind().
+        self.lastMarker = None
+
+        self._dbg = None
+        self.setDebugListener(dbg)
+
+        # force TokenStream to get at least first valid token
+        # so we know if there are any hidden tokens first in the stream
+        self.input.LT(1)
+
+
+    def getDebugListener(self):
+        return self._dbg
+
+    def setDebugListener(self, dbg):
+        self._dbg = dbg
+
+    dbg = property(getDebugListener, setDebugListener)
+
+
+    def consume(self):
+        if self.initialStreamState:
+            self.consumeInitialHiddenTokens()
+
+        a = self.input.index()
+        t = self.input.LT(1)
+        self.input.consume()
+        b = self.input.index()
+        self._dbg.consumeToken(t)
+
+        if b > a+1:
+            # then we consumed more than one token; must be off channel tokens
+            for idx in range(a+1, b):
+                self._dbg.consumeHiddenToken(self.input.get(idx));
+
+
+    def consumeInitialHiddenTokens(self):
+        """consume all initial off-channel tokens"""
+
+        firstOnChannelTokenIndex = self.input.index()
+        for idx in range(firstOnChannelTokenIndex):
+            self._dbg.consumeHiddenToken(self.input.get(idx))
+
+        self.initialStreamState = False
+
+
+    def LT(self, i):
+        if self.initialStreamState:
+            self.consumeInitialHiddenTokens()
+
+        t = self.input.LT(i)
+        self._dbg.LT(i, t)
+        return t
+
+
+    def LA(self, i):
+        if self.initialStreamState:
+            self.consumeInitialHiddenTokens()
+
+        t = self.input.LT(i)
+        self._dbg.LT(i, t)
+        return t.type
+
+
+    def get(self, i):
+        return self.input.get(i)
+
+
+    def index(self):
+        return self.input.index()
+
+
+    def mark(self):
+        self.lastMarker = self.input.mark()
+        self._dbg.mark(self.lastMarker)
+        return self.lastMarker
+
+
+    def rewind(self, marker=None):
+        self._dbg.rewind(marker)
+        self.input.rewind(marker)
+
+
+    def release(self, marker):
+        pass
+
+
+    def seek(self, index):
+        # TODO: implement seek in dbg interface
+        # self._dbg.seek(index);
+        self.input.seek(index)
+
+
+    def size(self):
+        return self.input.size()
+
+
+    def getTokenSource(self):
+        return self.input.getTokenSource()
+
+
+    def getSourceName(self):
+        return self.getTokenSource().getSourceName()
+
+
+    def toString(self, start=None, stop=None):
+        return self.input.toString(start, stop)
+
+
+class DebugTreeAdaptor(TreeAdaptor):
+    """A TreeAdaptor proxy that fires debugging events to a DebugEventListener
+    delegate and uses the TreeAdaptor delegate to do the actual work.  All
+    AST events are triggered by this adaptor; no code gen changes are needed
+    in generated rules.  Debugging events are triggered *after* invoking
+    tree adaptor routines.
+
+    Trees created with actions in rewrite actions like "-> ^(ADD {foo} {bar})"
+    cannot be tracked as they might not use the adaptor to create foo, bar.
+    The debug listener has to deal with tree node IDs for which it did
+    not see a createNode event.  A single <unknown> node is sufficient even
+    if it represents a whole tree.
+    """
+
+    def __init__(self, dbg, adaptor):
+        self.dbg = dbg
+        self.adaptor = adaptor
+
+
+    def createWithPayload(self, payload):
+        if payload.getTokenIndex() < 0:
+            # could be token conjured up during error recovery
+            return self.createFromType(payload.getType(), payload.getText())
+
+        node = self.adaptor.createWithPayload(payload)
+        self.dbg.createNode(node, payload)
+        return node
+
+    def createFromToken(self, tokenType, fromToken, text=None):
+        node = self.adaptor.createFromToken(tokenType, fromToken, text)
+        self.dbg.createNode(node)
+        return node
+
+    def createFromType(self, tokenType, text):
+        node = self.adaptor.createFromType(tokenType, text)
+        self.dbg.createNode(node)
+        return node
+
+
+    def errorNode(self, input, start, stop, exc):
+        node = selfadaptor.errorNode(input, start, stop, exc)
+        if node is not None:
+            dbg.errorNode(node)
+
+        return node
+
+
+    def dupTree(self, tree):
+        t = self.adaptor.dupTree(tree)
+        # walk the tree and emit create and add child events
+        # to simulate what dupTree has done. dupTree does not call this debug
+        # adapter so I must simulate.
+        self.simulateTreeConstruction(t)
+        return t
+
+
+    def simulateTreeConstruction(self, t):
+	"""^(A B C): emit create A, create B, add child, ..."""
+        self.dbg.createNode(t)
+        for i in range(self.adaptor.getChildCount(t)):
+            child = self.adaptor.getChild(t, i)
+            self.simulateTreeConstruction(child)
+            self.dbg.addChild(t, child)
+
+
+    def dupNode(self, treeNode):
+        d = self.adaptor.dupNode(treeNode)
+        self.dbg.createNode(d)
+        return d
+
+
+    def nil(self):
+        node = self.adaptor.nil()
+        self.dbg.nilNode(node)
+        return node
+
+
+    def isNil(self, tree):
+        return self.adaptor.isNil(tree)
+
+
+    def addChild(self, t, child):
+        if isinstance(child, Token):
+            n = self.createWithPayload(child)
+            self.addChild(t, n)
+
+        else:
+            if t is None or child is None:
+                return
+
+            self.adaptor.addChild(t, child)
+            self.dbg.addChild(t, child)
+
+    def becomeRoot(self, newRoot, oldRoot):
+        if isinstance(newRoot, Token):
+            n = self.createWithPayload(newRoot)
+            self.adaptor.becomeRoot(n, oldRoot)
+        else:
+            n = self.adaptor.becomeRoot(newRoot, oldRoot)
+
+        self.dbg.becomeRoot(newRoot, oldRoot)
+        return n
+
+
+    def rulePostProcessing(self, root):
+        return self.adaptor.rulePostProcessing(root)
+
+
+    def getType(self, t):
+        return self.adaptor.getType(t)
+
+
+    def setType(self, t, type):
+        self.adaptor.setType(t, type)
+
+
+    def getText(self, t):
+        return self.adaptor.getText(t)
+
+
+    def setText(self, t, text):
+        self.adaptor.setText(t, text)
+
+
+    def getToken(self, t):
+        return self.adaptor.getToken(t)
+
+
+    def setTokenBoundaries(self, t, startToken, stopToken):
+        self.adaptor.setTokenBoundaries(t, startToken, stopToken)
+        if t is not None and startToken is not None and stopToken is not None:
+            self.dbg.setTokenBoundaries(
+                t, startToken.getTokenIndex(),
+                stopToken.getTokenIndex())
+
+
+    def getTokenStartIndex(self, t):
+        return self.adaptor.getTokenStartIndex(t)
+
+
+    def getTokenStopIndex(self, t):
+        return self.adaptor.getTokenStopIndex(t)
+
+
+    def getChild(self, t, i):
+        return self.adaptor.getChild(t, i)
+
+
+    def setChild(self, t, i, child):
+        self.adaptor.setChild(t, i, child)
+
+
+    def deleteChild(self, t, i):
+        return self.adaptor.deleteChild(t, i)
+
+
+    def getChildCount(self, t):
+        return self.adaptor.getChildCount(t)
+
+
+    def getUniqueID(self, node):
+        return self.adaptor.getUniqueID(node)
+
+
+    def getParent(self, t):
+        return self.adaptor.getParent(t)
+
+
+    def getChildIndex(self, t):
+        return self.adaptor.getChildIndex(t)
+
+
+    def setParent(self, t, parent):
+        self.adaptor.setParent(t, parent)
+
+
+    def setChildIndex(self, t, index):
+        self.adaptor.setChildIndex(t, index)
+
+
+    def replaceChildren(self, parent, startChildIndex, stopChildIndex, t):
+        self.adaptor.replaceChildren(parent, startChildIndex, stopChildIndex, t)
+
+
+    ## support
+
+    def getDebugListener(self):
+        return dbg
+
+    def setDebugListener(self, dbg):
+        self.dbg = dbg
+
+
+    def getTreeAdaptor(self):
+        return self.adaptor
+
+
+
+class DebugEventListener(object):
+    """All debugging events that a recognizer can trigger.
+
+    I did not create a separate AST debugging interface as it would create
+    lots of extra classes and DebugParser has a dbg var defined, which makes
+    it hard to change to ASTDebugEventListener.  I looked hard at this issue
+    and it is easier to understand as one monolithic event interface for all
+    possible events.  Hopefully, adding ST debugging stuff won't be bad.  Leave
+    for future. 4/26/2006.
+    """
+
+    # Moved to version 2 for v3.1: added grammar name to enter/exit Rule
+    PROTOCOL_VERSION = "2"
+
+    def enterRule(self, grammarFileName, ruleName):
+	"""The parser has just entered a rule. No decision has been made about
+        which alt is predicted.  This is fired AFTER init actions have been
+        executed.  Attributes are defined and available etc...
+        The grammarFileName allows composite grammars to jump around among
+        multiple grammar files.
+        """
+
+        pass
+
+
+    def enterAlt(self, alt):
+	"""Because rules can have lots of alternatives, it is very useful to
+        know which alt you are entering.  This is 1..n for n alts.
+        """
+        pass
+
+
+    def exitRule(self, grammarFileName, ruleName):
+	"""This is the last thing executed before leaving a rule.  It is
+        executed even if an exception is thrown.  This is triggered after
+        error reporting and recovery have occurred (unless the exception is
+        not caught in this rule).  This implies an "exitAlt" event.
+        The grammarFileName allows composite grammars to jump around among
+        multiple grammar files.
+	"""
+        pass
+
+
+    def enterSubRule(self, decisionNumber):
+	"""Track entry into any (...) subrule other EBNF construct"""
+        pass
+
+
+    def exitSubRule(self, decisionNumber):
+        pass
+
+
+    def enterDecision(self, decisionNumber, couldBacktrack):
+	"""Every decision, fixed k or arbitrary, has an enter/exit event
+        so that a GUI can easily track what LT/consume events are
+        associated with prediction.  You will see a single enter/exit
+        subrule but multiple enter/exit decision events, one for each
+        loop iteration.
+        """
+        pass
+
+
+    def exitDecision(self, decisionNumber):
+        pass
+
+
+    def consumeToken(self, t):
+	"""An input token was consumed; matched by any kind of element.
+        Trigger after the token was matched by things like match(), matchAny().
+	"""
+        pass
+
+
+    def consumeHiddenToken(self, t):
+	"""An off-channel input token was consumed.
+        Trigger after the token was matched by things like match(), matchAny().
+        (unless of course the hidden token is first stuff in the input stream).
+	"""
+        pass
+
+
+    def LT(self, i, t):
+	"""Somebody (anybody) looked ahead.  Note that this actually gets
+        triggered by both LA and LT calls.  The debugger will want to know
+        which Token object was examined.  Like consumeToken, this indicates
+        what token was seen at that depth.  A remote debugger cannot look
+        ahead into a file it doesn't have so LT events must pass the token
+        even if the info is redundant.
+	"""
+        pass
+
+
+    def mark(self, marker):
+	"""The parser is going to look arbitrarily ahead; mark this location,
+        the token stream's marker is sent in case you need it.
+	"""
+        pass
+
+
+    def rewind(self, marker=None):
+	"""After an arbitrairly long lookahead as with a cyclic DFA (or with
+        any backtrack), this informs the debugger that stream should be
+        rewound to the position associated with marker.
+
+        """
+        pass
+
+
+    def beginBacktrack(self, level):
+        pass
+
+
+    def endBacktrack(self, level, successful):
+        pass
+
+
+    def location(self, line, pos):
+	"""To watch a parser move through the grammar, the parser needs to
+        inform the debugger what line/charPos it is passing in the grammar.
+        For now, this does not know how to switch from one grammar to the
+        other and back for island grammars etc...
+
+        This should also allow breakpoints because the debugger can stop
+        the parser whenever it hits this line/pos.
+	"""
+        pass
+
+
+    def recognitionException(self, e):
+	"""A recognition exception occurred such as NoViableAltException.  I made
+        this a generic event so that I can alter the exception hierachy later
+        without having to alter all the debug objects.
+
+        Upon error, the stack of enter rule/subrule must be properly unwound.
+        If no viable alt occurs it is within an enter/exit decision, which
+        also must be rewound.  Even the rewind for each mark must be unwount.
+        In the Java target this is pretty easy using try/finally, if a bit
+        ugly in the generated code.  The rewind is generated in DFA.predict()
+        actually so no code needs to be generated for that.  For languages
+        w/o this "finally" feature (C++?), the target implementor will have
+        to build an event stack or something.
+
+        Across a socket for remote debugging, only the RecognitionException
+        data fields are transmitted.  The token object or whatever that
+        caused the problem was the last object referenced by LT.  The
+        immediately preceding LT event should hold the unexpected Token or
+        char.
+
+        Here is a sample event trace for grammar:
+
+        b : C ({;}A|B) // {;} is there to prevent A|B becoming a set
+          | D
+          ;
+
+        The sequence for this rule (with no viable alt in the subrule) for
+        input 'c c' (there are 3 tokens) is:
+
+		commence
+		LT(1)
+		enterRule b
+		location 7 1
+		enter decision 3
+		LT(1)
+		exit decision 3
+		enterAlt1
+		location 7 5
+		LT(1)
+		consumeToken [c/<4>,1:0]
+		location 7 7
+		enterSubRule 2
+		enter decision 2
+		LT(1)
+		LT(1)
+		recognitionException NoViableAltException 2 1 2
+		exit decision 2
+		exitSubRule 2
+		beginResync
+		LT(1)
+		consumeToken [c/<4>,1:1]
+		LT(1)
+		endResync
+		LT(-1)
+		exitRule b
+		terminate
+	"""
+        pass
+
+
+    def beginResync(self):
+	"""Indicates the recognizer is about to consume tokens to resynchronize
+        the parser.  Any consume events from here until the recovered event
+        are not part of the parse--they are dead tokens.
+        """
+        pass
+
+
+    def endResync(self):
+	"""Indicates that the recognizer has finished consuming tokens in order
+        to resychronize.  There may be multiple beginResync/endResync pairs
+        before the recognizer comes out of errorRecovery mode (in which
+        multiple errors are suppressed).  This will be useful
+        in a gui where you want to probably grey out tokens that are consumed
+        but not matched to anything in grammar.  Anything between
+        a beginResync/endResync pair was tossed out by the parser.
+	"""
+        pass
+
+
+    def semanticPredicate(self, result, predicate):
+	"""A semantic predicate was evaluate with this result and action text"""
+        pass
+
+
+    def commence(self):
+	"""Announce that parsing has begun.  Not technically useful except for
+        sending events over a socket.  A GUI for example will launch a thread
+        to connect and communicate with a remote parser.  The thread will want
+        to notify the GUI when a connection is made.  ANTLR parsers
+        trigger this upon entry to the first rule (the ruleLevel is used to
+        figure this out).
+	"""
+        pass
+
+
+    def terminate(self):
+        """Parsing is over; successfully or not.  Mostly useful for telling
+        remote debugging listeners that it's time to quit.  When the rule
+        invocation level goes to zero at the end of a rule, we are done
+        parsing.
+	"""
+        pass
+
+
+    ## T r e e  P a r s i n g
+
+    def consumeNode(self, t):
+        """Input for a tree parser is an AST, but we know nothing for sure
+        about a node except its type and text (obtained from the adaptor).
+        This is the analog of the consumeToken method.  Again, the ID is
+        the hashCode usually of the node so it only works if hashCode is
+        not implemented.  If the type is UP or DOWN, then
+        the ID is not really meaningful as it's fixed--there is
+        just one UP node and one DOWN navigation node.
+        """
+        pass
+
+
+    def LT(self, i, t):
+	"""The tree parser lookedahead.  If the type is UP or DOWN,
+        then the ID is not really meaningful as it's fixed--there is
+        just one UP node and one DOWN navigation node.
+	"""
+        pass
+
+
+
+    ## A S T  E v e n t s
+
+    def nilNode(self, t):
+	"""A nil was created (even nil nodes have a unique ID...
+        they are not "null" per se).  As of 4/28/2006, this
+        seems to be uniquely triggered when starting a new subtree
+        such as when entering a subrule in automatic mode and when
+        building a tree in rewrite mode.
+
+        If you are receiving this event over a socket via
+        RemoteDebugEventSocketListener then only t.ID is set.
+	"""
+        pass
+
+
+    def errorNode(self, t):
+	"""Upon syntax error, recognizers bracket the error with an error node
+        if they are building ASTs.
+        """
+        pass
+
+
+    def createNode(self, node, token=None):
+	"""Announce a new node built from token elements such as type etc...
+
+        If you are receiving this event over a socket via
+        RemoteDebugEventSocketListener then only t.ID, type, text are
+        set.
+	"""
+        pass
+
+
+    def becomeRoot(self, newRoot, oldRoot):
+	"""Make a node the new root of an existing root.
+
+        Note: the newRootID parameter is possibly different
+        than the TreeAdaptor.becomeRoot() newRoot parameter.
+        In our case, it will always be the result of calling
+        TreeAdaptor.becomeRoot() and not root_n or whatever.
+
+        The listener should assume that this event occurs
+        only when the current subrule (or rule) subtree is
+        being reset to newRootID.
+
+        If you are receiving this event over a socket via
+        RemoteDebugEventSocketListener then only IDs are set.
+
+        @see antlr3.tree.TreeAdaptor.becomeRoot()
+	"""
+        pass
+
+
+    def addChild(self, root, child):
+	"""Make childID a child of rootID.
+
+        If you are receiving this event over a socket via
+        RemoteDebugEventSocketListener then only IDs are set.
+
+        @see antlr3.tree.TreeAdaptor.addChild()
+        """
+        pass
+
+
+    def setTokenBoundaries(self, t, tokenStartIndex, tokenStopIndex):
+	"""Set the token start/stop token index for a subtree root or node.
+
+        If you are receiving this event over a socket via
+        RemoteDebugEventSocketListener then only t.ID is set.
+	"""
+        pass
+
+
+class BlankDebugEventListener(DebugEventListener):
+    """A blank listener that does nothing; useful for real classes so
+    they don't have to have lots of blank methods and are less
+    sensitive to updates to debug interface.
+
+    Note: this class is identical to DebugEventListener and exists purely
+    for compatibility with Java.
+    """
+    pass
+
+
+class TraceDebugEventListener(DebugEventListener):
+    """A listener that simply records text representations of the events.
+
+    Useful for debugging the debugging facility ;)
+
+    Subclasses can override the record() method (which defaults to printing to
+    stdout) to record the events in a different way.
+    """
+
+    def __init__(self, adaptor=None):
+        super(TraceDebugEventListener, self).__init__()
+
+        if adaptor is None:
+            adaptor = CommonTreeAdaptor()
+        self.adaptor = adaptor
+
+    def record(self, event):
+        sys.stdout.write(event + '\n')
+
+    def enterRule(self, grammarFileName, ruleName):
+        self.record("enterRule "+ruleName)
+
+    def exitRule(self, grammarFileName, ruleName):
+        self.record("exitRule "+ruleName)
+
+    def enterSubRule(self, decisionNumber):
+        self.record("enterSubRule")
+
+    def exitSubRule(self, decisionNumber):
+        self.record("exitSubRule")
+
+    def location(self, line, pos):
+        self.record("location %s:%s" % (line, pos))
+
+    ## Tree parsing stuff
+
+    def consumeNode(self, t):
+        self.record("consumeNode %s %s %s" % (
+                self.adaptor.getUniqueID(t),
+                self.adaptor.getText(t),
+                self.adaptor.getType(t)))
+
+    def LT(self, i, t):
+        self.record("LT %s %s %s %s" % (
+                i,
+                self.adaptor.getUniqueID(t),
+                self.adaptor.getText(t),
+                self.adaptor.getType(t)))
+
+
+    ## AST stuff
+    def nilNode(self, t):
+        self.record("nilNode %s" % self.adaptor.getUniqueID(t))
+
+    def createNode(self, t, token=None):
+        if token is None:
+            self.record("create %s: %s, %s" % (
+                    self.adaptor.getUniqueID(t),
+                    self.adaptor.getText(t),
+                    self.adaptor.getType(t)))
+
+        else:
+            self.record("create %s: %s" % (
+                    self.adaptor.getUniqueID(t),
+                    token.getTokenIndex()))
+
+    def becomeRoot(self, newRoot, oldRoot):
+        self.record("becomeRoot %s, %s" % (
+                self.adaptor.getUniqueID(newRoot),
+                self.adaptor.getUniqueID(oldRoot)))
+
+    def addChild(self, root, child):
+        self.record("addChild %s, %s" % (
+                self.adaptor.getUniqueID(root),
+                self.adaptor.getUniqueID(child)))
+
+    def setTokenBoundaries(self, t, tokenStartIndex, tokenStopIndex):
+        self.record("setTokenBoundaries %s, %s, %s" % (
+                self.adaptor.getUniqueID(t),
+                tokenStartIndex, tokenStopIndex))
+
+
+class RecordDebugEventListener(TraceDebugEventListener):
+    """A listener that records events as strings in an array."""
+
+    def __init__(self, adaptor=None):
+        super(RecordDebugEventListener, self).__init__(adaptor)
+
+        self.events = []
+
+    def record(self, event):
+        self.events.append(event)
+
+
+class DebugEventSocketProxy(DebugEventListener):
+    """A proxy debug event listener that forwards events over a socket to
+    a debugger (or any other listener) using a simple text-based protocol;
+    one event per line.  ANTLRWorks listens on server socket with a
+    RemoteDebugEventSocketListener instance.  These two objects must therefore
+    be kept in sync.  New events must be handled on both sides of socket.
+    """
+
+    DEFAULT_DEBUGGER_PORT = 49100
+
+    def __init__(self, recognizer, adaptor=None, port=None,
+                 debug=None):
+        super(DebugEventSocketProxy, self).__init__()
+
+        self.grammarFileName = recognizer.getGrammarFileName()
+
+	# Almost certainly the recognizer will have adaptor set, but
+        # we don't know how to cast it (Parser or TreeParser) to get
+        # the adaptor field.  Must be set with a constructor. :(
+        self.adaptor = adaptor
+
+        self.port = port or self.DEFAULT_DEBUGGER_PORT
+
+        self.debug = debug
+
+        self.socket = None
+        self.connection = None
+        self.input = None
+        self.output = None
+
+
+    def log(self, msg):
+        if self.debug is not None:
+            self.debug.write(msg + '\n')
+
+
+    def handshake(self):
+        if self.socket is None:
+            # create listening socket
+            self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+            self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+            self.socket.bind(('', self.port))
+            self.socket.listen(1)
+            self.log("Waiting for incoming connection on port %d" % self.port)
+
+            # wait for an incoming connection
+            self.connection, addr = self.socket.accept()
+            self.log("Accepted connection from %s:%d" % addr)
+
+            self.connection.setblocking(1)
+            self.connection.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1)
+
+            # FIXME(pink): wrap into utf8 encoding stream
+            self.output = self.connection.makefile('w', 0)
+            self.input = self.connection.makefile('r', 0)
+
+            self.write("ANTLR %s" % self.PROTOCOL_VERSION)
+            self.write("grammar \"%s" % self.grammarFileName)
+            self.ack()
+
+
+    def write(self, msg):
+        self.log("> %s" % msg)
+        self.output.write("%s\n" % msg)
+        self.output.flush()
+
+
+    def ack(self):
+        t = self.input.readline()
+        self.log("< %s" % t.rstrip())
+
+
+    def transmit(self, event):
+        self.write(event);
+        self.ack();
+
+
+    def commence(self):
+        # don't bother sending event; listener will trigger upon connection
+        pass
+
+
+    def terminate(self):
+        self.transmit("terminate")
+        self.output.close()
+        self.input.close()
+        self.connection.close()
+        self.socket.close()
+
+
+    def enterRule(self, grammarFileName, ruleName):
+        self.transmit("enterRule\t%s\t%s" % (grammarFileName, ruleName))
+
+
+    def enterAlt(self, alt):
+        self.transmit("enterAlt\t%d" % alt)
+
+
+    def exitRule(self, grammarFileName, ruleName):
+        self.transmit("exitRule\t%s\t%s" % (grammarFileName, ruleName))
+
+
+    def enterSubRule(self, decisionNumber):
+        self.transmit("enterSubRule\t%d" % decisionNumber)
+
+
+    def exitSubRule(self, decisionNumber):
+        self.transmit("exitSubRule\t%d" % decisionNumber)
+
+
+    def enterDecision(self, decisionNumber, couldBacktrack):
+        self.transmit(
+            "enterDecision\t%d\t%d" % (decisionNumber, couldBacktrack))
+
+
+    def exitDecision(self, decisionNumber):
+        self.transmit("exitDecision\t%d" % decisionNumber)
+
+
+    def consumeToken(self, t):
+        self.transmit("consumeToken\t%s" % self.serializeToken(t))
+
+
+    def consumeHiddenToken(self, t):
+        self.transmit("consumeHiddenToken\t%s" % self.serializeToken(t))
+
+
+    def LT(self, i, o):
+        if isinstance(o, Tree):
+            return self.LT_tree(i, o)
+        return self.LT_token(i, o)
+
+
+    def LT_token(self, i, t):
+        if t is not None:
+            self.transmit("LT\t%d\t%s" % (i, self.serializeToken(t)))
+
+
+    def mark(self, i):
+        self.transmit("mark\t%d" % i)
+
+
+    def rewind(self, i=None):
+        if i is not None:
+            self.transmit("rewind\t%d" % i)
+        else:
+            self.transmit("rewind")
+
+
+    def beginBacktrack(self, level):
+        self.transmit("beginBacktrack\t%d" % level)
+
+
+    def endBacktrack(self, level, successful):
+        self.transmit("endBacktrack\t%d\t%s" % (
+                level, ['0', '1'][bool(successful)]))
+
+
+    def location(self, line, pos):
+        self.transmit("location\t%d\t%d" % (line, pos))
+
+
+    def recognitionException(self, exc):
+        self.transmit('\t'.join([
+                    "exception",
+                    exc.__class__.__name__,
+                    str(int(exc.index)),
+                    str(int(exc.line)),
+                    str(int(exc.charPositionInLine))]))
+
+
+    def beginResync(self):
+        self.transmit("beginResync")
+
+
+    def endResync(self):
+        self.transmit("endResync")
+
+
+    def semanticPredicate(self, result, predicate):
+        self.transmit('\t'.join([
+                    "semanticPredicate",
+                    str(int(result)),
+                    self.escapeNewlines(predicate)]))
+
+    ## A S T  P a r s i n g  E v e n t s
+
+    def consumeNode(self, t):
+        FIXME(31)
+#         StringBuffer buf = new StringBuffer(50);
+#         buf.append("consumeNode");
+#         serializeNode(buf, t);
+#         transmit(buf.toString());
+
+
+    def LT_tree(self, i, t):
+        FIXME(34)
+#         int ID = adaptor.getUniqueID(t);
+#         String text = adaptor.getText(t);
+#         int type = adaptor.getType(t);
+#         StringBuffer buf = new StringBuffer(50);
+#         buf.append("LN\t"); // lookahead node; distinguish from LT in protocol
+#         buf.append(i);
+#         serializeNode(buf, t);
+#         transmit(buf.toString());
+
+
+    def serializeNode(self, buf, t):
+        FIXME(33)
+#         int ID = adaptor.getUniqueID(t);
+#         String text = adaptor.getText(t);
+#         int type = adaptor.getType(t);
+#         buf.append("\t");
+#         buf.append(ID);
+#         buf.append("\t");
+#         buf.append(type);
+#         Token token = adaptor.getToken(t);
+#         int line = -1;
+#         int pos = -1;
+#         if ( token!=null ) {
+#             line = token.getLine();
+#             pos = token.getCharPositionInLine();
+#             }
+#         buf.append("\t");
+#         buf.append(line);
+#         buf.append("\t");
+#         buf.append(pos);
+#         int tokenIndex = adaptor.getTokenStartIndex(t);
+#         buf.append("\t");
+#         buf.append(tokenIndex);
+#         serializeText(buf, text);
+
+
+    ## A S T  E v e n t s
+
+    def nilNode(self, t):
+        self.transmit("nilNode\t%d" % self.adaptor.getUniqueID(t))
+
+
+    def errorNode(self, t):
+        self.transmit("errorNode\t%d\t%d\t\"%s" % (
+             self.adaptor.getUniqueID(t),
+             Token.INVALID_TOKEN_TYPE,
+             self.escapeNewlines(t.toString())))
+
+
+
+    def createNode(self, node, token=None):
+        if token is not None:
+            self.transmit("createNode\t%d\t%d" % (
+                    self.adaptor.getUniqueID(node),
+                    token.getTokenIndex()))
+
+        else:
+            self.transmit("createNodeFromTokenElements\t%d\t%d\t\"%s" % (
+                    self.adaptor.getUniqueID(node),
+                    self.adaptor.getType(node),
+                    self.adaptor.getText(node)))
+
+
+    def becomeRoot(self, newRoot, oldRoot):
+        self.transmit("becomeRoot\t%d\t%d" % (
+                self.adaptor.getUniqueID(newRoot),
+                self.adaptor.getUniqueID(oldRoot)))
+
+
+    def addChild(self, root, child):
+        self.transmit("addChild\t%d\t%d" % (
+                self.adaptor.getUniqueID(root),
+                self.adaptor.getUniqueID(child)))
+
+
+    def setTokenBoundaries(self, t, tokenStartIndex, tokenStopIndex):
+        self.transmit("setTokenBoundaries\t%d\t%d\t%d" % (
+                self.adaptor.getUniqueID(t),
+                tokenStartIndex, tokenStopIndex))
+
+
+
+    ## support
+
+    def setTreeAdaptor(self, adaptor):
+        self.adaptor = adaptor
+
+    def getTreeAdaptor(self):
+        return self.adaptor
+
+
+    def serializeToken(self, t):
+        buf = [str(int(t.getTokenIndex())),
+               str(int(t.getType())),
+               str(int(t.getChannel())),
+               str(int(t.getLine() or 0)),
+               str(int(t.getCharPositionInLine() or 0)),
+               '\"' + self.escapeNewlines(t.getText())]
+        return '\t'.join(buf)
+
+
+    def escapeNewlines(self, txt):
+        if txt is None:
+            return ''
+
+        txt = txt.replace("%","%25")   # escape all escape char ;)
+        txt = txt.replace("\n","%0A")  # escape \n
+        txt = txt.replace("\r","%0D")  # escape \r
+        return txt
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/dfa.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/dfa.py
new file mode 100644
index 0000000000000000000000000000000000000000..fa8e282e2455b056a686545f04d7244f45bb40e9
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/dfa.py
@@ -0,0 +1,213 @@
+"""ANTLR3 runtime package"""
+
+# begin[licence]
+#
+# [The "BSD licence"]
+# Copyright (c) 2005-2008 Terence Parr
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# end[licensc]
+
+from antlr3.constants import EOF
+from antlr3.exceptions import NoViableAltException, BacktrackingFailed
+
+
+class DFA(object):
+    """@brief A DFA implemented as a set of transition tables.
+
+    Any state that has a semantic predicate edge is special; those states
+    are generated with if-then-else structures in a specialStateTransition()
+    which is generated by cyclicDFA template.
+    
+    """
+    
+    def __init__(
+        self,
+        recognizer, decisionNumber,
+        eot, eof, min, max, accept, special, transition
+        ):
+        ## Which recognizer encloses this DFA?  Needed to check backtracking
+        self.recognizer = recognizer
+
+        self.decisionNumber = decisionNumber
+        self.eot = eot
+        self.eof = eof
+        self.min = min
+        self.max = max
+        self.accept = accept
+        self.special = special
+        self.transition = transition
+
+
+    def predict(self, input):
+        """
+        From the input stream, predict what alternative will succeed
+	using this DFA (representing the covering regular approximation
+	to the underlying CFL).  Return an alternative number 1..n.  Throw
+	 an exception upon error.
+	"""
+        mark = input.mark()
+        s = 0 # we always start at s0
+        try:
+            for _ in xrange(50000):
+                #print "***Current state = %d" % s
+                
+                specialState = self.special[s]
+                if specialState >= 0:
+                    #print "is special"
+                    s = self.specialStateTransition(specialState, input)
+                    if s == -1:
+                        self.noViableAlt(s, input)
+                        return 0
+                    input.consume()
+                    continue
+
+                if self.accept[s] >= 1:
+                    #print "accept state for alt %d" % self.accept[s]
+                    return self.accept[s]
+
+                # look for a normal char transition
+                c = input.LA(1)
+
+                #print "LA = %d (%r)" % (c, unichr(c) if c >= 0 else 'EOF')
+                #print "range = %d..%d" % (self.min[s], self.max[s])
+
+                if c >= self.min[s] and c <= self.max[s]:
+                    # move to next state
+                    snext = self.transition[s][c-self.min[s]]
+                    #print "in range, next state = %d" % snext
+                    
+                    if snext < 0:
+                        #print "not a normal transition"
+                        # was in range but not a normal transition
+                        # must check EOT, which is like the else clause.
+                        # eot[s]>=0 indicates that an EOT edge goes to another
+                        # state.
+                        if self.eot[s] >= 0: # EOT Transition to accept state?
+                            #print "EOT trans to accept state %d" % self.eot[s]
+                            
+                            s = self.eot[s]
+                            input.consume()
+                            # TODO: I had this as return accept[eot[s]]
+                            # which assumed here that the EOT edge always
+                            # went to an accept...faster to do this, but
+                            # what about predicated edges coming from EOT
+                            # target?
+                            continue
+
+                        #print "no viable alt"
+                        self.noViableAlt(s, input)
+                        return 0
+
+                    s = snext
+                    input.consume()
+                    continue
+
+                if self.eot[s] >= 0:
+                    #print "EOT to %d" % self.eot[s]
+                    
+                    s = self.eot[s]
+                    input.consume()
+                    continue
+
+                # EOF Transition to accept state?
+                if c == EOF and self.eof[s] >= 0:
+                    #print "EOF Transition to accept state %d" \
+                    #  % self.accept[self.eof[s]]
+                    return self.accept[self.eof[s]]
+
+                # not in range and not EOF/EOT, must be invalid symbol
+                self.noViableAlt(s, input)
+                return 0
+
+            else:
+                raise RuntimeError("DFA bang!")
+            
+        finally:
+            input.rewind(mark)
+
+
+    def noViableAlt(self, s, input):
+        if self.recognizer._state.backtracking > 0:
+            raise BacktrackingFailed
+
+        nvae = NoViableAltException(
+            self.getDescription(),
+            self.decisionNumber,
+            s,
+            input
+            )
+
+        self.error(nvae)
+        raise nvae
+
+
+    def error(self, nvae):
+        """A hook for debugging interface"""
+        pass
+
+
+    def specialStateTransition(self, s, input):
+        return -1
+
+
+    def getDescription(self):
+        return "n/a"
+
+
+##     def specialTransition(self, state, symbol):
+##         return 0
+
+
+    def unpack(cls, string):
+        """@brief Unpack the runlength encoded table data.
+
+        Terence implemented packed table initializers, because Java has a
+        size restriction on .class files and the lookup tables can grow
+        pretty large. The generated JavaLexer.java of the Java.g example
+        would be about 15MB with uncompressed array initializers.
+
+        Python does not have any size restrictions, but the compilation of
+        such large source files seems to be pretty memory hungry. The memory
+        consumption of the python process grew to >1.5GB when importing a
+        15MB lexer, eating all my swap space and I was to impacient to see,
+        if it could finish at all. With packed initializers that are unpacked
+        at import time of the lexer module, everything works like a charm.
+        
+        """
+        
+        ret = []
+        for i in range(len(string) / 2):
+            (n, v) = ord(string[i*2]), ord(string[i*2+1])
+
+            # Is there a bitwise operation to do this?
+            if v == 0xFFFF:
+                v = -1
+
+            ret += [v] * n
+
+        return ret
+    
+    unpack = classmethod(unpack)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/dottreegen.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/dottreegen.py
new file mode 100644
index 0000000000000000000000000000000000000000..bab8b5aef7465d57c7406d8b31dab06273c34178
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/dottreegen.py
@@ -0,0 +1,210 @@
+""" @package antlr3.dottreegenerator
+@brief ANTLR3 runtime package, tree module
+
+This module contains all support classes for AST construction and tree parsers.
+
+"""
+
+# begin[licence]
+#
+# [The "BSD licence"]
+# Copyright (c) 2005-2008 Terence Parr
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# end[licence]
+
+# lot's of docstrings are missing, don't complain for now...
+# pylint: disable-msg=C0111
+
+from antlr3.tree import CommonTreeAdaptor
+import stringtemplate3
+
+class DOTTreeGenerator(object):
+    """
+    A utility class to generate DOT diagrams (graphviz) from
+    arbitrary trees.  You can pass in your own templates and
+    can pass in any kind of tree or use Tree interface method.
+    """
+
+    _treeST = stringtemplate3.StringTemplate(
+        template=(
+        "digraph {\n" +
+        "  ordering=out;\n" +
+        "  ranksep=.4;\n" +
+        "  node [shape=plaintext, fixedsize=true, fontsize=11, fontname=\"Courier\",\n" +
+        "        width=.25, height=.25];\n" +
+        "  edge [arrowsize=.5]\n" +
+        "  $nodes$\n" +
+        "  $edges$\n" +
+        "}\n")
+        )
+
+    _nodeST = stringtemplate3.StringTemplate(
+        template="$name$ [label=\"$text$\"];\n"
+        )
+
+    _edgeST = stringtemplate3.StringTemplate(
+        template="$parent$ -> $child$ // \"$parentText$\" -> \"$childText$\"\n"
+        )
+
+    def __init__(self):
+        ## Track node to number mapping so we can get proper node name back
+        self.nodeToNumberMap = {}
+
+        ## Track node number so we can get unique node names
+        self.nodeNumber = 0
+
+
+    def toDOT(self, tree, adaptor=None, treeST=_treeST, edgeST=_edgeST):
+        if adaptor is None:
+            adaptor = CommonTreeAdaptor()
+
+        treeST = treeST.getInstanceOf()
+
+        self.nodeNumber = 0
+        self.toDOTDefineNodes(tree, adaptor, treeST)
+
+        self.nodeNumber = 0
+        self.toDOTDefineEdges(tree, adaptor, treeST, edgeST)
+        return treeST
+
+
+    def toDOTDefineNodes(self, tree, adaptor, treeST, knownNodes=None):
+        if knownNodes is None:
+            knownNodes = set()
+
+        if tree is None:
+            return
+
+        n = adaptor.getChildCount(tree)
+        if n == 0:
+            # must have already dumped as child from previous
+            # invocation; do nothing
+            return
+
+        # define parent node
+        number = self.getNodeNumber(tree)
+        if number not in knownNodes:
+            parentNodeST = self.getNodeST(adaptor, tree)
+            treeST.setAttribute("nodes", parentNodeST)
+            knownNodes.add(number)
+
+        # for each child, do a "<unique-name> [label=text]" node def
+        for i in range(n):
+            child = adaptor.getChild(tree, i)
+            
+            number = self.getNodeNumber(child)
+            if number not in knownNodes:
+                nodeST = self.getNodeST(adaptor, child)
+                treeST.setAttribute("nodes", nodeST)
+                knownNodes.add(number)
+
+            self.toDOTDefineNodes(child, adaptor, treeST, knownNodes)
+
+
+    def toDOTDefineEdges(self, tree, adaptor, treeST, edgeST):
+        if tree is None:
+            return
+
+        n = adaptor.getChildCount(tree)
+        if n == 0:
+            # must have already dumped as child from previous
+            # invocation; do nothing
+            return
+
+        parentName = "n%d" % self.getNodeNumber(tree)
+
+        # for each child, do a parent -> child edge using unique node names
+        parentText = adaptor.getText(tree)
+        for i in range(n):
+            child = adaptor.getChild(tree, i)
+            childText = adaptor.getText(child)
+            childName = "n%d" % self.getNodeNumber(child)
+            edgeST = edgeST.getInstanceOf()
+            edgeST.setAttribute("parent", parentName)
+            edgeST.setAttribute("child", childName)
+            edgeST.setAttribute("parentText", parentText)
+            edgeST.setAttribute("childText", childText)
+            treeST.setAttribute("edges", edgeST)
+            self.toDOTDefineEdges(child, adaptor, treeST, edgeST)
+
+
+    def getNodeST(self, adaptor, t):
+        text = adaptor.getText(t)
+        nodeST = self._nodeST.getInstanceOf()
+        uniqueName = "n%d" % self.getNodeNumber(t)
+        nodeST.setAttribute("name", uniqueName)
+        if text is not None:
+            text = text.replace('"', r'\"')
+        nodeST.setAttribute("text", text)
+        return nodeST
+
+
+    def getNodeNumber(self, t):
+        try:
+            return self.nodeToNumberMap[t]
+        except KeyError:
+            self.nodeToNumberMap[t] = self.nodeNumber
+            self.nodeNumber += 1
+            return self.nodeNumber - 1
+
+
+def toDOT(tree, adaptor=None, treeST=DOTTreeGenerator._treeST, edgeST=DOTTreeGenerator._edgeST):
+    """
+    Generate DOT (graphviz) for a whole tree not just a node.
+    For example, 3+4*5 should generate:
+
+    digraph {
+        node [shape=plaintext, fixedsize=true, fontsize=11, fontname="Courier",
+            width=.4, height=.2];
+        edge [arrowsize=.7]
+        "+"->3
+        "+"->"*"
+        "*"->4
+        "*"->5
+    }
+
+    Return the ST not a string in case people want to alter.
+
+    Takes a Tree interface object.
+
+    Example of invokation:
+
+        import antlr3
+        import antlr3.extras
+
+        input = antlr3.ANTLRInputStream(sys.stdin)
+        lex = TLexer(input)
+        tokens = antlr3.CommonTokenStream(lex)
+        parser = TParser(tokens)
+        tree = parser.e().tree
+        print tree.toStringTree()
+        st = antlr3.extras.toDOT(t)
+        print st
+        
+    """
+
+    gen = DOTTreeGenerator()
+    return gen.toDOT(tree, adaptor, treeST, edgeST)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/exceptions.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/exceptions.py
new file mode 100644
index 0000000000000000000000000000000000000000..6b4feb499ab671852b10078f3bca6df7f8771b9f
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/exceptions.py
@@ -0,0 +1,364 @@
+"""ANTLR3 exception hierarchy"""
+
+# begin[licence]
+#
+# [The "BSD licence"]
+# Copyright (c) 2005-2008 Terence Parr
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# end[licence]
+
+from antlr3.constants import INVALID_TOKEN_TYPE
+
+
+class BacktrackingFailed(Exception):
+    """@brief Raised to signal failed backtrack attempt"""
+
+    pass
+
+
+class RecognitionException(Exception):
+    """@brief The root of the ANTLR exception hierarchy.
+
+    To avoid English-only error messages and to generally make things
+    as flexible as possible, these exceptions are not created with strings,
+    but rather the information necessary to generate an error.  Then
+    the various reporting methods in Parser and Lexer can be overridden
+    to generate a localized error message.  For example, MismatchedToken
+    exceptions are built with the expected token type.
+    So, don't expect getMessage() to return anything.
+
+    Note that as of Java 1.4, you can access the stack trace, which means
+    that you can compute the complete trace of rules from the start symbol.
+    This gives you considerable context information with which to generate
+    useful error messages.
+
+    ANTLR generates code that throws exceptions upon recognition error and
+    also generates code to catch these exceptions in each rule.  If you
+    want to quit upon first error, you can turn off the automatic error
+    handling mechanism using rulecatch action, but you still need to
+    override methods mismatch and recoverFromMismatchSet.
+    
+    In general, the recognition exceptions can track where in a grammar a
+    problem occurred and/or what was the expected input.  While the parser
+    knows its state (such as current input symbol and line info) that
+    state can change before the exception is reported so current token index
+    is computed and stored at exception time.  From this info, you can
+    perhaps print an entire line of input not just a single token, for example.
+    Better to just say the recognizer had a problem and then let the parser
+    figure out a fancy report.
+    
+    """
+
+    def __init__(self, input=None):
+        Exception.__init__(self)
+
+	# What input stream did the error occur in?
+        self.input = None
+
+        # What is index of token/char were we looking at when the error
+        # occurred?
+        self.index = None
+
+	# The current Token when an error occurred.  Since not all streams
+	# can retrieve the ith Token, we have to track the Token object.
+	# For parsers.  Even when it's a tree parser, token might be set.
+        self.token = None
+
+	# If this is a tree parser exception, node is set to the node with
+	# the problem.
+        self.node = None
+
+	# The current char when an error occurred. For lexers.
+        self.c = None
+
+	# Track the line at which the error occurred in case this is
+	# generated from a lexer.  We need to track this since the
+        # unexpected char doesn't carry the line info.
+        self.line = None
+
+        self.charPositionInLine = None
+
+        # If you are parsing a tree node stream, you will encounter som
+        # imaginary nodes w/o line/col info.  We now search backwards looking
+        # for most recent token with line/col info, but notify getErrorHeader()
+        # that info is approximate.
+        self.approximateLineInfo = False
+
+        
+        if input is not None:
+            self.input = input
+            self.index = input.index()
+
+            # late import to avoid cyclic dependencies
+            from antlr3.streams import TokenStream, CharStream
+            from antlr3.tree import TreeNodeStream
+
+            if isinstance(self.input, TokenStream):
+                self.token = self.input.LT(1)
+                self.line = self.token.line
+                self.charPositionInLine = self.token.charPositionInLine
+
+            if isinstance(self.input, TreeNodeStream):
+                self.extractInformationFromTreeNodeStream(self.input)
+
+            else:
+                if isinstance(self.input, CharStream):
+                    self.c = self.input.LT(1)
+                    self.line = self.input.line
+                    self.charPositionInLine = self.input.charPositionInLine
+
+                else:
+                    self.c = self.input.LA(1)
+
+    def extractInformationFromTreeNodeStream(self, nodes):
+        from antlr3.tree import Tree, CommonTree
+        from antlr3.tokens import CommonToken
+        
+        self.node = nodes.LT(1)
+        adaptor = nodes.adaptor
+        payload = adaptor.getToken(self.node)
+        if payload is not None:
+            self.token = payload
+            if payload.line <= 0:
+                # imaginary node; no line/pos info; scan backwards
+                i = -1
+                priorNode = nodes.LT(i)
+                while priorNode is not None:
+                    priorPayload = adaptor.getToken(priorNode)
+                    if priorPayload is not None and priorPayload.line > 0:
+                        # we found the most recent real line / pos info
+                        self.line = priorPayload.line
+                        self.charPositionInLine = priorPayload.charPositionInLine
+                        self.approximateLineInfo = True
+                        break
+                    
+                    i -= 1
+                    priorNode = nodes.LT(i)
+                    
+            else: # node created from real token
+                self.line = payload.line
+                self.charPositionInLine = payload.charPositionInLine
+                
+        elif isinstance(self.node, Tree):
+            self.line = self.node.line
+            self.charPositionInLine = self.node.charPositionInLine
+            if isinstance(self.node, CommonTree):
+                self.token = self.node.token
+
+        else:
+            type = adaptor.getType(self.node)
+            text = adaptor.getText(self.node)
+            self.token = CommonToken(type=type, text=text)
+
+     
+    def getUnexpectedType(self):
+        """Return the token type or char of the unexpected input element"""
+
+        from antlr3.streams import TokenStream
+        from antlr3.tree import TreeNodeStream
+
+        if isinstance(self.input, TokenStream):
+            return self.token.type
+
+        elif isinstance(self.input, TreeNodeStream):
+            adaptor = self.input.treeAdaptor
+            return adaptor.getType(self.node)
+
+        else:
+            return self.c
+
+    unexpectedType = property(getUnexpectedType)
+    
+
+class MismatchedTokenException(RecognitionException):
+    """@brief A mismatched char or Token or tree node."""
+    
+    def __init__(self, expecting, input):
+        RecognitionException.__init__(self, input)
+        self.expecting = expecting
+        
+
+    def __str__(self):
+        #return "MismatchedTokenException("+self.expecting+")"
+        return "MismatchedTokenException(%r!=%r)" % (
+            self.getUnexpectedType(), self.expecting
+            )
+    __repr__ = __str__
+
+
+class UnwantedTokenException(MismatchedTokenException):
+    """An extra token while parsing a TokenStream"""
+
+    def getUnexpectedToken(self):
+        return self.token
+
+
+    def __str__(self):
+        exp = ", expected %s" % self.expecting
+        if self.expecting == INVALID_TOKEN_TYPE:
+            exp = ""
+
+        if self.token is None:
+            return "UnwantedTokenException(found=%s%s)" % (None, exp)
+
+        return "UnwantedTokenException(found=%s%s)" % (self.token.text, exp)
+    __repr__ = __str__
+
+
+class MissingTokenException(MismatchedTokenException):
+    """
+    We were expecting a token but it's not found.  The current token
+    is actually what we wanted next.
+    """
+
+    def __init__(self, expecting, input, inserted):
+        MismatchedTokenException.__init__(self, expecting, input)
+
+        self.inserted = inserted
+
+
+    def getMissingType(self):
+        return self.expecting
+
+
+    def __str__(self):
+        if self.inserted is not None and self.token is not None:
+            return "MissingTokenException(inserted %r at %r)" % (
+                self.inserted, self.token.text)
+
+        if self.token is not None:
+            return "MissingTokenException(at %r)" % self.token.text
+
+        return "MissingTokenException"
+    __repr__ = __str__
+
+
+class MismatchedRangeException(RecognitionException):
+    """@brief The next token does not match a range of expected types."""
+
+    def __init__(self, a, b, input):
+        RecognitionException.__init__(self, input)
+
+        self.a = a
+        self.b = b
+        
+
+    def __str__(self):
+        return "MismatchedRangeException(%r not in [%r..%r])" % (
+            self.getUnexpectedType(), self.a, self.b
+            )
+    __repr__ = __str__
+    
+
+class MismatchedSetException(RecognitionException):
+    """@brief The next token does not match a set of expected types."""
+
+    def __init__(self, expecting, input):
+        RecognitionException.__init__(self, input)
+
+        self.expecting = expecting
+        
+
+    def __str__(self):
+        return "MismatchedSetException(%r not in %r)" % (
+            self.getUnexpectedType(), self.expecting
+            )
+    __repr__ = __str__
+
+
+class MismatchedNotSetException(MismatchedSetException):
+    """@brief Used for remote debugger deserialization"""
+    
+    def __str__(self):
+        return "MismatchedNotSetException(%r!=%r)" % (
+            self.getUnexpectedType(), self.expecting
+            )
+    __repr__ = __str__
+
+
+class NoViableAltException(RecognitionException):
+    """@brief Unable to decide which alternative to choose."""
+
+    def __init__(
+        self, grammarDecisionDescription, decisionNumber, stateNumber, input
+        ):
+        RecognitionException.__init__(self, input)
+
+        self.grammarDecisionDescription = grammarDecisionDescription
+        self.decisionNumber = decisionNumber
+        self.stateNumber = stateNumber
+
+
+    def __str__(self):
+        return "NoViableAltException(%r!=[%r])" % (
+            self.unexpectedType, self.grammarDecisionDescription
+            )
+    __repr__ = __str__
+    
+
+class EarlyExitException(RecognitionException):
+    """@brief The recognizer did not match anything for a (..)+ loop."""
+
+    def __init__(self, decisionNumber, input):
+        RecognitionException.__init__(self, input)
+
+        self.decisionNumber = decisionNumber
+
+
+class FailedPredicateException(RecognitionException):
+    """@brief A semantic predicate failed during validation.
+
+    Validation of predicates
+    occurs when normally parsing the alternative just like matching a token.
+    Disambiguating predicate evaluation occurs when we hoist a predicate into
+    a prediction decision.
+    """
+
+    def __init__(self, input, ruleName, predicateText):
+        RecognitionException.__init__(self, input)
+        
+        self.ruleName = ruleName
+        self.predicateText = predicateText
+
+
+    def __str__(self):
+        return "FailedPredicateException("+self.ruleName+",{"+self.predicateText+"}?)"
+    __repr__ = __str__
+    
+
+class MismatchedTreeNodeException(RecognitionException):
+    """@brief The next tree mode does not match the expected type."""
+
+    def __init__(self, expecting, input):
+        RecognitionException.__init__(self, input)
+        
+        self.expecting = expecting
+
+    def __str__(self):
+        return "MismatchedTreeNodeException(%r!=%r)" % (
+            self.getUnexpectedType(), self.expecting
+            )
+    __repr__ = __str__
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/extras.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/extras.py
new file mode 100644
index 0000000000000000000000000000000000000000..5303cab53a44f319cb926792009537e872f712cc
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/extras.py
@@ -0,0 +1,47 @@
+""" @package antlr3.dottreegenerator
+@brief ANTLR3 runtime package, tree module
+
+This module contains all support classes for AST construction and tree parsers.
+
+"""
+
+# begin[licence]
+#
+# [The "BSD licence"]
+# Copyright (c) 2005-2008 Terence Parr
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# end[licence]
+
+# lot's of docstrings are missing, don't complain for now...
+# pylint: disable-msg=C0111
+
+from treewizard import TreeWizard
+
+try:
+    from antlr3.dottreegen import toDOT
+except ImportError, exc:
+    def toDOT(*args, **kwargs):
+        raise exc
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/main.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/main.py
new file mode 100644
index 0000000000000000000000000000000000000000..687d84d433a29d19d3cad9f0c93c058e6eccf237
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/main.py
@@ -0,0 +1,305 @@
+"""ANTLR3 runtime package"""
+
+# begin[licence]
+#
+# [The "BSD licence"]
+# Copyright (c) 2005-2008 Terence Parr
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# end[licence]
+
+
+import sys
+import optparse
+
+import antlr3
+
+
+class _Main(object):
+    def __init__(self):
+        self.stdin = sys.stdin
+        self.stdout = sys.stdout
+        self.stderr = sys.stderr
+
+
+    def parseOptions(self, argv):
+        optParser = optparse.OptionParser()
+        optParser.add_option(
+            "--encoding",
+            action="store",
+            type="string",
+            dest="encoding"
+            )
+        optParser.add_option(
+            "--input",
+            action="store",
+            type="string",
+            dest="input"
+            )
+        optParser.add_option(
+            "--interactive", "-i",
+            action="store_true",
+            dest="interactive"
+            )
+        optParser.add_option(
+            "--no-output",
+            action="store_true",
+            dest="no_output"
+            )
+        optParser.add_option(
+            "--profile",
+            action="store_true",
+            dest="profile"
+            )
+        optParser.add_option(
+            "--hotshot",
+            action="store_true",
+            dest="hotshot"
+            )
+        optParser.add_option(
+            "--port",
+            type="int",
+            dest="port",
+            default=None
+            )
+        optParser.add_option(
+            "--debug-socket",
+            action='store_true',
+            dest="debug_socket",
+            default=None
+            )
+
+        self.setupOptions(optParser)
+
+        return optParser.parse_args(argv[1:])
+
+
+    def setupOptions(self, optParser):
+        pass
+
+
+    def execute(self, argv):
+        options, args = self.parseOptions(argv)
+
+        self.setUp(options)
+
+        if options.interactive:
+            while True:
+                try:
+                    input = raw_input(">>> ")
+                except (EOFError, KeyboardInterrupt):
+                    self.stdout.write("\nBye.\n")
+                    break
+
+                inStream = antlr3.ANTLRStringStream(input)
+                self.parseStream(options, inStream)
+
+        else:
+            if options.input is not None:
+                inStream = antlr3.ANTLRStringStream(options.input)
+
+            elif len(args) == 1 and args[0] != '-':
+                inStream = antlr3.ANTLRFileStream(
+                    args[0], encoding=options.encoding
+                    )
+
+            else:
+                inStream = antlr3.ANTLRInputStream(
+                    self.stdin, encoding=options.encoding
+                    )
+
+            if options.profile:
+                try:
+                    import cProfile as profile
+                except ImportError:
+                    import profile
+
+                profile.runctx(
+                    'self.parseStream(options, inStream)',
+                    globals(),
+                    locals(),
+                    'profile.dat'
+                    )
+
+                import pstats
+                stats = pstats.Stats('profile.dat')
+                stats.strip_dirs()
+                stats.sort_stats('time')
+                stats.print_stats(100)
+
+            elif options.hotshot:
+                import hotshot
+
+                profiler = hotshot.Profile('hotshot.dat')
+                profiler.runctx(
+                    'self.parseStream(options, inStream)',
+                    globals(),
+                    locals()
+                    )
+
+            else:
+                self.parseStream(options, inStream)
+
+
+    def setUp(self, options):
+        pass
+
+
+    def parseStream(self, options, inStream):
+        raise NotImplementedError
+
+
+    def write(self, options, text):
+        if not options.no_output:
+            self.stdout.write(text)
+
+
+    def writeln(self, options, text):
+        self.write(options, text + '\n')
+
+
+class LexerMain(_Main):
+    def __init__(self, lexerClass):
+        _Main.__init__(self)
+
+        self.lexerClass = lexerClass
+
+
+    def parseStream(self, options, inStream):
+        lexer = self.lexerClass(inStream)
+        for token in lexer:
+            self.writeln(options, str(token))
+
+
+class ParserMain(_Main):
+    def __init__(self, lexerClassName, parserClass):
+        _Main.__init__(self)
+
+        self.lexerClassName = lexerClassName
+        self.lexerClass = None
+        self.parserClass = parserClass
+
+
+    def setupOptions(self, optParser):
+        optParser.add_option(
+            "--lexer",
+            action="store",
+            type="string",
+            dest="lexerClass",
+            default=self.lexerClassName
+            )
+        optParser.add_option(
+            "--rule",
+            action="store",
+            type="string",
+            dest="parserRule"
+            )
+
+
+    def setUp(self, options):
+        lexerMod = __import__(options.lexerClass)
+        self.lexerClass = getattr(lexerMod, options.lexerClass)
+
+
+    def parseStream(self, options, inStream):
+        kwargs = {}
+        if options.port is not None:
+            kwargs['port'] = options.port
+        if options.debug_socket is not None:
+            kwargs['debug_socket'] = sys.stderr
+
+        lexer = self.lexerClass(inStream)
+        tokenStream = antlr3.CommonTokenStream(lexer)
+        parser = self.parserClass(tokenStream, **kwargs)
+        result = getattr(parser, options.parserRule)()
+        if result is not None:
+            if hasattr(result, 'tree') and result.tree is not None:
+                self.writeln(options, result.tree.toStringTree())
+            else:
+                self.writeln(options, repr(result))
+
+
+class WalkerMain(_Main):
+    def __init__(self, walkerClass):
+        _Main.__init__(self)
+
+        self.lexerClass = None
+        self.parserClass = None
+        self.walkerClass = walkerClass
+
+
+    def setupOptions(self, optParser):
+        optParser.add_option(
+            "--lexer",
+            action="store",
+            type="string",
+            dest="lexerClass",
+            default=None
+            )
+        optParser.add_option(
+            "--parser",
+            action="store",
+            type="string",
+            dest="parserClass",
+            default=None
+            )
+        optParser.add_option(
+            "--parser-rule",
+            action="store",
+            type="string",
+            dest="parserRule",
+            default=None
+            )
+        optParser.add_option(
+            "--rule",
+            action="store",
+            type="string",
+            dest="walkerRule"
+            )
+
+
+    def setUp(self, options):
+        lexerMod = __import__(options.lexerClass)
+        self.lexerClass = getattr(lexerMod, options.lexerClass)
+        parserMod = __import__(options.parserClass)
+        self.parserClass = getattr(parserMod, options.parserClass)
+
+
+    def parseStream(self, options, inStream):
+        lexer = self.lexerClass(inStream)
+        tokenStream = antlr3.CommonTokenStream(lexer)
+        parser = self.parserClass(tokenStream)
+        result = getattr(parser, options.parserRule)()
+        if result is not None:
+            assert hasattr(result, 'tree'), "Parser did not return an AST"
+            nodeStream = antlr3.tree.CommonTreeNodeStream(result.tree)
+            nodeStream.setTokenStream(tokenStream)
+            walker = self.walkerClass(nodeStream)
+            result = getattr(walker, options.walkerRule)()
+            if result is not None:
+                if hasattr(result, 'tree'):
+                    self.writeln(options, result.tree.toStringTree())
+                else:
+                    self.writeln(options, repr(result))
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/recognizers.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/recognizers.py
new file mode 100644
index 0000000000000000000000000000000000000000..82bd977e4a4be12c1a3e85abc28b0ab502891be7
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/recognizers.py
@@ -0,0 +1,1485 @@
+"""ANTLR3 runtime package"""
+
+# begin[licence]
+#
+# [The "BSD licence"]
+# Copyright (c) 2005-2008 Terence Parr
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# end[licence]
+
+import sys
+import inspect
+
+from antlr3 import compatible_api_versions
+from antlr3.constants import DEFAULT_CHANNEL, HIDDEN_CHANNEL, EOF, \
+     EOR_TOKEN_TYPE, INVALID_TOKEN_TYPE
+from antlr3.exceptions import RecognitionException, MismatchedTokenException, \
+     MismatchedRangeException, MismatchedTreeNodeException, \
+     NoViableAltException, EarlyExitException, MismatchedSetException, \
+     MismatchedNotSetException, FailedPredicateException, \
+     BacktrackingFailed, UnwantedTokenException, MissingTokenException
+from antlr3.tokens import CommonToken, SKIP_TOKEN
+from antlr3.compat import set, frozenset, reversed
+
+
+class RecognizerSharedState(object):
+    """
+    The set of fields needed by an abstract recognizer to recognize input
+    and recover from errors etc...  As a separate state object, it can be
+    shared among multiple grammars; e.g., when one grammar imports another.
+
+    These fields are publically visible but the actual state pointer per
+    parser is protected.
+    """
+
+    def __init__(self):
+        # Track the set of token types that can follow any rule invocation.
+        # Stack grows upwards.
+        self.following = []
+
+        # This is true when we see an error and before having successfully
+        # matched a token.  Prevents generation of more than one error message
+        # per error.
+        self.errorRecovery = False
+
+        # The index into the input stream where the last error occurred.
+        # This is used to prevent infinite loops where an error is found
+        # but no token is consumed during recovery...another error is found,
+        # ad naseum.  This is a failsafe mechanism to guarantee that at least
+        # one token/tree node is consumed for two errors.
+        self.lastErrorIndex = -1
+
+        # If 0, no backtracking is going on.  Safe to exec actions etc...
+        # If >0 then it's the level of backtracking.
+        self.backtracking = 0
+
+        # An array[size num rules] of Map<Integer,Integer> that tracks
+        # the stop token index for each rule.  ruleMemo[ruleIndex] is
+        # the memoization table for ruleIndex.  For key ruleStartIndex, you
+        # get back the stop token for associated rule or MEMO_RULE_FAILED.
+        #
+        # This is only used if rule memoization is on (which it is by default).
+        self.ruleMemo = None
+
+        ## Did the recognizer encounter a syntax error?  Track how many.
+        self.syntaxErrors = 0
+
+
+        # LEXER FIELDS (must be in same state object to avoid casting
+        # constantly in generated code and Lexer object) :(
+
+
+	## The goal of all lexer rules/methods is to create a token object.
+        # This is an instance variable as multiple rules may collaborate to
+        # create a single token.  nextToken will return this object after
+        # matching lexer rule(s).  If you subclass to allow multiple token
+        # emissions, then set this to the last token to be matched or
+        # something nonnull so that the auto token emit mechanism will not
+        # emit another token.
+        self.token = None
+
+        ## What character index in the stream did the current token start at?
+        # Needed, for example, to get the text for current token.  Set at
+        # the start of nextToken.
+        self.tokenStartCharIndex = -1
+
+        ## The line on which the first character of the token resides
+        self.tokenStartLine = None
+
+        ## The character position of first character within the line
+        self.tokenStartCharPositionInLine = None
+
+        ## The channel number for the current token
+        self.channel = None
+
+        ## The token type for the current token
+        self.type = None
+
+        ## You can set the text for the current token to override what is in
+        # the input char buffer.  Use setText() or can set this instance var.
+        self.text = None
+
+
+class BaseRecognizer(object):
+    """
+    @brief Common recognizer functionality.
+
+    A generic recognizer that can handle recognizers generated from
+    lexer, parser, and tree grammars.  This is all the parsing
+    support code essentially; most of it is error recovery stuff and
+    backtracking.
+    """
+
+    MEMO_RULE_FAILED = -2
+    MEMO_RULE_UNKNOWN = -1
+
+    # copies from Token object for convenience in actions
+    DEFAULT_TOKEN_CHANNEL = DEFAULT_CHANNEL
+
+    # for convenience in actions
+    HIDDEN = HIDDEN_CHANNEL
+
+    # overridden by generated subclasses
+    tokenNames = None
+
+    # The api_version attribute has been introduced in 3.3. If it is not
+    # overwritten in the generated recognizer, we assume a default of v0.
+    api_version = 0
+
+    def __init__(self, state=None):
+        # Input stream of the recognizer. Must be initialized by a subclass.
+        self.input = None
+
+        ## State of a lexer, parser, or tree parser are collected into a state
+        # object so the state can be shared.  This sharing is needed to
+        # have one grammar import others and share same error variables
+        # and other state variables.  It's a kind of explicit multiple
+        # inheritance via delegation of methods and shared state.
+        if state is None:
+            state = RecognizerSharedState()
+        self._state = state
+
+        if self.api_version not in compatible_api_versions:
+            raise RuntimeError(
+                ("ANTLR version mismatch: "
+                 "The recognizer has been generated with API V%s, "
+                 "but this runtime does not support this.")
+                % self.api_version)
+
+    # this one only exists to shut up pylint :(
+    def setInput(self, input):
+        self.input = input
+
+
+    def reset(self):
+        """
+        reset the parser's state; subclasses must rewinds the input stream
+        """
+
+        # wack everything related to error recovery
+        if self._state is None:
+            # no shared state work to do
+            return
+
+        self._state.following = []
+        self._state.errorRecovery = False
+        self._state.lastErrorIndex = -1
+        self._state.syntaxErrors = 0
+        # wack everything related to backtracking and memoization
+        self._state.backtracking = 0
+        if self._state.ruleMemo is not None:
+            self._state.ruleMemo = {}
+
+
+    def match(self, input, ttype, follow):
+        """
+        Match current input symbol against ttype.  Attempt
+        single token insertion or deletion error recovery.  If
+        that fails, throw MismatchedTokenException.
+
+        To turn off single token insertion or deletion error
+        recovery, override recoverFromMismatchedToken() and have it
+        throw an exception. See TreeParser.recoverFromMismatchedToken().
+        This way any error in a rule will cause an exception and
+        immediate exit from rule.  Rule would recover by resynchronizing
+        to the set of symbols that can follow rule ref.
+        """
+
+        matchedSymbol = self.getCurrentInputSymbol(input)
+        if self.input.LA(1) == ttype:
+            self.input.consume()
+            self._state.errorRecovery = False
+            return matchedSymbol
+
+        if self._state.backtracking > 0:
+            # FIXME: need to return matchedSymbol here as well. damn!!
+            raise BacktrackingFailed
+
+        matchedSymbol = self.recoverFromMismatchedToken(input, ttype, follow)
+        return matchedSymbol
+
+
+    def matchAny(self, input):
+        """Match the wildcard: in a symbol"""
+
+        self._state.errorRecovery = False
+        self.input.consume()
+
+
+    def mismatchIsUnwantedToken(self, input, ttype):
+        return input.LA(2) == ttype
+
+
+    def mismatchIsMissingToken(self, input, follow):
+        if follow is None:
+            # we have no information about the follow; we can only consume
+            # a single token and hope for the best
+            return False
+
+        # compute what can follow this grammar element reference
+        if EOR_TOKEN_TYPE in follow:
+            viableTokensFollowingThisRule = self.computeContextSensitiveRuleFOLLOW()
+            follow = follow | viableTokensFollowingThisRule
+
+            if len(self._state.following) > 0:
+                # remove EOR if we're not the start symbol
+                follow = follow - set([EOR_TOKEN_TYPE])
+
+        # if current token is consistent with what could come after set
+        # then we know we're missing a token; error recovery is free to
+        # "insert" the missing token
+        if input.LA(1) in follow or EOR_TOKEN_TYPE in follow:
+            return True
+
+        return False
+
+
+    def reportError(self, e):
+        """Report a recognition problem.
+
+        This method sets errorRecovery to indicate the parser is recovering
+        not parsing.  Once in recovery mode, no errors are generated.
+        To get out of recovery mode, the parser must successfully match
+        a token (after a resync).  So it will go:
+
+        1. error occurs
+        2. enter recovery mode, report error
+        3. consume until token found in resynch set
+        4. try to resume parsing
+        5. next match() will reset errorRecovery mode
+
+        If you override, make sure to update syntaxErrors if you care about
+        that.
+
+        """
+
+        # if we've already reported an error and have not matched a token
+        # yet successfully, don't report any errors.
+        if self._state.errorRecovery:
+            return
+
+        self._state.syntaxErrors += 1 # don't count spurious
+        self._state.errorRecovery = True
+
+        self.displayRecognitionError(self.tokenNames, e)
+
+
+    def displayRecognitionError(self, tokenNames, e):
+        hdr = self.getErrorHeader(e)
+        msg = self.getErrorMessage(e, tokenNames)
+        self.emitErrorMessage(hdr+" "+msg)
+
+
+    def getErrorMessage(self, e, tokenNames):
+        """
+        What error message should be generated for the various
+        exception types?
+
+        Not very object-oriented code, but I like having all error message
+        generation within one method rather than spread among all of the
+        exception classes. This also makes it much easier for the exception
+        handling because the exception classes do not have to have pointers back
+        to this object to access utility routines and so on. Also, changing
+        the message for an exception type would be difficult because you
+        would have to subclassing exception, but then somehow get ANTLR
+        to make those kinds of exception objects instead of the default.
+        This looks weird, but trust me--it makes the most sense in terms
+        of flexibility.
+
+        For grammar debugging, you will want to override this to add
+        more information such as the stack frame with
+        getRuleInvocationStack(e, this.getClass().getName()) and,
+        for no viable alts, the decision description and state etc...
+
+        Override this to change the message generated for one or more
+        exception types.
+        """
+
+        if isinstance(e, UnwantedTokenException):
+            tokenName = "<unknown>"
+            if e.expecting == EOF:
+                tokenName = "EOF"
+
+            else:
+                tokenName = self.tokenNames[e.expecting]
+
+            msg = "extraneous input %s expecting %s" % (
+                self.getTokenErrorDisplay(e.getUnexpectedToken()),
+                tokenName
+                )
+
+        elif isinstance(e, MissingTokenException):
+            tokenName = "<unknown>"
+            if e.expecting == EOF:
+                tokenName = "EOF"
+
+            else:
+                tokenName = self.tokenNames[e.expecting]
+
+            msg = "missing %s at %s" % (
+                tokenName, self.getTokenErrorDisplay(e.token)
+                )
+
+        elif isinstance(e, MismatchedTokenException):
+            tokenName = "<unknown>"
+            if e.expecting == EOF:
+                tokenName = "EOF"
+            else:
+                tokenName = self.tokenNames[e.expecting]
+
+            msg = "mismatched input " \
+                  + self.getTokenErrorDisplay(e.token) \
+                  + " expecting " \
+                  + tokenName
+
+        elif isinstance(e, MismatchedTreeNodeException):
+            tokenName = "<unknown>"
+            if e.expecting == EOF:
+                tokenName = "EOF"
+            else:
+                tokenName = self.tokenNames[e.expecting]
+
+            msg = "mismatched tree node: %s expecting %s" \
+                  % (e.node, tokenName)
+
+        elif isinstance(e, NoViableAltException):
+            msg = "no viable alternative at input " \
+                  + self.getTokenErrorDisplay(e.token)
+
+        elif isinstance(e, EarlyExitException):
+            msg = "required (...)+ loop did not match anything at input " \
+                  + self.getTokenErrorDisplay(e.token)
+
+        elif isinstance(e, MismatchedSetException):
+            msg = "mismatched input " \
+                  + self.getTokenErrorDisplay(e.token) \
+                  + " expecting set " \
+                  + repr(e.expecting)
+
+        elif isinstance(e, MismatchedNotSetException):
+            msg = "mismatched input " \
+                  + self.getTokenErrorDisplay(e.token) \
+                  + " expecting set " \
+                  + repr(e.expecting)
+
+        elif isinstance(e, FailedPredicateException):
+            msg = "rule " \
+                  + e.ruleName \
+                  + " failed predicate: {" \
+                  + e.predicateText \
+                  + "}?"
+
+        else:
+            msg = str(e)
+
+        return msg
+
+
+    def getNumberOfSyntaxErrors(self):
+        """
+        Get number of recognition errors (lexer, parser, tree parser).  Each
+        recognizer tracks its own number.  So parser and lexer each have
+        separate count.  Does not count the spurious errors found between
+        an error and next valid token match
+
+        See also reportError()
+	"""
+        return self._state.syntaxErrors
+
+
+    def getErrorHeader(self, e):
+        """
+        What is the error header, normally line/character position information?
+        """
+
+        source_name = self.getSourceName()
+        if source_name is not None:
+            return "%s line %d:%d" % (source_name, e.line, e.charPositionInLine)
+        return "line %d:%d" % (e.line, e.charPositionInLine)
+
+
+    def getTokenErrorDisplay(self, t):
+        """
+        How should a token be displayed in an error message? The default
+        is to display just the text, but during development you might
+        want to have a lot of information spit out.  Override in that case
+        to use t.toString() (which, for CommonToken, dumps everything about
+        the token). This is better than forcing you to override a method in
+        your token objects because you don't have to go modify your lexer
+        so that it creates a new Java type.
+        """
+
+        s = t.text
+        if s is None:
+            if t.type == EOF:
+                s = "<EOF>"
+            else:
+                s = "<"+t.type+">"
+
+        return repr(s)
+
+
+    def emitErrorMessage(self, msg):
+        """Override this method to change where error messages go"""
+        sys.stderr.write(msg + '\n')
+
+
+    def recover(self, input, re):
+        """
+        Recover from an error found on the input stream.  This is
+        for NoViableAlt and mismatched symbol exceptions.  If you enable
+        single token insertion and deletion, this will usually not
+        handle mismatched symbol exceptions but there could be a mismatched
+        token that the match() routine could not recover from.
+        """
+
+        # PROBLEM? what if input stream is not the same as last time
+        # perhaps make lastErrorIndex a member of input
+        if self._state.lastErrorIndex == input.index():
+            # uh oh, another error at same token index; must be a case
+            # where LT(1) is in the recovery token set so nothing is
+            # consumed; consume a single token so at least to prevent
+            # an infinite loop; this is a failsafe.
+            input.consume()
+
+        self._state.lastErrorIndex = input.index()
+        followSet = self.computeErrorRecoverySet()
+
+        self.beginResync()
+        self.consumeUntil(input, followSet)
+        self.endResync()
+
+
+    def beginResync(self):
+        """
+        A hook to listen in on the token consumption during error recovery.
+        The DebugParser subclasses this to fire events to the listenter.
+        """
+
+        pass
+
+
+    def endResync(self):
+        """
+        A hook to listen in on the token consumption during error recovery.
+        The DebugParser subclasses this to fire events to the listenter.
+        """
+
+        pass
+
+
+    def computeErrorRecoverySet(self):
+        """
+        Compute the error recovery set for the current rule.  During
+        rule invocation, the parser pushes the set of tokens that can
+        follow that rule reference on the stack; this amounts to
+        computing FIRST of what follows the rule reference in the
+        enclosing rule. This local follow set only includes tokens
+        from within the rule; i.e., the FIRST computation done by
+        ANTLR stops at the end of a rule.
+
+        EXAMPLE
+
+        When you find a "no viable alt exception", the input is not
+        consistent with any of the alternatives for rule r.  The best
+        thing to do is to consume tokens until you see something that
+        can legally follow a call to r *or* any rule that called r.
+        You don't want the exact set of viable next tokens because the
+        input might just be missing a token--you might consume the
+        rest of the input looking for one of the missing tokens.
+
+        Consider grammar:
+
+        a : '[' b ']'
+          | '(' b ')'
+          ;
+        b : c '^' INT ;
+        c : ID
+          | INT
+          ;
+
+        At each rule invocation, the set of tokens that could follow
+        that rule is pushed on a stack.  Here are the various "local"
+        follow sets:
+
+        FOLLOW(b1_in_a) = FIRST(']') = ']'
+        FOLLOW(b2_in_a) = FIRST(')') = ')'
+        FOLLOW(c_in_b) = FIRST('^') = '^'
+
+        Upon erroneous input "[]", the call chain is
+
+        a -> b -> c
+
+        and, hence, the follow context stack is:
+
+        depth  local follow set     after call to rule
+          0         \<EOF>                    a (from main())
+          1          ']'                     b
+          3          '^'                     c
+
+        Notice that ')' is not included, because b would have to have
+        been called from a different context in rule a for ')' to be
+        included.
+
+        For error recovery, we cannot consider FOLLOW(c)
+        (context-sensitive or otherwise).  We need the combined set of
+        all context-sensitive FOLLOW sets--the set of all tokens that
+        could follow any reference in the call chain.  We need to
+        resync to one of those tokens.  Note that FOLLOW(c)='^' and if
+        we resync'd to that token, we'd consume until EOF.  We need to
+        sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
+        In this case, for input "[]", LA(1) is in this set so we would
+        not consume anything and after printing an error rule c would
+        return normally.  It would not find the required '^' though.
+        At this point, it gets a mismatched token error and throws an
+        exception (since LA(1) is not in the viable following token
+        set).  The rule exception handler tries to recover, but finds
+        the same recovery set and doesn't consume anything.  Rule b
+        exits normally returning to rule a.  Now it finds the ']' (and
+        with the successful match exits errorRecovery mode).
+
+        So, you cna see that the parser walks up call chain looking
+        for the token that was a member of the recovery set.
+
+        Errors are not generated in errorRecovery mode.
+
+        ANTLR's error recovery mechanism is based upon original ideas:
+
+        "Algorithms + Data Structures = Programs" by Niklaus Wirth
+
+        and
+
+        "A note on error recovery in recursive descent parsers":
+        http://portal.acm.org/citation.cfm?id=947902.947905
+
+        Later, Josef Grosch had some good ideas:
+
+        "Efficient and Comfortable Error Recovery in Recursive Descent
+        Parsers":
+        ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
+
+        Like Grosch I implemented local FOLLOW sets that are combined
+        at run-time upon error to avoid overhead during parsing.
+        """
+
+        return self.combineFollows(False)
+
+
+    def computeContextSensitiveRuleFOLLOW(self):
+        """
+        Compute the context-sensitive FOLLOW set for current rule.
+        This is set of token types that can follow a specific rule
+        reference given a specific call chain.  You get the set of
+        viable tokens that can possibly come next (lookahead depth 1)
+        given the current call chain.  Contrast this with the
+        definition of plain FOLLOW for rule r:
+
+         FOLLOW(r)={x | S=>*alpha r beta in G and x in FIRST(beta)}
+
+        where x in T* and alpha, beta in V*; T is set of terminals and
+        V is the set of terminals and nonterminals.  In other words,
+        FOLLOW(r) is the set of all tokens that can possibly follow
+        references to r in *any* sentential form (context).  At
+        runtime, however, we know precisely which context applies as
+        we have the call chain.  We may compute the exact (rather
+        than covering superset) set of following tokens.
+
+        For example, consider grammar:
+
+        stat : ID '=' expr ';'      // FOLLOW(stat)=={EOF}
+             | "return" expr '.'
+             ;
+        expr : atom ('+' atom)* ;   // FOLLOW(expr)=={';','.',')'}
+        atom : INT                  // FOLLOW(atom)=={'+',')',';','.'}
+             | '(' expr ')'
+             ;
+
+        The FOLLOW sets are all inclusive whereas context-sensitive
+        FOLLOW sets are precisely what could follow a rule reference.
+        For input input "i=(3);", here is the derivation:
+
+        stat => ID '=' expr ';'
+             => ID '=' atom ('+' atom)* ';'
+             => ID '=' '(' expr ')' ('+' atom)* ';'
+             => ID '=' '(' atom ')' ('+' atom)* ';'
+             => ID '=' '(' INT ')' ('+' atom)* ';'
+             => ID '=' '(' INT ')' ';'
+
+        At the "3" token, you'd have a call chain of
+
+          stat -> expr -> atom -> expr -> atom
+
+        What can follow that specific nested ref to atom?  Exactly ')'
+        as you can see by looking at the derivation of this specific
+        input.  Contrast this with the FOLLOW(atom)={'+',')',';','.'}.
+
+        You want the exact viable token set when recovering from a
+        token mismatch.  Upon token mismatch, if LA(1) is member of
+        the viable next token set, then you know there is most likely
+        a missing token in the input stream.  "Insert" one by just not
+        throwing an exception.
+        """
+
+        return self.combineFollows(True)
+
+
+    def combineFollows(self, exact):
+        followSet = set()
+        for idx, localFollowSet in reversed(list(enumerate(self._state.following))):
+            followSet |= localFollowSet
+            if exact:
+                # can we see end of rule?
+                if EOR_TOKEN_TYPE in localFollowSet:
+                    # Only leave EOR in set if at top (start rule); this lets
+                    # us know if have to include follow(start rule); i.e., EOF
+                    if idx > 0:
+                        followSet.remove(EOR_TOKEN_TYPE)
+
+                else:
+                    # can't see end of rule, quit
+                    break
+
+        return followSet
+
+
+    def recoverFromMismatchedToken(self, input, ttype, follow):
+        """Attempt to recover from a single missing or extra token.
+
+        EXTRA TOKEN
+
+        LA(1) is not what we are looking for.  If LA(2) has the right token,
+        however, then assume LA(1) is some extra spurious token.  Delete it
+        and LA(2) as if we were doing a normal match(), which advances the
+        input.
+
+        MISSING TOKEN
+
+        If current token is consistent with what could come after
+        ttype then it is ok to 'insert' the missing token, else throw
+        exception For example, Input 'i=(3;' is clearly missing the
+        ')'.  When the parser returns from the nested call to expr, it
+        will have call chain:
+
+          stat -> expr -> atom
+
+        and it will be trying to match the ')' at this point in the
+        derivation:
+
+             => ID '=' '(' INT ')' ('+' atom)* ';'
+                                ^
+        match() will see that ';' doesn't match ')' and report a
+        mismatched token error.  To recover, it sees that LA(1)==';'
+        is in the set of tokens that can follow the ')' token
+        reference in rule atom.  It can assume that you forgot the ')'.
+        """
+
+        e = None
+
+        # if next token is what we are looking for then "delete" this token
+        if self.mismatchIsUnwantedToken(input, ttype):
+            e = UnwantedTokenException(ttype, input)
+
+            self.beginResync()
+            input.consume() # simply delete extra token
+            self.endResync()
+
+            # report after consuming so AW sees the token in the exception
+            self.reportError(e)
+
+            # we want to return the token we're actually matching
+            matchedSymbol = self.getCurrentInputSymbol(input)
+
+            # move past ttype token as if all were ok
+            input.consume()
+            return matchedSymbol
+
+        # can't recover with single token deletion, try insertion
+        if self.mismatchIsMissingToken(input, follow):
+            inserted = self.getMissingSymbol(input, e, ttype, follow)
+            e = MissingTokenException(ttype, input, inserted)
+
+            # report after inserting so AW sees the token in the exception
+            self.reportError(e)
+            return inserted
+
+        # even that didn't work; must throw the exception
+        e = MismatchedTokenException(ttype, input)
+        raise e
+
+
+    def recoverFromMismatchedSet(self, input, e, follow):
+        """Not currently used"""
+
+        if self.mismatchIsMissingToken(input, follow):
+            self.reportError(e)
+            # we don't know how to conjure up a token for sets yet
+            return self.getMissingSymbol(input, e, INVALID_TOKEN_TYPE, follow)
+
+        # TODO do single token deletion like above for Token mismatch
+        raise e
+
+
+    def getCurrentInputSymbol(self, input):
+        """
+        Match needs to return the current input symbol, which gets put
+        into the label for the associated token ref; e.g., x=ID.  Token
+        and tree parsers need to return different objects. Rather than test
+        for input stream type or change the IntStream interface, I use
+        a simple method to ask the recognizer to tell me what the current
+        input symbol is.
+
+        This is ignored for lexers.
+        """
+
+        return None
+
+
+    def getMissingSymbol(self, input, e, expectedTokenType, follow):
+        """Conjure up a missing token during error recovery.
+
+        The recognizer attempts to recover from single missing
+        symbols. But, actions might refer to that missing symbol.
+        For example, x=ID {f($x);}. The action clearly assumes
+        that there has been an identifier matched previously and that
+        $x points at that token. If that token is missing, but
+        the next token in the stream is what we want we assume that
+        this token is missing and we keep going. Because we
+        have to return some token to replace the missing token,
+        we have to conjure one up. This method gives the user control
+        over the tokens returned for missing tokens. Mostly,
+        you will want to create something special for identifier
+        tokens. For literals such as '{' and ',', the default
+        action in the parser or tree parser works. It simply creates
+        a CommonToken of the appropriate type. The text will be the token.
+        If you change what tokens must be created by the lexer,
+        override this method to create the appropriate tokens.
+        """
+
+        return None
+
+
+##     def recoverFromMissingElement(self, input, e, follow):
+##         """
+##         This code is factored out from mismatched token and mismatched set
+##         recovery.  It handles "single token insertion" error recovery for
+##         both.  No tokens are consumed to recover from insertions.  Return
+##         true if recovery was possible else return false.
+##         """
+
+##         if self.mismatchIsMissingToken(input, follow):
+##             self.reportError(e)
+##             return True
+
+##         # nothing to do; throw exception
+##         return False
+
+
+    def consumeUntil(self, input, tokenTypes):
+        """
+        Consume tokens until one matches the given token or token set
+
+        tokenTypes can be a single token type or a set of token types
+
+        """
+
+        if not isinstance(tokenTypes, (set, frozenset)):
+            tokenTypes = frozenset([tokenTypes])
+
+        ttype = input.LA(1)
+        while ttype != EOF and ttype not in tokenTypes:
+            input.consume()
+            ttype = input.LA(1)
+
+
+    def getRuleInvocationStack(self):
+        """
+        Return List<String> of the rules in your parser instance
+        leading up to a call to this method.  You could override if
+        you want more details such as the file/line info of where
+        in the parser java code a rule is invoked.
+
+        This is very useful for error messages and for context-sensitive
+        error recovery.
+
+        You must be careful, if you subclass a generated recognizers.
+        The default implementation will only search the module of self
+        for rules, but the subclass will not contain any rules.
+        You probably want to override this method to look like
+
+        def getRuleInvocationStack(self):
+            return self._getRuleInvocationStack(<class>.__module__)
+
+        where <class> is the class of the generated recognizer, e.g.
+        the superclass of self.
+        """
+
+        return self._getRuleInvocationStack(self.__module__)
+
+
+    def _getRuleInvocationStack(cls, module):
+        """
+        A more general version of getRuleInvocationStack where you can
+        pass in, for example, a RecognitionException to get it's rule
+        stack trace.  This routine is shared with all recognizers, hence,
+        static.
+
+        TODO: move to a utility class or something; weird having lexer call
+        this
+        """
+
+        # mmmhhh,... perhaps look at the first argument
+        # (f_locals[co_varnames[0]]?) and test if it's a (sub)class of
+        # requested recognizer...
+
+        rules = []
+        for frame in reversed(inspect.stack()):
+            code = frame[0].f_code
+            codeMod = inspect.getmodule(code)
+            if codeMod is None:
+                continue
+
+            # skip frames not in requested module
+            if codeMod.__name__ != module:
+                continue
+
+            # skip some unwanted names
+            if code.co_name in ('nextToken', '<module>'):
+                continue
+
+            rules.append(code.co_name)
+
+        return rules
+
+    _getRuleInvocationStack = classmethod(_getRuleInvocationStack)
+
+
+    def getBacktrackingLevel(self):
+        return self._state.backtracking
+
+    def setBacktrackingLevel(self, n):
+        self._state.backtracking = n
+
+
+    def getGrammarFileName(self):
+        """For debugging and other purposes, might want the grammar name.
+
+        Have ANTLR generate an implementation for this method.
+        """
+
+        return self.grammarFileName
+
+
+    def getSourceName(self):
+        raise NotImplementedError
+
+
+    def toStrings(self, tokens):
+        """A convenience method for use most often with template rewrites.
+
+        Convert a List<Token> to List<String>
+        """
+
+        if tokens is None:
+            return None
+
+        return [token.text for token in tokens]
+
+
+    def getRuleMemoization(self, ruleIndex, ruleStartIndex):
+        """
+        Given a rule number and a start token index number, return
+        MEMO_RULE_UNKNOWN if the rule has not parsed input starting from
+        start index.  If this rule has parsed input starting from the
+        start index before, then return where the rule stopped parsing.
+        It returns the index of the last token matched by the rule.
+        """
+
+        if ruleIndex not in self._state.ruleMemo:
+            self._state.ruleMemo[ruleIndex] = {}
+
+        return self._state.ruleMemo[ruleIndex].get(
+            ruleStartIndex, self.MEMO_RULE_UNKNOWN
+            )
+
+
+    def alreadyParsedRule(self, input, ruleIndex):
+        """
+        Has this rule already parsed input at the current index in the
+        input stream?  Return the stop token index or MEMO_RULE_UNKNOWN.
+        If we attempted but failed to parse properly before, return
+        MEMO_RULE_FAILED.
+
+        This method has a side-effect: if we have seen this input for
+        this rule and successfully parsed before, then seek ahead to
+        1 past the stop token matched for this rule last time.
+        """
+
+        stopIndex = self.getRuleMemoization(ruleIndex, input.index())
+        if stopIndex == self.MEMO_RULE_UNKNOWN:
+            return False
+
+        if stopIndex == self.MEMO_RULE_FAILED:
+            raise BacktrackingFailed
+
+        else:
+            input.seek(stopIndex + 1)
+
+        return True
+
+
+    def memoize(self, input, ruleIndex, ruleStartIndex, success):
+        """
+        Record whether or not this rule parsed the input at this position
+        successfully.
+        """
+
+        if success:
+            stopTokenIndex = input.index() - 1
+        else:
+            stopTokenIndex = self.MEMO_RULE_FAILED
+
+        if ruleIndex in self._state.ruleMemo:
+            self._state.ruleMemo[ruleIndex][ruleStartIndex] = stopTokenIndex
+
+
+    def traceIn(self, ruleName, ruleIndex, inputSymbol):
+        sys.stdout.write("enter %s %s" % (ruleName, inputSymbol))
+
+        if self._state.backtracking > 0:
+            sys.stdout.write(" backtracking=%s" % self._state.backtracking)
+
+        sys.stdout.write('\n')
+
+
+    def traceOut(self, ruleName, ruleIndex, inputSymbol):
+        sys.stdout.write("exit %s %s" % (ruleName, inputSymbol))
+
+        if self._state.backtracking > 0:
+            sys.stdout.write(" backtracking=%s" % self._state.backtracking)
+
+        # mmmm... we use BacktrackingFailed exceptions now. So how could we
+        # get that information here?
+        #if self._state.failed:
+        #    sys.stdout.write(" failed")
+        #else:
+        #    sys.stdout.write(" succeeded")
+
+        sys.stdout.write('\n')
+
+
+class TokenSource(object):
+    """
+    @brief Abstract baseclass for token producers.
+
+    A source of tokens must provide a sequence of tokens via nextToken()
+    and also must reveal it's source of characters; CommonToken's text is
+    computed from a CharStream; it only store indices into the char stream.
+
+    Errors from the lexer are never passed to the parser.  Either you want
+    to keep going or you do not upon token recognition error.  If you do not
+    want to continue lexing then you do not want to continue parsing.  Just
+    throw an exception not under RecognitionException and Java will naturally
+    toss you all the way out of the recognizers.  If you want to continue
+    lexing then you should not throw an exception to the parser--it has already
+    requested a token.  Keep lexing until you get a valid one.  Just report
+    errors and keep going, looking for a valid token.
+    """
+
+    def nextToken(self):
+        """Return a Token object from your input stream (usually a CharStream).
+
+        Do not fail/return upon lexing error; keep chewing on the characters
+        until you get a good one; errors are not passed through to the parser.
+        """
+
+        raise NotImplementedError
+
+
+    def __iter__(self):
+        """The TokenSource is an interator.
+
+        The iteration will not include the final EOF token, see also the note
+        for the next() method.
+
+        """
+
+        return self
+
+
+    def next(self):
+        """Return next token or raise StopIteration.
+
+        Note that this will raise StopIteration when hitting the EOF token,
+        so EOF will not be part of the iteration.
+
+        """
+
+        token = self.nextToken()
+        if token is None or token.type == EOF:
+            raise StopIteration
+        return token
+
+
+class Lexer(BaseRecognizer, TokenSource):
+    """
+    @brief Baseclass for generated lexer classes.
+
+    A lexer is recognizer that draws input symbols from a character stream.
+    lexer grammars result in a subclass of this object. A Lexer object
+    uses simplified match() and error recovery mechanisms in the interest
+    of speed.
+    """
+
+    def __init__(self, input, state=None):
+        BaseRecognizer.__init__(self, state)
+        TokenSource.__init__(self)
+
+        # Where is the lexer drawing characters from?
+        self.input = input
+
+
+    def reset(self):
+        BaseRecognizer.reset(self) # reset all recognizer state variables
+
+        if self.input is not None:
+            # rewind the input
+            self.input.seek(0)
+
+        if self._state is None:
+            # no shared state work to do
+            return
+
+        # wack Lexer state variables
+        self._state.token = None
+        self._state.type = INVALID_TOKEN_TYPE
+        self._state.channel = DEFAULT_CHANNEL
+        self._state.tokenStartCharIndex = -1
+        self._state.tokenStartLine = -1
+        self._state.tokenStartCharPositionInLine = -1
+        self._state.text = None
+
+
+    def makeEOFToken(self):
+        eof = CommonToken(
+            type=EOF, channel=DEFAULT_CHANNEL,
+            input=self.input,
+            start=self.input.index(), stop=self.input.index())
+        eof.line = self.input.line
+        eof.charPositionInLine = self.input.charPositionInLine
+        return eof
+
+    def nextToken(self):
+        """
+        Return a token from this source; i.e., match a token on the char
+        stream.
+        """
+
+        while 1:
+            self._state.token = None
+            self._state.channel = DEFAULT_CHANNEL
+            self._state.tokenStartCharIndex = self.input.index()
+            self._state.tokenStartCharPositionInLine = self.input.charPositionInLine
+            self._state.tokenStartLine = self.input.line
+            self._state.text = None
+            if self.input.LA(1) == EOF:
+                return self.makeEOFToken()
+
+            try:
+                self.mTokens()
+
+                if self._state.token is None:
+                    self.emit()
+
+                elif self._state.token == SKIP_TOKEN:
+                    continue
+
+                return self._state.token
+
+            except NoViableAltException, re:
+                self.reportError(re)
+                self.recover(re) # throw out current char and try again
+
+            except RecognitionException, re:
+                self.reportError(re)
+                # match() routine has already called recover()
+
+
+    def skip(self):
+        """
+        Instruct the lexer to skip creating a token for current lexer rule
+        and look for another token.  nextToken() knows to keep looking when
+        a lexer rule finishes with token set to SKIP_TOKEN.  Recall that
+        if token==null at end of any token rule, it creates one for you
+        and emits it.
+        """
+
+        self._state.token = SKIP_TOKEN
+
+
+    def mTokens(self):
+        """This is the lexer entry point that sets instance var 'token'"""
+
+        # abstract method
+        raise NotImplementedError
+
+
+    def setCharStream(self, input):
+        """Set the char stream and reset the lexer"""
+        self.input = None
+        self.reset()
+        self.input = input
+
+
+    def getSourceName(self):
+        return self.input.getSourceName()
+
+
+    def emit(self, token=None):
+        """
+        The standard method called to automatically emit a token at the
+        outermost lexical rule.  The token object should point into the
+        char buffer start..stop.  If there is a text override in 'text',
+        use that to set the token's text.  Override this method to emit
+        custom Token objects.
+
+        If you are building trees, then you should also override
+        Parser or TreeParser.getMissingSymbol().
+        """
+
+        if token is None:
+            token = CommonToken(
+                input=self.input,
+                type=self._state.type,
+                channel=self._state.channel,
+                start=self._state.tokenStartCharIndex,
+                stop=self.getCharIndex()-1
+                )
+            token.line = self._state.tokenStartLine
+            token.text = self._state.text
+            token.charPositionInLine = self._state.tokenStartCharPositionInLine
+
+        self._state.token = token
+
+        return token
+
+
+    def match(self, s):
+        if isinstance(s, basestring):
+            for c in s:
+                if self.input.LA(1) != ord(c):
+                    if self._state.backtracking > 0:
+                        raise BacktrackingFailed
+
+                    mte = MismatchedTokenException(c, self.input)
+                    self.recover(mte)
+                    raise mte
+
+                self.input.consume()
+
+        else:
+            if self.input.LA(1) != s:
+                if self._state.backtracking > 0:
+                    raise BacktrackingFailed
+
+                mte = MismatchedTokenException(unichr(s), self.input)
+                self.recover(mte) # don't really recover; just consume in lexer
+                raise mte
+
+            self.input.consume()
+
+
+    def matchAny(self):
+        self.input.consume()
+
+
+    def matchRange(self, a, b):
+        if self.input.LA(1) < a or self.input.LA(1) > b:
+            if self._state.backtracking > 0:
+                raise BacktrackingFailed
+
+            mre = MismatchedRangeException(unichr(a), unichr(b), self.input)
+            self.recover(mre)
+            raise mre
+
+        self.input.consume()
+
+
+    def getLine(self):
+        return self.input.line
+
+
+    def getCharPositionInLine(self):
+        return self.input.charPositionInLine
+
+
+    def getCharIndex(self):
+        """What is the index of the current character of lookahead?"""
+
+        return self.input.index()
+
+
+    def getText(self):
+        """
+        Return the text matched so far for the current token or any
+        text override.
+        """
+        if self._state.text is not None:
+            return self._state.text
+
+        return self.input.substring(
+            self._state.tokenStartCharIndex,
+            self.getCharIndex()-1
+            )
+
+
+    def setText(self, text):
+        """
+        Set the complete text of this token; it wipes any previous
+        changes to the text.
+        """
+        self._state.text = text
+
+
+    text = property(getText, setText)
+
+
+    def reportError(self, e):
+        ## TODO: not thought about recovery in lexer yet.
+
+        ## # if we've already reported an error and have not matched a token
+        ## # yet successfully, don't report any errors.
+        ## if self.errorRecovery:
+        ##     #System.err.print("[SPURIOUS] ");
+        ##     return;
+        ##
+        ## self.errorRecovery = True
+
+        self.displayRecognitionError(self.tokenNames, e)
+
+
+    def getErrorMessage(self, e, tokenNames):
+        msg = None
+
+        if isinstance(e, MismatchedTokenException):
+            msg = "mismatched character " \
+                  + self.getCharErrorDisplay(e.c) \
+                  + " expecting " \
+                  + self.getCharErrorDisplay(e.expecting)
+
+        elif isinstance(e, NoViableAltException):
+            msg = "no viable alternative at character " \
+                  + self.getCharErrorDisplay(e.c)
+
+        elif isinstance(e, EarlyExitException):
+            msg = "required (...)+ loop did not match anything at character " \
+                  + self.getCharErrorDisplay(e.c)
+
+        elif isinstance(e, MismatchedNotSetException):
+            msg = "mismatched character " \
+                  + self.getCharErrorDisplay(e.c) \
+                  + " expecting set " \
+                  + repr(e.expecting)
+
+        elif isinstance(e, MismatchedSetException):
+            msg = "mismatched character " \
+                  + self.getCharErrorDisplay(e.c) \
+                  + " expecting set " \
+                  + repr(e.expecting)
+
+        elif isinstance(e, MismatchedRangeException):
+            msg = "mismatched character " \
+                  + self.getCharErrorDisplay(e.c) \
+                  + " expecting set " \
+                  + self.getCharErrorDisplay(e.a) \
+                  + ".." \
+                  + self.getCharErrorDisplay(e.b)
+
+        else:
+            msg = BaseRecognizer.getErrorMessage(self, e, tokenNames)
+
+        return msg
+
+
+    def getCharErrorDisplay(self, c):
+        if c == EOF:
+            c = '<EOF>'
+        return repr(c)
+
+
+    def recover(self, re):
+        """
+        Lexers can normally match any char in it's vocabulary after matching
+        a token, so do the easy thing and just kill a character and hope
+        it all works out.  You can instead use the rule invocation stack
+        to do sophisticated error recovery if you are in a fragment rule.
+        """
+
+        self.input.consume()
+
+
+    def traceIn(self, ruleName, ruleIndex):
+        inputSymbol = "%s line=%d:%s" % (self.input.LT(1),
+                                         self.getLine(),
+                                         self.getCharPositionInLine()
+                                         )
+
+        BaseRecognizer.traceIn(self, ruleName, ruleIndex, inputSymbol)
+
+
+    def traceOut(self, ruleName, ruleIndex):
+        inputSymbol = "%s line=%d:%s" % (self.input.LT(1),
+                                         self.getLine(),
+                                         self.getCharPositionInLine()
+                                         )
+
+        BaseRecognizer.traceOut(self, ruleName, ruleIndex, inputSymbol)
+
+
+
+class Parser(BaseRecognizer):
+    """
+    @brief Baseclass for generated parser classes.
+    """
+
+    def __init__(self, lexer, state=None):
+        BaseRecognizer.__init__(self, state)
+
+        self.input = lexer
+
+
+    def reset(self):
+        BaseRecognizer.reset(self) # reset all recognizer state variables
+        if self.input is not None:
+            self.input.seek(0) # rewind the input
+
+
+    def getCurrentInputSymbol(self, input):
+        return input.LT(1)
+
+
+    def getMissingSymbol(self, input, e, expectedTokenType, follow):
+        if expectedTokenType == EOF:
+            tokenText = "<missing EOF>"
+        else:
+            tokenText = "<missing " + self.tokenNames[expectedTokenType] + ">"
+        t = CommonToken(type=expectedTokenType, text=tokenText)
+        current = input.LT(1)
+        if current.type == EOF:
+            current = input.LT(-1)
+
+        if current is not None:
+            t.line = current.line
+            t.charPositionInLine = current.charPositionInLine
+        t.channel = DEFAULT_CHANNEL
+        return t
+
+
+    def setTokenStream(self, input):
+        """Set the token stream and reset the parser"""
+
+        self.input = None
+        self.reset()
+        self.input = input
+
+
+    def getTokenStream(self):
+        return self.input
+
+
+    def getSourceName(self):
+        return self.input.getSourceName()
+
+
+    def traceIn(self, ruleName, ruleIndex):
+        BaseRecognizer.traceIn(self, ruleName, ruleIndex, self.input.LT(1))
+
+
+    def traceOut(self, ruleName, ruleIndex):
+        BaseRecognizer.traceOut(self, ruleName, ruleIndex, self.input.LT(1))
+
+
+class RuleReturnScope(object):
+    """
+    Rules can return start/stop info as well as possible trees and templates.
+    """
+
+    def getStart(self):
+        """Return the start token or tree."""
+        return None
+
+
+    def getStop(self):
+        """Return the stop token or tree."""
+        return None
+
+
+    def getTree(self):
+        """Has a value potentially if output=AST."""
+        return None
+
+
+    def getTemplate(self):
+        """Has a value potentially if output=template."""
+        return None
+
+
+class ParserRuleReturnScope(RuleReturnScope):
+    """
+    Rules that return more than a single value must return an object
+    containing all the values.  Besides the properties defined in
+    RuleLabelScope.predefinedRulePropertiesScope there may be user-defined
+    return values.  This class simply defines the minimum properties that
+    are always defined and methods to access the others that might be
+    available depending on output option such as template and tree.
+
+    Note text is not an actual property of the return value, it is computed
+    from start and stop using the input stream's toString() method.  I
+    could add a ctor to this so that we can pass in and store the input
+    stream, but I'm not sure we want to do that.  It would seem to be undefined
+    to get the .text property anyway if the rule matches tokens from multiple
+    input streams.
+
+    I do not use getters for fields of objects that are used simply to
+    group values such as this aggregate.  The getters/setters are there to
+    satisfy the superclass interface.
+    """
+
+    def __init__(self):
+        self.start = None
+        self.stop = None
+        self.tree = None  # only used when output=AST
+
+
+    def getStart(self):
+        return self.start
+
+
+    def getStop(self):
+        return self.stop
+
+
+    def getTree(self):
+        return self.tree
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/streams.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/streams.py
new file mode 100644
index 0000000000000000000000000000000000000000..1e0f4e515db676b57824733a277d6479a7bd218c
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/streams.py
@@ -0,0 +1,1522 @@
+"""ANTLR3 runtime package"""
+
+# begin[licence]
+#
+# [The "BSD licence"]
+# Copyright (c) 2005-2008 Terence Parr
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# end[licence]
+
+import codecs
+from StringIO import StringIO
+
+from antlr3.constants import DEFAULT_CHANNEL, EOF
+from antlr3.tokens import Token, CommonToken
+
+
+############################################################################
+#
+# basic interfaces
+#   IntStream
+#    +- CharStream
+#    \- TokenStream
+#
+# subclasses must implemented all methods
+#
+############################################################################
+
+class IntStream(object):
+    """
+    @brief Base interface for streams of integer values.
+
+    A simple stream of integers used when all I care about is the char
+    or token type sequence (such as interpretation).
+    """
+
+    def consume(self):
+        raise NotImplementedError
+
+
+    def LA(self, i):
+        """Get int at current input pointer + i ahead where i=1 is next int.
+
+        Negative indexes are allowed.  LA(-1) is previous token (token
+	just matched).  LA(-i) where i is before first token should
+	yield -1, invalid char / EOF.
+	"""
+
+        raise NotImplementedError
+
+
+    def mark(self):
+        """
+        Tell the stream to start buffering if it hasn't already.  Return
+        current input position, index(), or some other marker so that
+        when passed to rewind() you get back to the same spot.
+        rewind(mark()) should not affect the input cursor.  The Lexer
+        track line/col info as well as input index so its markers are
+        not pure input indexes.  Same for tree node streams.
+        """
+
+        raise NotImplementedError
+
+
+    def index(self):
+        """
+        Return the current input symbol index 0..n where n indicates the
+        last symbol has been read.  The index is the symbol about to be
+        read not the most recently read symbol.
+        """
+
+        raise NotImplementedError
+
+
+    def rewind(self, marker=None):
+        """
+        Reset the stream so that next call to index would return marker.
+        The marker will usually be index() but it doesn't have to be.  It's
+        just a marker to indicate what state the stream was in.  This is
+        essentially calling release() and seek().  If there are markers
+        created after this marker argument, this routine must unroll them
+        like a stack.  Assume the state the stream was in when this marker
+        was created.
+
+        If marker is None:
+        Rewind to the input position of the last marker.
+        Used currently only after a cyclic DFA and just
+        before starting a sem/syn predicate to get the
+        input position back to the start of the decision.
+        Do not "pop" the marker off the state.  mark(i)
+        and rewind(i) should balance still. It is
+        like invoking rewind(last marker) but it should not "pop"
+        the marker off.  It's like seek(last marker's input position).
+	"""
+
+        raise NotImplementedError
+
+
+    def release(self, marker=None):
+        """
+        You may want to commit to a backtrack but don't want to force the
+        stream to keep bookkeeping objects around for a marker that is
+        no longer necessary.  This will have the same behavior as
+        rewind() except it releases resources without the backward seek.
+        This must throw away resources for all markers back to the marker
+        argument.  So if you're nested 5 levels of mark(), and then release(2)
+        you have to release resources for depths 2..5.
+	"""
+
+        raise NotImplementedError
+
+
+    def seek(self, index):
+        """
+        Set the input cursor to the position indicated by index.  This is
+        normally used to seek ahead in the input stream.  No buffering is
+        required to do this unless you know your stream will use seek to
+        move backwards such as when backtracking.
+
+        This is different from rewind in its multi-directional
+        requirement and in that its argument is strictly an input cursor
+        (index).
+
+        For char streams, seeking forward must update the stream state such
+        as line number.  For seeking backwards, you will be presumably
+        backtracking using the mark/rewind mechanism that restores state and
+        so this method does not need to update state when seeking backwards.
+
+        Currently, this method is only used for efficient backtracking using
+        memoization, but in the future it may be used for incremental parsing.
+
+        The index is 0..n-1.  A seek to position i means that LA(1) will
+        return the ith symbol.  So, seeking to 0 means LA(1) will return the
+        first element in the stream.
+        """
+
+        raise NotImplementedError
+
+
+    def size(self):
+        """
+        Only makes sense for streams that buffer everything up probably, but
+        might be useful to display the entire stream or for testing.  This
+        value includes a single EOF.
+	"""
+
+        raise NotImplementedError
+
+
+    def getSourceName(self):
+        """
+        Where are you getting symbols from?  Normally, implementations will
+        pass the buck all the way to the lexer who can ask its input stream
+        for the file name or whatever.
+        """
+
+        raise NotImplementedError
+
+
+class CharStream(IntStream):
+    """
+    @brief A source of characters for an ANTLR lexer.
+
+    This is an abstract class that must be implemented by a subclass.
+
+    """
+
+    # pylint does not realize that this is an interface, too
+    #pylint: disable-msg=W0223
+
+    EOF = -1
+
+
+    def substring(self, start, stop):
+        """
+        For infinite streams, you don't need this; primarily I'm providing
+        a useful interface for action code.  Just make sure actions don't
+        use this on streams that don't support it.
+        """
+
+        raise NotImplementedError
+
+
+    def LT(self, i):
+        """
+        Get the ith character of lookahead.  This is the same usually as
+        LA(i).  This will be used for labels in the generated
+        lexer code.  I'd prefer to return a char here type-wise, but it's
+        probably better to be 32-bit clean and be consistent with LA.
+        """
+
+        raise NotImplementedError
+
+
+    def getLine(self):
+        """ANTLR tracks the line information automatically"""
+
+        raise NotImplementedError
+
+
+    def setLine(self, line):
+        """
+        Because this stream can rewind, we need to be able to reset the line
+        """
+
+        raise NotImplementedError
+
+
+    def getCharPositionInLine(self):
+        """
+        The index of the character relative to the beginning of the line 0..n-1
+        """
+
+        raise NotImplementedError
+
+
+    def setCharPositionInLine(self, pos):
+        raise NotImplementedError
+
+
+class TokenStream(IntStream):
+    """
+
+    @brief A stream of tokens accessing tokens from a TokenSource
+
+    This is an abstract class that must be implemented by a subclass.
+
+    """
+
+    # pylint does not realize that this is an interface, too
+    #pylint: disable-msg=W0223
+
+    def LT(self, k):
+        """
+        Get Token at current input pointer + i ahead where i=1 is next Token.
+        i<0 indicates tokens in the past.  So -1 is previous token and -2 is
+        two tokens ago. LT(0) is undefined.  For i>=n, return Token.EOFToken.
+        Return null for LT(0) and any index that results in an absolute address
+        that is negative.
+	"""
+
+        raise NotImplementedError
+
+
+    def range(self):
+        """
+        How far ahead has the stream been asked to look?  The return
+        value is a valid index from 0..n-1.
+        """
+
+        raise NotImplementedError
+
+
+    def get(self, i):
+        """
+        Get a token at an absolute index i; 0..n-1.  This is really only
+        needed for profiling and debugging and token stream rewriting.
+        If you don't want to buffer up tokens, then this method makes no
+        sense for you.  Naturally you can't use the rewrite stream feature.
+        I believe DebugTokenStream can easily be altered to not use
+        this method, removing the dependency.
+        """
+
+        raise NotImplementedError
+
+
+    def getTokenSource(self):
+        """
+        Where is this stream pulling tokens from?  This is not the name, but
+        the object that provides Token objects.
+	"""
+
+        raise NotImplementedError
+
+
+    def toString(self, start=None, stop=None):
+        """
+        Return the text of all tokens from start to stop, inclusive.
+        If the stream does not buffer all the tokens then it can just
+        return "" or null;  Users should not access $ruleLabel.text in
+        an action of course in that case.
+
+        Because the user is not required to use a token with an index stored
+        in it, we must provide a means for two token objects themselves to
+        indicate the start/end location.  Most often this will just delegate
+        to the other toString(int,int).  This is also parallel with
+        the TreeNodeStream.toString(Object,Object).
+	"""
+
+        raise NotImplementedError
+
+
+############################################################################
+#
+# character streams for use in lexers
+#   CharStream
+#   \- ANTLRStringStream
+#
+############################################################################
+
+
+class ANTLRStringStream(CharStream):
+    """
+    @brief CharStream that pull data from a unicode string.
+
+    A pretty quick CharStream that pulls all data from an array
+    directly.  Every method call counts in the lexer.
+
+    """
+
+
+    def __init__(self, data):
+        """
+        @param data This should be a unicode string holding the data you want
+           to parse. If you pass in a byte string, the Lexer will choke on
+           non-ascii data.
+
+        """
+
+        CharStream.__init__(self)
+
+  	# The data being scanned
+        self.strdata = unicode(data)
+        self.data = [ord(c) for c in self.strdata]
+
+	# How many characters are actually in the buffer
+        self.n = len(data)
+
+ 	# 0..n-1 index into string of next char
+        self.p = 0
+
+	# line number 1..n within the input
+        self.line = 1
+
+ 	# The index of the character relative to the beginning of the
+        # line 0..n-1
+        self.charPositionInLine = 0
+
+	# A list of CharStreamState objects that tracks the stream state
+        # values line, charPositionInLine, and p that can change as you
+        # move through the input stream.  Indexed from 0..markDepth-1.
+        self._markers = [ ]
+        self.lastMarker = None
+        self.markDepth = 0
+
+        # What is name or source of this char stream?
+        self.name = None
+
+
+    def reset(self):
+        """
+        Reset the stream so that it's in the same state it was
+        when the object was created *except* the data array is not
+        touched.
+        """
+
+        self.p = 0
+        self.line = 1
+        self.charPositionInLine = 0
+        self._markers = [ ]
+
+
+    def consume(self):
+        try:
+            if self.data[self.p] == 10: # \n
+                self.line += 1
+                self.charPositionInLine = 0
+            else:
+                self.charPositionInLine += 1
+
+            self.p += 1
+
+        except IndexError:
+            # happend when we reached EOF and self.data[self.p] fails
+            # just do nothing
+            pass
+
+
+
+    def LA(self, i):
+        if i == 0:
+            return 0 # undefined
+
+        if i < 0:
+            i += 1 # e.g., translate LA(-1) to use offset i=0; then data[p+0-1]
+
+        try:
+            return self.data[self.p+i-1]
+        except IndexError:
+            return EOF
+
+
+
+    def LT(self, i):
+        if i == 0:
+            return 0 # undefined
+
+        if i < 0:
+            i += 1 # e.g., translate LA(-1) to use offset i=0; then data[p+0-1]
+
+        try:
+            return self.strdata[self.p+i-1]
+        except IndexError:
+            return EOF
+
+
+    def index(self):
+        """
+        Return the current input symbol index 0..n where n indicates the
+        last symbol has been read.  The index is the index of char to
+        be returned from LA(1).
+        """
+
+        return self.p
+
+
+    def size(self):
+        return self.n
+
+
+    def mark(self):
+        state = (self.p, self.line, self.charPositionInLine)
+        try:
+            self._markers[self.markDepth] = state
+        except IndexError:
+            self._markers.append(state)
+        self.markDepth += 1
+
+        self.lastMarker = self.markDepth
+
+        return self.lastMarker
+
+
+    def rewind(self, marker=None):
+        if marker is None:
+            marker = self.lastMarker
+
+        p, line, charPositionInLine = self._markers[marker-1]
+
+        self.seek(p)
+        self.line = line
+        self.charPositionInLine = charPositionInLine
+        self.release(marker)
+
+
+    def release(self, marker=None):
+        if marker is None:
+            marker = self.lastMarker
+
+        self.markDepth = marker-1
+
+
+    def seek(self, index):
+        """
+        consume() ahead until p==index; can't just set p=index as we must
+        update line and charPositionInLine.
+        """
+
+        if index <= self.p:
+            self.p = index # just jump; don't update stream state (line, ...)
+            return
+
+        # seek forward, consume until p hits index
+        while self.p < index:
+            self.consume()
+
+
+    def substring(self, start, stop):
+        return self.strdata[start:stop+1]
+
+
+    def getLine(self):
+        """Using setter/getter methods is deprecated. Use o.line instead."""
+        return self.line
+
+
+    def getCharPositionInLine(self):
+        """
+        Using setter/getter methods is deprecated. Use o.charPositionInLine
+        instead.
+        """
+        return self.charPositionInLine
+
+
+    def setLine(self, line):
+        """Using setter/getter methods is deprecated. Use o.line instead."""
+        self.line = line
+
+
+    def setCharPositionInLine(self, pos):
+        """
+        Using setter/getter methods is deprecated. Use o.charPositionInLine
+        instead.
+        """
+        self.charPositionInLine = pos
+
+
+    def getSourceName(self):
+        return self.name
+
+
+class ANTLRFileStream(ANTLRStringStream):
+    """
+    @brief CharStream that opens a file to read the data.
+
+    This is a char buffer stream that is loaded from a file
+    all at once when you construct the object.
+    """
+
+    def __init__(self, fileName, encoding=None):
+        """
+        @param fileName The path to the file to be opened. The file will be
+           opened with mode 'rb'.
+
+        @param encoding If you set the optional encoding argument, then the
+           data will be decoded on the fly.
+
+        """
+
+        self.fileName = fileName
+
+        fp = codecs.open(fileName, 'rb', encoding)
+        try:
+            data = fp.read()
+        finally:
+            fp.close()
+
+        ANTLRStringStream.__init__(self, data)
+
+
+    def getSourceName(self):
+        """Deprecated, access o.fileName directly."""
+
+        return self.fileName
+
+
+class ANTLRInputStream(ANTLRStringStream):
+    """
+    @brief CharStream that reads data from a file-like object.
+
+    This is a char buffer stream that is loaded from a file like object
+    all at once when you construct the object.
+
+    All input is consumed from the file, but it is not closed.
+    """
+
+    def __init__(self, file, encoding=None):
+        """
+        @param file A file-like object holding your input. Only the read()
+           method must be implemented.
+
+        @param encoding If you set the optional encoding argument, then the
+           data will be decoded on the fly.
+
+        """
+
+        if encoding is not None:
+            # wrap input in a decoding reader
+            reader = codecs.lookup(encoding)[2]
+            file = reader(file)
+
+        data = file.read()
+
+        ANTLRStringStream.__init__(self, data)
+
+
+# I guess the ANTLR prefix exists only to avoid a name clash with some Java
+# mumbojumbo. A plain "StringStream" looks better to me, which should be
+# the preferred name in Python.
+StringStream = ANTLRStringStream
+FileStream = ANTLRFileStream
+InputStream = ANTLRInputStream
+
+
+############################################################################
+#
+# Token streams
+#   TokenStream
+#   +- CommonTokenStream
+#   \- TokenRewriteStream
+#
+############################################################################
+
+
+class CommonTokenStream(TokenStream):
+    """
+    @brief The most common stream of tokens
+
+    The most common stream of tokens is one where every token is buffered up
+    and tokens are prefiltered for a certain channel (the parser will only
+    see these tokens and cannot change the filter channel number during the
+    parse).
+    """
+
+    def __init__(self, tokenSource=None, channel=DEFAULT_CHANNEL):
+        """
+        @param tokenSource A TokenSource instance (usually a Lexer) to pull
+            the tokens from.
+
+        @param channel Skip tokens on any channel but this one; this is how we
+            skip whitespace...
+
+        """
+
+        TokenStream.__init__(self)
+
+        self.tokenSource = tokenSource
+
+	# Record every single token pulled from the source so we can reproduce
+        # chunks of it later.
+        self.tokens = []
+
+	# Map<tokentype, channel> to override some Tokens' channel numbers
+        self.channelOverrideMap = {}
+
+	# Set<tokentype>; discard any tokens with this type
+        self.discardSet = set()
+
+	# Skip tokens on any channel but this one; this is how we skip
+        # whitespace...
+        self.channel = channel
+
+	# By default, track all incoming tokens
+        self.discardOffChannelTokens = False
+
+	# The index into the tokens list of the current token (next token
+        # to consume).  p==-1 indicates that the tokens list is empty
+        self.p = -1
+
+        # Remember last marked position
+        self.lastMarker = None
+
+        # how deep have we gone?
+        self._range = -1
+
+
+    def makeEOFToken(self):
+        return self.tokenSource.makeEOFToken()
+
+
+    def setTokenSource(self, tokenSource):
+        """Reset this token stream by setting its token source."""
+
+        self.tokenSource = tokenSource
+        self.tokens = []
+        self.p = -1
+        self.channel = DEFAULT_CHANNEL
+
+
+    def reset(self):
+        self.p = 0
+        self.lastMarker = None
+
+
+    def fillBuffer(self):
+        """
+        Load all tokens from the token source and put in tokens.
+	This is done upon first LT request because you might want to
+        set some token type / channel overrides before filling buffer.
+        """
+
+
+        index = 0
+        t = self.tokenSource.nextToken()
+        while t is not None and t.type != EOF:
+            discard = False
+
+            if self.discardSet is not None and t.type in self.discardSet:
+                discard = True
+
+            elif self.discardOffChannelTokens and t.channel != self.channel:
+                discard = True
+
+            # is there a channel override for token type?
+            try:
+                overrideChannel = self.channelOverrideMap[t.type]
+
+            except KeyError:
+                # no override for this type
+                pass
+
+            else:
+                if overrideChannel == self.channel:
+                    t.channel = overrideChannel
+                else:
+                    discard = True
+
+            if not discard:
+                t.index = index
+                self.tokens.append(t)
+                index += 1
+
+            t = self.tokenSource.nextToken()
+
+        # leave p pointing at first token on channel
+        self.p = 0
+        self.p = self.skipOffTokenChannels(self.p)
+
+
+    def consume(self):
+        """
+        Move the input pointer to the next incoming token.  The stream
+        must become active with LT(1) available.  consume() simply
+        moves the input pointer so that LT(1) points at the next
+        input symbol. Consume at least one token.
+
+        Walk past any token not on the channel the parser is listening to.
+        """
+
+        if self.p < len(self.tokens):
+            self.p += 1
+
+            self.p = self.skipOffTokenChannels(self.p) # leave p on valid token
+
+
+    def skipOffTokenChannels(self, i):
+        """
+        Given a starting index, return the index of the first on-channel
+        token.
+        """
+
+        try:
+            while self.tokens[i].channel != self.channel:
+                i += 1
+        except IndexError:
+            # hit the end of token stream
+            pass
+
+        return i
+
+
+    def skipOffTokenChannelsReverse(self, i):
+        while i >= 0 and self.tokens[i].channel != self.channel:
+            i -= 1
+
+        return i
+
+
+    def setTokenTypeChannel(self, ttype, channel):
+        """
+        A simple filter mechanism whereby you can tell this token stream
+        to force all tokens of type ttype to be on channel.  For example,
+        when interpreting, we cannot exec actions so we need to tell
+        the stream to force all WS and NEWLINE to be a different, ignored
+        channel.
+	"""
+
+        self.channelOverrideMap[ttype] = channel
+
+
+    def discardTokenType(self, ttype):
+        self.discardSet.add(ttype)
+
+
+    def getTokens(self, start=None, stop=None, types=None):
+        """
+        Given a start and stop index, return a list of all tokens in
+        the token type set.  Return None if no tokens were found.  This
+        method looks at both on and off channel tokens.
+        """
+
+        if self.p == -1:
+            self.fillBuffer()
+
+        if stop is None or stop > len(self.tokens):
+            stop = len(self.tokens)
+
+        if start is None or stop < 0:
+            start = 0
+
+        if start > stop:
+            return None
+
+        if isinstance(types, (int, long)):
+            # called with a single type, wrap into set
+            types = set([types])
+
+        filteredTokens = [
+            token for token in self.tokens[start:stop]
+            if types is None or token.type in types
+            ]
+
+        if len(filteredTokens) == 0:
+            return None
+
+        return filteredTokens
+
+
+    def LT(self, k):
+        """
+        Get the ith token from the current position 1..n where k=1 is the
+        first symbol of lookahead.
+        """
+
+        if self.p == -1:
+            self.fillBuffer()
+
+        if k == 0:
+            return None
+
+        if k < 0:
+            return self.LB(-k)
+
+        i = self.p
+        n = 1
+        # find k good tokens
+        while n < k:
+            # skip off-channel tokens
+            i = self.skipOffTokenChannels(i+1) # leave p on valid token
+            n += 1
+
+        if i > self._range:
+            self._range = i
+
+        try:
+            return self.tokens[i]
+        except IndexError:
+            return self.makeEOFToken()
+
+
+    def LB(self, k):
+        """Look backwards k tokens on-channel tokens"""
+
+        if self.p == -1:
+            self.fillBuffer()
+
+        if k == 0:
+            return None
+
+        if self.p - k < 0:
+            return None
+
+        i = self.p
+        n = 1
+        # find k good tokens looking backwards
+        while n <= k:
+            # skip off-channel tokens
+            i = self.skipOffTokenChannelsReverse(i-1) # leave p on valid token
+            n += 1
+
+        if i < 0:
+            return None
+
+        return self.tokens[i]
+
+
+    def get(self, i):
+        """
+        Return absolute token i; ignore which channel the tokens are on;
+        that is, count all tokens not just on-channel tokens.
+        """
+
+        return self.tokens[i]
+
+
+    def slice(self, start, stop):
+        if self.p == -1:
+            self.fillBuffer()
+
+        if start < 0 or stop < 0:
+            return None
+
+        return self.tokens[start:stop+1]
+
+
+    def LA(self, i):
+        return self.LT(i).type
+
+
+    def mark(self):
+        self.lastMarker = self.index()
+        return self.lastMarker
+
+
+    def release(self, marker=None):
+        # no resources to release
+        pass
+
+
+    def size(self):
+        return len(self.tokens)
+
+
+    def range(self):
+        return self._range
+
+
+    def index(self):
+        return self.p
+
+
+    def rewind(self, marker=None):
+        if marker is None:
+            marker = self.lastMarker
+
+        self.seek(marker)
+
+
+    def seek(self, index):
+        self.p = index
+
+
+    def getTokenSource(self):
+        return self.tokenSource
+
+
+    def getSourceName(self):
+        return self.tokenSource.getSourceName()
+
+
+    def toString(self, start=None, stop=None):
+        if self.p == -1:
+            self.fillBuffer()
+
+        if start is None:
+            start = 0
+        elif not isinstance(start, int):
+            start = start.index
+
+        if stop is None:
+            stop = len(self.tokens) - 1
+        elif not isinstance(stop, int):
+            stop = stop.index
+
+        if stop >= len(self.tokens):
+            stop = len(self.tokens) - 1
+
+        return ''.join([t.text for t in self.tokens[start:stop+1]])
+
+
+class RewriteOperation(object):
+    """@brief Internal helper class."""
+
+    def __init__(self, stream, index, text):
+        self.stream = stream
+
+        # What index into rewrites List are we?
+        self.instructionIndex = None
+
+        # Token buffer index.
+        self.index = index
+        self.text = text
+
+    def execute(self, buf):
+        """Execute the rewrite operation by possibly adding to the buffer.
+        Return the index of the next token to operate on.
+        """
+
+        return self.index
+
+    def toString(self):
+        opName = self.__class__.__name__
+        return '<%s@%d:"%s">' % (
+            opName, self.index, self.text)
+
+    __str__ = toString
+    __repr__ = toString
+
+
+class InsertBeforeOp(RewriteOperation):
+    """@brief Internal helper class."""
+
+    def execute(self, buf):
+        buf.write(self.text)
+        if self.stream.tokens[self.index].type != EOF:
+            buf.write(self.stream.tokens[self.index].text)
+        return self.index + 1
+
+
+class ReplaceOp(RewriteOperation):
+    """
+    @brief Internal helper class.
+
+    I'm going to try replacing range from x..y with (y-x)+1 ReplaceOp
+    instructions.
+    """
+
+    def __init__(self, stream, first, last, text):
+        RewriteOperation.__init__(self, stream, first, text)
+        self.lastIndex = last
+
+
+    def execute(self, buf):
+        if self.text is not None:
+            buf.write(self.text)
+
+        return self.lastIndex + 1
+
+
+    def toString(self):
+        if self.text is None:
+            return '<DeleteOp@%d..%d>' % (self.index, self.lastIndex)
+
+        return '<ReplaceOp@%d..%d:"%s">' % (
+            self.index, self.lastIndex, self.text)
+
+    __str__ = toString
+    __repr__ = toString
+
+
+class TokenRewriteStream(CommonTokenStream):
+    """@brief CommonTokenStream that can be modified.
+
+    Useful for dumping out the input stream after doing some
+    augmentation or other manipulations.
+
+    You can insert stuff, replace, and delete chunks.  Note that the
+    operations are done lazily--only if you convert the buffer to a
+    String.  This is very efficient because you are not moving data around
+    all the time.  As the buffer of tokens is converted to strings, the
+    toString() method(s) check to see if there is an operation at the
+    current index.  If so, the operation is done and then normal String
+    rendering continues on the buffer.  This is like having multiple Turing
+    machine instruction streams (programs) operating on a single input tape. :)
+
+    Since the operations are done lazily at toString-time, operations do not
+    screw up the token index values.  That is, an insert operation at token
+    index i does not change the index values for tokens i+1..n-1.
+
+    Because operations never actually alter the buffer, you may always get
+    the original token stream back without undoing anything.  Since
+    the instructions are queued up, you can easily simulate transactions and
+    roll back any changes if there is an error just by removing instructions.
+    For example,
+
+     CharStream input = new ANTLRFileStream("input");
+     TLexer lex = new TLexer(input);
+     TokenRewriteStream tokens = new TokenRewriteStream(lex);
+     T parser = new T(tokens);
+     parser.startRule();
+
+     Then in the rules, you can execute
+        Token t,u;
+        ...
+        input.insertAfter(t, "text to put after t");}
+        input.insertAfter(u, "text after u");}
+        System.out.println(tokens.toString());
+
+    Actually, you have to cast the 'input' to a TokenRewriteStream. :(
+
+    You can also have multiple "instruction streams" and get multiple
+    rewrites from a single pass over the input.  Just name the instruction
+    streams and use that name again when printing the buffer.  This could be
+    useful for generating a C file and also its header file--all from the
+    same buffer:
+
+        tokens.insertAfter("pass1", t, "text to put after t");}
+        tokens.insertAfter("pass2", u, "text after u");}
+        System.out.println(tokens.toString("pass1"));
+        System.out.println(tokens.toString("pass2"));
+
+    If you don't use named rewrite streams, a "default" stream is used as
+    the first example shows.
+    """
+
+    DEFAULT_PROGRAM_NAME = "default"
+    MIN_TOKEN_INDEX = 0
+
+    def __init__(self, tokenSource=None, channel=DEFAULT_CHANNEL):
+        CommonTokenStream.__init__(self, tokenSource, channel)
+
+        # You may have multiple, named streams of rewrite operations.
+        # I'm calling these things "programs."
+        #  Maps String (name) -> rewrite (List)
+        self.programs = {}
+        self.programs[self.DEFAULT_PROGRAM_NAME] = []
+
+ 	# Map String (program name) -> Integer index
+        self.lastRewriteTokenIndexes = {}
+
+
+    def rollback(self, *args):
+        """
+        Rollback the instruction stream for a program so that
+        the indicated instruction (via instructionIndex) is no
+        longer in the stream.  UNTESTED!
+        """
+
+        if len(args) == 2:
+            programName = args[0]
+            instructionIndex = args[1]
+        elif len(args) == 1:
+            programName = self.DEFAULT_PROGRAM_NAME
+            instructionIndex = args[0]
+        else:
+            raise TypeError("Invalid arguments")
+
+        p = self.programs.get(programName, None)
+        if p is not None:
+            self.programs[programName] = (
+                p[self.MIN_TOKEN_INDEX:instructionIndex])
+
+
+    def deleteProgram(self, programName=DEFAULT_PROGRAM_NAME):
+        """Reset the program so that no instructions exist"""
+
+        self.rollback(programName, self.MIN_TOKEN_INDEX)
+
+
+    def insertAfter(self, *args):
+        if len(args) == 2:
+            programName = self.DEFAULT_PROGRAM_NAME
+            index = args[0]
+            text = args[1]
+
+        elif len(args) == 3:
+            programName = args[0]
+            index = args[1]
+            text = args[2]
+
+        else:
+            raise TypeError("Invalid arguments")
+
+        if isinstance(index, Token):
+            # index is a Token, grap the stream index from it
+            index = index.index
+
+        # to insert after, just insert before next index (even if past end)
+        self.insertBefore(programName, index+1, text)
+
+
+    def insertBefore(self, *args):
+        if len(args) == 2:
+            programName = self.DEFAULT_PROGRAM_NAME
+            index = args[0]
+            text = args[1]
+
+        elif len(args) == 3:
+            programName = args[0]
+            index = args[1]
+            text = args[2]
+
+        else:
+            raise TypeError("Invalid arguments")
+
+        if isinstance(index, Token):
+            # index is a Token, grap the stream index from it
+            index = index.index
+
+        op = InsertBeforeOp(self, index, text)
+        rewrites = self.getProgram(programName)
+        op.instructionIndex = len(rewrites)
+        rewrites.append(op)
+
+
+    def replace(self, *args):
+        if len(args) == 2:
+            programName = self.DEFAULT_PROGRAM_NAME
+            first = args[0]
+            last = args[0]
+            text = args[1]
+
+        elif len(args) == 3:
+            programName = self.DEFAULT_PROGRAM_NAME
+            first = args[0]
+            last = args[1]
+            text = args[2]
+
+        elif len(args) == 4:
+            programName = args[0]
+            first = args[1]
+            last = args[2]
+            text = args[3]
+
+        else:
+            raise TypeError("Invalid arguments")
+
+        if isinstance(first, Token):
+            # first is a Token, grap the stream index from it
+            first = first.index
+
+        if isinstance(last, Token):
+            # last is a Token, grap the stream index from it
+            last = last.index
+
+        if first > last or first < 0 or last < 0 or last >= len(self.tokens):
+            raise ValueError(
+                "replace: range invalid: %d..%d (size=%d)"
+                % (first, last, len(self.tokens)))
+
+        op = ReplaceOp(self, first, last, text)
+        rewrites = self.getProgram(programName)
+        op.instructionIndex = len(rewrites)
+        rewrites.append(op)
+
+
+    def delete(self, *args):
+        self.replace(*(list(args) + [None]))
+
+
+    def getLastRewriteTokenIndex(self, programName=DEFAULT_PROGRAM_NAME):
+        return self.lastRewriteTokenIndexes.get(programName, -1)
+
+
+    def setLastRewriteTokenIndex(self, programName, i):
+        self.lastRewriteTokenIndexes[programName] = i
+
+
+    def getProgram(self, name):
+        p = self.programs.get(name, None)
+        if p is  None:
+            p = self.initializeProgram(name)
+
+        return p
+
+
+    def initializeProgram(self, name):
+        p = []
+        self.programs[name] = p
+        return p
+
+
+    def toOriginalString(self, start=None, end=None):
+        if self.p == -1:
+            self.fillBuffer()
+
+        if start is None:
+            start = self.MIN_TOKEN_INDEX
+        if end is None:
+            end = self.size() - 1
+
+        buf = StringIO()
+        i = start
+        while i >= self.MIN_TOKEN_INDEX and i <= end and i < len(self.tokens):
+            if self.get(i).type != EOF:
+                buf.write(self.get(i).text)
+            i += 1
+
+        return buf.getvalue()
+
+
+    def toString(self, *args):
+        if self.p == -1:
+            self.fillBuffer()
+
+        if len(args) == 0:
+            programName = self.DEFAULT_PROGRAM_NAME
+            start = self.MIN_TOKEN_INDEX
+            end = self.size() - 1
+
+        elif len(args) == 1:
+            programName = args[0]
+            start = self.MIN_TOKEN_INDEX
+            end = self.size() - 1
+
+        elif len(args) == 2:
+            programName = self.DEFAULT_PROGRAM_NAME
+            start = args[0]
+            end = args[1]
+
+        if start is None:
+            start = self.MIN_TOKEN_INDEX
+        elif not isinstance(start, int):
+            start = start.index
+
+        if end is None:
+            end = len(self.tokens) - 1
+        elif not isinstance(end, int):
+            end = end.index
+
+        # ensure start/end are in range
+        if end >= len(self.tokens):
+            end = len(self.tokens) - 1
+
+        if start < 0:
+            start = 0
+
+        rewrites = self.programs.get(programName)
+        if rewrites is None or len(rewrites) == 0:
+            # no instructions to execute
+            return self.toOriginalString(start, end)
+
+        buf = StringIO()
+
+        # First, optimize instruction stream
+        indexToOp = self.reduceToSingleOperationPerIndex(rewrites)
+
+        # Walk buffer, executing instructions and emitting tokens
+        i = start
+        while i <= end and i < len(self.tokens):
+            op = indexToOp.get(i)
+            # remove so any left have index size-1
+            try:
+                del indexToOp[i]
+            except KeyError:
+                pass
+
+            t = self.tokens[i]
+            if op is None:
+                # no operation at that index, just dump token
+                if t.type != EOF:
+                    buf.write(t.text)
+                i += 1 # move to next token
+
+            else:
+                i = op.execute(buf) # execute operation and skip
+
+        # include stuff after end if it's last index in buffer
+        # So, if they did an insertAfter(lastValidIndex, "foo"), include
+        # foo if end==lastValidIndex.
+        if end == len(self.tokens) - 1:
+            # Scan any remaining operations after last token
+            # should be included (they will be inserts).
+            for i in sorted(indexToOp.keys()):
+                op = indexToOp[i]
+                if op.index >= len(self.tokens)-1:
+                    buf.write(op.text)
+
+        return buf.getvalue()
+
+    __str__ = toString
+
+
+    def reduceToSingleOperationPerIndex(self, rewrites):
+        """
+        We need to combine operations and report invalid operations (like
+        overlapping replaces that are not completed nested).  Inserts to
+        same index need to be combined etc...   Here are the cases:
+
+        I.i.u I.j.v                           leave alone, nonoverlapping
+        I.i.u I.i.v                           combine: Iivu
+
+        R.i-j.u R.x-y.v | i-j in x-y          delete first R
+        R.i-j.u R.i-j.v                       delete first R
+        R.i-j.u R.x-y.v | x-y in i-j          ERROR
+        R.i-j.u R.x-y.v | boundaries overlap  ERROR
+
+        Delete special case of replace (text==null):
+        D.i-j.u D.x-y.v |                     boundaries overlapcombine to
+                                              max(min)..max(right)
+
+        I.i.u R.x-y.v   |                     i in (x+1)-ydelete I (since
+                                              insert before we're not deleting
+                                              i)
+        I.i.u R.x-y.v   |                     i not in (x+1)-yleave alone,
+                                              nonoverlapping
+
+        R.x-y.v I.i.u   | i in x-y            ERROR
+        R.x-y.v I.x.u                         R.x-y.uv (combine, delete I)
+        R.x-y.v I.i.u   | i not in x-y        leave alone, nonoverlapping
+
+        I.i.u = insert u before op @ index i
+        R.x-y.u = replace x-y indexed tokens with u
+
+        First we need to examine replaces.  For any replace op:
+
+          1. wipe out any insertions before op within that range.
+          2. Drop any replace op before that is contained completely within
+             that range.
+          3. Throw exception upon boundary overlap with any previous replace.
+
+        Then we can deal with inserts:
+
+          1. for any inserts to same index, combine even if not adjacent.
+          2. for any prior replace with same left boundary, combine this
+             insert with replace and delete this replace.
+          3. throw exception if index in same range as previous replace
+
+        Don't actually delete; make op null in list. Easier to walk list.
+        Later we can throw as we add to index -> op map.
+
+        Note that I.2 R.2-2 will wipe out I.2 even though, technically, the
+        inserted stuff would be before the replace range.  But, if you
+        add tokens in front of a method body '{' and then delete the method
+        body, I think the stuff before the '{' you added should disappear too.
+
+        Return a map from token index to operation.
+        """
+
+        # WALK REPLACES
+        for i, rop in enumerate(rewrites):
+            if rop is None:
+                continue
+
+            if not isinstance(rop, ReplaceOp):
+                continue
+
+            # Wipe prior inserts within range
+            for j, iop in self.getKindOfOps(rewrites, InsertBeforeOp, i):
+                if iop.index == rop.index:
+                    # E.g., insert before 2, delete 2..2; update replace
+                    # text to include insert before, kill insert
+                    rewrites[iop.instructionIndex] = None
+                    rop.text = self.catOpText(iop.text, rop.text)
+
+                elif iop.index > rop.index and iop.index <= rop.lastIndex:
+                    # delete insert as it's a no-op.
+                    rewrites[j] = None
+
+            # Drop any prior replaces contained within
+            for j, prevRop in self.getKindOfOps(rewrites, ReplaceOp, i):
+                if (prevRop.index >= rop.index
+                    and prevRop.lastIndex <= rop.lastIndex):
+                    # delete replace as it's a no-op.
+                    rewrites[j] = None
+                    continue
+
+                # throw exception unless disjoint or identical
+                disjoint = (prevRop.lastIndex < rop.index
+                            or prevRop.index > rop.lastIndex)
+                same = (prevRop.index == rop.index
+                        and prevRop.lastIndex == rop.lastIndex)
+
+                # Delete special case of replace (text==null):
+                # D.i-j.u D.x-y.v| boundaries overlapcombine to
+                # max(min)..max(right)
+                if prevRop.text is None and rop.text is None and not disjoint:
+                    # kill first delete
+                    rewrites[prevRop.instructionIndex] = None
+
+                    rop.index = min(prevRop.index, rop.index)
+                    rop.lastIndex = max(prevRop.lastIndex, rop.lastIndex)
+
+                elif not disjoint and not same:
+                    raise ValueError(
+                        "replace op boundaries of %s overlap with previous %s"
+                        % (rop, prevRop))
+
+        # WALK INSERTS
+        for i, iop in enumerate(rewrites):
+            if iop is None:
+                continue
+
+            if not isinstance(iop, InsertBeforeOp):
+                continue
+
+            # combine current insert with prior if any at same index
+            for j, prevIop in self.getKindOfOps(rewrites, InsertBeforeOp, i):
+                if prevIop.index == iop.index: # combine objects
+                    # convert to strings...we're in process of toString'ing
+                    # whole token buffer so no lazy eval issue with any
+                    # templates
+                    iop.text = self.catOpText(iop.text, prevIop.text)
+                    # delete redundant prior insert
+                    rewrites[j] = None
+
+            # look for replaces where iop.index is in range; error
+            for j, rop in self.getKindOfOps(rewrites, ReplaceOp, i):
+                if iop.index == rop.index:
+                    rop.text = self.catOpText(iop.text, rop.text)
+                    # delete current insert
+                    rewrites[i] = None
+                    continue
+
+                if iop.index >= rop.index and iop.index <= rop.lastIndex:
+                    raise ValueError(
+                        "insert op %s within boundaries of previous %s"
+                        % (iop, rop))
+
+        m = {}
+        for i, op in enumerate(rewrites):
+            if op is None:
+                # ignore deleted ops
+                continue
+
+            assert op.index not in m, "should only be one op per index"
+            m[op.index] = op
+
+        return m
+
+
+    def catOpText(self, a, b):
+        x = ""
+        y = ""
+        if a is not None:
+            x = a
+        if b is not None:
+            y = b
+        return x + y
+
+
+    def getKindOfOps(self, rewrites, kind, before=None):
+        """Get all operations before an index of a particular kind."""
+
+        if before is None:
+            before = len(rewrites)
+        elif before > len(rewrites):
+            before = len(rewrites)
+
+        for i, op in enumerate(rewrites[:before]):
+            if op is None:
+                # ignore deleted
+                continue
+            if op.__class__ == kind:
+                yield i, op
+
+
+    def toDebugString(self, start=None, end=None):
+        if start is None:
+            start = self.MIN_TOKEN_INDEX
+        if end is None:
+            end = self.size() - 1
+
+        buf = StringIO()
+        i = start
+        while i >= self.MIN_TOKEN_INDEX and i <= end and i < len(self.tokens):
+            buf.write(self.get(i))
+            i += 1
+
+        return buf.getvalue()
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/tokens.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/tokens.py
new file mode 100644
index 0000000000000000000000000000000000000000..bce4bc3b5c4260458fdc924edaa2b798223a90da
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/tokens.py
@@ -0,0 +1,418 @@
+"""ANTLR3 runtime package"""
+
+# begin[licence]
+#
+# [The "BSD licence"]
+# Copyright (c) 2005-2008 Terence Parr
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# end[licence]
+
+from antlr3.constants import EOF, DEFAULT_CHANNEL, INVALID_TOKEN_TYPE
+
+############################################################################
+#
+# basic token interface
+#
+############################################################################
+
+class Token(object):
+    """@brief Abstract token baseclass."""
+
+    def getText(self):
+        """@brief Get the text of the token.
+
+        Using setter/getter methods is deprecated. Use o.text instead.
+        """
+        raise NotImplementedError
+
+    def setText(self, text):
+        """@brief Set the text of the token.
+
+        Using setter/getter methods is deprecated. Use o.text instead.
+        """
+        raise NotImplementedError
+
+
+    def getType(self):
+        """@brief Get the type of the token.
+
+        Using setter/getter methods is deprecated. Use o.type instead."""
+
+        raise NotImplementedError
+
+    def setType(self, ttype):
+        """@brief Get the type of the token.
+
+        Using setter/getter methods is deprecated. Use o.type instead."""
+
+        raise NotImplementedError
+
+
+    def getLine(self):
+        """@brief Get the line number on which this token was matched
+
+        Lines are numbered 1..n
+
+        Using setter/getter methods is deprecated. Use o.line instead."""
+
+        raise NotImplementedError
+
+    def setLine(self, line):
+        """@brief Set the line number on which this token was matched
+
+        Using setter/getter methods is deprecated. Use o.line instead."""
+
+        raise NotImplementedError
+
+
+    def getCharPositionInLine(self):
+        """@brief Get the column of the tokens first character,
+
+        Columns are numbered 0..n-1
+
+        Using setter/getter methods is deprecated. Use o.charPositionInLine instead."""
+
+        raise NotImplementedError
+
+    def setCharPositionInLine(self, pos):
+        """@brief Set the column of the tokens first character,
+
+        Using setter/getter methods is deprecated. Use o.charPositionInLine instead."""
+
+        raise NotImplementedError
+
+
+    def getChannel(self):
+        """@brief Get the channel of the token
+
+        Using setter/getter methods is deprecated. Use o.channel instead."""
+
+        raise NotImplementedError
+
+    def setChannel(self, channel):
+        """@brief Set the channel of the token
+
+        Using setter/getter methods is deprecated. Use o.channel instead."""
+
+        raise NotImplementedError
+
+
+    def getTokenIndex(self):
+        """@brief Get the index in the input stream.
+
+        An index from 0..n-1 of the token object in the input stream.
+        This must be valid in order to use the ANTLRWorks debugger.
+
+        Using setter/getter methods is deprecated. Use o.index instead."""
+
+        raise NotImplementedError
+
+    def setTokenIndex(self, index):
+        """@brief Set the index in the input stream.
+
+        Using setter/getter methods is deprecated. Use o.index instead."""
+
+        raise NotImplementedError
+
+
+    def getInputStream(self):
+        """@brief From what character stream was this token created.
+
+        You don't have to implement but it's nice to know where a Token
+        comes from if you have include files etc... on the input."""
+
+        raise NotImplementedError
+
+    def setInputStream(self, input):
+        """@brief From what character stream was this token created.
+
+        You don't have to implement but it's nice to know where a Token
+        comes from if you have include files etc... on the input."""
+
+        raise NotImplementedError
+
+
+############################################################################
+#
+# token implementations
+#
+# Token
+# +- CommonToken
+# \- ClassicToken
+#
+############################################################################
+
+class CommonToken(Token):
+    """@brief Basic token implementation.
+
+    This implementation does not copy the text from the input stream upon
+    creation, but keeps start/stop pointers into the stream to avoid
+    unnecessary copy operations.
+
+    """
+
+    def __init__(self, type=None, channel=DEFAULT_CHANNEL, text=None,
+                 input=None, start=None, stop=None, oldToken=None):
+        Token.__init__(self)
+
+        if oldToken is not None:
+            self.type = oldToken.type
+            self.line = oldToken.line
+            self.charPositionInLine = oldToken.charPositionInLine
+            self.channel = oldToken.channel
+            self.index = oldToken.index
+            self._text = oldToken._text
+            self.input = oldToken.input
+            if isinstance(oldToken, CommonToken):
+                self.start = oldToken.start
+                self.stop = oldToken.stop
+
+        else:
+            self.type = type
+            self.input = input
+            self.charPositionInLine = -1 # set to invalid position
+            self.line = 0
+            self.channel = channel
+
+	    #What token number is this from 0..n-1 tokens; < 0 implies invalid index
+            self.index = -1
+
+            # We need to be able to change the text once in a while.  If
+            # this is non-null, then getText should return this.  Note that
+            # start/stop are not affected by changing this.
+            self._text = text
+
+            # The char position into the input buffer where this token starts
+            self.start = start
+
+            # The char position into the input buffer where this token stops
+            # This is the index of the last char, *not* the index after it!
+            self.stop = stop
+
+
+    def getText(self):
+        if self._text is not None:
+            return self._text
+
+        if self.input is None:
+            return None
+
+        if self.start < self.input.size() and self.stop < self.input.size():
+          return self.input.substring(self.start, self.stop)
+
+        return '<EOF>'
+
+
+    def setText(self, text):
+        """
+        Override the text for this token.  getText() will return this text
+        rather than pulling from the buffer.  Note that this does not mean
+        that start/stop indexes are not valid.  It means that that input
+        was converted to a new string in the token object.
+	"""
+        self._text = text
+
+    text = property(getText, setText)
+
+
+    def getType(self):
+        return self.type
+
+    def setType(self, ttype):
+        self.type = ttype
+
+    def getTypeName(self):
+        return str(self.type)
+
+    typeName = property(lambda s: s.getTypeName())
+
+    def getLine(self):
+        return self.line
+
+    def setLine(self, line):
+        self.line = line
+
+
+    def getCharPositionInLine(self):
+        return self.charPositionInLine
+
+    def setCharPositionInLine(self, pos):
+        self.charPositionInLine = pos
+
+
+    def getChannel(self):
+        return self.channel
+
+    def setChannel(self, channel):
+        self.channel = channel
+
+
+    def getTokenIndex(self):
+        return self.index
+
+    def setTokenIndex(self, index):
+        self.index = index
+
+
+    def getInputStream(self):
+        return self.input
+
+    def setInputStream(self, input):
+        self.input = input
+
+
+    def __str__(self):
+        if self.type == EOF:
+            return "<EOF>"
+
+        channelStr = ""
+        if self.channel > 0:
+            channelStr = ",channel=" + str(self.channel)
+
+        txt = self.text
+        if txt is not None:
+            txt = txt.replace("\n","\\\\n")
+            txt = txt.replace("\r","\\\\r")
+            txt = txt.replace("\t","\\\\t")
+        else:
+            txt = "<no text>"
+
+        return "[@%d,%d:%d=%r,<%s>%s,%d:%d]" % (
+            self.index,
+            self.start, self.stop,
+            txt,
+            self.typeName, channelStr,
+            self.line, self.charPositionInLine
+            )
+
+
+class ClassicToken(Token):
+    """@brief Alternative token implementation.
+
+    A Token object like we'd use in ANTLR 2.x; has an actual string created
+    and associated with this object.  These objects are needed for imaginary
+    tree nodes that have payload objects.  We need to create a Token object
+    that has a string; the tree node will point at this token.  CommonToken
+    has indexes into a char stream and hence cannot be used to introduce
+    new strings.
+    """
+
+    def __init__(self, type=None, text=None, channel=DEFAULT_CHANNEL,
+                 oldToken=None
+                 ):
+        Token.__init__(self)
+
+        if oldToken is not None:
+            self.text = oldToken.text
+            self.type = oldToken.type
+            self.line = oldToken.line
+            self.charPositionInLine = oldToken.charPositionInLine
+            self.channel = oldToken.channel
+
+        self.text = text
+        self.type = type
+        self.line = None
+        self.charPositionInLine = None
+        self.channel = channel
+        self.index = None
+
+
+    def getText(self):
+        return self.text
+
+    def setText(self, text):
+        self.text = text
+
+
+    def getType(self):
+        return self.type
+
+    def setType(self, ttype):
+        self.type = ttype
+
+
+    def getLine(self):
+        return self.line
+
+    def setLine(self, line):
+        self.line = line
+
+
+    def getCharPositionInLine(self):
+        return self.charPositionInLine
+
+    def setCharPositionInLine(self, pos):
+        self.charPositionInLine = pos
+
+
+    def getChannel(self):
+        return self.channel
+
+    def setChannel(self, channel):
+        self.channel = channel
+
+
+    def getTokenIndex(self):
+        return self.index
+
+    def setTokenIndex(self, index):
+        self.index = index
+
+
+    def getInputStream(self):
+        return None
+
+    def setInputStream(self, input):
+        pass
+
+
+    def toString(self):
+        channelStr = ""
+        if self.channel > 0:
+            channelStr = ",channel=" + str(self.channel)
+
+        txt = self.text
+        if txt is None:
+            txt = "<no text>"
+
+        return "[@%r,%r,<%r>%s,%r:%r]" % (self.index,
+                                          txt,
+                                          self.type,
+                                          channelStr,
+                                          self.line,
+                                          self.charPositionInLine
+                                          )
+
+
+    __str__ = toString
+    __repr__ = toString
+
+
+INVALID_TOKEN = CommonToken(type=INVALID_TOKEN_TYPE)
+
+# In an action, a lexer rule can set token to this SKIP_TOKEN and ANTLR
+# will avoid creating a token for this symbol and try to fetch another.
+SKIP_TOKEN = CommonToken(type=INVALID_TOKEN_TYPE)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/tree.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/tree.py
new file mode 100644
index 0000000000000000000000000000000000000000..d20b58dff29681d4ae0daa5e8ebb29abe7d20ee5
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/tree.py
@@ -0,0 +1,2843 @@
+""" @package antlr3.tree
+@brief ANTLR3 runtime package, tree module
+
+This module contains all support classes for AST construction and tree parsers.
+
+"""
+
+# begin[licence]
+#
+# [The "BSD licence"]
+# Copyright (c) 2005-2008 Terence Parr
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# end[licence]
+
+# lot's of docstrings are missing, don't complain for now...
+# pylint: disable-msg=C0111
+
+import re
+
+from antlr3.constants import UP, DOWN, EOF, INVALID_TOKEN_TYPE
+from antlr3.recognizers import BaseRecognizer, RuleReturnScope
+from antlr3.streams import IntStream
+from antlr3.tokens import CommonToken, Token, INVALID_TOKEN
+from antlr3.exceptions import MismatchedTreeNodeException, \
+     MissingTokenException, UnwantedTokenException, MismatchedTokenException, \
+     NoViableAltException
+
+
+############################################################################
+#
+# tree related exceptions
+#
+############################################################################
+
+
+class RewriteCardinalityException(RuntimeError):
+    """
+    @brief Base class for all exceptions thrown during AST rewrite construction.
+
+    This signifies a case where the cardinality of two or more elements
+    in a subrule are different: (ID INT)+ where |ID|!=|INT|
+    """
+
+    def __init__(self, elementDescription):
+        RuntimeError.__init__(self, elementDescription)
+
+        self.elementDescription = elementDescription
+
+
+    def getMessage(self):
+        return self.elementDescription
+
+
+class RewriteEarlyExitException(RewriteCardinalityException):
+    """@brief No elements within a (...)+ in a rewrite rule"""
+
+    def __init__(self, elementDescription=None):
+        RewriteCardinalityException.__init__(self, elementDescription)
+
+
+class RewriteEmptyStreamException(RewriteCardinalityException):
+    """
+    @brief Ref to ID or expr but no tokens in ID stream or subtrees in expr stream
+    """
+
+    pass
+
+
+############################################################################
+#
+# basic Tree and TreeAdaptor interfaces
+#
+############################################################################
+
+class Tree(object):
+    """
+    @brief Abstract baseclass for tree nodes.
+
+    What does a tree look like?  ANTLR has a number of support classes
+    such as CommonTreeNodeStream that work on these kinds of trees.  You
+    don't have to make your trees implement this interface, but if you do,
+    you'll be able to use more support code.
+
+    NOTE: When constructing trees, ANTLR can build any kind of tree; it can
+    even use Token objects as trees if you add a child list to your tokens.
+
+    This is a tree node without any payload; just navigation and factory stuff.
+    """
+
+
+    def getChild(self, i):
+        raise NotImplementedError
+
+
+    def getChildCount(self):
+        raise NotImplementedError
+
+
+    def getParent(self):
+        """Tree tracks parent and child index now > 3.0"""
+
+        raise NotImplementedError
+
+    def setParent(self, t):
+        """Tree tracks parent and child index now > 3.0"""
+
+        raise NotImplementedError
+
+
+    def hasAncestor(self, ttype):
+        """Walk upwards looking for ancestor with this token type."""
+
+        raise NotImplementedError
+
+    def getAncestor(self, ttype):
+        """Walk upwards and get first ancestor with this token type."""
+
+        raise NotImplementedError
+
+    def getAncestors(self):
+        """Return a list of all ancestors of this node.
+
+        The first node of list is the root and the last is the parent of
+        this node.
+        """
+
+        raise NotImplementedError
+
+
+    def getChildIndex(self):
+        """This node is what child index? 0..n-1"""
+
+        raise NotImplementedError
+
+    def setChildIndex(self, index):
+        """This node is what child index? 0..n-1"""
+
+        raise NotImplementedError
+
+
+    def freshenParentAndChildIndexes(self):
+        """Set the parent and child index values for all children"""
+
+        raise NotImplementedError
+
+
+    def addChild(self, t):
+        """
+        Add t as a child to this node.  If t is null, do nothing.  If t
+        is nil, add all children of t to this' children.
+        """
+
+        raise NotImplementedError
+
+
+    def setChild(self, i, t):
+        """Set ith child (0..n-1) to t; t must be non-null and non-nil node"""
+
+        raise NotImplementedError
+
+
+    def deleteChild(self, i):
+        raise NotImplementedError
+
+
+    def replaceChildren(self, startChildIndex, stopChildIndex, t):
+        """
+        Delete children from start to stop and replace with t even if t is
+        a list (nil-root tree).  num of children can increase or decrease.
+        For huge child lists, inserting children can force walking rest of
+        children to set their childindex; could be slow.
+        """
+
+        raise NotImplementedError
+
+
+    def isNil(self):
+        """
+        Indicates the node is a nil node but may still have children, meaning
+        the tree is a flat list.
+        """
+
+        raise NotImplementedError
+
+
+    def getTokenStartIndex(self):
+        """
+        What is the smallest token index (indexing from 0) for this node
+           and its children?
+        """
+
+        raise NotImplementedError
+
+
+    def setTokenStartIndex(self, index):
+        raise NotImplementedError
+
+
+    def getTokenStopIndex(self):
+        """
+        What is the largest token index (indexing from 0) for this node
+        and its children?
+        """
+
+        raise NotImplementedError
+
+
+    def setTokenStopIndex(self, index):
+        raise NotImplementedError
+
+
+    def dupNode(self):
+        raise NotImplementedError
+
+
+    def getType(self):
+        """Return a token type; needed for tree parsing."""
+
+        raise NotImplementedError
+
+
+    def getText(self):
+        raise NotImplementedError
+
+
+    def getLine(self):
+        """
+        In case we don't have a token payload, what is the line for errors?
+        """
+
+        raise NotImplementedError
+
+
+    def getCharPositionInLine(self):
+        raise NotImplementedError
+
+
+    def toStringTree(self):
+        raise NotImplementedError
+
+
+    def toString(self):
+        raise NotImplementedError
+
+
+
+class TreeAdaptor(object):
+    """
+    @brief Abstract baseclass for tree adaptors.
+
+    How to create and navigate trees.  Rather than have a separate factory
+    and adaptor, I've merged them.  Makes sense to encapsulate.
+
+    This takes the place of the tree construction code generated in the
+    generated code in 2.x and the ASTFactory.
+
+    I do not need to know the type of a tree at all so they are all
+    generic Objects.  This may increase the amount of typecasting needed. :(
+    """
+
+    # C o n s t r u c t i o n
+
+    def createWithPayload(self, payload):
+        """
+        Create a tree node from Token object; for CommonTree type trees,
+        then the token just becomes the payload.  This is the most
+        common create call.
+
+        Override if you want another kind of node to be built.
+        """
+
+        raise NotImplementedError
+
+
+    def dupNode(self, treeNode):
+        """Duplicate a single tree node.
+
+        Override if you want another kind of node to be built."""
+
+        raise NotImplementedError
+
+
+    def dupTree(self, tree):
+        """Duplicate tree recursively, using dupNode() for each node"""
+
+        raise NotImplementedError
+
+
+    def nil(self):
+        """
+        Return a nil node (an empty but non-null node) that can hold
+        a list of element as the children.  If you want a flat tree (a list)
+        use "t=adaptor.nil(); t.addChild(x); t.addChild(y);"
+        """
+
+        raise NotImplementedError
+
+
+    def errorNode(self, input, start, stop, exc):
+        """
+        Return a tree node representing an error.  This node records the
+        tokens consumed during error recovery.  The start token indicates the
+        input symbol at which the error was detected.  The stop token indicates
+        the last symbol consumed during recovery.
+
+        You must specify the input stream so that the erroneous text can
+        be packaged up in the error node.  The exception could be useful
+        to some applications; default implementation stores ptr to it in
+        the CommonErrorNode.
+
+        This only makes sense during token parsing, not tree parsing.
+        Tree parsing should happen only when parsing and tree construction
+        succeed.
+        """
+
+        raise NotImplementedError
+
+
+    def isNil(self, tree):
+        """Is tree considered a nil node used to make lists of child nodes?"""
+
+        raise NotImplementedError
+
+
+    def addChild(self, t, child):
+        """
+        Add a child to the tree t.  If child is a flat tree (a list), make all
+        in list children of t.  Warning: if t has no children, but child does
+        and child isNil then you can decide it is ok to move children to t via
+        t.children = child.children; i.e., without copying the array.  Just
+        make sure that this is consistent with have the user will build
+        ASTs. Do nothing if t or child is null.
+        """
+
+        raise NotImplementedError
+
+
+    def becomeRoot(self, newRoot, oldRoot):
+        """
+        If oldRoot is a nil root, just copy or move the children to newRoot.
+        If not a nil root, make oldRoot a child of newRoot.
+
+           old=^(nil a b c), new=r yields ^(r a b c)
+           old=^(a b c), new=r yields ^(r ^(a b c))
+
+        If newRoot is a nil-rooted single child tree, use the single
+        child as the new root node.
+
+           old=^(nil a b c), new=^(nil r) yields ^(r a b c)
+           old=^(a b c), new=^(nil r) yields ^(r ^(a b c))
+
+        If oldRoot was null, it's ok, just return newRoot (even if isNil).
+
+           old=null, new=r yields r
+           old=null, new=^(nil r) yields ^(nil r)
+
+        Return newRoot.  Throw an exception if newRoot is not a
+        simple node or nil root with a single child node--it must be a root
+        node.  If newRoot is ^(nil x) return x as newRoot.
+
+        Be advised that it's ok for newRoot to point at oldRoot's
+        children; i.e., you don't have to copy the list.  We are
+        constructing these nodes so we should have this control for
+        efficiency.
+        """
+
+        raise NotImplementedError
+
+
+    def rulePostProcessing(self, root):
+        """
+        Given the root of the subtree created for this rule, post process
+        it to do any simplifications or whatever you want.  A required
+        behavior is to convert ^(nil singleSubtree) to singleSubtree
+        as the setting of start/stop indexes relies on a single non-nil root
+        for non-flat trees.
+
+        Flat trees such as for lists like "idlist : ID+ ;" are left alone
+        unless there is only one ID.  For a list, the start/stop indexes
+        are set in the nil node.
+
+        This method is executed after all rule tree construction and right
+        before setTokenBoundaries().
+        """
+
+        raise NotImplementedError
+
+
+    def getUniqueID(self, node):
+        """For identifying trees.
+
+        How to identify nodes so we can say "add node to a prior node"?
+        Even becomeRoot is an issue.  Use System.identityHashCode(node)
+        usually.
+        """
+
+        raise NotImplementedError
+
+
+    # R e w r i t e  R u l e s
+
+    def createFromToken(self, tokenType, fromToken, text=None):
+        """
+        Create a new node derived from a token, with a new token type and
+        (optionally) new text.
+
+        This is invoked from an imaginary node ref on right side of a
+        rewrite rule as IMAG[$tokenLabel] or IMAG[$tokenLabel "IMAG"].
+
+        This should invoke createToken(Token).
+        """
+
+        raise NotImplementedError
+
+
+    def createFromType(self, tokenType, text):
+        """Create a new node derived from a token, with a new token type.
+
+        This is invoked from an imaginary node ref on right side of a
+        rewrite rule as IMAG["IMAG"].
+
+        This should invoke createToken(int,String).
+        """
+
+        raise NotImplementedError
+
+
+    # C o n t e n t
+
+    def getType(self, t):
+        """For tree parsing, I need to know the token type of a node"""
+
+        raise NotImplementedError
+
+
+    def setType(self, t, type):
+        """Node constructors can set the type of a node"""
+
+        raise NotImplementedError
+
+
+    def getText(self, t):
+        raise NotImplementedError
+
+    def setText(self, t, text):
+        """Node constructors can set the text of a node"""
+
+        raise NotImplementedError
+
+
+    def getToken(self, t):
+        """Return the token object from which this node was created.
+
+        Currently used only for printing an error message.
+        The error display routine in BaseRecognizer needs to
+        display where the input the error occurred. If your
+        tree of limitation does not store information that can
+        lead you to the token, you can create a token filled with
+        the appropriate information and pass that back.  See
+        BaseRecognizer.getErrorMessage().
+        """
+
+        raise NotImplementedError
+
+
+    def setTokenBoundaries(self, t, startToken, stopToken):
+        """
+        Where are the bounds in the input token stream for this node and
+        all children?  Each rule that creates AST nodes will call this
+        method right before returning.  Flat trees (i.e., lists) will
+        still usually have a nil root node just to hold the children list.
+        That node would contain the start/stop indexes then.
+        """
+
+        raise NotImplementedError
+
+
+    def getTokenStartIndex(self, t):
+        """
+        Get the token start index for this subtree; return -1 if no such index
+        """
+
+        raise NotImplementedError
+
+
+    def getTokenStopIndex(self, t):
+        """
+        Get the token stop index for this subtree; return -1 if no such index
+        """
+
+        raise NotImplementedError
+
+
+    # N a v i g a t i o n  /  T r e e  P a r s i n g
+
+    def getChild(self, t, i):
+        """Get a child 0..n-1 node"""
+
+        raise NotImplementedError
+
+
+    def setChild(self, t, i, child):
+        """Set ith child (0..n-1) to t; t must be non-null and non-nil node"""
+
+        raise NotImplementedError
+
+
+    def deleteChild(self, t, i):
+        """Remove ith child and shift children down from right."""
+
+        raise NotImplementedError
+
+
+    def getChildCount(self, t):
+        """How many children?  If 0, then this is a leaf node"""
+
+        raise NotImplementedError
+
+
+    def getParent(self, t):
+        """
+        Who is the parent node of this node; if null, implies node is root.
+        If your node type doesn't handle this, it's ok but the tree rewrites
+        in tree parsers need this functionality.
+        """
+
+        raise NotImplementedError
+
+
+    def setParent(self, t, parent):
+        """
+        Who is the parent node of this node; if null, implies node is root.
+        If your node type doesn't handle this, it's ok but the tree rewrites
+        in tree parsers need this functionality.
+        """
+
+        raise NotImplementedError
+
+
+    def getChildIndex(self, t):
+        """
+        What index is this node in the child list? Range: 0..n-1
+        If your node type doesn't handle this, it's ok but the tree rewrites
+        in tree parsers need this functionality.
+        """
+
+        raise NotImplementedError
+
+
+    def setChildIndex(self, t, index):
+        """
+        What index is this node in the child list? Range: 0..n-1
+        If your node type doesn't handle this, it's ok but the tree rewrites
+        in tree parsers need this functionality.
+        """
+
+        raise NotImplementedError
+
+
+    def replaceChildren(self, parent, startChildIndex, stopChildIndex, t):
+        """
+        Replace from start to stop child index of parent with t, which might
+        be a list.  Number of children may be different
+        after this call.
+
+        If parent is null, don't do anything; must be at root of overall tree.
+        Can't replace whatever points to the parent externally.  Do nothing.
+        """
+
+        raise NotImplementedError
+
+
+    # Misc
+
+    def create(self, *args):
+        """
+        Deprecated, use createWithPayload, createFromToken or createFromType.
+
+        This method only exists to mimic the Java interface of TreeAdaptor.
+
+        """
+
+        if len(args) == 1 and isinstance(args[0], Token):
+            # Object create(Token payload);
+##             warnings.warn(
+##                 "Using create() is deprecated, use createWithPayload()",
+##                 DeprecationWarning,
+##                 stacklevel=2
+##                 )
+            return self.createWithPayload(args[0])
+
+        if (len(args) == 2
+            and isinstance(args[0], (int, long))
+            and isinstance(args[1], Token)
+            ):
+            # Object create(int tokenType, Token fromToken);
+##             warnings.warn(
+##                 "Using create() is deprecated, use createFromToken()",
+##                 DeprecationWarning,
+##                 stacklevel=2
+##                 )
+            return self.createFromToken(args[0], args[1])
+
+        if (len(args) == 3
+            and isinstance(args[0], (int, long))
+            and isinstance(args[1], Token)
+            and isinstance(args[2], basestring)
+            ):
+            # Object create(int tokenType, Token fromToken, String text);
+##             warnings.warn(
+##                 "Using create() is deprecated, use createFromToken()",
+##                 DeprecationWarning,
+##                 stacklevel=2
+##                 )
+            return self.createFromToken(args[0], args[1], args[2])
+
+        if (len(args) == 2
+            and isinstance(args[0], (int, long))
+            and isinstance(args[1], basestring)
+            ):
+            # Object create(int tokenType, String text);
+##             warnings.warn(
+##                 "Using create() is deprecated, use createFromType()",
+##                 DeprecationWarning,
+##                 stacklevel=2
+##                 )
+            return self.createFromType(args[0], args[1])
+
+        raise TypeError(
+            "No create method with this signature found: %s"
+            % (', '.join(type(v).__name__ for v in args))
+            )
+
+
+############################################################################
+#
+# base implementation of Tree and TreeAdaptor
+#
+# Tree
+# \- BaseTree
+#
+# TreeAdaptor
+# \- BaseTreeAdaptor
+#
+############################################################################
+
+
+class BaseTree(Tree):
+    """
+    @brief A generic tree implementation with no payload.
+
+    You must subclass to
+    actually have any user data.  ANTLR v3 uses a list of children approach
+    instead of the child-sibling approach in v2.  A flat tree (a list) is
+    an empty node whose children represent the list.  An empty, but
+    non-null node is called "nil".
+    """
+
+    # BaseTree is abstract, no need to complain about not implemented abstract
+    # methods
+    # pylint: disable-msg=W0223
+
+    def __init__(self, node=None):
+        """
+        Create a new node from an existing node does nothing for BaseTree
+        as there are no fields other than the children list, which cannot
+        be copied as the children are not considered part of this node.
+        """
+
+        Tree.__init__(self)
+        self.children = []
+        self.parent = None
+        self.childIndex = 0
+
+
+    def getChild(self, i):
+        try:
+            return self.children[i]
+        except IndexError:
+            return None
+
+
+    def getChildren(self):
+        """@brief Get the children internal List
+
+        Note that if you directly mess with
+        the list, do so at your own risk.
+        """
+
+        # FIXME: mark as deprecated
+        return self.children
+
+
+    def getFirstChildWithType(self, treeType):
+        for child in self.children:
+            if child.getType() == treeType:
+                return child
+
+        return None
+
+
+    def getChildCount(self):
+        return len(self.children)
+
+
+    def addChild(self, childTree):
+        """Add t as child of this node.
+
+        Warning: if t has no children, but child does
+        and child isNil then this routine moves children to t via
+        t.children = child.children; i.e., without copying the array.
+        """
+
+        # this implementation is much simpler and probably less efficient
+        # than the mumbo-jumbo that Ter did for the Java runtime.
+
+        if childTree is None:
+            return
+
+        if childTree.isNil():
+            # t is an empty node possibly with children
+
+            if self.children is childTree.children:
+                raise ValueError("attempt to add child list to itself")
+
+            # fix parent pointer and childIndex for new children
+            for idx, child in enumerate(childTree.children):
+                child.parent = self
+                child.childIndex = len(self.children) + idx
+
+            self.children += childTree.children
+
+        else:
+            # child is not nil (don't care about children)
+            self.children.append(childTree)
+            childTree.parent = self
+            childTree.childIndex = len(self.children) - 1
+
+
+    def addChildren(self, children):
+        """Add all elements of kids list as children of this node"""
+
+        self.children += children
+
+
+    def setChild(self, i, t):
+        if t is None:
+            return
+
+        if t.isNil():
+            raise ValueError("Can't set single child to a list")
+
+        self.children[i] = t
+        t.parent = self
+        t.childIndex = i
+
+
+    def deleteChild(self, i):
+        killed = self.children[i]
+
+        del self.children[i]
+
+        # walk rest and decrement their child indexes
+        for idx, child in enumerate(self.children[i:]):
+            child.childIndex = i + idx
+
+        return killed
+
+
+    def replaceChildren(self, startChildIndex, stopChildIndex, newTree):
+        """
+        Delete children from start to stop and replace with t even if t is
+        a list (nil-root tree).  num of children can increase or decrease.
+        For huge child lists, inserting children can force walking rest of
+        children to set their childindex; could be slow.
+        """
+
+        if (startChildIndex >= len(self.children)
+            or stopChildIndex >= len(self.children)
+            ):
+            raise IndexError("indexes invalid")
+
+        replacingHowMany = stopChildIndex - startChildIndex + 1
+
+        # normalize to a list of children to add: newChildren
+        if newTree.isNil():
+            newChildren = newTree.children
+
+        else:
+            newChildren = [newTree]
+
+        replacingWithHowMany = len(newChildren)
+        delta = replacingHowMany - replacingWithHowMany
+
+
+        if delta == 0:
+            # if same number of nodes, do direct replace
+            for idx, child in enumerate(newChildren):
+                self.children[idx + startChildIndex] = child
+                child.parent = self
+                child.childIndex = idx + startChildIndex
+
+        else:
+            # length of children changes...
+
+            # ...delete replaced segment...
+            del self.children[startChildIndex:stopChildIndex+1]
+
+            # ...insert new segment...
+            self.children[startChildIndex:startChildIndex] = newChildren
+
+            # ...and fix indeces
+            self.freshenParentAndChildIndexes(startChildIndex)
+
+
+    def isNil(self):
+        return False
+
+
+    def freshenParentAndChildIndexes(self, offset=0):
+        for idx, child in enumerate(self.children[offset:]):
+            child.childIndex = idx + offset
+            child.parent = self
+
+
+    def sanityCheckParentAndChildIndexes(self, parent=None, i=-1):
+        if parent != self.parent:
+            raise ValueError(
+                "parents don't match; expected %r found %r"
+                % (parent, self.parent)
+                )
+
+        if i != self.childIndex:
+            raise ValueError(
+                "child indexes don't match; expected %d found %d"
+                % (i, self.childIndex)
+                )
+
+        for idx, child in enumerate(self.children):
+            child.sanityCheckParentAndChildIndexes(self, idx)
+
+
+    def getChildIndex(self):
+        """BaseTree doesn't track child indexes."""
+
+        return 0
+
+
+    def setChildIndex(self, index):
+        """BaseTree doesn't track child indexes."""
+
+        pass
+
+
+    def getParent(self):
+        """BaseTree doesn't track parent pointers."""
+
+        return None
+
+    def setParent(self, t):
+        """BaseTree doesn't track parent pointers."""
+
+        pass
+
+
+    def hasAncestor(self, ttype):
+        """Walk upwards looking for ancestor with this token type."""
+        return self.getAncestor(ttype) is not None
+
+    def getAncestor(self, ttype):
+        """Walk upwards and get first ancestor with this token type."""
+        t = self.getParent()
+        while t is not None:
+            if t.getType() == ttype:
+                return t
+            t = t.getParent()
+
+        return None
+
+    def getAncestors(self):
+        """Return a list of all ancestors of this node.
+
+        The first node of list is the root and the last is the parent of
+        this node.
+        """
+        if selfgetParent() is None:
+            return None
+
+        ancestors = []
+        t = self.getParent()
+        while t is not None:
+            ancestors.insert(0, t) # insert at start
+            t = t.getParent()
+
+        return ancestors
+
+
+    def toStringTree(self):
+        """Print out a whole tree not just a node"""
+
+        if len(self.children) == 0:
+            return self.toString()
+
+        buf = []
+        if not self.isNil():
+            buf.append('(')
+            buf.append(self.toString())
+            buf.append(' ')
+
+        for i, child in enumerate(self.children):
+            if i > 0:
+                buf.append(' ')
+            buf.append(child.toStringTree())
+
+        if not self.isNil():
+            buf.append(')')
+
+        return ''.join(buf)
+
+
+    def getLine(self):
+        return 0
+
+
+    def getCharPositionInLine(self):
+        return 0
+
+
+    def toString(self):
+        """Override to say how a node (not a tree) should look as text"""
+
+        raise NotImplementedError
+
+
+
+class BaseTreeAdaptor(TreeAdaptor):
+    """
+    @brief A TreeAdaptor that works with any Tree implementation.
+    """
+
+    # BaseTreeAdaptor is abstract, no need to complain about not implemented
+    # abstract methods
+    # pylint: disable-msg=W0223
+
+    def nil(self):
+        return self.createWithPayload(None)
+
+
+    def errorNode(self, input, start, stop, exc):
+        """
+        create tree node that holds the start and stop tokens associated
+        with an error.
+
+        If you specify your own kind of tree nodes, you will likely have to
+        override this method. CommonTree returns Token.INVALID_TOKEN_TYPE
+        if no token payload but you might have to set token type for diff
+        node type.
+
+        You don't have to subclass CommonErrorNode; you will likely need to
+        subclass your own tree node class to avoid class cast exception.
+        """
+
+        return CommonErrorNode(input, start, stop, exc)
+
+
+    def isNil(self, tree):
+        return tree.isNil()
+
+
+    def dupTree(self, t, parent=None):
+        """
+        This is generic in the sense that it will work with any kind of
+        tree (not just Tree interface).  It invokes the adaptor routines
+        not the tree node routines to do the construction.
+        """
+
+        if t is None:
+            return None
+
+        newTree = self.dupNode(t)
+
+        # ensure new subtree root has parent/child index set
+
+        # same index in new tree
+        self.setChildIndex(newTree, self.getChildIndex(t))
+
+        self.setParent(newTree, parent)
+
+        for i in range(self.getChildCount(t)):
+            child = self.getChild(t, i)
+            newSubTree = self.dupTree(child, t)
+            self.addChild(newTree, newSubTree)
+
+        return newTree
+
+
+    def addChild(self, tree, child):
+        """
+        Add a child to the tree t.  If child is a flat tree (a list), make all
+        in list children of t.  Warning: if t has no children, but child does
+        and child isNil then you can decide it is ok to move children to t via
+        t.children = child.children; i.e., without copying the array.  Just
+        make sure that this is consistent with have the user will build
+        ASTs.
+        """
+
+        #if isinstance(child, Token):
+        #    child = self.createWithPayload(child)
+
+        if tree is not None and child is not None:
+            tree.addChild(child)
+
+
+    def becomeRoot(self, newRoot, oldRoot):
+        """
+        If oldRoot is a nil root, just copy or move the children to newRoot.
+        If not a nil root, make oldRoot a child of newRoot.
+
+          old=^(nil a b c), new=r yields ^(r a b c)
+          old=^(a b c), new=r yields ^(r ^(a b c))
+
+        If newRoot is a nil-rooted single child tree, use the single
+        child as the new root node.
+
+          old=^(nil a b c), new=^(nil r) yields ^(r a b c)
+          old=^(a b c), new=^(nil r) yields ^(r ^(a b c))
+
+        If oldRoot was null, it's ok, just return newRoot (even if isNil).
+
+          old=null, new=r yields r
+          old=null, new=^(nil r) yields ^(nil r)
+
+        Return newRoot.  Throw an exception if newRoot is not a
+        simple node or nil root with a single child node--it must be a root
+        node.  If newRoot is ^(nil x) return x as newRoot.
+
+        Be advised that it's ok for newRoot to point at oldRoot's
+        children; i.e., you don't have to copy the list.  We are
+        constructing these nodes so we should have this control for
+        efficiency.
+        """
+
+        if isinstance(newRoot, Token):
+            newRoot = self.create(newRoot)
+
+        if oldRoot is None:
+            return newRoot
+
+        if not isinstance(newRoot, CommonTree):
+            newRoot = self.createWithPayload(newRoot)
+
+        # handle ^(nil real-node)
+        if newRoot.isNil():
+            nc = newRoot.getChildCount()
+            if nc == 1:
+                newRoot = newRoot.getChild(0)
+
+            elif nc > 1:
+                # TODO: make tree run time exceptions hierarchy
+                raise RuntimeError("more than one node as root")
+
+        # add oldRoot to newRoot; addChild takes care of case where oldRoot
+        # is a flat list (i.e., nil-rooted tree).  All children of oldRoot
+        # are added to newRoot.
+        newRoot.addChild(oldRoot)
+        return newRoot
+
+
+    def rulePostProcessing(self, root):
+        """Transform ^(nil x) to x and nil to null"""
+
+        if root is not None and root.isNil():
+            if root.getChildCount() == 0:
+                root = None
+
+            elif root.getChildCount() == 1:
+                root = root.getChild(0)
+                # whoever invokes rule will set parent and child index
+                root.setParent(None)
+                root.setChildIndex(-1)
+
+        return root
+
+
+    def createFromToken(self, tokenType, fromToken, text=None):
+        if fromToken is None:
+            return self.createFromType(tokenType, text)
+
+        assert isinstance(tokenType, (int, long)), type(tokenType).__name__
+        assert isinstance(fromToken, Token), type(fromToken).__name__
+        assert text is None or isinstance(text, basestring), type(text).__name__
+
+        fromToken = self.createToken(fromToken)
+        fromToken.type = tokenType
+        if text is not None:
+            fromToken.text = text
+        t = self.createWithPayload(fromToken)
+        return t
+
+
+    def createFromType(self, tokenType, text):
+        assert isinstance(tokenType, (int, long)), type(tokenType).__name__
+        assert isinstance(text, basestring) or text is None, type(text).__name__
+
+        fromToken = self.createToken(tokenType=tokenType, text=text)
+        t = self.createWithPayload(fromToken)
+        return t
+
+
+    def getType(self, t):
+        return t.getType()
+
+
+    def setType(self, t, type):
+        raise RuntimeError("don't know enough about Tree node")
+
+
+    def getText(self, t):
+        return t.getText()
+
+
+    def setText(self, t, text):
+        raise RuntimeError("don't know enough about Tree node")
+
+
+    def getChild(self, t, i):
+        return t.getChild(i)
+
+
+    def setChild(self, t, i, child):
+        t.setChild(i, child)
+
+
+    def deleteChild(self, t, i):
+        return t.deleteChild(i)
+
+
+    def getChildCount(self, t):
+        return t.getChildCount()
+
+
+    def getUniqueID(self, node):
+        return hash(node)
+
+
+    def createToken(self, fromToken=None, tokenType=None, text=None):
+        """
+        Tell me how to create a token for use with imaginary token nodes.
+        For example, there is probably no input symbol associated with imaginary
+        token DECL, but you need to create it as a payload or whatever for
+        the DECL node as in ^(DECL type ID).
+
+        If you care what the token payload objects' type is, you should
+        override this method and any other createToken variant.
+        """
+
+        raise NotImplementedError
+
+
+############################################################################
+#
+# common tree implementation
+#
+# Tree
+# \- BaseTree
+#    \- CommonTree
+#       \- CommonErrorNode
+#
+# TreeAdaptor
+# \- BaseTreeAdaptor
+#    \- CommonTreeAdaptor
+#
+############################################################################
+
+
+class CommonTree(BaseTree):
+    """@brief A tree node that is wrapper for a Token object.
+
+    After 3.0 release
+    while building tree rewrite stuff, it became clear that computing
+    parent and child index is very difficult and cumbersome.  Better to
+    spend the space in every tree node.  If you don't want these extra
+    fields, it's easy to cut them out in your own BaseTree subclass.
+
+    """
+
+    def __init__(self, payload):
+        BaseTree.__init__(self)
+
+        # What token indexes bracket all tokens associated with this node
+        # and below?
+        self.startIndex = -1
+        self.stopIndex = -1
+
+        # Who is the parent node of this node; if null, implies node is root
+        self.parent = None
+
+        # What index is this node in the child list? Range: 0..n-1
+        self.childIndex = -1
+
+        # A single token is the payload
+        if payload is None:
+            self.token = None
+
+        elif isinstance(payload, CommonTree):
+            self.token = payload.token
+            self.startIndex = payload.startIndex
+            self.stopIndex = payload.stopIndex
+
+        elif payload is None or isinstance(payload, Token):
+            self.token = payload
+
+        else:
+            raise TypeError(type(payload).__name__)
+
+
+
+    def getToken(self):
+        return self.token
+
+
+    def dupNode(self):
+        return CommonTree(self)
+
+
+    def isNil(self):
+        return self.token is None
+
+
+    def getType(self):
+        if self.token is None:
+            return INVALID_TOKEN_TYPE
+
+        return self.token.getType()
+
+    type = property(getType)
+
+
+    def getText(self):
+        if self.token is None:
+            return None
+
+        return self.token.text
+
+    text = property(getText)
+
+
+    def getLine(self):
+        if self.token is None or self.token.getLine() == 0:
+            if self.getChildCount():
+                return self.getChild(0).getLine()
+            else:
+                return 0
+
+        return self.token.getLine()
+
+    line = property(getLine)
+
+
+    def getCharPositionInLine(self):
+        if self.token is None or self.token.getCharPositionInLine() == -1:
+            if self.getChildCount():
+                return self.getChild(0).getCharPositionInLine()
+            else:
+                return 0
+
+        else:
+            return self.token.getCharPositionInLine()
+
+    charPositionInLine = property(getCharPositionInLine)
+
+
+    def getTokenStartIndex(self):
+        if self.startIndex == -1 and self.token is not None:
+            return self.token.getTokenIndex()
+
+        return self.startIndex
+
+    def setTokenStartIndex(self, index):
+        self.startIndex = index
+
+    tokenStartIndex = property(getTokenStartIndex, setTokenStartIndex)
+
+
+    def getTokenStopIndex(self):
+        if self.stopIndex == -1 and self.token is not None:
+            return self.token.getTokenIndex()
+
+        return self.stopIndex
+
+    def setTokenStopIndex(self, index):
+        self.stopIndex = index
+
+    tokenStopIndex = property(getTokenStopIndex, setTokenStopIndex)
+
+
+    def setUnknownTokenBoundaries(self):
+        """For every node in this subtree, make sure it's start/stop token's
+        are set.  Walk depth first, visit bottom up.  Only updates nodes
+        with at least one token index < 0.
+        """
+
+        if self.children is None:
+            if self.startIndex < 0 or self.stopIndex < 0:
+                self.startIndex = self.stopIndex = self.token.getTokenIndex()
+
+            return
+
+        for child in self.children:
+            child.setUnknownTokenBoundaries()
+
+        if self.startIndex >= 0 and self.stopIndex >= 0:
+            # already set
+            return
+
+        if self.children:
+            firstChild = self.children[0]
+            lastChild = self.children[-1]
+            self.startIndex = firstChild.getTokenStartIndex()
+            self.stopIndex = lastChild.getTokenStopIndex()
+
+
+    def getChildIndex(self):
+        #FIXME: mark as deprecated
+        return self.childIndex
+
+
+    def setChildIndex(self, idx):
+        #FIXME: mark as deprecated
+        self.childIndex = idx
+
+
+    def getParent(self):
+        #FIXME: mark as deprecated
+        return self.parent
+
+
+    def setParent(self, t):
+        #FIXME: mark as deprecated
+        self.parent = t
+
+
+    def toString(self):
+        if self.isNil():
+            return "nil"
+
+        if self.getType() == INVALID_TOKEN_TYPE:
+            return "<errornode>"
+
+        return self.token.text
+
+    __str__ = toString
+
+
+
+    def toStringTree(self):
+        if not self.children:
+            return self.toString()
+
+        ret = ''
+        if not self.isNil():
+            ret += '(%s ' % (self.toString())
+
+        ret += ' '.join([child.toStringTree() for child in self.children])
+
+        if not self.isNil():
+            ret += ')'
+
+        return ret
+
+
+INVALID_NODE = CommonTree(INVALID_TOKEN)
+
+
+class CommonErrorNode(CommonTree):
+    """A node representing erroneous token range in token stream"""
+
+    def __init__(self, input, start, stop, exc):
+        CommonTree.__init__(self, None)
+
+        if (stop is None or
+            (stop.getTokenIndex() < start.getTokenIndex() and
+             stop.getType() != EOF
+             )
+            ):
+            # sometimes resync does not consume a token (when LT(1) is
+            # in follow set.  So, stop will be 1 to left to start. adjust.
+            # Also handle case where start is the first token and no token
+            # is consumed during recovery; LT(-1) will return null.
+            stop = start
+
+        self.input = input
+        self.start = start
+        self.stop = stop
+        self.trappedException = exc
+
+
+    def isNil(self):
+        return False
+
+
+    def getType(self):
+        return INVALID_TOKEN_TYPE
+
+
+    def getText(self):
+        if isinstance(self.start, Token):
+            i = self.start.getTokenIndex()
+            j = self.stop.getTokenIndex()
+            if self.stop.getType() == EOF:
+                j = self.input.size()
+
+            badText = self.input.toString(i, j)
+
+        elif isinstance(self.start, Tree):
+            badText = self.input.toString(self.start, self.stop)
+
+        else:
+            # people should subclass if they alter the tree type so this
+            # next one is for sure correct.
+            badText = "<unknown>"
+
+        return badText
+
+
+    def toString(self):
+        if isinstance(self.trappedException, MissingTokenException):
+            return ("<missing type: "
+                    + str(self.trappedException.getMissingType())
+                    + ">")
+
+        elif isinstance(self.trappedException, UnwantedTokenException):
+            return ("<extraneous: "
+                    + str(self.trappedException.getUnexpectedToken())
+                    + ", resync=" + self.getText() + ">")
+
+        elif isinstance(self.trappedException, MismatchedTokenException):
+            return ("<mismatched token: "
+                    + str(self.trappedException.token)
+                    + ", resync=" + self.getText() + ">")
+
+        elif isinstance(self.trappedException, NoViableAltException):
+            return ("<unexpected: "
+                    + str(self.trappedException.token)
+                    + ", resync=" + self.getText() + ">")
+
+        return "<error: "+self.getText()+">"
+
+
+class CommonTreeAdaptor(BaseTreeAdaptor):
+    """
+    @brief A TreeAdaptor that works with any Tree implementation.
+
+    It provides
+    really just factory methods; all the work is done by BaseTreeAdaptor.
+    If you would like to have different tokens created than ClassicToken
+    objects, you need to override this and then set the parser tree adaptor to
+    use your subclass.
+
+    To get your parser to build nodes of a different type, override
+    create(Token), errorNode(), and to be safe, YourTreeClass.dupNode().
+    dupNode is called to duplicate nodes during rewrite operations.
+    """
+
+    def dupNode(self, treeNode):
+        """
+        Duplicate a node.  This is part of the factory;
+        override if you want another kind of node to be built.
+
+        I could use reflection to prevent having to override this
+        but reflection is slow.
+        """
+
+        if treeNode is None:
+            return None
+
+        return treeNode.dupNode()
+
+
+    def createWithPayload(self, payload):
+        return CommonTree(payload)
+
+
+    def createToken(self, fromToken=None, tokenType=None, text=None):
+        """
+        Tell me how to create a token for use with imaginary token nodes.
+        For example, there is probably no input symbol associated with imaginary
+        token DECL, but you need to create it as a payload or whatever for
+        the DECL node as in ^(DECL type ID).
+
+        If you care what the token payload objects' type is, you should
+        override this method and any other createToken variant.
+        """
+
+        if fromToken is not None:
+            return CommonToken(oldToken=fromToken)
+
+        return CommonToken(type=tokenType, text=text)
+
+
+    def setTokenBoundaries(self, t, startToken, stopToken):
+        """
+        Track start/stop token for subtree root created for a rule.
+        Only works with Tree nodes.  For rules that match nothing,
+        seems like this will yield start=i and stop=i-1 in a nil node.
+        Might be useful info so I'll not force to be i..i.
+        """
+
+        if t is None:
+            return
+
+        start = 0
+        stop = 0
+
+        if startToken is not None:
+            start = startToken.index
+
+        if stopToken is not None:
+            stop = stopToken.index
+
+        t.setTokenStartIndex(start)
+        t.setTokenStopIndex(stop)
+
+
+    def getTokenStartIndex(self, t):
+        if t is None:
+            return -1
+        return t.getTokenStartIndex()
+
+
+    def getTokenStopIndex(self, t):
+        if t is None:
+            return -1
+        return t.getTokenStopIndex()
+
+
+    def getText(self, t):
+        if t is None:
+            return None
+        return t.getText()
+
+
+    def getType(self, t):
+        if t is None:
+            return INVALID_TOKEN_TYPE
+
+        return t.getType()
+
+
+    def getToken(self, t):
+        """
+        What is the Token associated with this node?  If
+        you are not using CommonTree, then you must
+        override this in your own adaptor.
+        """
+
+        if isinstance(t, CommonTree):
+            return t.getToken()
+
+        return None # no idea what to do
+
+
+    def getChild(self, t, i):
+        if t is None:
+            return None
+        return t.getChild(i)
+
+
+    def getChildCount(self, t):
+        if t is None:
+            return 0
+        return t.getChildCount()
+
+
+    def getParent(self, t):
+        return t.getParent()
+
+
+    def setParent(self, t, parent):
+        t.setParent(parent)
+
+
+    def getChildIndex(self, t):
+        if t is None:
+            return 0
+        return t.getChildIndex()
+
+
+    def setChildIndex(self, t, index):
+        t.setChildIndex(index)
+
+
+    def replaceChildren(self, parent, startChildIndex, stopChildIndex, t):
+        if parent is not None:
+            parent.replaceChildren(startChildIndex, stopChildIndex, t)
+
+
+############################################################################
+#
+# streams
+#
+# TreeNodeStream
+# \- BaseTree
+#    \- CommonTree
+#
+# TreeAdaptor
+# \- BaseTreeAdaptor
+#    \- CommonTreeAdaptor
+#
+############################################################################
+
+
+
+class TreeNodeStream(IntStream):
+    """@brief A stream of tree nodes
+
+    It accessing nodes from a tree of some kind.
+    """
+
+    # TreeNodeStream is abstract, no need to complain about not implemented
+    # abstract methods
+    # pylint: disable-msg=W0223
+
+    def get(self, i):
+        """Get a tree node at an absolute index i; 0..n-1.
+        If you don't want to buffer up nodes, then this method makes no
+        sense for you.
+        """
+
+        raise NotImplementedError
+
+
+    def LT(self, k):
+        """
+        Get tree node at current input pointer + i ahead where i=1 is next node.
+        i<0 indicates nodes in the past.  So LT(-1) is previous node, but
+        implementations are not required to provide results for k < -1.
+        LT(0) is undefined.  For i>=n, return null.
+        Return null for LT(0) and any index that results in an absolute address
+        that is negative.
+
+        This is analogus to the LT() method of the TokenStream, but this
+        returns a tree node instead of a token.  Makes code gen identical
+        for both parser and tree grammars. :)
+        """
+
+        raise NotImplementedError
+
+
+    def getTreeSource(self):
+        """
+        Where is this stream pulling nodes from?  This is not the name, but
+        the object that provides node objects.
+        """
+
+        raise NotImplementedError
+
+
+    def getTokenStream(self):
+        """
+        If the tree associated with this stream was created from a TokenStream,
+        you can specify it here.  Used to do rule $text attribute in tree
+        parser.  Optional unless you use tree parser rule text attribute
+        or output=template and rewrite=true options.
+        """
+
+        raise NotImplementedError
+
+
+    def getTreeAdaptor(self):
+        """
+        What adaptor can tell me how to interpret/navigate nodes and
+        trees.  E.g., get text of a node.
+        """
+
+        raise NotImplementedError
+
+
+    def setUniqueNavigationNodes(self, uniqueNavigationNodes):
+        """
+        As we flatten the tree, we use UP, DOWN nodes to represent
+        the tree structure.  When debugging we need unique nodes
+        so we have to instantiate new ones.  When doing normal tree
+        parsing, it's slow and a waste of memory to create unique
+        navigation nodes.  Default should be false;
+        """
+
+        raise NotImplementedError
+
+
+    def reset(self):
+        """
+        Reset the tree node stream in such a way that it acts like
+        a freshly constructed stream.
+        """
+
+        raise NotImplementedError
+
+
+    def toString(self, start, stop):
+        """
+        Return the text of all nodes from start to stop, inclusive.
+        If the stream does not buffer all the nodes then it can still
+        walk recursively from start until stop.  You can always return
+        null or "" too, but users should not access $ruleLabel.text in
+        an action of course in that case.
+        """
+
+        raise NotImplementedError
+
+
+    # REWRITING TREES (used by tree parser)
+    def replaceChildren(self, parent, startChildIndex, stopChildIndex, t):
+        """
+ 	Replace from start to stop child index of parent with t, which might
+        be a list.  Number of children may be different
+        after this call.  The stream is notified because it is walking the
+        tree and might need to know you are monkeying with the underlying
+        tree.  Also, it might be able to modify the node stream to avoid
+        restreaming for future phases.
+
+        If parent is null, don't do anything; must be at root of overall tree.
+        Can't replace whatever points to the parent externally.  Do nothing.
+        """
+
+        raise NotImplementedError
+
+
+class CommonTreeNodeStream(TreeNodeStream):
+    """@brief A buffered stream of tree nodes.
+
+    Nodes can be from a tree of ANY kind.
+
+    This node stream sucks all nodes out of the tree specified in
+    the constructor during construction and makes pointers into
+    the tree using an array of Object pointers. The stream necessarily
+    includes pointers to DOWN and UP and EOF nodes.
+
+    This stream knows how to mark/release for backtracking.
+
+    This stream is most suitable for tree interpreters that need to
+    jump around a lot or for tree parsers requiring speed (at cost of memory).
+    There is some duplicated functionality here with UnBufferedTreeNodeStream
+    but just in bookkeeping, not tree walking etc...
+
+    @see UnBufferedTreeNodeStream
+    """
+
+    def __init__(self, *args):
+        TreeNodeStream.__init__(self)
+
+        if len(args) == 1:
+            adaptor = CommonTreeAdaptor()
+            tree = args[0]
+
+            nodes = None
+            down = None
+            up = None
+            eof = None
+
+        elif len(args) == 2:
+            adaptor = args[0]
+            tree = args[1]
+
+            nodes = None
+            down = None
+            up = None
+            eof = None
+
+        elif len(args) == 3:
+            parent = args[0]
+            start = args[1]
+            stop = args[2]
+
+            adaptor = parent.adaptor
+            tree = parent.root
+
+            nodes = parent.nodes[start:stop]
+            down = parent.down
+            up = parent.up
+            eof = parent.eof
+
+        else:
+            raise TypeError("Invalid arguments")
+
+        # all these navigation nodes are shared and hence they
+        # cannot contain any line/column info
+        if down is not None:
+            self.down = down
+        else:
+            self.down = adaptor.createFromType(DOWN, "DOWN")
+
+        if up is not None:
+            self.up = up
+        else:
+            self.up = adaptor.createFromType(UP, "UP")
+
+        if eof is not None:
+            self.eof = eof
+        else:
+            self.eof = adaptor.createFromType(EOF, "EOF")
+
+        # The complete mapping from stream index to tree node.
+        # This buffer includes pointers to DOWN, UP, and EOF nodes.
+        # It is built upon ctor invocation.  The elements are type
+        #  Object as we don't what the trees look like.
+
+        # Load upon first need of the buffer so we can set token types
+        # of interest for reverseIndexing.  Slows us down a wee bit to
+        # do all of the if p==-1 testing everywhere though.
+        if nodes is not None:
+            self.nodes = nodes
+        else:
+            self.nodes = []
+
+        # Pull nodes from which tree?
+        self.root = tree
+
+        # IF this tree (root) was created from a token stream, track it.
+        self.tokens = None
+
+        # What tree adaptor was used to build these trees
+        self.adaptor = adaptor
+
+        # Reuse same DOWN, UP navigation nodes unless this is true
+        self.uniqueNavigationNodes = False
+
+        # The index into the nodes list of the current node (next node
+        # to consume).  If -1, nodes array not filled yet.
+        self.p = -1
+
+        # Track the last mark() call result value for use in rewind().
+        self.lastMarker = None
+
+        # Stack of indexes used for push/pop calls
+        self.calls = []
+
+
+    def __iter__(self):
+        return TreeIterator(self.root, self.adaptor)
+
+
+    def fillBuffer(self):
+        """Walk tree with depth-first-search and fill nodes buffer.
+        Don't do DOWN, UP nodes if its a list (t is isNil).
+        """
+
+        self._fillBuffer(self.root)
+        self.p = 0 # buffer of nodes intialized now
+
+
+    def _fillBuffer(self, t):
+        nil = self.adaptor.isNil(t)
+
+        if not nil:
+            self.nodes.append(t) # add this node
+
+        # add DOWN node if t has children
+        n = self.adaptor.getChildCount(t)
+        if not nil and n > 0:
+            self.addNavigationNode(DOWN)
+
+        # and now add all its children
+        for c in range(n):
+            self._fillBuffer(self.adaptor.getChild(t, c))
+
+        # add UP node if t has children
+        if not nil and n > 0:
+            self.addNavigationNode(UP)
+
+
+    def getNodeIndex(self, node):
+        """What is the stream index for node? 0..n-1
+        Return -1 if node not found.
+        """
+
+        if self.p == -1:
+            self.fillBuffer()
+
+        for i, t in enumerate(self.nodes):
+            if t == node:
+                return i
+
+        return -1
+
+
+    def addNavigationNode(self, ttype):
+        """
+        As we flatten the tree, we use UP, DOWN nodes to represent
+        the tree structure.  When debugging we need unique nodes
+        so instantiate new ones when uniqueNavigationNodes is true.
+        """
+
+        navNode = None
+
+        if ttype == DOWN:
+            if self.hasUniqueNavigationNodes():
+                navNode = self.adaptor.createFromType(DOWN, "DOWN")
+
+            else:
+                navNode = self.down
+
+        else:
+            if self.hasUniqueNavigationNodes():
+                navNode = self.adaptor.createFromType(UP, "UP")
+
+            else:
+                navNode = self.up
+
+        self.nodes.append(navNode)
+
+
+    def get(self, i):
+        if self.p == -1:
+            self.fillBuffer()
+
+        return self.nodes[i]
+
+
+    def LT(self, k):
+        if self.p == -1:
+            self.fillBuffer()
+
+        if k == 0:
+            return None
+
+        if k < 0:
+            return self.LB(-k)
+
+        if self.p + k - 1 >= len(self.nodes):
+            return self.eof
+
+        return self.nodes[self.p + k - 1]
+
+
+    def getCurrentSymbol(self):
+        return self.LT(1)
+
+
+    def LB(self, k):
+        """Look backwards k nodes"""
+
+        if k == 0:
+            return None
+
+        if self.p - k < 0:
+            return None
+
+        return self.nodes[self.p - k]
+
+
+    def isEOF(self, obj):
+        return self.adaptor.getType(obj) == EOF
+
+
+    def getTreeSource(self):
+        return self.root
+
+
+    def getSourceName(self):
+        return self.getTokenStream().getSourceName()
+
+
+    def getTokenStream(self):
+        return self.tokens
+
+
+    def setTokenStream(self, tokens):
+        self.tokens = tokens
+
+
+    def getTreeAdaptor(self):
+        return self.adaptor
+
+
+    def hasUniqueNavigationNodes(self):
+        return self.uniqueNavigationNodes
+
+
+    def setUniqueNavigationNodes(self, uniqueNavigationNodes):
+        self.uniqueNavigationNodes = uniqueNavigationNodes
+
+
+    def consume(self):
+        if self.p == -1:
+            self.fillBuffer()
+
+        self.p += 1
+
+
+    def LA(self, i):
+        return self.adaptor.getType(self.LT(i))
+
+
+    def mark(self):
+        if self.p == -1:
+            self.fillBuffer()
+
+
+        self.lastMarker = self.index()
+        return self.lastMarker
+
+
+    def release(self, marker=None):
+        # no resources to release
+
+        pass
+
+
+    def index(self):
+        return self.p
+
+
+    def rewind(self, marker=None):
+        if marker is None:
+            marker = self.lastMarker
+
+        self.seek(marker)
+
+
+    def seek(self, index):
+        if self.p == -1:
+            self.fillBuffer()
+
+        self.p = index
+
+
+    def push(self, index):
+        """
+        Make stream jump to a new location, saving old location.
+        Switch back with pop().
+        """
+
+        self.calls.append(self.p) # save current index
+        self.seek(index)
+
+
+    def pop(self):
+        """
+        Seek back to previous index saved during last push() call.
+        Return top of stack (return index).
+        """
+
+        ret = self.calls.pop(-1)
+        self.seek(ret)
+        return ret
+
+
+    def reset(self):
+        self.p = 0
+        self.lastMarker = 0
+        self.calls = []
+
+
+    def size(self):
+        if self.p == -1:
+            self.fillBuffer()
+
+        return len(self.nodes)
+
+
+    # TREE REWRITE INTERFACE
+
+    def replaceChildren(self, parent, startChildIndex, stopChildIndex, t):
+        if parent is not None:
+            self.adaptor.replaceChildren(
+                parent, startChildIndex, stopChildIndex, t
+                )
+
+
+    def __str__(self):
+        """Used for testing, just return the token type stream"""
+
+        if self.p == -1:
+            self.fillBuffer()
+
+        return ' '.join([str(self.adaptor.getType(node))
+                         for node in self.nodes
+                         ])
+
+
+    def toString(self, start, stop):
+        if start is None or stop is None:
+            return None
+
+        if self.p == -1:
+            self.fillBuffer()
+
+        #System.out.println("stop: "+stop);
+        #if ( start instanceof CommonTree )
+        #    System.out.print("toString: "+((CommonTree)start).getToken()+", ");
+        #else
+        #    System.out.println(start);
+        #if ( stop instanceof CommonTree )
+        #    System.out.println(((CommonTree)stop).getToken());
+        #else
+        #    System.out.println(stop);
+
+        # if we have the token stream, use that to dump text in order
+        if self.tokens is not None:
+            beginTokenIndex = self.adaptor.getTokenStartIndex(start)
+            endTokenIndex = self.adaptor.getTokenStopIndex(stop)
+
+            # if it's a tree, use start/stop index from start node
+            # else use token range from start/stop nodes
+            if self.adaptor.getType(stop) == UP:
+                endTokenIndex = self.adaptor.getTokenStopIndex(start)
+
+            elif self.adaptor.getType(stop) == EOF:
+                endTokenIndex = self.size() -2 # don't use EOF
+
+            return self.tokens.toString(beginTokenIndex, endTokenIndex)
+
+        # walk nodes looking for start
+        i, t = 0, None
+        for i, t in enumerate(self.nodes):
+            if t == start:
+                break
+
+        # now walk until we see stop, filling string buffer with text
+        buf = []
+        t = self.nodes[i]
+        while t != stop:
+            text = self.adaptor.getText(t)
+            if text is None:
+                text = " " + self.adaptor.getType(t)
+
+            buf.append(text)
+            i += 1
+            t = self.nodes[i]
+
+        # include stop node too
+        text = self.adaptor.getText(stop)
+        if text is None:
+            text = " " +self.adaptor.getType(stop)
+
+        buf.append(text)
+
+        return ''.join(buf)
+
+
+    ## iterator interface
+    def __iter__(self):
+        if self.p == -1:
+            self.fillBuffer()
+
+        for node in self.nodes:
+            yield node
+
+
+#############################################################################
+#
+# tree parser
+#
+#############################################################################
+
+class TreeParser(BaseRecognizer):
+    """@brief Baseclass for generated tree parsers.
+
+    A parser for a stream of tree nodes.  "tree grammars" result in a subclass
+    of this.  All the error reporting and recovery is shared with Parser via
+    the BaseRecognizer superclass.
+    """
+
+    def __init__(self, input, state=None):
+        BaseRecognizer.__init__(self, state)
+
+        self.input = None
+        self.setTreeNodeStream(input)
+
+
+    def reset(self):
+        BaseRecognizer.reset(self) # reset all recognizer state variables
+        if self.input is not None:
+            self.input.seek(0) # rewind the input
+
+
+    def setTreeNodeStream(self, input):
+        """Set the input stream"""
+
+        self.input = input
+
+
+    def getTreeNodeStream(self):
+        return self.input
+
+
+    def getSourceName(self):
+        return self.input.getSourceName()
+
+
+    def getCurrentInputSymbol(self, input):
+        return input.LT(1)
+
+
+    def getMissingSymbol(self, input, e, expectedTokenType, follow):
+        tokenText = "<missing " + self.tokenNames[expectedTokenType] + ">"
+        adaptor = input.adaptor
+        return adaptor.createToken(
+            CommonToken(type=expectedTokenType, text=tokenText))
+
+
+    # precompiled regex used by inContext
+    dotdot = ".*[^.]\\.\\.[^.].*"
+    doubleEtc = ".*\\.\\.\\.\\s+\\.\\.\\..*"
+    dotdotPattern = re.compile(dotdot)
+    doubleEtcPattern = re.compile(doubleEtc)
+
+    def inContext(self, context, adaptor=None, tokenName=None, t=None):
+        """Check if current node in input has a context.
+
+        Context means sequence of nodes towards root of tree.  For example,
+        you might say context is "MULT" which means my parent must be MULT.
+        "CLASS VARDEF" says current node must be child of a VARDEF and whose
+        parent is a CLASS node.  You can use "..." to mean zero-or-more nodes.
+        "METHOD ... VARDEF" means my parent is VARDEF and somewhere above
+        that is a METHOD node.  The first node in the context is not
+        necessarily the root.  The context matcher stops matching and returns
+        true when it runs out of context.  There is no way to force the first
+        node to be the root.
+        """
+
+        return _inContext(
+            self.input.getTreeAdaptor(), self.getTokenNames(),
+            self.input.LT(1), context)
+
+    @classmethod
+    def _inContext(cls, adaptor, tokenNames, t, context):
+        """The worker for inContext.
+
+        It's static and full of parameters for testing purposes.
+        """
+
+        if cls.dotdotPattern.match(context):
+            # don't allow "..", must be "..."
+            raise ValueError("invalid syntax: ..")
+
+        if cls.doubleEtcPattern.match(context):
+            # don't allow double "..."
+            raise ValueError("invalid syntax: ... ...")
+
+        # ensure spaces around ...
+        context = context.replace("...", " ... ")
+        context = context.strip()
+        nodes = context.split()
+
+        ni = len(nodes) - 1
+        t = adaptor.getParent(t)
+        while ni >= 0 and t is not None:
+            if nodes[ni] == "...":
+                # walk upwards until we see nodes[ni-1] then continue walking
+                if ni == 0:
+                    # ... at start is no-op
+                    return True
+                goal = nodes[ni-1]
+                ancestor = cls._getAncestor(adaptor, tokenNames, t, goal)
+                if ancestor is None:
+                    return False
+                t = ancestor
+                ni -= 1
+
+            name = tokenNames[adaptor.getType(t)]
+            if name != nodes[ni]:
+                return False
+
+            # advance to parent and to previous element in context node list
+            ni -= 1
+            t = adaptor.getParent(t)
+
+        # at root but more nodes to match
+        if t is None and ni >= 0:
+            return False
+
+        return True
+
+    @staticmethod
+    def _getAncestor(adaptor, tokenNames, t, goal):
+        """Helper for static inContext."""
+        while t is not None:
+            name = tokenNames[adaptor.getType(t)]
+            if name == goal:
+                return t
+            t = adaptor.getParent(t)
+
+        return None
+
+
+    def matchAny(self, ignore): # ignore stream, copy of this.input
+        """
+        Match '.' in tree parser has special meaning.  Skip node or
+        entire tree if node has children.  If children, scan until
+        corresponding UP node.
+        """
+
+        self._state.errorRecovery = False
+
+        look = self.input.LT(1)
+        if self.input.getTreeAdaptor().getChildCount(look) == 0:
+            self.input.consume() # not subtree, consume 1 node and return
+            return
+
+        # current node is a subtree, skip to corresponding UP.
+        # must count nesting level to get right UP
+        level = 0
+        tokenType = self.input.getTreeAdaptor().getType(look)
+        while tokenType != EOF and not (tokenType == UP and level==0):
+            self.input.consume()
+            look = self.input.LT(1)
+            tokenType = self.input.getTreeAdaptor().getType(look)
+            if tokenType == DOWN:
+                level += 1
+
+            elif tokenType == UP:
+                level -= 1
+
+        self.input.consume() # consume UP
+
+
+    def mismatch(self, input, ttype, follow):
+        """
+        We have DOWN/UP nodes in the stream that have no line info; override.
+        plus we want to alter the exception type. Don't try to recover
+        from tree parser errors inline...
+        """
+
+        raise MismatchedTreeNodeException(ttype, input)
+
+
+    def getErrorHeader(self, e):
+        """
+        Prefix error message with the grammar name because message is
+        always intended for the programmer because the parser built
+        the input tree not the user.
+        """
+
+        return (self.getGrammarFileName() +
+                ": node from %sline %s:%s"
+                % (['', "after "][e.approximateLineInfo],
+                   e.line,
+                   e.charPositionInLine
+                   )
+                )
+
+    def getErrorMessage(self, e, tokenNames):
+        """
+        Tree parsers parse nodes they usually have a token object as
+        payload. Set the exception token and do the default behavior.
+        """
+
+        if isinstance(self, TreeParser):
+            adaptor = e.input.getTreeAdaptor()
+            e.token = adaptor.getToken(e.node)
+            if e.token is not None: # could be an UP/DOWN node
+                e.token = CommonToken(
+                    type=adaptor.getType(e.node),
+                    text=adaptor.getText(e.node)
+                    )
+
+        return BaseRecognizer.getErrorMessage(self, e, tokenNames)
+
+
+    def traceIn(self, ruleName, ruleIndex):
+        BaseRecognizer.traceIn(self, ruleName, ruleIndex, self.input.LT(1))
+
+
+    def traceOut(self, ruleName, ruleIndex):
+        BaseRecognizer.traceOut(self, ruleName, ruleIndex, self.input.LT(1))
+
+
+#############################################################################
+#
+# tree visitor
+#
+#############################################################################
+
+class TreeVisitor(object):
+    """Do a depth first walk of a tree, applying pre() and post() actions
+    we go.
+    """
+
+    def __init__(self, adaptor=None):
+        if adaptor is not None:
+            self.adaptor = adaptor
+        else:
+            self.adaptor = CommonTreeAdaptor()
+
+    def visit(self, t, pre_action=None, post_action=None):
+        """Visit every node in tree t and trigger an action for each node
+        before/after having visited all of its children.  Bottom up walk.
+        Execute both actions even if t has no children.  Ignore return
+        results from transforming children since they will have altered
+        the child list of this node (their parent).  Return result of
+        applying post action to this node.
+
+        The Python version differs from the Java version by taking two
+        callables 'pre_action' and 'post_action' instead of a class instance
+        that wraps those methods. Those callables must accept a TreeNode as
+        their single argument and return the (potentially transformed or
+        replaced) TreeNode.
+        """
+
+        isNil = self.adaptor.isNil(t)
+        if pre_action is not None and not isNil:
+            # if rewritten, walk children of new t
+            t = pre_action(t)
+
+        idx = 0
+        while idx < self.adaptor.getChildCount(t):
+            child = self.adaptor.getChild(t, idx)
+            self.visit(child, pre_action, post_action)
+            idx += 1
+
+        if post_action is not None and not isNil:
+            t = post_action(t)
+
+        return t
+
+#############################################################################
+#
+# tree iterator
+#
+#############################################################################
+
+class TreeIterator(object):
+    """
+    Return a node stream from a doubly-linked tree whose nodes
+    know what child index they are.
+
+    Emit navigation nodes (DOWN, UP, and EOF) to let show tree structure.
+    """
+
+    def __init__(self, tree, adaptor=None):
+        if adaptor is None:
+            adaptor = CommonTreeAdaptor()
+
+        self.root = tree
+        self.adaptor = adaptor
+
+        self.first_time = True
+        self.tree = tree
+
+        # If we emit UP/DOWN nodes, we need to spit out multiple nodes per
+        # next() call.
+        self.nodes = []
+
+        # navigation nodes to return during walk and at end
+        self.down = adaptor.createFromType(DOWN, "DOWN")
+        self.up = adaptor.createFromType(UP, "UP")
+        self.eof = adaptor.createFromType(EOF, "EOF")
+
+
+    def reset(self):
+        self.first_time = True
+        self.tree = self.root
+        self.nodes = []
+
+
+    def __iter__(self):
+        return self
+
+
+    def has_next(self):
+        if self.first_time:
+            return self.root is not None
+
+        if len(self.nodes) > 0:
+            return True
+
+        if self.tree is None:
+            return False
+
+        if self.adaptor.getChildCount(self.tree) > 0:
+            return True
+
+        # back at root?
+        return self.adaptor.getParent(self.tree) is not None
+
+
+    def next(self):
+        if not self.has_next():
+            raise StopIteration
+
+        if self.first_time:
+            # initial condition
+            self.first_time = False
+            if self.adaptor.getChildCount(self.tree) == 0:
+                # single node tree (special)
+                self.nodes.append(self.eof)
+                return self.tree
+
+            return self.tree
+
+        # if any queued up, use those first
+        if len(self.nodes) > 0:
+            return self.nodes.pop(0)
+
+        # no nodes left?
+        if self.tree is None:
+            return self.eof
+
+        # next node will be child 0 if any children
+        if self.adaptor.getChildCount(self.tree) > 0:
+            self.tree = self.adaptor.getChild(self.tree, 0)
+            # real node is next after DOWN
+            self.nodes.append(self.tree)
+            return self.down
+
+        # if no children, look for next sibling of tree or ancestor
+        parent = self.adaptor.getParent(self.tree)
+        # while we're out of siblings, keep popping back up towards root
+        while (parent is not None
+               and self.adaptor.getChildIndex(self.tree)+1 >= self.adaptor.getChildCount(parent)):
+            # we're moving back up
+            self.nodes.append(self.up)
+            self.tree = parent
+            parent = self.adaptor.getParent(self.tree)
+
+        # no nodes left?
+        if parent is None:
+            self.tree = None # back at root? nothing left then
+            self.nodes.append(self.eof) # add to queue, might have UP nodes in there
+            return self.nodes.pop(0)
+
+        # must have found a node with an unvisited sibling
+        # move to it and return it
+        nextSiblingIndex = self.adaptor.getChildIndex(self.tree) + 1
+        self.tree = self.adaptor.getChild(parent, nextSiblingIndex)
+        self.nodes.append(self.tree) # add to queue, might have UP nodes in there
+        return self.nodes.pop(0)
+
+
+
+#############################################################################
+#
+# streams for rule rewriting
+#
+#############################################################################
+
+class RewriteRuleElementStream(object):
+    """@brief Internal helper class.
+
+    A generic list of elements tracked in an alternative to be used in
+    a -> rewrite rule.  We need to subclass to fill in the next() method,
+    which returns either an AST node wrapped around a token payload or
+    an existing subtree.
+
+    Once you start next()ing, do not try to add more elements.  It will
+    break the cursor tracking I believe.
+
+    @see org.antlr.runtime.tree.RewriteRuleSubtreeStream
+    @see org.antlr.runtime.tree.RewriteRuleTokenStream
+
+    TODO: add mechanism to detect/puke on modification after reading from
+    stream
+    """
+
+    def __init__(self, adaptor, elementDescription, elements=None):
+        # Cursor 0..n-1.  If singleElement!=null, cursor is 0 until you next(),
+        # which bumps it to 1 meaning no more elements.
+        self.cursor = 0
+
+        # Track single elements w/o creating a list.  Upon 2nd add, alloc list
+        self.singleElement = None
+
+        # The list of tokens or subtrees we are tracking
+        self.elements = None
+
+        # Once a node / subtree has been used in a stream, it must be dup'd
+        # from then on.  Streams are reset after subrules so that the streams
+        # can be reused in future subrules.  So, reset must set a dirty bit.
+        # If dirty, then next() always returns a dup.
+        self.dirty = False
+
+        # The element or stream description; usually has name of the token or
+        # rule reference that this list tracks.  Can include rulename too, but
+        # the exception would track that info.
+        self.elementDescription = elementDescription
+
+        self.adaptor = adaptor
+
+        if isinstance(elements, (list, tuple)):
+            # Create a stream, but feed off an existing list
+            self.singleElement = None
+            self.elements = elements
+
+        else:
+            # Create a stream with one element
+            self.add(elements)
+
+
+    def reset(self):
+        """
+        Reset the condition of this stream so that it appears we have
+        not consumed any of its elements.  Elements themselves are untouched.
+        Once we reset the stream, any future use will need duplicates.  Set
+        the dirty bit.
+        """
+
+        self.cursor = 0
+        self.dirty = True
+
+
+    def add(self, el):
+        if el is None:
+            return
+
+        if self.elements is not None: # if in list, just add
+            self.elements.append(el)
+            return
+
+        if self.singleElement is None: # no elements yet, track w/o list
+            self.singleElement = el
+            return
+
+        # adding 2nd element, move to list
+        self.elements = []
+        self.elements.append(self.singleElement)
+        self.singleElement = None
+        self.elements.append(el)
+
+
+    def nextTree(self):
+        """
+        Return the next element in the stream.  If out of elements, throw
+        an exception unless size()==1.  If size is 1, then return elements[0].
+
+        Return a duplicate node/subtree if stream is out of elements and
+        size==1. If we've already used the element, dup (dirty bit set).
+        """
+
+        if (self.dirty
+            or (self.cursor >= len(self) and len(self) == 1)
+            ):
+            # if out of elements and size is 1, dup
+            el = self._next()
+            return self.dup(el)
+
+        # test size above then fetch
+        el = self._next()
+        return el
+
+
+    def _next(self):
+        """
+        do the work of getting the next element, making sure that it's
+        a tree node or subtree.  Deal with the optimization of single-
+        element list versus list of size > 1.  Throw an exception
+        if the stream is empty or we're out of elements and size>1.
+        protected so you can override in a subclass if necessary.
+        """
+
+        if len(self) == 0:
+            raise RewriteEmptyStreamException(self.elementDescription)
+
+        if self.cursor >= len(self): # out of elements?
+            if len(self) == 1: # if size is 1, it's ok; return and we'll dup
+                return self.toTree(self.singleElement)
+
+            # out of elements and size was not 1, so we can't dup
+            raise RewriteCardinalityException(self.elementDescription)
+
+        # we have elements
+        if self.singleElement is not None:
+            self.cursor += 1 # move cursor even for single element list
+            return self.toTree(self.singleElement)
+
+        # must have more than one in list, pull from elements
+        o = self.toTree(self.elements[self.cursor])
+        self.cursor += 1
+        return o
+
+
+    def dup(self, el):
+        """
+        When constructing trees, sometimes we need to dup a token or AST
+        subtree.  Dup'ing a token means just creating another AST node
+        around it.  For trees, you must call the adaptor.dupTree() unless
+        the element is for a tree root; then it must be a node dup.
+        """
+
+        raise NotImplementedError
+
+
+    def toTree(self, el):
+        """
+        Ensure stream emits trees; tokens must be converted to AST nodes.
+        AST nodes can be passed through unmolested.
+        """
+
+        return el
+
+
+    def hasNext(self):
+        return ( (self.singleElement is not None and self.cursor < 1)
+                 or (self.elements is not None
+                     and self.cursor < len(self.elements)
+                     )
+                 )
+
+
+    def size(self):
+        if self.singleElement is not None:
+            return 1
+
+        if self.elements is not None:
+            return len(self.elements)
+
+        return 0
+
+    __len__ = size
+
+
+    def getDescription(self):
+        """Deprecated. Directly access elementDescription attribute"""
+
+        return self.elementDescription
+
+
+class RewriteRuleTokenStream(RewriteRuleElementStream):
+    """@brief Internal helper class."""
+
+    def toTree(self, el):
+        # Don't convert to a tree unless they explicitly call nextTree.
+        # This way we can do hetero tree nodes in rewrite.
+        return el
+
+
+    def nextNode(self):
+        t = self._next()
+        return self.adaptor.createWithPayload(t)
+
+
+    def nextToken(self):
+        return self._next()
+
+
+    def dup(self, el):
+        raise TypeError("dup can't be called for a token stream.")
+
+
+class RewriteRuleSubtreeStream(RewriteRuleElementStream):
+    """@brief Internal helper class."""
+
+    def nextNode(self):
+        """
+        Treat next element as a single node even if it's a subtree.
+        This is used instead of next() when the result has to be a
+        tree root node.  Also prevents us from duplicating recently-added
+        children; e.g., ^(type ID)+ adds ID to type and then 2nd iteration
+        must dup the type node, but ID has been added.
+
+        Referencing a rule result twice is ok; dup entire tree as
+        we can't be adding trees as root; e.g., expr expr.
+
+        Hideous code duplication here with super.next().  Can't think of
+        a proper way to refactor.  This needs to always call dup node
+        and super.next() doesn't know which to call: dup node or dup tree.
+        """
+
+        if (self.dirty
+            or (self.cursor >= len(self) and len(self) == 1)
+            ):
+            # if out of elements and size is 1, dup (at most a single node
+            # since this is for making root nodes).
+            el = self._next()
+            return self.adaptor.dupNode(el)
+
+        # test size above then fetch
+        el = self._next()
+        while self.adaptor.isNil(el) and self.adaptor.getChildCount(el) == 1:
+            el = self.adaptor.getChild(el, 0)
+
+        # dup just the root (want node here)
+        return self.adaptor.dupNode(el)
+
+
+    def dup(self, el):
+        return self.adaptor.dupTree(el)
+
+
+
+class RewriteRuleNodeStream(RewriteRuleElementStream):
+    """
+    Queues up nodes matched on left side of -> in a tree parser. This is
+    the analog of RewriteRuleTokenStream for normal parsers.
+    """
+
+    def nextNode(self):
+        return self._next()
+
+
+    def toTree(self, el):
+        return self.adaptor.dupNode(el)
+
+
+    def dup(self, el):
+        # we dup every node, so don't have to worry about calling dup; short-
+        #circuited next() so it doesn't call.
+        raise TypeError("dup can't be called for a node stream.")
+
+
+class TreeRuleReturnScope(RuleReturnScope):
+    """
+    This is identical to the ParserRuleReturnScope except that
+    the start property is a tree nodes not Token object
+    when you are parsing trees.  To be generic the tree node types
+    have to be Object.
+    """
+
+    def __init__(self):
+        self.start = None
+        self.tree = None
+
+
+    def getStart(self):
+        return self.start
+
+
+    def getTree(self):
+        return self.tree
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/treewizard.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/treewizard.py
new file mode 100644
index 0000000000000000000000000000000000000000..43d3542d6b723efbb0dfed302cfc12105e011803
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/antlr/antlr-python-runtime-3.4/antlr3/treewizard.py
@@ -0,0 +1,619 @@
+""" @package antlr3.tree
+@brief ANTLR3 runtime package, treewizard module
+
+A utility module to create ASTs at runtime.
+See <http://www.antlr.org/wiki/display/~admin/2007/07/02/Exploring+Concept+of+TreeWizard> for an overview. Note that the API of the Python implementation is slightly different.
+
+"""
+
+# begin[licence]
+#
+# [The "BSD licence"]
+# Copyright (c) 2005-2008 Terence Parr
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# end[licence]
+
+from antlr3.constants import INVALID_TOKEN_TYPE
+from antlr3.tokens import CommonToken
+from antlr3.tree import CommonTree, CommonTreeAdaptor
+
+
+def computeTokenTypes(tokenNames):
+    """
+    Compute a dict that is an inverted index of
+    tokenNames (which maps int token types to names).
+    """
+
+    if tokenNames is None:
+        return {}
+
+    return dict((name, type) for type, name in enumerate(tokenNames))
+
+
+## token types for pattern parser
+EOF = -1
+BEGIN = 1
+END = 2
+ID = 3
+ARG = 4
+PERCENT = 5
+COLON = 6
+DOT = 7
+
+class TreePatternLexer(object):
+    def __init__(self, pattern):
+        ## The tree pattern to lex like "(A B C)"
+        self.pattern = pattern
+
+	## Index into input string
+        self.p = -1
+
+	## Current char
+        self.c = None
+
+	## How long is the pattern in char?
+        self.n = len(pattern)
+
+	## Set when token type is ID or ARG
+        self.sval = None
+
+        self.error = False
+
+        self.consume()
+
+
+    __idStartChar = frozenset(
+        'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_'
+        )
+    __idChar = __idStartChar | frozenset('0123456789')
+
+    def nextToken(self):
+        self.sval = ""
+        while self.c != EOF:
+            if self.c in (' ', '\n', '\r', '\t'):
+                self.consume()
+                continue
+
+            if self.c in self.__idStartChar:
+                self.sval += self.c
+                self.consume()
+                while self.c in self.__idChar:
+                    self.sval += self.c
+                    self.consume()
+
+                return ID
+
+            if self.c == '(':
+                self.consume()
+                return BEGIN
+
+            if self.c == ')':
+                self.consume()
+                return END
+
+            if self.c == '%':
+                self.consume()
+                return PERCENT
+
+            if self.c == ':':
+                self.consume()
+                return COLON
+
+            if self.c == '.':
+                self.consume()
+                return DOT
+
+            if self.c == '[': # grab [x] as a string, returning x
+                self.consume()
+                while self.c != ']':
+                    if self.c == '\\':
+                        self.consume()
+                        if self.c != ']':
+                            self.sval += '\\'
+
+                        self.sval += self.c
+
+                    else:
+                        self.sval += self.c
+
+                    self.consume()
+
+                self.consume()
+                return ARG
+
+            self.consume()
+            self.error = True
+            return EOF
+
+        return EOF
+
+
+    def consume(self):
+        self.p += 1
+        if self.p >= self.n:
+            self.c = EOF
+
+        else:
+            self.c = self.pattern[self.p]
+
+
+class TreePatternParser(object):
+    def __init__(self, tokenizer, wizard, adaptor):
+        self.tokenizer = tokenizer
+        self.wizard = wizard
+        self.adaptor = adaptor
+        self.ttype = tokenizer.nextToken() # kickstart
+
+
+    def pattern(self):
+        if self.ttype == BEGIN:
+            return self.parseTree()
+
+        elif self.ttype == ID:
+            node = self.parseNode()
+            if self.ttype == EOF:
+                return node
+
+            return None # extra junk on end
+
+        return None
+
+
+    def parseTree(self):
+        if self.ttype != BEGIN:
+            return None
+
+        self.ttype = self.tokenizer.nextToken()
+        root = self.parseNode()
+        if root is None:
+            return None
+
+        while self.ttype in (BEGIN, ID, PERCENT, DOT):
+            if self.ttype == BEGIN:
+                subtree = self.parseTree()
+                self.adaptor.addChild(root, subtree)
+
+            else:
+                child = self.parseNode()
+                if child is None:
+                    return None
+
+                self.adaptor.addChild(root, child)
+
+        if self.ttype != END:
+            return None
+
+        self.ttype = self.tokenizer.nextToken()
+        return root
+
+
+    def parseNode(self):
+        # "%label:" prefix
+        label = None
+
+        if self.ttype == PERCENT:
+            self.ttype = self.tokenizer.nextToken()
+            if self.ttype != ID:
+                return None
+
+            label = self.tokenizer.sval
+            self.ttype = self.tokenizer.nextToken()
+            if self.ttype != COLON:
+                return None
+
+            self.ttype = self.tokenizer.nextToken() # move to ID following colon
+
+        # Wildcard?
+        if self.ttype == DOT:
+            self.ttype = self.tokenizer.nextToken()
+            wildcardPayload = CommonToken(0, ".")
+            node = WildcardTreePattern(wildcardPayload)
+            if label is not None:
+                node.label = label
+            return node
+
+        # "ID" or "ID[arg]"
+        if self.ttype != ID:
+            return None
+
+        tokenName = self.tokenizer.sval
+        self.ttype = self.tokenizer.nextToken()
+
+        if tokenName == "nil":
+            return self.adaptor.nil()
+
+        text = tokenName
+        # check for arg
+        arg = None
+        if self.ttype == ARG:
+            arg = self.tokenizer.sval
+            text = arg
+            self.ttype = self.tokenizer.nextToken()
+
+        # create node
+        treeNodeType = self.wizard.getTokenType(tokenName)
+        if treeNodeType == INVALID_TOKEN_TYPE:
+            return None
+
+        node = self.adaptor.createFromType(treeNodeType, text)
+        if label is not None and isinstance(node, TreePattern):
+            node.label = label
+
+        if arg is not None and isinstance(node, TreePattern):
+            node.hasTextArg = True
+
+        return node
+
+
+class TreePattern(CommonTree):
+    """
+    When using %label:TOKENNAME in a tree for parse(), we must
+    track the label.
+    """
+
+    def __init__(self, payload):
+        CommonTree.__init__(self, payload)
+
+        self.label = None
+        self.hasTextArg = None
+
+
+    def toString(self):
+        if self.label is not None:
+            return '%' + self.label + ':' + CommonTree.toString(self)
+
+        else:
+            return CommonTree.toString(self)
+
+
+class WildcardTreePattern(TreePattern):
+    pass
+
+
+class TreePatternTreeAdaptor(CommonTreeAdaptor):
+    """This adaptor creates TreePattern objects for use during scan()"""
+
+    def createWithPayload(self, payload):
+        return TreePattern(payload)
+
+
+class TreeWizard(object):
+    """
+    Build and navigate trees with this object.  Must know about the names
+    of tokens so you have to pass in a map or array of token names (from which
+    this class can build the map).  I.e., Token DECL means nothing unless the
+    class can translate it to a token type.
+
+    In order to create nodes and navigate, this class needs a TreeAdaptor.
+
+    This class can build a token type -> node index for repeated use or for
+    iterating over the various nodes with a particular type.
+
+    This class works in conjunction with the TreeAdaptor rather than moving
+    all this functionality into the adaptor.  An adaptor helps build and
+    navigate trees using methods.  This class helps you do it with string
+    patterns like "(A B C)".  You can create a tree from that pattern or
+    match subtrees against it.
+    """
+
+    def __init__(self, adaptor=None, tokenNames=None, typeMap=None):
+        if adaptor is None:
+            self.adaptor = CommonTreeAdaptor()
+
+        else:
+            self.adaptor = adaptor
+
+        if typeMap is None:
+            self.tokenNameToTypeMap = computeTokenTypes(tokenNames)
+
+        else:
+            if tokenNames is not None:
+                raise ValueError("Can't have both tokenNames and typeMap")
+
+            self.tokenNameToTypeMap = typeMap
+
+
+    def getTokenType(self, tokenName):
+        """Using the map of token names to token types, return the type."""
+
+        try:
+            return self.tokenNameToTypeMap[tokenName]
+        except KeyError:
+            return INVALID_TOKEN_TYPE
+
+
+    def create(self, pattern):
+        """
+        Create a tree or node from the indicated tree pattern that closely
+        follows ANTLR tree grammar tree element syntax:
+
+        (root child1 ... child2).
+
+        You can also just pass in a node: ID
+
+        Any node can have a text argument: ID[foo]
+        (notice there are no quotes around foo--it's clear it's a string).
+
+        nil is a special name meaning "give me a nil node".  Useful for
+        making lists: (nil A B C) is a list of A B C.
+        """
+
+        tokenizer = TreePatternLexer(pattern)
+        parser = TreePatternParser(tokenizer, self, self.adaptor)
+        return parser.pattern()
+
+
+    def index(self, tree):
+        """Walk the entire tree and make a node name to nodes mapping.
+
+        For now, use recursion but later nonrecursive version may be
+        more efficient.  Returns a dict int -> list where the list is
+        of your AST node type.  The int is the token type of the node.
+        """
+
+        m = {}
+        self._index(tree, m)
+        return m
+
+
+    def _index(self, t, m):
+        """Do the work for index"""
+
+        if t is None:
+            return
+
+        ttype = self.adaptor.getType(t)
+        elements = m.get(ttype)
+        if elements is None:
+            m[ttype] = elements = []
+
+        elements.append(t)
+        for i in range(self.adaptor.getChildCount(t)):
+            child = self.adaptor.getChild(t, i)
+            self._index(child, m)
+
+
+    def find(self, tree, what):
+        """Return a list of matching token.
+
+        what may either be an integer specifzing the token type to find or
+        a string with a pattern that must be matched.
+
+        """
+
+        if isinstance(what, (int, long)):
+            return self._findTokenType(tree, what)
+
+        elif isinstance(what, basestring):
+            return self._findPattern(tree, what)
+
+        else:
+            raise TypeError("'what' must be string or integer")
+
+
+    def _findTokenType(self, t, ttype):
+        """Return a List of tree nodes with token type ttype"""
+
+        nodes = []
+
+        def visitor(tree, parent, childIndex, labels):
+            nodes.append(tree)
+
+        self.visit(t, ttype, visitor)
+
+        return nodes
+
+
+    def _findPattern(self, t, pattern):
+        """Return a List of subtrees matching pattern."""
+
+        subtrees = []
+
+        # Create a TreePattern from the pattern
+        tokenizer = TreePatternLexer(pattern)
+        parser = TreePatternParser(tokenizer, self, TreePatternTreeAdaptor())
+        tpattern = parser.pattern()
+
+        # don't allow invalid patterns
+        if (tpattern is None or tpattern.isNil()
+            or isinstance(tpattern, WildcardTreePattern)):
+            return None
+
+        rootTokenType = tpattern.getType()
+
+        def visitor(tree, parent, childIndex, label):
+            if self._parse(tree, tpattern, None):
+                subtrees.append(tree)
+
+        self.visit(t, rootTokenType, visitor)
+
+        return subtrees
+
+
+    def visit(self, tree, what, visitor):
+        """Visit every node in tree matching what, invoking the visitor.
+
+        If what is a string, it is parsed as a pattern and only matching
+        subtrees will be visited.
+        The implementation uses the root node of the pattern in combination
+        with visit(t, ttype, visitor) so nil-rooted patterns are not allowed.
+        Patterns with wildcard roots are also not allowed.
+
+        If what is an integer, it is used as a token type and visit will match
+        all nodes of that type (this is faster than the pattern match).
+        The labels arg of the visitor action method is never set (it's None)
+        since using a token type rather than a pattern doesn't let us set a
+        label.
+        """
+
+        if isinstance(what, (int, long)):
+            self._visitType(tree, None, 0, what, visitor)
+
+        elif isinstance(what, basestring):
+            self._visitPattern(tree, what, visitor)
+
+        else:
+            raise TypeError("'what' must be string or integer")
+
+
+    def _visitType(self, t, parent, childIndex, ttype, visitor):
+        """Do the recursive work for visit"""
+
+        if t is None:
+            return
+
+        if self.adaptor.getType(t) == ttype:
+            visitor(t, parent, childIndex, None)
+
+        for i in range(self.adaptor.getChildCount(t)):
+            child = self.adaptor.getChild(t, i)
+            self._visitType(child, t, i, ttype, visitor)
+
+
+    def _visitPattern(self, tree, pattern, visitor):
+        """
+        For all subtrees that match the pattern, execute the visit action.
+        """
+
+        # Create a TreePattern from the pattern
+        tokenizer = TreePatternLexer(pattern)
+        parser = TreePatternParser(tokenizer, self, TreePatternTreeAdaptor())
+        tpattern = parser.pattern()
+
+        # don't allow invalid patterns
+        if (tpattern is None or tpattern.isNil()
+            or isinstance(tpattern, WildcardTreePattern)):
+            return
+
+        rootTokenType = tpattern.getType()
+
+        def rootvisitor(tree, parent, childIndex, labels):
+            labels = {}
+            if self._parse(tree, tpattern, labels):
+                visitor(tree, parent, childIndex, labels)
+
+        self.visit(tree, rootTokenType, rootvisitor)
+
+
+    def parse(self, t, pattern, labels=None):
+        """
+        Given a pattern like (ASSIGN %lhs:ID %rhs:.) with optional labels
+        on the various nodes and '.' (dot) as the node/subtree wildcard,
+        return true if the pattern matches and fill the labels Map with
+        the labels pointing at the appropriate nodes.  Return false if
+        the pattern is malformed or the tree does not match.
+
+        If a node specifies a text arg in pattern, then that must match
+        for that node in t.
+        """
+
+        tokenizer = TreePatternLexer(pattern)
+        parser = TreePatternParser(tokenizer, self, TreePatternTreeAdaptor())
+        tpattern = parser.pattern()
+
+        return self._parse(t, tpattern, labels)
+
+
+    def _parse(self, t1, tpattern, labels):
+        """
+        Do the work for parse. Check to see if the tpattern fits the
+        structure and token types in t1.  Check text if the pattern has
+        text arguments on nodes.  Fill labels map with pointers to nodes
+        in tree matched against nodes in pattern with labels.
+	"""
+
+        # make sure both are non-null
+        if t1 is None or tpattern is None:
+            return False
+
+        # check roots (wildcard matches anything)
+        if not isinstance(tpattern, WildcardTreePattern):
+            if self.adaptor.getType(t1) != tpattern.getType():
+                return False
+
+            # if pattern has text, check node text
+            if (tpattern.hasTextArg
+                and self.adaptor.getText(t1) != tpattern.getText()):
+                return False
+
+        if tpattern.label is not None and labels is not None:
+            # map label in pattern to node in t1
+            labels[tpattern.label] = t1
+
+        # check children
+        n1 = self.adaptor.getChildCount(t1)
+        n2 = tpattern.getChildCount()
+        if n1 != n2:
+            return False
+
+        for i in range(n1):
+            child1 = self.adaptor.getChild(t1, i)
+            child2 = tpattern.getChild(i)
+            if not self._parse(child1, child2, labels):
+                return False
+
+        return True
+
+
+    def equals(self, t1, t2, adaptor=None):
+        """
+        Compare t1 and t2; return true if token types/text, structure match
+        exactly.
+        The trees are examined in their entirety so that (A B) does not match
+        (A B C) nor (A (B C)).
+        """
+
+        if adaptor is None:
+            adaptor = self.adaptor
+
+        return self._equals(t1, t2, adaptor)
+
+
+    def _equals(self, t1, t2, adaptor):
+        # make sure both are non-null
+        if t1 is None or t2 is None:
+            return False
+
+        # check roots
+        if adaptor.getType(t1) != adaptor.getType(t2):
+            return False
+
+        if adaptor.getText(t1) != adaptor.getText(t2):
+            return False
+
+        # check children
+        n1 = adaptor.getChildCount(t1)
+        n2 = adaptor.getChildCount(t2)
+        if n1 != n2:
+            return False
+
+        for i in range(n1):
+            child1 = adaptor.getChild(t1, i)
+            child2 = adaptor.getChild(t2, i)
+            if not self._equals(child1, child2, adaptor):
+                return False
+
+        return True
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/gtkmvc.zip b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/gtkmvc.zip
new file mode 100644
index 0000000000000000000000000000000000000000..0b8ecaeba6cb0f60f6eafeecb7d7cf4835ac60d7
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/gtkmvc.zip differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/mathsat/_mathsat.pyd b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/mathsat/_mathsat.pyd
new file mode 100644
index 0000000000000000000000000000000000000000..10a21e36fdb0f9e283723cb52ee7a62e1520bc06
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/mathsat/_mathsat.pyd differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/mathsat/mathsat.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/mathsat/mathsat.py
new file mode 100644
index 0000000000000000000000000000000000000000..5833b195c198538047f9f08e09ede331938a5573
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/mathsat/mathsat.py
@@ -0,0 +1,1975 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 2.0.11
+#
+# Do not make changes to this file unless you know what you are doing--modify
+# the SWIG interface file instead.
+
+
+
+
+
+from sys import version_info
+if version_info >= (2,6,0):
+    def swig_import_helper():
+        from os.path import dirname
+        import imp
+        fp = None
+        try:
+            fp, pathname, description = imp.find_module('_mathsat', [dirname(__file__)])
+        except ImportError:
+            import _mathsat
+            return _mathsat
+        if fp is not None:
+            try:
+                _mod = imp.load_module('_mathsat', fp, pathname, description)
+            finally:
+                fp.close()
+            return _mod
+    _mathsat = swig_import_helper()
+    del swig_import_helper
+else:
+    import _mathsat
+del version_info
+try:
+    _swig_property = property
+except NameError:
+    pass # Python < 2.2 doesn't have 'property'.
+def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
+    if (name == "thisown"): return self.this.own(value)
+    if (name == "this"):
+        if type(value).__name__ == 'SwigPyObject':
+            self.__dict__[name] = value
+            return
+    method = class_type.__swig_setmethods__.get(name,None)
+    if method: return method(self,value)
+    if (not static):
+        self.__dict__[name] = value
+    else:
+        raise AttributeError("You cannot add attributes to %s" % self)
+
+def _swig_setattr(self,class_type,name,value):
+    return _swig_setattr_nondynamic(self,class_type,name,value,0)
+
+def _swig_getattr(self,class_type,name):
+    if (name == "thisown"): return self.this.own()
+    method = class_type.__swig_getmethods__.get(name,None)
+    if method: return method(self)
+    raise AttributeError(name)
+
+def _swig_repr(self):
+    try: strthis = "proxy of " + self.this.__repr__()
+    except: strthis = ""
+    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
+
+try:
+    _object = object
+    _newclass = 1
+except AttributeError:
+    class _object : pass
+    _newclass = 0
+
+
+class msat_config(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, msat_config, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, msat_config, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["repr"] = _mathsat.msat_config_repr_set
+    __swig_getmethods__["repr"] = _mathsat.msat_config_repr_get
+    if _newclass:repr = _swig_property(_mathsat.msat_config_repr_get, _mathsat.msat_config_repr_set)
+    def __init__(self): 
+        this = _mathsat.new_msat_config()
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _mathsat.delete_msat_config
+    __del__ = lambda self : None;
+msat_config_swigregister = _mathsat.msat_config_swigregister
+msat_config_swigregister(msat_config)
+
+class msat_env(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, msat_env, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, msat_env, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["repr"] = _mathsat.msat_env_repr_set
+    __swig_getmethods__["repr"] = _mathsat.msat_env_repr_get
+    if _newclass:repr = _swig_property(_mathsat.msat_env_repr_get, _mathsat.msat_env_repr_set)
+    def __init__(self): 
+        this = _mathsat.new_msat_env()
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _mathsat.delete_msat_env
+    __del__ = lambda self : None;
+msat_env_swigregister = _mathsat.msat_env_swigregister
+msat_env_swigregister(msat_env)
+
+class msat_term(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, msat_term, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, msat_term, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["repr"] = _mathsat.msat_term_repr_set
+    __swig_getmethods__["repr"] = _mathsat.msat_term_repr_get
+    if _newclass:repr = _swig_property(_mathsat.msat_term_repr_get, _mathsat.msat_term_repr_set)
+    def __init__(self): 
+        this = _mathsat.new_msat_term()
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _mathsat.delete_msat_term
+    __del__ = lambda self : None;
+msat_term_swigregister = _mathsat.msat_term_swigregister
+msat_term_swigregister(msat_term)
+
+class msat_decl(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, msat_decl, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, msat_decl, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["repr"] = _mathsat.msat_decl_repr_set
+    __swig_getmethods__["repr"] = _mathsat.msat_decl_repr_get
+    if _newclass:repr = _swig_property(_mathsat.msat_decl_repr_get, _mathsat.msat_decl_repr_set)
+    def __init__(self): 
+        this = _mathsat.new_msat_decl()
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _mathsat.delete_msat_decl
+    __del__ = lambda self : None;
+msat_decl_swigregister = _mathsat.msat_decl_swigregister
+msat_decl_swigregister(msat_decl)
+
+class msat_type(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, msat_type, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, msat_type, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["repr"] = _mathsat.msat_type_repr_set
+    __swig_getmethods__["repr"] = _mathsat.msat_type_repr_get
+    if _newclass:repr = _swig_property(_mathsat.msat_type_repr_get, _mathsat.msat_type_repr_set)
+    def __init__(self): 
+        this = _mathsat.new_msat_type()
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _mathsat.delete_msat_type
+    __del__ = lambda self : None;
+msat_type_swigregister = _mathsat.msat_type_swigregister
+msat_type_swigregister(msat_type)
+
+MSAT_UNKNOWN = _mathsat.MSAT_UNKNOWN
+MSAT_UNSAT = _mathsat.MSAT_UNSAT
+MSAT_SAT = _mathsat.MSAT_SAT
+MSAT_UNDEF = _mathsat.MSAT_UNDEF
+MSAT_FALSE = _mathsat.MSAT_FALSE
+MSAT_TRUE = _mathsat.MSAT_TRUE
+MSAT_TAG_ERROR = _mathsat.MSAT_TAG_ERROR
+MSAT_TAG_UNKNOWN = _mathsat.MSAT_TAG_UNKNOWN
+MSAT_TAG_TRUE = _mathsat.MSAT_TAG_TRUE
+MSAT_TAG_FALSE = _mathsat.MSAT_TAG_FALSE
+MSAT_TAG_AND = _mathsat.MSAT_TAG_AND
+MSAT_TAG_OR = _mathsat.MSAT_TAG_OR
+MSAT_TAG_NOT = _mathsat.MSAT_TAG_NOT
+MSAT_TAG_IFF = _mathsat.MSAT_TAG_IFF
+MSAT_TAG_PLUS = _mathsat.MSAT_TAG_PLUS
+MSAT_TAG_TIMES = _mathsat.MSAT_TAG_TIMES
+MSAT_TAG_FLOOR = _mathsat.MSAT_TAG_FLOOR
+MSAT_TAG_LEQ = _mathsat.MSAT_TAG_LEQ
+MSAT_TAG_EQ = _mathsat.MSAT_TAG_EQ
+MSAT_TAG_ITE = _mathsat.MSAT_TAG_ITE
+MSAT_TAG_INT_MOD_CONGR = _mathsat.MSAT_TAG_INT_MOD_CONGR
+MSAT_TAG_BV_CONCAT = _mathsat.MSAT_TAG_BV_CONCAT
+MSAT_TAG_BV_EXTRACT = _mathsat.MSAT_TAG_BV_EXTRACT
+MSAT_TAG_BV_NOT = _mathsat.MSAT_TAG_BV_NOT
+MSAT_TAG_BV_AND = _mathsat.MSAT_TAG_BV_AND
+MSAT_TAG_BV_OR = _mathsat.MSAT_TAG_BV_OR
+MSAT_TAG_BV_XOR = _mathsat.MSAT_TAG_BV_XOR
+MSAT_TAG_BV_ULT = _mathsat.MSAT_TAG_BV_ULT
+MSAT_TAG_BV_SLT = _mathsat.MSAT_TAG_BV_SLT
+MSAT_TAG_BV_ULE = _mathsat.MSAT_TAG_BV_ULE
+MSAT_TAG_BV_SLE = _mathsat.MSAT_TAG_BV_SLE
+MSAT_TAG_BV_COMP = _mathsat.MSAT_TAG_BV_COMP
+MSAT_TAG_BV_NEG = _mathsat.MSAT_TAG_BV_NEG
+MSAT_TAG_BV_ADD = _mathsat.MSAT_TAG_BV_ADD
+MSAT_TAG_BV_SUB = _mathsat.MSAT_TAG_BV_SUB
+MSAT_TAG_BV_MUL = _mathsat.MSAT_TAG_BV_MUL
+MSAT_TAG_BV_UDIV = _mathsat.MSAT_TAG_BV_UDIV
+MSAT_TAG_BV_SDIV = _mathsat.MSAT_TAG_BV_SDIV
+MSAT_TAG_BV_UREM = _mathsat.MSAT_TAG_BV_UREM
+MSAT_TAG_BV_SREM = _mathsat.MSAT_TAG_BV_SREM
+MSAT_TAG_BV_LSHL = _mathsat.MSAT_TAG_BV_LSHL
+MSAT_TAG_BV_LSHR = _mathsat.MSAT_TAG_BV_LSHR
+MSAT_TAG_BV_ASHR = _mathsat.MSAT_TAG_BV_ASHR
+MSAT_TAG_BV_ROL = _mathsat.MSAT_TAG_BV_ROL
+MSAT_TAG_BV_ROR = _mathsat.MSAT_TAG_BV_ROR
+MSAT_TAG_BV_ZEXT = _mathsat.MSAT_TAG_BV_ZEXT
+MSAT_TAG_BV_SEXT = _mathsat.MSAT_TAG_BV_SEXT
+MSAT_TAG_ARRAY_READ = _mathsat.MSAT_TAG_ARRAY_READ
+MSAT_TAG_ARRAY_WRITE = _mathsat.MSAT_TAG_ARRAY_WRITE
+MSAT_TAG_ARRAY_CONST = _mathsat.MSAT_TAG_ARRAY_CONST
+MSAT_TAG_FP_EQ = _mathsat.MSAT_TAG_FP_EQ
+MSAT_TAG_FP_LT = _mathsat.MSAT_TAG_FP_LT
+MSAT_TAG_FP_LE = _mathsat.MSAT_TAG_FP_LE
+MSAT_TAG_FP_NEG = _mathsat.MSAT_TAG_FP_NEG
+MSAT_TAG_FP_ADD = _mathsat.MSAT_TAG_FP_ADD
+MSAT_TAG_FP_SUB = _mathsat.MSAT_TAG_FP_SUB
+MSAT_TAG_FP_MUL = _mathsat.MSAT_TAG_FP_MUL
+MSAT_TAG_FP_DIV = _mathsat.MSAT_TAG_FP_DIV
+MSAT_TAG_FP_SQRT = _mathsat.MSAT_TAG_FP_SQRT
+MSAT_TAG_FP_ABS = _mathsat.MSAT_TAG_FP_ABS
+MSAT_TAG_FP_MIN = _mathsat.MSAT_TAG_FP_MIN
+MSAT_TAG_FP_MAX = _mathsat.MSAT_TAG_FP_MAX
+MSAT_TAG_FP_CAST = _mathsat.MSAT_TAG_FP_CAST
+MSAT_TAG_FP_ROUND_TO_INT = _mathsat.MSAT_TAG_FP_ROUND_TO_INT
+MSAT_TAG_FP_FROM_SBV = _mathsat.MSAT_TAG_FP_FROM_SBV
+MSAT_TAG_FP_FROM_UBV = _mathsat.MSAT_TAG_FP_FROM_UBV
+MSAT_TAG_FP_TO_BV = _mathsat.MSAT_TAG_FP_TO_BV
+MSAT_TAG_FP_AS_IEEEBV = _mathsat.MSAT_TAG_FP_AS_IEEEBV
+MSAT_TAG_FP_ISNAN = _mathsat.MSAT_TAG_FP_ISNAN
+MSAT_TAG_FP_ISINF = _mathsat.MSAT_TAG_FP_ISINF
+MSAT_TAG_FP_ISZERO = _mathsat.MSAT_TAG_FP_ISZERO
+MSAT_TAG_FP_ISSUBNORMAL = _mathsat.MSAT_TAG_FP_ISSUBNORMAL
+MSAT_TAG_FP_ISNORMAL = _mathsat.MSAT_TAG_FP_ISNORMAL
+MSAT_TAG_FP_ISNEG = _mathsat.MSAT_TAG_FP_ISNEG
+MSAT_TAG_FP_ISPOS = _mathsat.MSAT_TAG_FP_ISPOS
+MSAT_TAG_FP_FROM_IEEEBV = _mathsat.MSAT_TAG_FP_FROM_IEEEBV
+MSAT_TAG_INT_FROM_UBV = _mathsat.MSAT_TAG_INT_FROM_UBV
+MSAT_TAG_INT_FROM_SBV = _mathsat.MSAT_TAG_INT_FROM_SBV
+MSAT_TAG_INT_TO_BV = _mathsat.MSAT_TAG_INT_TO_BV
+class msat_model(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, msat_model, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, msat_model, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["repr"] = _mathsat.msat_model_repr_set
+    __swig_getmethods__["repr"] = _mathsat.msat_model_repr_get
+    if _newclass:repr = _swig_property(_mathsat.msat_model_repr_get, _mathsat.msat_model_repr_set)
+    def __init__(self): 
+        this = _mathsat.new_msat_model()
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _mathsat.delete_msat_model
+    __del__ = lambda self : None;
+msat_model_swigregister = _mathsat.msat_model_swigregister
+msat_model_swigregister(msat_model)
+
+class msat_model_iterator(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, msat_model_iterator, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, msat_model_iterator, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["repr"] = _mathsat.msat_model_iterator_repr_set
+    __swig_getmethods__["repr"] = _mathsat.msat_model_iterator_repr_get
+    if _newclass:repr = _swig_property(_mathsat.msat_model_iterator_repr_get, _mathsat.msat_model_iterator_repr_set)
+    def __init__(self): 
+        this = _mathsat.new_msat_model_iterator()
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _mathsat.delete_msat_model_iterator
+    __del__ = lambda self : None;
+msat_model_iterator_swigregister = _mathsat.msat_model_iterator_swigregister
+msat_model_iterator_swigregister(msat_model_iterator)
+
+MSAT_VISIT_PROCESS = _mathsat.MSAT_VISIT_PROCESS
+MSAT_VISIT_SKIP = _mathsat.MSAT_VISIT_SKIP
+MSAT_VISIT_ABORT = _mathsat.MSAT_VISIT_ABORT
+class msat_proof_manager(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, msat_proof_manager, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, msat_proof_manager, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["repr"] = _mathsat.msat_proof_manager_repr_set
+    __swig_getmethods__["repr"] = _mathsat.msat_proof_manager_repr_get
+    if _newclass:repr = _swig_property(_mathsat.msat_proof_manager_repr_get, _mathsat.msat_proof_manager_repr_set)
+    def __init__(self): 
+        this = _mathsat.new_msat_proof_manager()
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _mathsat.delete_msat_proof_manager
+    __del__ = lambda self : None;
+msat_proof_manager_swigregister = _mathsat.msat_proof_manager_swigregister
+msat_proof_manager_swigregister(msat_proof_manager)
+
+class msat_proof(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, msat_proof, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, msat_proof, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["repr"] = _mathsat.msat_proof_repr_set
+    __swig_getmethods__["repr"] = _mathsat.msat_proof_repr_get
+    if _newclass:repr = _swig_property(_mathsat.msat_proof_repr_get, _mathsat.msat_proof_repr_set)
+    def __init__(self): 
+        this = _mathsat.new_msat_proof()
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _mathsat.delete_msat_proof
+    __del__ = lambda self : None;
+msat_proof_swigregister = _mathsat.msat_proof_swigregister
+msat_proof_swigregister(msat_proof)
+
+
+def msat_get_version():
+  return _mathsat.msat_get_version()
+msat_get_version = _mathsat.msat_get_version
+
+def msat_last_error_message(*args):
+  return _mathsat.msat_last_error_message(*args)
+msat_last_error_message = _mathsat.msat_last_error_message
+
+def msat_create_config():
+  return _mathsat.msat_create_config()
+msat_create_config = _mathsat.msat_create_config
+
+def msat_create_default_config(*args):
+  return _mathsat.msat_create_default_config(*args)
+msat_create_default_config = _mathsat.msat_create_default_config
+
+def _msat_parse_config(*args):
+  return _mathsat._msat_parse_config(*args)
+_msat_parse_config = _mathsat._msat_parse_config
+
+def msat_destroy_config(*args):
+  return _mathsat.msat_destroy_config(*args)
+msat_destroy_config = _mathsat.msat_destroy_config
+
+def _msat_create_env(*args):
+  return _mathsat._msat_create_env(*args)
+_msat_create_env = _mathsat._msat_create_env
+
+def _msat_create_shared_env(*args):
+  return _mathsat._msat_create_shared_env(*args)
+_msat_create_shared_env = _mathsat._msat_create_shared_env
+
+def msat_destroy_env(*args):
+  return _mathsat.msat_destroy_env(*args)
+msat_destroy_env = _mathsat.msat_destroy_env
+
+def _msat_gc_env(*args):
+  return _mathsat._msat_gc_env(*args)
+_msat_gc_env = _mathsat._msat_gc_env
+
+def msat_set_option(*args):
+  return _mathsat.msat_set_option(*args)
+msat_set_option = _mathsat.msat_set_option
+
+def msat_set_termination_test(*args):
+  return _mathsat.msat_set_termination_test(*args)
+msat_set_termination_test = _mathsat.msat_set_termination_test
+
+def msat_get_bool_type(*args):
+  return _mathsat.msat_get_bool_type(*args)
+msat_get_bool_type = _mathsat.msat_get_bool_type
+
+def msat_get_rational_type(*args):
+  return _mathsat.msat_get_rational_type(*args)
+msat_get_rational_type = _mathsat.msat_get_rational_type
+
+def msat_get_integer_type(*args):
+  return _mathsat.msat_get_integer_type(*args)
+msat_get_integer_type = _mathsat.msat_get_integer_type
+
+def msat_get_bv_type(*args):
+  return _mathsat.msat_get_bv_type(*args)
+msat_get_bv_type = _mathsat.msat_get_bv_type
+
+def msat_get_array_type(*args):
+  return _mathsat.msat_get_array_type(*args)
+msat_get_array_type = _mathsat.msat_get_array_type
+
+def msat_get_fp_type(*args):
+  return _mathsat.msat_get_fp_type(*args)
+msat_get_fp_type = _mathsat.msat_get_fp_type
+
+def msat_get_fp_roundingmode_type(*args):
+  return _mathsat.msat_get_fp_roundingmode_type(*args)
+msat_get_fp_roundingmode_type = _mathsat.msat_get_fp_roundingmode_type
+
+def msat_get_simple_type(*args):
+  return _mathsat.msat_get_simple_type(*args)
+msat_get_simple_type = _mathsat.msat_get_simple_type
+
+def _msat_get_function_type(*args):
+  return _mathsat._msat_get_function_type(*args)
+_msat_get_function_type = _mathsat._msat_get_function_type
+
+def msat_is_bool_type(*args):
+  return _mathsat.msat_is_bool_type(*args)
+msat_is_bool_type = _mathsat.msat_is_bool_type
+
+def msat_is_rational_type(*args):
+  return _mathsat.msat_is_rational_type(*args)
+msat_is_rational_type = _mathsat.msat_is_rational_type
+
+def msat_is_integer_type(*args):
+  return _mathsat.msat_is_integer_type(*args)
+msat_is_integer_type = _mathsat.msat_is_integer_type
+
+def _msat_is_bv_type(*args):
+  return _mathsat._msat_is_bv_type(*args)
+_msat_is_bv_type = _mathsat._msat_is_bv_type
+
+def _msat_is_array_type(*args):
+  return _mathsat._msat_is_array_type(*args)
+_msat_is_array_type = _mathsat._msat_is_array_type
+
+def _msat_is_fp_type(*args):
+  return _mathsat._msat_is_fp_type(*args)
+_msat_is_fp_type = _mathsat._msat_is_fp_type
+
+def msat_is_fp_roundingmode_type(*args):
+  return _mathsat.msat_is_fp_roundingmode_type(*args)
+msat_is_fp_roundingmode_type = _mathsat.msat_is_fp_roundingmode_type
+
+def msat_type_equals(*args):
+  return _mathsat.msat_type_equals(*args)
+msat_type_equals = _mathsat.msat_type_equals
+
+def msat_type_repr(*args):
+  return _mathsat.msat_type_repr(*args)
+msat_type_repr = _mathsat.msat_type_repr
+
+def msat_declare_function(*args):
+  return _mathsat.msat_declare_function(*args)
+msat_declare_function = _mathsat.msat_declare_function
+
+def msat_make_true(*args):
+  return _mathsat.msat_make_true(*args)
+msat_make_true = _mathsat.msat_make_true
+
+def msat_make_false(*args):
+  return _mathsat.msat_make_false(*args)
+msat_make_false = _mathsat.msat_make_false
+
+def msat_make_iff(*args):
+  return _mathsat.msat_make_iff(*args)
+msat_make_iff = _mathsat.msat_make_iff
+
+def msat_make_or(*args):
+  return _mathsat.msat_make_or(*args)
+msat_make_or = _mathsat.msat_make_or
+
+def msat_make_and(*args):
+  return _mathsat.msat_make_and(*args)
+msat_make_and = _mathsat.msat_make_and
+
+def msat_make_not(*args):
+  return _mathsat.msat_make_not(*args)
+msat_make_not = _mathsat.msat_make_not
+
+def msat_make_equal(*args):
+  return _mathsat.msat_make_equal(*args)
+msat_make_equal = _mathsat.msat_make_equal
+
+def msat_make_eq(*args):
+  return _mathsat.msat_make_eq(*args)
+msat_make_eq = _mathsat.msat_make_eq
+
+def msat_make_leq(*args):
+  return _mathsat.msat_make_leq(*args)
+msat_make_leq = _mathsat.msat_make_leq
+
+def msat_make_plus(*args):
+  return _mathsat.msat_make_plus(*args)
+msat_make_plus = _mathsat.msat_make_plus
+
+def msat_make_times(*args):
+  return _mathsat.msat_make_times(*args)
+msat_make_times = _mathsat.msat_make_times
+
+def _msat_make_int_modular_congruence(*args):
+  return _mathsat._msat_make_int_modular_congruence(*args)
+_msat_make_int_modular_congruence = _mathsat._msat_make_int_modular_congruence
+
+def msat_make_floor(*args):
+  return _mathsat.msat_make_floor(*args)
+msat_make_floor = _mathsat.msat_make_floor
+
+def msat_make_number(*args):
+  return _mathsat.msat_make_number(*args)
+msat_make_number = _mathsat.msat_make_number
+
+def msat_make_term_ite(*args):
+  return _mathsat.msat_make_term_ite(*args)
+msat_make_term_ite = _mathsat.msat_make_term_ite
+
+def msat_make_constant(*args):
+  return _mathsat.msat_make_constant(*args)
+msat_make_constant = _mathsat.msat_make_constant
+
+def msat_make_uf(*args):
+  return _mathsat.msat_make_uf(*args)
+msat_make_uf = _mathsat.msat_make_uf
+
+def msat_make_array_read(*args):
+  return _mathsat.msat_make_array_read(*args)
+msat_make_array_read = _mathsat.msat_make_array_read
+
+def msat_make_array_write(*args):
+  return _mathsat.msat_make_array_write(*args)
+msat_make_array_write = _mathsat.msat_make_array_write
+
+def msat_make_array_const(*args):
+  return _mathsat.msat_make_array_const(*args)
+msat_make_array_const = _mathsat.msat_make_array_const
+
+def msat_make_bv_number(*args):
+  return _mathsat.msat_make_bv_number(*args)
+msat_make_bv_number = _mathsat.msat_make_bv_number
+
+def msat_make_bv_concat(*args):
+  return _mathsat.msat_make_bv_concat(*args)
+msat_make_bv_concat = _mathsat.msat_make_bv_concat
+
+def msat_make_bv_extract(*args):
+  return _mathsat.msat_make_bv_extract(*args)
+msat_make_bv_extract = _mathsat.msat_make_bv_extract
+
+def msat_make_bv_or(*args):
+  return _mathsat.msat_make_bv_or(*args)
+msat_make_bv_or = _mathsat.msat_make_bv_or
+
+def msat_make_bv_xor(*args):
+  return _mathsat.msat_make_bv_xor(*args)
+msat_make_bv_xor = _mathsat.msat_make_bv_xor
+
+def msat_make_bv_and(*args):
+  return _mathsat.msat_make_bv_and(*args)
+msat_make_bv_and = _mathsat.msat_make_bv_and
+
+def msat_make_bv_not(*args):
+  return _mathsat.msat_make_bv_not(*args)
+msat_make_bv_not = _mathsat.msat_make_bv_not
+
+def msat_make_bv_lshl(*args):
+  return _mathsat.msat_make_bv_lshl(*args)
+msat_make_bv_lshl = _mathsat.msat_make_bv_lshl
+
+def msat_make_bv_lshr(*args):
+  return _mathsat.msat_make_bv_lshr(*args)
+msat_make_bv_lshr = _mathsat.msat_make_bv_lshr
+
+def msat_make_bv_ashr(*args):
+  return _mathsat.msat_make_bv_ashr(*args)
+msat_make_bv_ashr = _mathsat.msat_make_bv_ashr
+
+def msat_make_bv_zext(*args):
+  return _mathsat.msat_make_bv_zext(*args)
+msat_make_bv_zext = _mathsat.msat_make_bv_zext
+
+def msat_make_bv_sext(*args):
+  return _mathsat.msat_make_bv_sext(*args)
+msat_make_bv_sext = _mathsat.msat_make_bv_sext
+
+def msat_make_bv_plus(*args):
+  return _mathsat.msat_make_bv_plus(*args)
+msat_make_bv_plus = _mathsat.msat_make_bv_plus
+
+def msat_make_bv_minus(*args):
+  return _mathsat.msat_make_bv_minus(*args)
+msat_make_bv_minus = _mathsat.msat_make_bv_minus
+
+def msat_make_bv_neg(*args):
+  return _mathsat.msat_make_bv_neg(*args)
+msat_make_bv_neg = _mathsat.msat_make_bv_neg
+
+def msat_make_bv_times(*args):
+  return _mathsat.msat_make_bv_times(*args)
+msat_make_bv_times = _mathsat.msat_make_bv_times
+
+def msat_make_bv_udiv(*args):
+  return _mathsat.msat_make_bv_udiv(*args)
+msat_make_bv_udiv = _mathsat.msat_make_bv_udiv
+
+def msat_make_bv_urem(*args):
+  return _mathsat.msat_make_bv_urem(*args)
+msat_make_bv_urem = _mathsat.msat_make_bv_urem
+
+def msat_make_bv_sdiv(*args):
+  return _mathsat.msat_make_bv_sdiv(*args)
+msat_make_bv_sdiv = _mathsat.msat_make_bv_sdiv
+
+def msat_make_bv_srem(*args):
+  return _mathsat.msat_make_bv_srem(*args)
+msat_make_bv_srem = _mathsat.msat_make_bv_srem
+
+def msat_make_bv_ult(*args):
+  return _mathsat.msat_make_bv_ult(*args)
+msat_make_bv_ult = _mathsat.msat_make_bv_ult
+
+def msat_make_bv_uleq(*args):
+  return _mathsat.msat_make_bv_uleq(*args)
+msat_make_bv_uleq = _mathsat.msat_make_bv_uleq
+
+def msat_make_bv_slt(*args):
+  return _mathsat.msat_make_bv_slt(*args)
+msat_make_bv_slt = _mathsat.msat_make_bv_slt
+
+def msat_make_bv_sleq(*args):
+  return _mathsat.msat_make_bv_sleq(*args)
+msat_make_bv_sleq = _mathsat.msat_make_bv_sleq
+
+def msat_make_bv_rol(*args):
+  return _mathsat.msat_make_bv_rol(*args)
+msat_make_bv_rol = _mathsat.msat_make_bv_rol
+
+def msat_make_bv_ror(*args):
+  return _mathsat.msat_make_bv_ror(*args)
+msat_make_bv_ror = _mathsat.msat_make_bv_ror
+
+def msat_make_bv_comp(*args):
+  return _mathsat.msat_make_bv_comp(*args)
+msat_make_bv_comp = _mathsat.msat_make_bv_comp
+
+def msat_make_fp_roundingmode_nearest_even(*args):
+  return _mathsat.msat_make_fp_roundingmode_nearest_even(*args)
+msat_make_fp_roundingmode_nearest_even = _mathsat.msat_make_fp_roundingmode_nearest_even
+
+def msat_make_fp_roundingmode_zero(*args):
+  return _mathsat.msat_make_fp_roundingmode_zero(*args)
+msat_make_fp_roundingmode_zero = _mathsat.msat_make_fp_roundingmode_zero
+
+def msat_make_fp_roundingmode_plus_inf(*args):
+  return _mathsat.msat_make_fp_roundingmode_plus_inf(*args)
+msat_make_fp_roundingmode_plus_inf = _mathsat.msat_make_fp_roundingmode_plus_inf
+
+def msat_make_fp_roundingmode_minus_inf(*args):
+  return _mathsat.msat_make_fp_roundingmode_minus_inf(*args)
+msat_make_fp_roundingmode_minus_inf = _mathsat.msat_make_fp_roundingmode_minus_inf
+
+def msat_make_fp_equal(*args):
+  return _mathsat.msat_make_fp_equal(*args)
+msat_make_fp_equal = _mathsat.msat_make_fp_equal
+
+def msat_make_fp_lt(*args):
+  return _mathsat.msat_make_fp_lt(*args)
+msat_make_fp_lt = _mathsat.msat_make_fp_lt
+
+def msat_make_fp_leq(*args):
+  return _mathsat.msat_make_fp_leq(*args)
+msat_make_fp_leq = _mathsat.msat_make_fp_leq
+
+def msat_make_fp_neg(*args):
+  return _mathsat.msat_make_fp_neg(*args)
+msat_make_fp_neg = _mathsat.msat_make_fp_neg
+
+def msat_make_fp_plus(*args):
+  return _mathsat.msat_make_fp_plus(*args)
+msat_make_fp_plus = _mathsat.msat_make_fp_plus
+
+def msat_make_fp_minus(*args):
+  return _mathsat.msat_make_fp_minus(*args)
+msat_make_fp_minus = _mathsat.msat_make_fp_minus
+
+def msat_make_fp_times(*args):
+  return _mathsat.msat_make_fp_times(*args)
+msat_make_fp_times = _mathsat.msat_make_fp_times
+
+def msat_make_fp_div(*args):
+  return _mathsat.msat_make_fp_div(*args)
+msat_make_fp_div = _mathsat.msat_make_fp_div
+
+def msat_make_fp_sqrt(*args):
+  return _mathsat.msat_make_fp_sqrt(*args)
+msat_make_fp_sqrt = _mathsat.msat_make_fp_sqrt
+
+def msat_make_fp_abs(*args):
+  return _mathsat.msat_make_fp_abs(*args)
+msat_make_fp_abs = _mathsat.msat_make_fp_abs
+
+def msat_make_fp_min(*args):
+  return _mathsat.msat_make_fp_min(*args)
+msat_make_fp_min = _mathsat.msat_make_fp_min
+
+def msat_make_fp_max(*args):
+  return _mathsat.msat_make_fp_max(*args)
+msat_make_fp_max = _mathsat.msat_make_fp_max
+
+def msat_make_fp_round_to_int(*args):
+  return _mathsat.msat_make_fp_round_to_int(*args)
+msat_make_fp_round_to_int = _mathsat.msat_make_fp_round_to_int
+
+def msat_make_fp_cast(*args):
+  return _mathsat.msat_make_fp_cast(*args)
+msat_make_fp_cast = _mathsat.msat_make_fp_cast
+
+def msat_make_fp_to_bv(*args):
+  return _mathsat.msat_make_fp_to_bv(*args)
+msat_make_fp_to_bv = _mathsat.msat_make_fp_to_bv
+
+def msat_make_fp_from_sbv(*args):
+  return _mathsat.msat_make_fp_from_sbv(*args)
+msat_make_fp_from_sbv = _mathsat.msat_make_fp_from_sbv
+
+def msat_make_fp_from_ubv(*args):
+  return _mathsat.msat_make_fp_from_ubv(*args)
+msat_make_fp_from_ubv = _mathsat.msat_make_fp_from_ubv
+
+def msat_make_fp_as_ieeebv(*args):
+  return _mathsat.msat_make_fp_as_ieeebv(*args)
+msat_make_fp_as_ieeebv = _mathsat.msat_make_fp_as_ieeebv
+
+def msat_make_fp_from_ieeebv(*args):
+  return _mathsat.msat_make_fp_from_ieeebv(*args)
+msat_make_fp_from_ieeebv = _mathsat.msat_make_fp_from_ieeebv
+
+def msat_make_fp_isnan(*args):
+  return _mathsat.msat_make_fp_isnan(*args)
+msat_make_fp_isnan = _mathsat.msat_make_fp_isnan
+
+def msat_make_fp_isinf(*args):
+  return _mathsat.msat_make_fp_isinf(*args)
+msat_make_fp_isinf = _mathsat.msat_make_fp_isinf
+
+def msat_make_fp_iszero(*args):
+  return _mathsat.msat_make_fp_iszero(*args)
+msat_make_fp_iszero = _mathsat.msat_make_fp_iszero
+
+def msat_make_fp_issubnormal(*args):
+  return _mathsat.msat_make_fp_issubnormal(*args)
+msat_make_fp_issubnormal = _mathsat.msat_make_fp_issubnormal
+
+def msat_make_fp_isnormal(*args):
+  return _mathsat.msat_make_fp_isnormal(*args)
+msat_make_fp_isnormal = _mathsat.msat_make_fp_isnormal
+
+def msat_make_fp_isneg(*args):
+  return _mathsat.msat_make_fp_isneg(*args)
+msat_make_fp_isneg = _mathsat.msat_make_fp_isneg
+
+def msat_make_fp_ispos(*args):
+  return _mathsat.msat_make_fp_ispos(*args)
+msat_make_fp_ispos = _mathsat.msat_make_fp_ispos
+
+def msat_make_fp_plus_inf(*args):
+  return _mathsat.msat_make_fp_plus_inf(*args)
+msat_make_fp_plus_inf = _mathsat.msat_make_fp_plus_inf
+
+def msat_make_fp_minus_inf(*args):
+  return _mathsat.msat_make_fp_minus_inf(*args)
+msat_make_fp_minus_inf = _mathsat.msat_make_fp_minus_inf
+
+def msat_make_fp_nan(*args):
+  return _mathsat.msat_make_fp_nan(*args)
+msat_make_fp_nan = _mathsat.msat_make_fp_nan
+
+def msat_make_fp_rat_number(*args):
+  return _mathsat.msat_make_fp_rat_number(*args)
+msat_make_fp_rat_number = _mathsat.msat_make_fp_rat_number
+
+def msat_make_fp_bits_number(*args):
+  return _mathsat.msat_make_fp_bits_number(*args)
+msat_make_fp_bits_number = _mathsat.msat_make_fp_bits_number
+
+def msat_make_int_to_bv(*args):
+  return _mathsat.msat_make_int_to_bv(*args)
+msat_make_int_to_bv = _mathsat.msat_make_int_to_bv
+
+def msat_make_int_from_ubv(*args):
+  return _mathsat.msat_make_int_from_ubv(*args)
+msat_make_int_from_ubv = _mathsat.msat_make_int_from_ubv
+
+def msat_make_int_from_sbv(*args):
+  return _mathsat.msat_make_int_from_sbv(*args)
+msat_make_int_from_sbv = _mathsat.msat_make_int_from_sbv
+
+def msat_make_term(*args):
+  return _mathsat.msat_make_term(*args)
+msat_make_term = _mathsat.msat_make_term
+
+def msat_make_copy_from(*args):
+  return _mathsat.msat_make_copy_from(*args)
+msat_make_copy_from = _mathsat.msat_make_copy_from
+
+def msat_term_id(*args):
+  return _mathsat.msat_term_id(*args)
+msat_term_id = _mathsat.msat_term_id
+
+def msat_term_arity(*args):
+  return _mathsat.msat_term_arity(*args)
+msat_term_arity = _mathsat.msat_term_arity
+
+def msat_term_get_arg(*args):
+  return _mathsat.msat_term_get_arg(*args)
+msat_term_get_arg = _mathsat.msat_term_get_arg
+
+def msat_term_get_type(*args):
+  return _mathsat.msat_term_get_type(*args)
+msat_term_get_type = _mathsat.msat_term_get_type
+
+def msat_term_is_true(*args):
+  return _mathsat.msat_term_is_true(*args)
+msat_term_is_true = _mathsat.msat_term_is_true
+
+def msat_term_is_false(*args):
+  return _mathsat.msat_term_is_false(*args)
+msat_term_is_false = _mathsat.msat_term_is_false
+
+def msat_term_is_boolean_constant(*args):
+  return _mathsat.msat_term_is_boolean_constant(*args)
+msat_term_is_boolean_constant = _mathsat.msat_term_is_boolean_constant
+
+def msat_term_is_atom(*args):
+  return _mathsat.msat_term_is_atom(*args)
+msat_term_is_atom = _mathsat.msat_term_is_atom
+
+def msat_term_is_number(*args):
+  return _mathsat.msat_term_is_number(*args)
+msat_term_is_number = _mathsat.msat_term_is_number
+
+def _msat_term_to_number(*args):
+  return _mathsat._msat_term_to_number(*args)
+_msat_term_to_number = _mathsat._msat_term_to_number
+
+def msat_term_is_and(*args):
+  return _mathsat.msat_term_is_and(*args)
+msat_term_is_and = _mathsat.msat_term_is_and
+
+def msat_term_is_or(*args):
+  return _mathsat.msat_term_is_or(*args)
+msat_term_is_or = _mathsat.msat_term_is_or
+
+def msat_term_is_not(*args):
+  return _mathsat.msat_term_is_not(*args)
+msat_term_is_not = _mathsat.msat_term_is_not
+
+def msat_term_is_iff(*args):
+  return _mathsat.msat_term_is_iff(*args)
+msat_term_is_iff = _mathsat.msat_term_is_iff
+
+def msat_term_is_term_ite(*args):
+  return _mathsat.msat_term_is_term_ite(*args)
+msat_term_is_term_ite = _mathsat.msat_term_is_term_ite
+
+def msat_term_is_constant(*args):
+  return _mathsat.msat_term_is_constant(*args)
+msat_term_is_constant = _mathsat.msat_term_is_constant
+
+def msat_term_is_uf(*args):
+  return _mathsat.msat_term_is_uf(*args)
+msat_term_is_uf = _mathsat.msat_term_is_uf
+
+def msat_term_is_equal(*args):
+  return _mathsat.msat_term_is_equal(*args)
+msat_term_is_equal = _mathsat.msat_term_is_equal
+
+def msat_term_is_leq(*args):
+  return _mathsat.msat_term_is_leq(*args)
+msat_term_is_leq = _mathsat.msat_term_is_leq
+
+def msat_term_is_plus(*args):
+  return _mathsat.msat_term_is_plus(*args)
+msat_term_is_plus = _mathsat.msat_term_is_plus
+
+def msat_term_is_times(*args):
+  return _mathsat.msat_term_is_times(*args)
+msat_term_is_times = _mathsat.msat_term_is_times
+
+def _msat_term_is_int_modular_congruence(*args):
+  return _mathsat._msat_term_is_int_modular_congruence(*args)
+_msat_term_is_int_modular_congruence = _mathsat._msat_term_is_int_modular_congruence
+
+def msat_term_is_floor(*args):
+  return _mathsat.msat_term_is_floor(*args)
+msat_term_is_floor = _mathsat.msat_term_is_floor
+
+def msat_term_is_array_read(*args):
+  return _mathsat.msat_term_is_array_read(*args)
+msat_term_is_array_read = _mathsat.msat_term_is_array_read
+
+def msat_term_is_array_write(*args):
+  return _mathsat.msat_term_is_array_write(*args)
+msat_term_is_array_write = _mathsat.msat_term_is_array_write
+
+def msat_term_is_array_const(*args):
+  return _mathsat.msat_term_is_array_const(*args)
+msat_term_is_array_const = _mathsat.msat_term_is_array_const
+
+def msat_term_is_bv_concat(*args):
+  return _mathsat.msat_term_is_bv_concat(*args)
+msat_term_is_bv_concat = _mathsat.msat_term_is_bv_concat
+
+def _msat_term_is_bv_extract(*args):
+  return _mathsat._msat_term_is_bv_extract(*args)
+_msat_term_is_bv_extract = _mathsat._msat_term_is_bv_extract
+
+def msat_term_is_bv_or(*args):
+  return _mathsat.msat_term_is_bv_or(*args)
+msat_term_is_bv_or = _mathsat.msat_term_is_bv_or
+
+def msat_term_is_bv_xor(*args):
+  return _mathsat.msat_term_is_bv_xor(*args)
+msat_term_is_bv_xor = _mathsat.msat_term_is_bv_xor
+
+def msat_term_is_bv_and(*args):
+  return _mathsat.msat_term_is_bv_and(*args)
+msat_term_is_bv_and = _mathsat.msat_term_is_bv_and
+
+def msat_term_is_bv_not(*args):
+  return _mathsat.msat_term_is_bv_not(*args)
+msat_term_is_bv_not = _mathsat.msat_term_is_bv_not
+
+def msat_term_is_bv_plus(*args):
+  return _mathsat.msat_term_is_bv_plus(*args)
+msat_term_is_bv_plus = _mathsat.msat_term_is_bv_plus
+
+def msat_term_is_bv_minus(*args):
+  return _mathsat.msat_term_is_bv_minus(*args)
+msat_term_is_bv_minus = _mathsat.msat_term_is_bv_minus
+
+def msat_term_is_bv_times(*args):
+  return _mathsat.msat_term_is_bv_times(*args)
+msat_term_is_bv_times = _mathsat.msat_term_is_bv_times
+
+def msat_term_is_bv_neg(*args):
+  return _mathsat.msat_term_is_bv_neg(*args)
+msat_term_is_bv_neg = _mathsat.msat_term_is_bv_neg
+
+def msat_term_is_bv_udiv(*args):
+  return _mathsat.msat_term_is_bv_udiv(*args)
+msat_term_is_bv_udiv = _mathsat.msat_term_is_bv_udiv
+
+def msat_term_is_bv_urem(*args):
+  return _mathsat.msat_term_is_bv_urem(*args)
+msat_term_is_bv_urem = _mathsat.msat_term_is_bv_urem
+
+def msat_term_is_bv_sdiv(*args):
+  return _mathsat.msat_term_is_bv_sdiv(*args)
+msat_term_is_bv_sdiv = _mathsat.msat_term_is_bv_sdiv
+
+def msat_term_is_bv_srem(*args):
+  return _mathsat.msat_term_is_bv_srem(*args)
+msat_term_is_bv_srem = _mathsat.msat_term_is_bv_srem
+
+def msat_term_is_bv_ult(*args):
+  return _mathsat.msat_term_is_bv_ult(*args)
+msat_term_is_bv_ult = _mathsat.msat_term_is_bv_ult
+
+def msat_term_is_bv_uleq(*args):
+  return _mathsat.msat_term_is_bv_uleq(*args)
+msat_term_is_bv_uleq = _mathsat.msat_term_is_bv_uleq
+
+def msat_term_is_bv_slt(*args):
+  return _mathsat.msat_term_is_bv_slt(*args)
+msat_term_is_bv_slt = _mathsat.msat_term_is_bv_slt
+
+def msat_term_is_bv_sleq(*args):
+  return _mathsat.msat_term_is_bv_sleq(*args)
+msat_term_is_bv_sleq = _mathsat.msat_term_is_bv_sleq
+
+def msat_term_is_bv_lshl(*args):
+  return _mathsat.msat_term_is_bv_lshl(*args)
+msat_term_is_bv_lshl = _mathsat.msat_term_is_bv_lshl
+
+def msat_term_is_bv_lshr(*args):
+  return _mathsat.msat_term_is_bv_lshr(*args)
+msat_term_is_bv_lshr = _mathsat.msat_term_is_bv_lshr
+
+def msat_term_is_bv_ashr(*args):
+  return _mathsat.msat_term_is_bv_ashr(*args)
+msat_term_is_bv_ashr = _mathsat.msat_term_is_bv_ashr
+
+def _msat_term_is_bv_zext(*args):
+  return _mathsat._msat_term_is_bv_zext(*args)
+_msat_term_is_bv_zext = _mathsat._msat_term_is_bv_zext
+
+def _msat_term_is_bv_sext(*args):
+  return _mathsat._msat_term_is_bv_sext(*args)
+_msat_term_is_bv_sext = _mathsat._msat_term_is_bv_sext
+
+def _msat_term_is_bv_rol(*args):
+  return _mathsat._msat_term_is_bv_rol(*args)
+_msat_term_is_bv_rol = _mathsat._msat_term_is_bv_rol
+
+def _msat_term_is_bv_ror(*args):
+  return _mathsat._msat_term_is_bv_ror(*args)
+_msat_term_is_bv_ror = _mathsat._msat_term_is_bv_ror
+
+def msat_term_is_bv_comp(*args):
+  return _mathsat.msat_term_is_bv_comp(*args)
+msat_term_is_bv_comp = _mathsat.msat_term_is_bv_comp
+
+def msat_term_is_fp_roundingmode_nearest_even(*args):
+  return _mathsat.msat_term_is_fp_roundingmode_nearest_even(*args)
+msat_term_is_fp_roundingmode_nearest_even = _mathsat.msat_term_is_fp_roundingmode_nearest_even
+
+def msat_term_is_fp_roundingmode_zero(*args):
+  return _mathsat.msat_term_is_fp_roundingmode_zero(*args)
+msat_term_is_fp_roundingmode_zero = _mathsat.msat_term_is_fp_roundingmode_zero
+
+def msat_term_is_fp_roundingmode_plus_inf(*args):
+  return _mathsat.msat_term_is_fp_roundingmode_plus_inf(*args)
+msat_term_is_fp_roundingmode_plus_inf = _mathsat.msat_term_is_fp_roundingmode_plus_inf
+
+def msat_term_is_fp_roundingmode_minus_inf(*args):
+  return _mathsat.msat_term_is_fp_roundingmode_minus_inf(*args)
+msat_term_is_fp_roundingmode_minus_inf = _mathsat.msat_term_is_fp_roundingmode_minus_inf
+
+def msat_term_is_fp_equal(*args):
+  return _mathsat.msat_term_is_fp_equal(*args)
+msat_term_is_fp_equal = _mathsat.msat_term_is_fp_equal
+
+def msat_term_is_fp_lt(*args):
+  return _mathsat.msat_term_is_fp_lt(*args)
+msat_term_is_fp_lt = _mathsat.msat_term_is_fp_lt
+
+def msat_term_is_fp_leq(*args):
+  return _mathsat.msat_term_is_fp_leq(*args)
+msat_term_is_fp_leq = _mathsat.msat_term_is_fp_leq
+
+def msat_term_is_fp_neg(*args):
+  return _mathsat.msat_term_is_fp_neg(*args)
+msat_term_is_fp_neg = _mathsat.msat_term_is_fp_neg
+
+def msat_term_is_fp_plus(*args):
+  return _mathsat.msat_term_is_fp_plus(*args)
+msat_term_is_fp_plus = _mathsat.msat_term_is_fp_plus
+
+def msat_term_is_fp_minus(*args):
+  return _mathsat.msat_term_is_fp_minus(*args)
+msat_term_is_fp_minus = _mathsat.msat_term_is_fp_minus
+
+def msat_term_is_fp_times(*args):
+  return _mathsat.msat_term_is_fp_times(*args)
+msat_term_is_fp_times = _mathsat.msat_term_is_fp_times
+
+def msat_term_is_fp_div(*args):
+  return _mathsat.msat_term_is_fp_div(*args)
+msat_term_is_fp_div = _mathsat.msat_term_is_fp_div
+
+def msat_term_is_fp_sqrt(*args):
+  return _mathsat.msat_term_is_fp_sqrt(*args)
+msat_term_is_fp_sqrt = _mathsat.msat_term_is_fp_sqrt
+
+def msat_term_is_fp_abs(*args):
+  return _mathsat.msat_term_is_fp_abs(*args)
+msat_term_is_fp_abs = _mathsat.msat_term_is_fp_abs
+
+def msat_term_is_fp_min(*args):
+  return _mathsat.msat_term_is_fp_min(*args)
+msat_term_is_fp_min = _mathsat.msat_term_is_fp_min
+
+def msat_term_is_fp_max(*args):
+  return _mathsat.msat_term_is_fp_max(*args)
+msat_term_is_fp_max = _mathsat.msat_term_is_fp_max
+
+def msat_term_is_fp_round_to_int(*args):
+  return _mathsat.msat_term_is_fp_round_to_int(*args)
+msat_term_is_fp_round_to_int = _mathsat.msat_term_is_fp_round_to_int
+
+def msat_term_is_fp_cast(*args):
+  return _mathsat.msat_term_is_fp_cast(*args)
+msat_term_is_fp_cast = _mathsat.msat_term_is_fp_cast
+
+def msat_term_is_fp_to_bv(*args):
+  return _mathsat.msat_term_is_fp_to_bv(*args)
+msat_term_is_fp_to_bv = _mathsat.msat_term_is_fp_to_bv
+
+def msat_term_is_fp_from_sbv(*args):
+  return _mathsat.msat_term_is_fp_from_sbv(*args)
+msat_term_is_fp_from_sbv = _mathsat.msat_term_is_fp_from_sbv
+
+def msat_term_is_fp_from_ubv(*args):
+  return _mathsat.msat_term_is_fp_from_ubv(*args)
+msat_term_is_fp_from_ubv = _mathsat.msat_term_is_fp_from_ubv
+
+def msat_term_is_fp_as_ieeebv(*args):
+  return _mathsat.msat_term_is_fp_as_ieeebv(*args)
+msat_term_is_fp_as_ieeebv = _mathsat.msat_term_is_fp_as_ieeebv
+
+def msat_term_is_fp_from_ieeebv(*args):
+  return _mathsat.msat_term_is_fp_from_ieeebv(*args)
+msat_term_is_fp_from_ieeebv = _mathsat.msat_term_is_fp_from_ieeebv
+
+def msat_term_is_fp_isnan(*args):
+  return _mathsat.msat_term_is_fp_isnan(*args)
+msat_term_is_fp_isnan = _mathsat.msat_term_is_fp_isnan
+
+def msat_term_is_fp_isinf(*args):
+  return _mathsat.msat_term_is_fp_isinf(*args)
+msat_term_is_fp_isinf = _mathsat.msat_term_is_fp_isinf
+
+def msat_term_is_fp_iszero(*args):
+  return _mathsat.msat_term_is_fp_iszero(*args)
+msat_term_is_fp_iszero = _mathsat.msat_term_is_fp_iszero
+
+def msat_term_is_fp_issubnormal(*args):
+  return _mathsat.msat_term_is_fp_issubnormal(*args)
+msat_term_is_fp_issubnormal = _mathsat.msat_term_is_fp_issubnormal
+
+def msat_term_is_fp_isnormal(*args):
+  return _mathsat.msat_term_is_fp_isnormal(*args)
+msat_term_is_fp_isnormal = _mathsat.msat_term_is_fp_isnormal
+
+def msat_term_is_fp_isneg(*args):
+  return _mathsat.msat_term_is_fp_isneg(*args)
+msat_term_is_fp_isneg = _mathsat.msat_term_is_fp_isneg
+
+def msat_term_is_fp_ispos(*args):
+  return _mathsat.msat_term_is_fp_ispos(*args)
+msat_term_is_fp_ispos = _mathsat.msat_term_is_fp_ispos
+
+def msat_term_is_int_to_bv(*args):
+  return _mathsat.msat_term_is_int_to_bv(*args)
+msat_term_is_int_to_bv = _mathsat.msat_term_is_int_to_bv
+
+def msat_term_is_int_from_ubv(*args):
+  return _mathsat.msat_term_is_int_from_ubv(*args)
+msat_term_is_int_from_ubv = _mathsat.msat_term_is_int_from_ubv
+
+def msat_term_is_int_from_sbv(*args):
+  return _mathsat.msat_term_is_int_from_sbv(*args)
+msat_term_is_int_from_sbv = _mathsat.msat_term_is_int_from_sbv
+
+def msat_visit_term(*args):
+  return _mathsat.msat_visit_term(*args)
+msat_visit_term = _mathsat.msat_visit_term
+
+def _msat_apply_substitution(*args):
+  return _mathsat._msat_apply_substitution(*args)
+_msat_apply_substitution = _mathsat._msat_apply_substitution
+
+def msat_find_decl(*args):
+  return _mathsat.msat_find_decl(*args)
+msat_find_decl = _mathsat.msat_find_decl
+
+def msat_term_get_decl(*args):
+  return _mathsat.msat_term_get_decl(*args)
+msat_term_get_decl = _mathsat.msat_term_get_decl
+
+def msat_decl_id(*args):
+  return _mathsat.msat_decl_id(*args)
+msat_decl_id = _mathsat.msat_decl_id
+
+def msat_decl_get_tag(*args):
+  return _mathsat.msat_decl_get_tag(*args)
+msat_decl_get_tag = _mathsat.msat_decl_get_tag
+
+def msat_decl_get_return_type(*args):
+  return _mathsat.msat_decl_get_return_type(*args)
+msat_decl_get_return_type = _mathsat.msat_decl_get_return_type
+
+def msat_decl_get_arity(*args):
+  return _mathsat.msat_decl_get_arity(*args)
+msat_decl_get_arity = _mathsat.msat_decl_get_arity
+
+def msat_decl_get_arg_type(*args):
+  return _mathsat.msat_decl_get_arg_type(*args)
+msat_decl_get_arg_type = _mathsat.msat_decl_get_arg_type
+
+def msat_decl_get_name(*args):
+  return _mathsat.msat_decl_get_name(*args)
+msat_decl_get_name = _mathsat.msat_decl_get_name
+
+def msat_decl_repr(*args):
+  return _mathsat.msat_decl_repr(*args)
+msat_decl_repr = _mathsat.msat_decl_repr
+
+def msat_term_repr(*args):
+  return _mathsat.msat_term_repr(*args)
+msat_term_repr = _mathsat.msat_term_repr
+
+def msat_from_string(*args):
+  return _mathsat.msat_from_string(*args)
+msat_from_string = _mathsat.msat_from_string
+
+def msat_from_smtlib1(*args):
+  return _mathsat.msat_from_smtlib1(*args)
+msat_from_smtlib1 = _mathsat.msat_from_smtlib1
+
+def msat_from_smtlib2(*args):
+  return _mathsat.msat_from_smtlib2(*args)
+msat_from_smtlib2 = _mathsat.msat_from_smtlib2
+
+def msat_to_smtlib1(*args):
+  return _mathsat.msat_to_smtlib1(*args)
+msat_to_smtlib1 = _mathsat.msat_to_smtlib1
+
+def msat_to_smtlib2(*args):
+  return _mathsat.msat_to_smtlib2(*args)
+msat_to_smtlib2 = _mathsat.msat_to_smtlib2
+
+def msat_to_smtlib2_ext(*args):
+  return _mathsat.msat_to_smtlib2_ext(*args)
+msat_to_smtlib2_ext = _mathsat.msat_to_smtlib2_ext
+
+def msat_to_smtlib2_term(*args):
+  return _mathsat.msat_to_smtlib2_term(*args)
+msat_to_smtlib2_term = _mathsat.msat_to_smtlib2_term
+
+def _msat_named_list_from_smtlib2(*args):
+  return _mathsat._msat_named_list_from_smtlib2(*args)
+_msat_named_list_from_smtlib2 = _mathsat._msat_named_list_from_smtlib2
+
+def _msat_named_list_to_smtlib2(*args):
+  return _mathsat._msat_named_list_to_smtlib2(*args)
+_msat_named_list_to_smtlib2 = _mathsat._msat_named_list_to_smtlib2
+
+def _msat_annotated_list_from_smtlib2(*args):
+  return _mathsat._msat_annotated_list_from_smtlib2(*args)
+_msat_annotated_list_from_smtlib2 = _mathsat._msat_annotated_list_from_smtlib2
+
+def _msat_annotated_list_to_smtlib2(*args):
+  return _mathsat._msat_annotated_list_to_smtlib2(*args)
+_msat_annotated_list_to_smtlib2 = _mathsat._msat_annotated_list_to_smtlib2
+
+def msat_push_backtrack_point(*args):
+  return _mathsat.msat_push_backtrack_point(*args)
+msat_push_backtrack_point = _mathsat.msat_push_backtrack_point
+
+def msat_pop_backtrack_point(*args):
+  return _mathsat.msat_pop_backtrack_point(*args)
+msat_pop_backtrack_point = _mathsat.msat_pop_backtrack_point
+
+def msat_num_backtrack_points(*args):
+  return _mathsat.msat_num_backtrack_points(*args)
+msat_num_backtrack_points = _mathsat.msat_num_backtrack_points
+
+def msat_reset_env(*args):
+  return _mathsat.msat_reset_env(*args)
+msat_reset_env = _mathsat.msat_reset_env
+
+def msat_assert_formula(*args):
+  return _mathsat.msat_assert_formula(*args)
+msat_assert_formula = _mathsat.msat_assert_formula
+
+def msat_add_preferred_for_branching(*args):
+  return _mathsat.msat_add_preferred_for_branching(*args)
+msat_add_preferred_for_branching = _mathsat.msat_add_preferred_for_branching
+
+def msat_clear_preferred_for_branching(*args):
+  return _mathsat.msat_clear_preferred_for_branching(*args)
+msat_clear_preferred_for_branching = _mathsat.msat_clear_preferred_for_branching
+
+def msat_solve(*args):
+  return _mathsat.msat_solve(*args)
+msat_solve = _mathsat.msat_solve
+
+def _msat_solve_with_assumptions(*args):
+  return _mathsat._msat_solve_with_assumptions(*args)
+_msat_solve_with_assumptions = _mathsat._msat_solve_with_assumptions
+
+def _msat_all_sat(*args):
+  return _mathsat._msat_all_sat(*args)
+_msat_all_sat = _mathsat._msat_all_sat
+
+def _msat_solve_diversify(*args):
+  return _mathsat._msat_solve_diversify(*args)
+_msat_solve_diversify = _mathsat._msat_solve_diversify
+
+def _msat_get_asserted_formulas(*args):
+  return _mathsat._msat_get_asserted_formulas(*args)
+_msat_get_asserted_formulas = _mathsat._msat_get_asserted_formulas
+
+def _msat_get_theory_lemmas(*args):
+  return _mathsat._msat_get_theory_lemmas(*args)
+_msat_get_theory_lemmas = _mathsat._msat_get_theory_lemmas
+
+def msat_get_search_stats(*args):
+  return _mathsat.msat_get_search_stats(*args)
+msat_get_search_stats = _mathsat.msat_get_search_stats
+
+def msat_create_itp_group(*args):
+  return _mathsat.msat_create_itp_group(*args)
+msat_create_itp_group = _mathsat.msat_create_itp_group
+
+def msat_set_itp_group(*args):
+  return _mathsat.msat_set_itp_group(*args)
+msat_set_itp_group = _mathsat.msat_set_itp_group
+
+def _msat_get_interpolant(*args):
+  return _mathsat._msat_get_interpolant(*args)
+_msat_get_interpolant = _mathsat._msat_get_interpolant
+
+def msat_get_model_value(*args):
+  return _mathsat.msat_get_model_value(*args)
+msat_get_model_value = _mathsat.msat_get_model_value
+
+def msat_create_model_iterator(*args):
+  return _mathsat.msat_create_model_iterator(*args)
+msat_create_model_iterator = _mathsat.msat_create_model_iterator
+
+def msat_model_iterator_has_next(*args):
+  return _mathsat.msat_model_iterator_has_next(*args)
+msat_model_iterator_has_next = _mathsat.msat_model_iterator_has_next
+
+def _msat_model_iterator_next(*args):
+  return _mathsat._msat_model_iterator_next(*args)
+_msat_model_iterator_next = _mathsat._msat_model_iterator_next
+
+def msat_destroy_model_iterator(*args):
+  return _mathsat.msat_destroy_model_iterator(*args)
+msat_destroy_model_iterator = _mathsat.msat_destroy_model_iterator
+
+def msat_get_model(*args):
+  return _mathsat.msat_get_model(*args)
+msat_get_model = _mathsat.msat_get_model
+
+def msat_destroy_model(*args):
+  return _mathsat.msat_destroy_model(*args)
+msat_destroy_model = _mathsat.msat_destroy_model
+
+def msat_model_eval(*args):
+  return _mathsat.msat_model_eval(*args)
+msat_model_eval = _mathsat.msat_model_eval
+
+def msat_model_create_iterator(*args):
+  return _mathsat.msat_model_create_iterator(*args)
+msat_model_create_iterator = _mathsat.msat_model_create_iterator
+
+def _msat_get_unsat_core(*args):
+  return _mathsat._msat_get_unsat_core(*args)
+_msat_get_unsat_core = _mathsat._msat_get_unsat_core
+
+def msat_get_unsat_core_ext(*args):
+  return _mathsat.msat_get_unsat_core_ext(*args)
+msat_get_unsat_core_ext = _mathsat.msat_get_unsat_core_ext
+
+def _msat_get_unsat_assumptions(*args):
+  return _mathsat._msat_get_unsat_assumptions(*args)
+_msat_get_unsat_assumptions = _mathsat._msat_get_unsat_assumptions
+
+def msat_get_proof_manager(*args):
+  return _mathsat.msat_get_proof_manager(*args)
+msat_get_proof_manager = _mathsat.msat_get_proof_manager
+
+def msat_destroy_proof_manager(*args):
+  return _mathsat.msat_destroy_proof_manager(*args)
+msat_destroy_proof_manager = _mathsat.msat_destroy_proof_manager
+
+def msat_get_proof(*args):
+  return _mathsat.msat_get_proof(*args)
+msat_get_proof = _mathsat.msat_get_proof
+
+def msat_proof_id(*args):
+  return _mathsat.msat_proof_id(*args)
+msat_proof_id = _mathsat.msat_proof_id
+
+def msat_proof_is_term(*args):
+  return _mathsat.msat_proof_is_term(*args)
+msat_proof_is_term = _mathsat.msat_proof_is_term
+
+def msat_proof_get_term(*args):
+  return _mathsat.msat_proof_get_term(*args)
+msat_proof_get_term = _mathsat.msat_proof_get_term
+
+def msat_proof_get_name(*args):
+  return _mathsat.msat_proof_get_name(*args)
+msat_proof_get_name = _mathsat.msat_proof_get_name
+
+def msat_proof_get_arity(*args):
+  return _mathsat.msat_proof_get_arity(*args)
+msat_proof_get_arity = _mathsat.msat_proof_get_arity
+
+def msat_proof_get_child(*args):
+  return _mathsat.msat_proof_get_child(*args)
+msat_proof_get_child = _mathsat.msat_proof_get_child
+class msat_dpll_callback(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, msat_dpll_callback, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, msat_dpll_callback, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["repr"] = _mathsat.msat_dpll_callback_repr_set
+    __swig_getmethods__["repr"] = _mathsat.msat_dpll_callback_repr_get
+    if _newclass:repr = _swig_property(_mathsat.msat_dpll_callback_repr_get, _mathsat.msat_dpll_callback_repr_set)
+    def __init__(self): 
+        this = _mathsat.new_msat_dpll_callback()
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _mathsat.delete_msat_dpll_callback
+    __del__ = lambda self : None;
+msat_dpll_callback_swigregister = _mathsat.msat_dpll_callback_swigregister
+msat_dpll_callback_swigregister(msat_dpll_callback)
+
+class msat_ext_dpll_interface(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, msat_ext_dpll_interface, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, msat_ext_dpll_interface, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["new_var"] = _mathsat.msat_ext_dpll_interface_new_var_set
+    __swig_getmethods__["new_var"] = _mathsat.msat_ext_dpll_interface_new_var_get
+    if _newclass:new_var = _swig_property(_mathsat.msat_ext_dpll_interface_new_var_get, _mathsat.msat_ext_dpll_interface_new_var_set)
+    __swig_setmethods__["set_decision_var"] = _mathsat.msat_ext_dpll_interface_set_decision_var_set
+    __swig_getmethods__["set_decision_var"] = _mathsat.msat_ext_dpll_interface_set_decision_var_get
+    if _newclass:set_decision_var = _swig_property(_mathsat.msat_ext_dpll_interface_set_decision_var_get, _mathsat.msat_ext_dpll_interface_set_decision_var_set)
+    __swig_setmethods__["set_frozen"] = _mathsat.msat_ext_dpll_interface_set_frozen_set
+    __swig_getmethods__["set_frozen"] = _mathsat.msat_ext_dpll_interface_set_frozen_get
+    if _newclass:set_frozen = _swig_property(_mathsat.msat_ext_dpll_interface_set_frozen_get, _mathsat.msat_ext_dpll_interface_set_frozen_set)
+    __swig_setmethods__["add_clause"] = _mathsat.msat_ext_dpll_interface_add_clause_set
+    __swig_getmethods__["add_clause"] = _mathsat.msat_ext_dpll_interface_add_clause_get
+    if _newclass:add_clause = _swig_property(_mathsat.msat_ext_dpll_interface_add_clause_get, _mathsat.msat_ext_dpll_interface_add_clause_set)
+    __swig_setmethods__["solve"] = _mathsat.msat_ext_dpll_interface_solve_set
+    __swig_getmethods__["solve"] = _mathsat.msat_ext_dpll_interface_solve_get
+    if _newclass:solve = _swig_property(_mathsat.msat_ext_dpll_interface_solve_get, _mathsat.msat_ext_dpll_interface_solve_set)
+    __swig_setmethods__["model_value"] = _mathsat.msat_ext_dpll_interface_model_value_set
+    __swig_getmethods__["model_value"] = _mathsat.msat_ext_dpll_interface_model_value_get
+    if _newclass:model_value = _swig_property(_mathsat.msat_ext_dpll_interface_model_value_get, _mathsat.msat_ext_dpll_interface_model_value_set)
+    __swig_setmethods__["enqueue_assignment"] = _mathsat.msat_ext_dpll_interface_enqueue_assignment_set
+    __swig_getmethods__["enqueue_assignment"] = _mathsat.msat_ext_dpll_interface_enqueue_assignment_get
+    if _newclass:enqueue_assignment = _swig_property(_mathsat.msat_ext_dpll_interface_enqueue_assignment_get, _mathsat.msat_ext_dpll_interface_enqueue_assignment_set)
+    __swig_setmethods__["remove_clauses_containing"] = _mathsat.msat_ext_dpll_interface_remove_clauses_containing_set
+    __swig_getmethods__["remove_clauses_containing"] = _mathsat.msat_ext_dpll_interface_remove_clauses_containing_get
+    if _newclass:remove_clauses_containing = _swig_property(_mathsat.msat_ext_dpll_interface_remove_clauses_containing_get, _mathsat.msat_ext_dpll_interface_remove_clauses_containing_set)
+    __swig_setmethods__["reset"] = _mathsat.msat_ext_dpll_interface_reset_set
+    __swig_getmethods__["reset"] = _mathsat.msat_ext_dpll_interface_reset_get
+    if _newclass:reset = _swig_property(_mathsat.msat_ext_dpll_interface_reset_get, _mathsat.msat_ext_dpll_interface_reset_set)
+    __swig_setmethods__["set_callback"] = _mathsat.msat_ext_dpll_interface_set_callback_set
+    __swig_getmethods__["set_callback"] = _mathsat.msat_ext_dpll_interface_set_callback_get
+    if _newclass:set_callback = _swig_property(_mathsat.msat_ext_dpll_interface_set_callback_get, _mathsat.msat_ext_dpll_interface_set_callback_set)
+    def __init__(self): 
+        this = _mathsat.new_msat_ext_dpll_interface()
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _mathsat.delete_msat_ext_dpll_interface
+    __del__ = lambda self : None;
+msat_ext_dpll_interface_swigregister = _mathsat.msat_ext_dpll_interface_swigregister
+msat_ext_dpll_interface_swigregister(msat_ext_dpll_interface)
+
+
+def msat_set_external_dpll_engine(*args):
+  return _mathsat.msat_set_external_dpll_engine(*args)
+msat_set_external_dpll_engine = _mathsat.msat_set_external_dpll_engine
+
+def msat_dpll_callback_no_conflict_after_bcp(*args):
+  return _mathsat.msat_dpll_callback_no_conflict_after_bcp(*args)
+msat_dpll_callback_no_conflict_after_bcp = _mathsat.msat_dpll_callback_no_conflict_after_bcp
+
+def msat_dpll_callback_model_found(*args):
+  return _mathsat.msat_dpll_callback_model_found(*args)
+msat_dpll_callback_model_found = _mathsat.msat_dpll_callback_model_found
+
+def msat_dpll_callback_notify_assignment(*args):
+  return _mathsat.msat_dpll_callback_notify_assignment(*args)
+msat_dpll_callback_notify_assignment = _mathsat.msat_dpll_callback_notify_assignment
+
+def msat_dpll_callback_notify_new_level(*args):
+  return _mathsat.msat_dpll_callback_notify_new_level(*args)
+msat_dpll_callback_notify_new_level = _mathsat.msat_dpll_callback_notify_new_level
+
+def msat_dpll_callback_notify_backtrack(*args):
+  return _mathsat.msat_dpll_callback_notify_backtrack(*args)
+msat_dpll_callback_notify_backtrack = _mathsat.msat_dpll_callback_notify_backtrack
+
+def msat_dpll_callback_ask_theory_reason(*args):
+  return _mathsat.msat_dpll_callback_ask_theory_reason(*args)
+msat_dpll_callback_ask_theory_reason = _mathsat.msat_dpll_callback_ask_theory_reason
+MSAT_EXIST_ELIM_ALLSMT_FM = _mathsat.MSAT_EXIST_ELIM_ALLSMT_FM
+MSAT_EXIST_ELIM_VTS = _mathsat.MSAT_EXIST_ELIM_VTS
+class msat_exist_elim_options(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, msat_exist_elim_options, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, msat_exist_elim_options, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["toplevel_propagation"] = _mathsat.msat_exist_elim_options_toplevel_propagation_set
+    __swig_getmethods__["toplevel_propagation"] = _mathsat.msat_exist_elim_options_toplevel_propagation_get
+    if _newclass:toplevel_propagation = _swig_property(_mathsat.msat_exist_elim_options_toplevel_propagation_get, _mathsat.msat_exist_elim_options_toplevel_propagation_set)
+    __swig_setmethods__["boolean_simplifications"] = _mathsat.msat_exist_elim_options_boolean_simplifications_set
+    __swig_getmethods__["boolean_simplifications"] = _mathsat.msat_exist_elim_options_boolean_simplifications_get
+    if _newclass:boolean_simplifications = _swig_property(_mathsat.msat_exist_elim_options_boolean_simplifications_get, _mathsat.msat_exist_elim_options_boolean_simplifications_set)
+    __swig_setmethods__["remove_redundant_constraints"] = _mathsat.msat_exist_elim_options_remove_redundant_constraints_set
+    __swig_getmethods__["remove_redundant_constraints"] = _mathsat.msat_exist_elim_options_remove_redundant_constraints_get
+    if _newclass:remove_redundant_constraints = _swig_property(_mathsat.msat_exist_elim_options_remove_redundant_constraints_get, _mathsat.msat_exist_elim_options_remove_redundant_constraints_set)
+    def __init__(self): 
+        this = _mathsat.new_msat_exist_elim_options()
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _mathsat.delete_msat_exist_elim_options
+    __del__ = lambda self : None;
+msat_exist_elim_options_swigregister = _mathsat.msat_exist_elim_options_swigregister
+msat_exist_elim_options_swigregister(msat_exist_elim_options)
+
+
+def _msat_exist_elim(*args):
+  return _mathsat._msat_exist_elim(*args)
+_msat_exist_elim = _mathsat._msat_exist_elim
+
+def _msat_exist_elim_model(*args):
+  return _mathsat._msat_exist_elim_model(*args)
+_msat_exist_elim_model = _mathsat._msat_exist_elim_model
+
+def msat_aig_simplify(*args):
+  return _mathsat.msat_aig_simplify(*args)
+msat_aig_simplify = _mathsat.msat_aig_simplify
+
+def msat_to_nnf(*args):
+  return _mathsat.msat_to_nnf(*args)
+msat_to_nnf = _mathsat.msat_to_nnf
+
+def msat_lra_simplify(*args):
+  return _mathsat.msat_lra_simplify(*args)
+msat_lra_simplify = _mathsat.msat_lra_simplify
+class msat_ic3(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, msat_ic3, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, msat_ic3, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["repr"] = _mathsat.msat_ic3_repr_set
+    __swig_getmethods__["repr"] = _mathsat.msat_ic3_repr_get
+    if _newclass:repr = _swig_property(_mathsat.msat_ic3_repr_get, _mathsat.msat_ic3_repr_set)
+    def __init__(self): 
+        this = _mathsat.new_msat_ic3()
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _mathsat.delete_msat_ic3
+    __del__ = lambda self : None;
+msat_ic3_swigregister = _mathsat.msat_ic3_swigregister
+msat_ic3_swigregister(msat_ic3)
+
+MSAT_IC3_CONCRETE = _mathsat.MSAT_IC3_CONCRETE
+MSAT_IC3_IA = _mathsat.MSAT_IC3_IA
+MSAT_IC3_PARAMS = _mathsat.MSAT_IC3_PARAMS
+MSAT_IC3_PARAMS_IA = _mathsat.MSAT_IC3_PARAMS_IA
+MSAT_IC3_BMC = _mathsat.MSAT_IC3_BMC
+MSAT_IC3_CTIGAR = _mathsat.MSAT_IC3_CTIGAR
+MSAT_IC3_KINDUCTION = _mathsat.MSAT_IC3_KINDUCTION
+MSAT_IC3_PROP_UNKNOWN = _mathsat.MSAT_IC3_PROP_UNKNOWN
+MSAT_IC3_PROP_INVAR = _mathsat.MSAT_IC3_PROP_INVAR
+MSAT_IC3_PROP_LIVE = _mathsat.MSAT_IC3_PROP_LIVE
+MSAT_IC3_ERR_GENERIC = _mathsat.MSAT_IC3_ERR_GENERIC
+MSAT_IC3_ERR_INVALID_PROPERTY = _mathsat.MSAT_IC3_ERR_INVALID_PROPERTY
+MSAT_IC3_ERR_INVALID_STATE = _mathsat.MSAT_IC3_ERR_INVALID_STATE
+MSAT_IC3_ERR_MAX_BOUND = _mathsat.MSAT_IC3_ERR_MAX_BOUND
+MSAT_IC3_ERR_REFINEMENT_FAILURE = _mathsat.MSAT_IC3_ERR_REFINEMENT_FAILURE
+
+def msat_create_ic3(*args):
+  return _mathsat.msat_create_ic3(*args)
+msat_create_ic3 = _mathsat.msat_create_ic3
+
+def msat_destroy_ic3(*args):
+  return _mathsat.msat_destroy_ic3(*args)
+msat_destroy_ic3 = _mathsat.msat_destroy_ic3
+
+def msat_ic3_last_error_message(*args):
+  return _mathsat.msat_ic3_last_error_message(*args)
+msat_ic3_last_error_message = _mathsat.msat_ic3_last_error_message
+
+def msat_ic3_set_verbosity(*args):
+  return _mathsat.msat_ic3_set_verbosity(*args)
+msat_ic3_set_verbosity = _mathsat.msat_ic3_set_verbosity
+
+def msat_ic3_setopt(*args):
+  return _mathsat.msat_ic3_setopt(*args)
+msat_ic3_setopt = _mathsat.msat_ic3_setopt
+
+def msat_ic3_parse_opts(*args):
+  return _mathsat.msat_ic3_parse_opts(*args)
+msat_ic3_parse_opts = _mathsat.msat_ic3_parse_opts
+
+def msat_ic3_opthelp(*args):
+  return _mathsat.msat_ic3_opthelp(*args)
+msat_ic3_opthelp = _mathsat.msat_ic3_opthelp
+
+def msat_ic3_set_search_bound_callback(*args):
+  return _mathsat.msat_ic3_set_search_bound_callback(*args)
+msat_ic3_set_search_bound_callback = _mathsat.msat_ic3_set_search_bound_callback
+
+def msat_ic3_set_param_region_callbacks(*args):
+  return _mathsat.msat_ic3_set_param_region_callbacks(*args)
+msat_ic3_set_param_region_callbacks = _mathsat.msat_ic3_set_param_region_callbacks
+
+def msat_ic3_add_state_var(*args):
+  return _mathsat.msat_ic3_add_state_var(*args)
+msat_ic3_add_state_var = _mathsat.msat_ic3_add_state_var
+
+def msat_ic3_set_init(*args):
+  return _mathsat.msat_ic3_set_init(*args)
+msat_ic3_set_init = _mathsat.msat_ic3_set_init
+
+def msat_ic3_set_trans(*args):
+  return _mathsat.msat_ic3_set_trans(*args)
+msat_ic3_set_trans = _mathsat.msat_ic3_set_trans
+
+def msat_ic3_add_invar_property(*args):
+  return _mathsat.msat_ic3_add_invar_property(*args)
+msat_ic3_add_invar_property = _mathsat.msat_ic3_add_invar_property
+
+def msat_ic3_add_property(*args):
+  return _mathsat.msat_ic3_add_property(*args)
+msat_ic3_add_property = _mathsat.msat_ic3_add_property
+
+def msat_ic3_add_param(*args):
+  return _mathsat.msat_ic3_add_param(*args)
+msat_ic3_add_param = _mathsat.msat_ic3_add_param
+
+def msat_ic3_add_predicate(*args):
+  return _mathsat.msat_ic3_add_predicate(*args)
+msat_ic3_add_predicate = _mathsat.msat_ic3_add_predicate
+
+def msat_ic3_set_kzeno_time_var(*args):
+  return _mathsat.msat_ic3_set_kzeno_time_var(*args)
+msat_ic3_set_kzeno_time_var = _mathsat.msat_ic3_set_kzeno_time_var
+
+def msat_ic3_set_kzeno_bound(*args):
+  return _mathsat.msat_ic3_set_kzeno_bound(*args)
+msat_ic3_set_kzeno_bound = _mathsat.msat_ic3_set_kzeno_bound
+
+def msat_ic3_init(*args):
+  return _mathsat.msat_ic3_init(*args)
+msat_ic3_init = _mathsat.msat_ic3_init
+
+def msat_ic3_add_init_constraint(*args):
+  return _mathsat.msat_ic3_add_init_constraint(*args)
+msat_ic3_add_init_constraint = _mathsat.msat_ic3_add_init_constraint
+
+def msat_ic3_add_trans_constraint(*args):
+  return _mathsat.msat_ic3_add_trans_constraint(*args)
+msat_ic3_add_trans_constraint = _mathsat.msat_ic3_add_trans_constraint
+
+def msat_ic3_num_state_vars(*args):
+  return _mathsat.msat_ic3_num_state_vars(*args)
+msat_ic3_num_state_vars = _mathsat.msat_ic3_num_state_vars
+
+def _msat_ic3_get_state_var(*args):
+  return _mathsat._msat_ic3_get_state_var(*args)
+_msat_ic3_get_state_var = _mathsat._msat_ic3_get_state_var
+
+def msat_ic3_get_init(*args):
+  return _mathsat.msat_ic3_get_init(*args)
+msat_ic3_get_init = _mathsat.msat_ic3_get_init
+
+def msat_ic3_get_trans(*args):
+  return _mathsat.msat_ic3_get_trans(*args)
+msat_ic3_get_trans = _mathsat.msat_ic3_get_trans
+
+def msat_ic3_num_properties(*args):
+  return _mathsat.msat_ic3_num_properties(*args)
+msat_ic3_num_properties = _mathsat.msat_ic3_num_properties
+
+def msat_ic3_get_property(*args):
+  return _mathsat.msat_ic3_get_property(*args)
+msat_ic3_get_property = _mathsat.msat_ic3_get_property
+
+def msat_ic3_get_property_kind(*args):
+  return _mathsat.msat_ic3_get_property_kind(*args)
+msat_ic3_get_property_kind = _mathsat.msat_ic3_get_property_kind
+
+def msat_ic3_num_params(*args):
+  return _mathsat.msat_ic3_num_params(*args)
+msat_ic3_num_params = _mathsat.msat_ic3_num_params
+
+def msat_ic3_get_param(*args):
+  return _mathsat.msat_ic3_get_param(*args)
+msat_ic3_get_param = _mathsat.msat_ic3_get_param
+
+def msat_ic3_num_predicates(*args):
+  return _mathsat.msat_ic3_num_predicates(*args)
+msat_ic3_num_predicates = _mathsat.msat_ic3_num_predicates
+
+def msat_ic3_get_predicate(*args):
+  return _mathsat.msat_ic3_get_predicate(*args)
+msat_ic3_get_predicate = _mathsat.msat_ic3_get_predicate
+
+def msat_ic3_from_smtlib2(*args):
+  return _mathsat.msat_ic3_from_smtlib2(*args)
+msat_ic3_from_smtlib2 = _mathsat.msat_ic3_from_smtlib2
+
+def msat_ic3_to_smtlib2(*args):
+  return _mathsat.msat_ic3_to_smtlib2(*args)
+msat_ic3_to_smtlib2 = _mathsat.msat_ic3_to_smtlib2
+
+def msat_ic3_to_smtlib2_horn(*args):
+  return _mathsat.msat_ic3_to_smtlib2_horn(*args)
+msat_ic3_to_smtlib2_horn = _mathsat.msat_ic3_to_smtlib2_horn
+
+def msat_ic3_to_smtlib2_horn_file(*args):
+  return _mathsat.msat_ic3_to_smtlib2_horn_file(*args)
+msat_ic3_to_smtlib2_horn_file = _mathsat.msat_ic3_to_smtlib2_horn_file
+
+def msat_ic3_prove(*args):
+  return _mathsat.msat_ic3_prove(*args)
+msat_ic3_prove = _mathsat.msat_ic3_prove
+
+def msat_ic3_witness(*args):
+  return _mathsat.msat_ic3_witness(*args)
+msat_ic3_witness = _mathsat.msat_ic3_witness
+
+def msat_ic3_witness_loopback(*args):
+  return _mathsat.msat_ic3_witness_loopback(*args)
+msat_ic3_witness_loopback = _mathsat.msat_ic3_witness_loopback
+
+def msat_ic3_stats(*args):
+  return _mathsat.msat_ic3_stats(*args)
+msat_ic3_stats = _mathsat.msat_ic3_stats
+
+def MSAT_ERROR_CONFIG(*args):
+  return _mathsat.MSAT_ERROR_CONFIG(*args)
+MSAT_ERROR_CONFIG = _mathsat.MSAT_ERROR_CONFIG
+
+def MSAT_ERROR_ENV(*args):
+  return _mathsat.MSAT_ERROR_ENV(*args)
+MSAT_ERROR_ENV = _mathsat.MSAT_ERROR_ENV
+
+def MSAT_ERROR_TERM(*args):
+  return _mathsat.MSAT_ERROR_TERM(*args)
+MSAT_ERROR_TERM = _mathsat.MSAT_ERROR_TERM
+
+def MSAT_ERROR_DECL(*args):
+  return _mathsat.MSAT_ERROR_DECL(*args)
+MSAT_ERROR_DECL = _mathsat.MSAT_ERROR_DECL
+
+def MSAT_MAKE_ERROR_TERM():
+  return _mathsat.MSAT_MAKE_ERROR_TERM()
+MSAT_MAKE_ERROR_TERM = _mathsat.MSAT_MAKE_ERROR_TERM
+
+def MSAT_ERROR_TYPE(*args):
+  return _mathsat.MSAT_ERROR_TYPE(*args)
+MSAT_ERROR_TYPE = _mathsat.MSAT_ERROR_TYPE
+
+def MSAT_ERROR_MODEL_ITERATOR(*args):
+  return _mathsat.MSAT_ERROR_MODEL_ITERATOR(*args)
+MSAT_ERROR_MODEL_ITERATOR = _mathsat.MSAT_ERROR_MODEL_ITERATOR
+
+def MSAT_ERROR_MODEL(*args):
+  return _mathsat.MSAT_ERROR_MODEL(*args)
+MSAT_ERROR_MODEL = _mathsat.MSAT_ERROR_MODEL
+def msat_parse_config(data_or_file):
+    if hasattr(data_or_file, 'read'):
+        data_or_file = data_or_file.read()
+    return _msat_parse_config(data_or_file)
+
+def msat_parse_config_file(f):
+    return _msat_parse_config(f.read())
+
+def msat_create_env(conf=None, other=None):
+    try:
+        if conf is None:
+            cfg = msat_create_config()
+        elif hasattr(conf, 'iteritems'):
+            cfg = msat_create_config()
+            for (k, v) in conf.iteritems():
+                msat_set_option(cfg, k, v)
+        elif hasattr(conf, 'read'):
+            cfg = _msat_parse_config(conf.read())
+        else:
+            try:
+                cfg = conf + ""
+            except:
+                cfg = conf
+            else:
+                if '=' not in cfg:
+                    cfg = msat_create_default_config(cfg)
+                else:
+                    cfg = msat_parse_config(cfg)
+        if other is not None:
+            return _msat_create_shared_env(cfg, other)
+        else:
+            return _msat_create_env(cfg)
+    finally:
+        if cfg is not conf:
+            msat_destroy_config(cfg)
+            
+msat_create_shared_env = msat_create_env
+
+def msat_get_function_type(env, param_types, return_type):
+    return _msat_get_function_type(env, param_types, len(param_types), return_type)
+
+def msat_model_iterator_next(i):
+    "returns a tuple (term, value)"
+    t = msat_term()
+    v = msat_term()
+    _msat_model_iterator_next(i, t, v)
+    return (t, v)
+
+def msat_all_sat(env, important, callback):
+    return _msat_all_sat(env, important, len(important), callback)
+
+def msat_solve_diversify(env, diversifiers, callback):
+    return _msat_solve_diversify(env, diversifiers, len(diversifiers), callback)
+
+def msat_get_asserted_formulas(env):
+    return _msat_get_asserted_formulas(env, 0)
+
+def msat_get_unsat_core(env):
+    return _msat_get_unsat_core(env, 0)
+
+def msat_get_theory_lemmas(env):
+    return _msat_get_theory_lemmas(env, 0)
+
+def msat_solve_with_assumptions(env, assumptions):
+    return _msat_solve_with_assumptions(env, assumptions, len(assumptions))
+
+def msat_get_unsat_assumptions(env):
+    return _msat_get_unsat_assumptions(env, 0)
+
+def msat_get_interpolant(env, groups_of_a):
+    return _msat_get_interpolant(env, groups_of_a, len(groups_of_a))
+
+def msat_from_smtlib1_file(env, fileobj):
+    return _msat_from_smtlib1(env, fileobj.read())
+
+def msat_from_smtlib2_file(env, fileobj):
+    return _msat_from_smtlib2(env, fileobj.read())
+
+def msat_term_to_number(env, term):
+    return _msat_term_to_number(env, term, 0)
+
+def msat_make_int_modular_congruence(env, modulus, t1, t2):
+    return _msat_make_int_modular_congruence(env, str(modulus), t1, t2)
+
+def msat_term_is_int_modular_congruence(env, term):
+    "returns a tuple (res, number)"
+    return _msat_term_is_int_modular_congruence(env, term, 0)
+
+
+def msat_is_bv_type(env, tp):
+    "returns a tuple (res, width)"
+    return _msat_is_bv_type(env, tp, None)
+
+
+def msat_is_array_type(env, tp):
+    "returns a tuple (res, indextp, elemtp)"
+    return _msat_is_array_type(env, tp, None, None)
+
+
+def msat_is_fp_type(env, tp):
+    "returns a tuple (res, exp_width, mant_width)"
+    return _msat_is_fp_type(env, tp, None, None)
+
+
+def msat_term_is_bv_extract(env, term):
+    "returns a tuple (res, msb, lsb)"
+    return _msat_term_is_bv_extract(env, term, None, None)
+
+
+def msat_term_is_bv_zext(env, term):
+    "returns a tuple (res, amount)"
+    return _msat_term_is_bv_zext(env, term, None)
+
+
+def msat_term_is_bv_sext(env, term):
+    "returns a tuple (res, amount)"
+    return _msat_term_is_bv_sext(env, term, None)
+
+
+def msat_term_is_bv_rol(env, term):
+    "returns a tuple (res, amount)"
+    return _msat_term_is_bv_rol(env, term, None)
+
+    
+def msat_term_is_bv_ror(env, term):
+    "returns a tuple (res, amount)"
+    return _msat_term_is_bv_ror(env, term, None)
+
+
+def msat_named_list_from_smtlib2(env, data):
+    ret = _msat_named_list_from_smtlib2(env, data, 0, 0, 0)
+    if ret is not None:
+        ret = [p[0] for p in ret], [p[1] for p in ret]
+    return ret
+
+def msat_named_list_from_smtlib2_file(env, f):
+    return msat_named_list_from_smtlib2(env, f.read())
+
+
+def msat_named_list_to_smtlib2(env, names, terms):
+    return _msat_named_list_to_smtlib2(env, len(names), names, terms)
+
+
+def msat_named_list_to_smtlib2_file(env, names, terms, out):
+    data = msat_named_list_to_smtlib2(env, names, terms)
+    out.write(data)
+
+
+def msat_annotated_list_from_smtlib2(env, data):
+    return _msat_annotated_list_from_smtlib2(env, data, 0, 0, 0)
+
+
+def msat_annotated_list_from_smtlib2_file(env, f):
+    return msat_annotated_list_from_smtlib2(env, f.read())
+
+
+def msat_annotated_list_to_smtlib2(env, terms, annots):
+    return _msat_annotated_list_to_smtlib2(env, len(terms), terms, annots)
+
+
+def msat_annotated_list_to_smtlib2_file(env, terms, annots, out):
+    data = msat_annotated_list_to_smtlib2(env, terms, annots)
+    out.write(data)
+    
+
+def msat_gc_env(env, tokeep):
+    return _msat_gc_env(env, tokeep, len(tokeep))
+
+
+# add suitable __eq__, __hash__ and __str__ methods to the msat classes
+
+def _term_hash(self):
+    return msat_term_id(self)
+msat_term.__hash__ = _term_hash
+del _term_hash
+
+def _term_eq(self, other):
+    return isinstance(other, msat_term) and msat_term_id(self) == msat_term_id(other)
+msat_term.__eq__ = _term_eq
+del _term_eq
+
+def _term_str(self):
+    if MSAT_ERROR_TERM(self): return "<ERROR>"
+    return msat_term_repr(self)
+msat_term.__str__ = _term_str
+del _term_str
+
+def _decl_hash(self):
+    return msat_decl_id(self)
+msat_decl.__hash__ = _decl_hash
+del _decl_hash
+
+def _decl_eq(self, other):
+    return isinstance(other, msat_decl) and msat_decl_id(self) == msat_decl_id(other)
+msat_decl.__eq__ = _decl_eq
+del _decl_eq
+
+def msat_exist_elim(env, formula, to_elim, algo,
+                    toplevel_propagation=True,
+                    boolean_simplifications=True,
+                    remove_redundant_constraints=True):
+    opts = msat_exist_elim_options()
+    opts.toplevel_propagation = toplevel_propagation
+    opts.boolean_simplifications = boolean_simplifications
+    opts.remove_redundant_constraints = remove_redundant_constraints
+    return _msat_exist_elim(env, formula, to_elim, len(to_elim), algo, opts)
+
+def msat_exist_elim_model(env, formula, to_elim, model, model_values=None):
+    if model_values is None:
+        model_vars, model_values = [], []
+        for (k, v) in model.iteritems():
+            model_vars.append(k)
+            model_values.append(v)
+    else:
+        model_vars = model
+    return _msat_exist_elim_model(env, formula, to_elim, len(to_elim),
+                                  model_vars, model_values, len(model_vars))
+
+def msat_apply_substitution(env, term, to_subst, values=None):
+    if values is None:
+        m = to_subst
+        to_subst = []
+        values = []
+        if hasattr(m, 'iteritems'):
+            for (k, v) in m.iteritems():
+                to_subst.append(k)
+                values.append(v)
+        else:
+            # assume m is a sequence of (k, v) pairs
+            for (k, v) in m:
+                to_subst.append(k)
+                values.append(v)
+    return _msat_apply_substitution(env, term, len(to_subst), to_subst, values)
+
+def msat_ic3_get_state_var(s, idx):
+    return _msat_ic3_get_state_var(s, idx, None, None)
+
+
+
+# This file is compatible with both classic and new-style classes.
+
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/pysmt.whl b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/pysmt.whl
new file mode 100644
index 0000000000000000000000000000000000000000..70c22147a7f1c28a4dea77d2969223d454c0c824
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/pysmt.whl differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/win64/goocanvas.pyd b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/win64/goocanvas.pyd
new file mode 100644
index 0000000000000000000000000000000000000000..b53ae2529bb9c655b4402e6b7d3f45455962090e
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/common/external/win64/goocanvas.pyd differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/fault_tree_viewer/resources/ui/glade/ftv.glade b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/fault_tree_viewer/resources/ui/glade/ftv.glade
new file mode 100644
index 0000000000000000000000000000000000000000..352fa2c2ef847541b892e41b4bb4f6c3fb9875b5
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/fault_tree_viewer/resources/ui/glade/ftv.glade
@@ -0,0 +1,270 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkActionGroup" id="actiongroup"/>
+  <object class="GtkAction" id="file_close">
+    <property name="label">Close</property>
+    <property name="tooltip">Close</property>
+    <property name="stock_id">gtk-close</property>
+    <signal name="activate" handler="on_file_close_activate"/>
+  </object>
+  <object class="GtkAction" id="file_menu">
+    <property name="label">File</property>
+  </object>
+  <object class="GtkAction" id="file_open">
+    <property name="label">Open</property>
+    <property name="tooltip">Open a file</property>
+    <property name="stock_id">gtk-open</property>
+    <signal name="activate" handler="on_file_open_activate"/>
+  </object>
+  <object class="GtkAction" id="file_export">
+    <property name="label">Export current page</property>
+    <property name="tooltip">Export image of the currently selected page</property>
+    <property name="stock_id">gtk-save</property>
+    <signal name="activate" handler="on_file_export_activate"/>
+  </object>
+  <object class="GtkAction" id="file_export_all">
+    <property name="label">Export all pages</property>
+    <property name="short_label">Export all pages</property>
+    <property name="tooltip">Export images of all pages</property>
+    <property name="stock_id">gtk-save-as</property>
+    <signal name="activate" handler="on_file_export_all_activate"/>
+  </object>
+  <object class="GtkAction" id="quit">
+    <property name="label">Quit</property>
+    <property name="tooltip">Quit</property>
+    <property name="stock_id">gtk-quit</property>
+    <signal name="activate" handler="on_quit_activate"/>
+  </object>
+  <object class="GtkAction" id="zoom_in">
+    <property name="label">Zoom in</property>
+    <property name="tooltip">Zoom in</property>
+    <property name="stock_id">gtk-zoom-in</property>
+    <signal name="activate" handler="on_zoom_in_activate"/>
+  </object>
+  <object class="GtkAction" id="zoom_out">
+    <property name="label">Zoom out</property>
+    <property name="tooltip">Zoom out</property>
+    <property name="stock_id">gtk-zoom-out</property>
+    <signal name="activate" handler="on_zoom_out_activate"/>
+  </object>
+  <object class="GtkAction" id="zoom_reset">
+    <property name="label">Zoom reset</property>
+    <property name="tooltip">Zoom reset</property>
+    <property name="stock_id">gtk-zoom-100</property>
+    <signal name="activate" handler="on_zoom_reset_activate"/>
+  </object>
+  <object class="GtkWindow" id="win_graph">
+    <property name="visible">True</property>
+    <property name="window_position">center</property>
+    <child>
+      <object class="GtkVBox" id="vbox">
+        <property name="visible">True</property>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <object class="GtkHBox" id="hbox1">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkVBox" id="vbox1">
+                <property name="visible">True</property>
+                <property name="orientation">vertical</property>
+                <property name="homogeneous">True</property>
+                <child>
+                  <object class="GtkHBox" id="hbox2">
+                    <property name="visible">True</property>
+                    <child>
+                      <object class="GtkLabel" id="label1">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Events file:</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="padding">10</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="e_file">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="editable">False</property>
+                        <property name="invisible_char">&#x25CF;</property>
+                      </object>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHBox" id="hbox3">
+                    <property name="visible">True</property>
+                    <child>
+                      <object class="GtkLabel" id="label2">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Gates file: </property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="padding">10</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="g_file">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="editable">False</property>
+                        <property name="invisible_char">&#x25CF;</property>
+                      </object>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVSeparator" id="vseparator1">
+                <property name="visible">True</property>
+                <property name="orientation">vertical</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="padding">10</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHBox" id="hbox5">
+                <property name="visible">True</property>
+                <child>
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">XML file:</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="xml_file">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="editable">False</property>
+                    <property name="invisible_char">&#x25CF;</property>
+                  </object>
+                  <packing>
+                    <property name="padding">10</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="padding">10</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHSeparator" id="hseparator">
+            <property name="visible">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHBox" id="hbox4">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolledwindow1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">automatic</property>
+                <property name="vscrollbar_policy">automatic</property>
+                <child>
+                  <object class="GtkTreeView" id="treeview">
+                    <property name="width_request">140</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="headers_clickable">False</property>
+                    <signal name="row_activated" handler="on_treeview_select"/>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn">
+                        <property name="title">node</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="cellrenderertext"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVSeparator" id="vseparator">
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolledwindow">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">4</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/fault_tree_viewer/resources/ui/menu/ftv.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/fault_tree_viewer/resources/ui/menu/ftv.xml
new file mode 100644
index 0000000000000000000000000000000000000000..01f2d78d60b88ca75c0b0df628aa8e6b53b44ad1
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/fault_tree_viewer/resources/ui/menu/ftv.xml
@@ -0,0 +1,25 @@
+<ui>
+    <menubar name='MenuBar'>
+        <menu action='file_menu'>
+            <menuitem action='file_open'/>
+            <menuitem action='file_close'/>
+            <menuitem action='file_export'/>
+            <menuitem action='file_export_all'/>
+            <separator/>
+            <menuitem action='quit'/>
+        </menu>
+    </menubar>
+    <toolbar name='Toolbar'>
+        <toolitem action='file_open'/>
+        <toolitem action='file_close'/>
+        <separator/>
+        <toolitem action='file_export'/>
+        <toolitem action='file_export_all'/>
+        <separator/>
+        <toolitem action='zoom_in'/>
+        <toolitem action='zoom_out'/>
+        <toolitem action='zoom_reset'/>
+        <separator/>
+        <toolitem action='quit'/>
+    </toolbar>
+</ui>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/tfpg_viewer/resources/ui/glade/tfpg_glade.glade b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/tfpg_viewer/resources/ui/glade/tfpg_glade.glade
new file mode 100644
index 0000000000000000000000000000000000000000..ad0e33711d60598a2440472818beaa996324840a
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/tfpg_viewer/resources/ui/glade/tfpg_glade.glade
@@ -0,0 +1,317 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkWindow" id="window_top">
+    <property name="width_request">600</property>
+    <property name="height_request">550</property>
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">TFPG Viewer</property>
+    <signal name="destroy" handler="on_main_window_destroy"/>
+    <child>
+      <object class="GtkVBox" id="vbox1">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkMenuBar" id="main_menu">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkMenuItem" id="file_menu_item">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">_File</property>
+                <property name="use_underline">True</property>
+                <child type="submenu">
+                  <object class="GtkMenu" id="menu4">
+                    <property name="visible">True</property>
+                    <child>
+                      <object class="GtkImageMenuItem" id="main_menu_new_tfpg_item">
+                        <property name="label">New tfpg</property>
+                        <property name="visible">True</property>
+                        <property name="image">image7</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_file_new_tfpg_activate"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkImageMenuItem" id="main_menu_load_structural_item">
+                        <property name="label" translatable="yes">Load structural tfpg</property>
+                        <property name="visible">True</property>
+                        <property name="image">image1</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_file_load_structural_activate"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkImageMenuItem" id="main_menu_load_trace_item">
+                        <property name="label">Load tfpg trace</property>
+                        <property name="visible">True</property>
+                        <property name="image">image2</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_file_load_trace_activate"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkImageMenuItem" id="main_menu_save_concrete_item">
+                        <property name="label">Save as tfpg</property>
+                        <property name="visible">True</property>
+                        <property name="image">image4</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_file_save_as_concrete_activate"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkImageMenuItem" id="main_menu_save_xml_item">
+                        <property name="label">Save as xml</property>
+                        <property name="visible">True</property>
+                        <property name="image">image6</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_file_save_as_xml_activate"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkSeparatorMenuItem" id="separatormenuitem2">
+                        <property name="visible">True</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkImageMenuItem" id="main_menu_quit_item">
+                        <property name="label">Quit</property>
+                        <property name="visible">True</property>
+                        <property name="image">image3</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_main_window_destroy"/>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkMenuItem" id="edit_menu_item">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">_Edit</property>
+                <property name="use_underline">True</property>
+                <child type="submenu">
+                  <object class="GtkMenu" id="menu1">
+                    <property name="visible">True</property>
+                    <child>
+                      <object class="GtkImageMenuItem" id="edit_menu_edit">
+                        <property name="label">Edit</property>
+                        <property name="visible">True</property>
+                        <property name="tooltip_text" translatable="yes">Edit textually the below graph</property>
+                        <property name="image">image5</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_edit_menu_edit_activate"/>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHBox" id="main_panel">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkVBox" id="vbox_toolbar_viewer">
+                <property name="visible">True</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHButtonBox" id="trace_control_bar">
+                <property name="visible">True</property>
+                <property name="layout_style">start</property>
+                <child>
+                  <object class="GtkButton" id="btn_prev_state">
+                    <property name="label">gtk-media-previous</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes">Show the previous state</property>
+                    <property name="use_stock">True</property>
+                    <signal name="clicked" handler="on_btn_prev_state_clicked"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="btn_run_trace">
+                    <property name="label">gtk-media-play</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes">Execute the whole trace from the beginning</property>
+                    <property name="use_stock">True</property>
+                    <signal name="clicked" handler="on_btn_run_trace_clicked"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="btn_next_state">
+                    <property name="label">gtk-media-forward</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes">Show the next state</property>
+                    <property name="use_stock">True</property>
+                    <signal name="clicked" handler="on_btn_next_state_clicked"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHPaned" id="hpaned1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <child>
+                  <object class="GtkHBox" id="hbox_viewing_area">
+                    <property name="visible">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="resize">True</property>
+                    <property name="shrink">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkVBox" id="vbox2">
+                    <property name="width_request">200</property>
+                    <property name="visible">True</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkHBox" id="hbox_info_area">
+                        <property name="width_request">200</property>
+                        <property name="visible">True</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkVBox" id="vbox_caption">
+                        <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="resize">False</property>
+                    <property name="shrink">False</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHButtonBox" id="hbuttonbox1">
+                <property name="visible">True</property>
+                <property name="layout_style">end</property>
+                <child>
+                  <object class="GtkButton" id="btn_caption">
+                    <property name="label" translatable="yes">Caption</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <signal name="clicked" handler="on_btn_caption_clicked"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+  <object class="GtkAction" id="action1"/>
+  <object class="GtkImage" id="image2">
+    <property name="visible">True</property>
+    <property name="stock">gtk-open</property>
+  </object>
+  <object class="GtkImage" id="image1">
+    <property name="visible">True</property>
+    <property name="stock">gtk-open</property>
+  </object>
+  <object class="GtkImage" id="image4">
+    <property name="visible">True</property>
+    <property name="stock">gtk-save-as</property>
+  </object>
+  <object class="GtkImage" id="image5">
+    <property name="visible">True</property>
+    <property name="stock">gtk-edit</property>
+  </object>
+  <object class="GtkImage" id="image3">
+    <property name="visible">True</property>
+    <property name="stock">gtk-quit</property>
+  </object>
+  <object class="GtkImage" id="image6">
+    <property name="visible">True</property>
+    <property name="stock">gtk-save-as</property>
+  </object>
+  <object class="GtkImage" id="image7">
+    <property name="visible">True</property>
+    <property name="yalign">0.49000000953674316</property>
+    <property name="stock">gtk-new</property>
+  </object>
+</interface>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/tfpg_viewer/resources/ui/glade/tfpg_glade_without_traces.glade b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/tfpg_viewer/resources/ui/glade/tfpg_glade_without_traces.glade
new file mode 100644
index 0000000000000000000000000000000000000000..ac600be93ad132f665cadd3c3a65c8b72ac40539
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/tfpg_viewer/resources/ui/glade/tfpg_glade_without_traces.glade
@@ -0,0 +1,263 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkWindow" id="window_top">
+    <property name="width_request">600</property>
+    <property name="height_request">550</property>
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">TFPG Viewer</property>
+    <signal name="destroy" handler="on_main_window_destroy"/>
+    <child>
+      <object class="GtkVBox" id="vbox1">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkMenuBar" id="main_menu">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkMenuItem" id="file_menu_item">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">_File</property>
+                <property name="use_underline">True</property>
+                <child type="submenu">
+                  <object class="GtkMenu" id="menu4">
+                    <property name="visible">True</property>
+                    <child>
+                      <object class="GtkImageMenuItem" id="main_menu_new_tfpg_item">
+                        <property name="label">New tfpg</property>
+                        <property name="visible">True</property>
+                        <property name="image">image7</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_file_new_tfpg_activate"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkImageMenuItem" id="main_menu_load_structural_item">
+                        <property name="label" translatable="yes">Load TFPG</property>
+                        <property name="visible">True</property>
+                        <property name="image">image1</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_file_load_structural_activate"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkImageMenuItem" id="main_menu_save_concrete_item">
+                        <property name="label">Save as tfpg</property>
+                        <property name="visible">True</property>
+                        <property name="image">image4</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_file_save_as_concrete_activate"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkImageMenuItem" id="main_menu_save_xml_item">
+                        <property name="label">Save as xml</property>
+                        <property name="visible">True</property>
+                        <property name="image">image6</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_file_save_as_xml_activate"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkImageMenuItem" id="main_menu_export_tfpg">
+                        <property name="label">Export to...</property>
+                        <property name="visible">True</property>
+                        <property name="image">image8</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_button_export_tfpg_clicked"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkSeparatorMenuItem" id="separatormenuitem2">
+                        <property name="visible">True</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkImageMenuItem" id="main_menu_quit_item">
+                        <property name="label">Quit</property>
+                        <property name="visible">True</property>
+                        <property name="image">image3</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_main_window_destroy"/>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkMenuItem" id="edit_menu_item">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">_Edit</property>
+                <property name="use_underline">True</property>
+                <child type="submenu">
+                  <object class="GtkMenu" id="menu1">
+                    <property name="visible">True</property>
+                    <child>
+                      <object class="GtkImageMenuItem" id="edit_menu_edit">
+                        <property name="label">Edit</property>
+                        <property name="visible">True</property>
+                        <property name="tooltip_text" translatable="yes">Edit textually the below graph</property>
+                        <property name="image">image5</property>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_edit_menu_edit_activate"/>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHBox" id="main_panel">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkVBox" id="vbox_toolbar_viewer">
+                <property name="visible">True</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHButtonBox" id="hbuttonbox1">
+                <property name="visible">True</property>
+                <property name="layout_style">end</property>
+                <child>
+                  <object class="GtkButton" id="btn_caption">
+                    <property name="label" translatable="yes">Caption</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <signal name="clicked" handler="on_btn_caption_clicked"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHPaned" id="hpaned1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <child>
+                  <object class="GtkHBox" id="hbox_viewing_area">
+                    <property name="visible">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="resize">True</property>
+                    <property name="shrink">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkVBox" id="vbox2">
+                    <property name="width_request">200</property>
+                    <property name="visible">True</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkHBox" id="hbox_info_area">
+                        <property name="width_request">200</property>
+                        <property name="visible">True</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkVBox" id="vbox_caption">
+                        <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="resize">False</property>
+                    <property name="shrink">False</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+  <object class="GtkAction" id="action1"/>
+  <object class="GtkImage" id="image2">
+    <property name="visible">True</property>
+    <property name="stock">gtk-open</property>
+  </object>
+  <object class="GtkImage" id="image1">
+    <property name="visible">True</property>
+    <property name="stock">gtk-open</property>
+  </object>
+  <object class="GtkImage" id="image4">
+    <property name="visible">True</property>
+    <property name="stock">gtk-save-as</property>
+  </object>
+  <object class="GtkImage" id="image5">
+    <property name="visible">True</property>
+    <property name="stock">gtk-edit</property>
+  </object>
+  <object class="GtkImage" id="image3">
+    <property name="visible">True</property>
+    <property name="stock">gtk-quit</property>
+  </object>
+  <object class="GtkImage" id="image6">
+    <property name="visible">True</property>
+    <property name="stock">gtk-save-as</property>
+  </object>
+  <object class="GtkImage" id="image7">
+    <property name="visible">True</property>
+    <property name="yalign">0.49000000953674316</property>
+    <property name="stock">gtk-new</property>
+  </object>
+  <object class="GtkImage" id="image8">
+    <property name="visible">True</property>
+    <property name="stock">gtk-go-down</property>
+  </object>
+</interface>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/trace_viewer/resources/filters/filters-list.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/trace_viewer/resources/filters/filters-list.xml
new file mode 100644
index 0000000000000000000000000000000000000000..72f57f602c28d1d7f14edf34cd0d993dddb72332
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/trace_viewer/resources/filters/filters-list.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<filters>
+	<filter name="a-filter" >
+		<name>a*</name>
+		<types>
+		</types>
+		<ranges>
+		</ranges>
+	</filter>
+	<filter name="random" >
+		<name>box.rnd?.mode,box.rnd?.*_timer</name>
+		<types>
+		</types>
+		<ranges>
+		</ranges>
+	</filter>
+	<filter name="filter_1" >
+		<name>box.rnd?.output,box.rnd?.*_*</name>
+		<types>
+		</types>
+		<ranges>
+		</ranges>
+	</filter>
+	<filter name="Robot1" >
+		<name>r1.EVENT,r1\.cur_[xy],r1\.req_dir,r1\.cur_dir,r1.state</name>
+		<types>
+		</types>
+		<ranges>
+		</ranges>
+	</filter>
+</filters>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/trace_viewer/resources/ui/glade/filter.glade b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/trace_viewer/resources/ui/glade/filter.glade
new file mode 100644
index 0000000000000000000000000000000000000000..551a1ee13e149e1a4060dcd67cdac48f6a71ac90
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/trace_viewer/resources/ui/glade/filter.glade
@@ -0,0 +1,292 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.18"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkWindow" id="window_filter">
+    <property name="can_focus">False</property>
+    <property name="border_width">12</property>
+    <property name="title" translatable="yes">Edit Filters</property>
+    <property name="window_position">center</property>
+    <signal name="delete-event" handler="on_delete_event" swapped="no"/>
+    <child>
+      <object class="GtkVBox" id="vbox3">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">18</property>
+        <child>
+          <object class="GtkHBox" id="hbox1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="LBLFilterName">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Filter name:</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="TEFilterName">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="invisible_char">●</property>
+                <property name="invisible_char_set">True</property>
+                <property name="primary_icon_activatable">False</property>
+                <property name="secondary_icon_activatable">False</property>
+                <property name="primary_icon_sensitive">True</property>
+                <property name="secondary_icon_sensitive">True</property>
+                <signal name="changed" handler="edit_changes" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">False</property>
+            <property name="padding">6</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFrame" id="frame1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkAlignment" id="alignment1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="top_padding">6</property>
+                <property name="left_padding">18</property>
+                <child>
+                  <object class="GtkVBox" id="vbox1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <object class="GtkLabel" id="LBLFilterDetails">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">&lt;i&gt;(Comma separated fields,
+each comma is equivalent to OR)&lt;/i&gt;
+
+Examples:
+a.* , [abc]* , [abd]?
+</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkTable" id="table_details">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="n_rows">3</property>
+                        <property name="n_columns">2</property>
+                        <property name="column_spacing">6</property>
+                        <property name="row_spacing">6</property>
+                        <child>
+                          <object class="GtkLabel" id="LBLName">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Filtered names:</property>
+                          </object>
+                          <packing>
+                            <property name="x_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="TEName">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_tooltip">True</property>
+                            <property name="tooltip_markup">comma-separated regex
+(see regex documentation for more info)</property>
+                            <property name="tooltip_text" translatable="yes">comma-separated regex
+(see regex documentation for more info)</property>
+                            <property name="invisible_char">●</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="primary_icon_sensitive">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
+                            <signal name="changed" handler="edit_changes" swapped="no"/>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="LBLTypes">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Filtered types:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                            <property name="x_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="TETypes">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_tooltip">True</property>
+                            <property name="tooltip_markup">comma separated types (only input, combinatorial, state and error)</property>
+                            <property name="tooltip_text" translatable="yes">comma separated types (only input, combinatorial, state and error)</property>
+                            <property name="invisible_char">●</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="primary_icon_sensitive">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
+                            <signal name="changed" handler="edit_changes" swapped="no"/>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="LBLSteps">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Filtered steps:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="TESteps">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_tooltip">True</property>
+                            <property name="tooltip_markup">comma separated ranges (ex. 3-5,4-)</property>
+                            <property name="tooltip_text" translatable="yes">comma separated ranges (ex. 3-5,4-)</property>
+                            <property name="invisible_char">●</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="primary_icon_sensitive">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
+                            <signal name="changed" handler="edit_changes" swapped="no"/>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">&lt;b&gt;Filter Details&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHSeparator" id="hseparator1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHBox" id="hbox5">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">24</property>
+            <property name="homogeneous">True</property>
+            <child>
+              <object class="GtkButton" id="BTNCancel">
+                <property name="label">gtk-cancel</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+                <signal name="clicked" handler="on_cancel_clicked" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="BTNCreate">
+                <property name="label">gtk-ok</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+                <signal name="clicked" handler="create_filter" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/trace_viewer/resources/ui/glade/filter_bar.glade b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/trace_viewer/resources/ui/glade/filter_bar.glade
new file mode 100644
index 0000000000000000000000000000000000000000..6748a636ba7875421aaee7cdec50504b5f4fa64e
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/trace_viewer/resources/ui/glade/filter_bar.glade
@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.18"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkWindow" id="window_filter_bar">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="window_position">center</property>
+    <child>
+      <object class="GtkHBox" id="TBFilter">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkHBox" id="hbox3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">3</property>
+            <child>
+              <object class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Name:</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="TENameFilter">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="has_frame">False</property>
+                <property name="invisible_char">●</property>
+                <property name="primary_icon_activatable">False</property>
+                <property name="secondary_icon_activatable">False</property>
+                <property name="primary_icon_sensitive">True</property>
+                <property name="secondary_icon_sensitive">True</property>
+                <signal name="changed" handler="qfilter_changed" swapped="no"/>
+                <signal name="activate" handler="apply_quick_filter" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkToggleButton" id="TTBApply">
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="has_tooltip">True</property>
+                <property name="tooltip_markup">Enable the name filtering</property>
+                <property name="tooltip_text" translatable="yes">Enable the name filtering</property>
+                <property name="relief">none</property>
+                <signal name="toggled" handler="apply_quick_filter" swapped="no"/>
+                <child>
+                  <object class="GtkImage" id="image1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="stock">gtk-apply</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVSeparator" id="vseparator1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHBox" id="hbox4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">3</property>
+            <child>
+              <object class="GtkLabel" id="label4">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Stored:</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBox" id="CBStoredFilters">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <signal name="changed" handler="apply_stored_filter" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHBox" id="hbox2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkButton" id="bu_name">
+                <property name="label">gtk-edit</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="has_tooltip">True</property>
+                <property name="tooltip_markup">Edit the stored filter</property>
+                <property name="tooltip_text" translatable="yes">Edit the stored filter</property>
+                <property name="relief">none</property>
+                <property name="use_stock">True</property>
+                <signal name="clicked" handler="create_filter_dialog" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="bu_remove">
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="has_tooltip">True</property>
+                <property name="tooltip_markup">Delete the stored filter</property>
+                <property name="tooltip_text" translatable="yes">Delete the stored filter</property>
+                <property name="relief">none</property>
+                <signal name="clicked" handler="remove_filter" swapped="no"/>
+                <child>
+                  <object class="GtkImage" id="image2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="stock">gtk-delete</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/trace_viewer/resources/ui/glade/main.glade b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/trace_viewer/resources/ui/glade/main.glade
new file mode 100644
index 0000000000000000000000000000000000000000..3056744bbfd7594443c9bdf319215c50b7d30fea
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/code/viewers/trace_viewer/resources/ui/glade/main.glade
@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<glade-interface>
+  <!-- <requires lib="gtk+" version="2.18"/> -->
+  <!-- interface-naming-policy project-wide -->
+  <widget class="GtkWindow" id="window_main">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Counter Example Trace Viewer</property>
+    <property name="window_position">center</property>
+    <signal name="delete-event" handler="on_window_delete_event"/>
+    <child>
+      <widget class="GtkVBox" id="main_vbox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">6</property>
+        <child>
+          <widget class="GtkVBox" id="extras_vbox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <widget class="GtkMenuBar" id="MB">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <widget class="GtkMenuItem" id="MIFile">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <widget class="GtkMenu" id="MFileList">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <widget class="GtkImageMenuItem" id="IMIOpen">
+                            <property name="label">gtk-open</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="use_stock">True</property>
+                            <child>
+                              <widget class="GtkMenu" id="menu2">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <child>
+                                  <widget class="GtkMenuItem" id="IITrace">
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="has_tooltip">True</property>
+                                    <property name="tooltip_markup">open a trace</property>
+                                    <property name="tooltip_text" translatable="yes">open a trace</property>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkMenuItem" id="IIFilter">
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="has_tooltip">True</property>
+                                    <property name="tooltip_markup">open list of filters</property>
+                                    <property name="tooltip_text" translatable="yes">open list of filters</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkMenuItem" id="IMISave">
+                            <property name="use_action_appearance">False</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="has_tooltip">True</property>
+                            <property name="tooltip_markup">save filters</property>
+                            <property name="tooltip_text" translatable="yes">save filters</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkSeparatorMenuItem" id="SMISeparator">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkMenuItem" id="IMIQuit">
+                            <property name="use_action_appearance">False</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkMenuItem" id="MIEdit">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <widget class="GtkMenu" id="MEdit">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <widget class="GtkMenuItem" id="IMIFilter">
+                            <property name="use_action_appearance">False</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <widget class="GtkMenu" id="menu1">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <child>
+                                  <widget class="GtkMenuItem" id="MICreate">
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <signal name="activate" handler="create_filter_dialog"/>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkMenuItem" id="MIModify">
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <signal name="activate" handler="create_filter_dialog"/>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkMenuItem" id="MIDelete">
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <signal name="activate" handler="delete_filter"/>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkMenuItem" id="IMISort">
+                            <property name="use_action_appearance">False</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="has_tooltip">True</property>
+                            <property name="tooltip_markup">sort the datas</property>
+                            <property name="tooltip_text" translatable="yes">sort the datas</property>
+                            <child>
+                              <widget class="GtkMenu" id="menu3">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <child>
+                                  <widget class="GtkMenuItem" id="IMIAsc">
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="has_tooltip">True</property>
+                                    <property name="tooltip_markup">ascending order</property>
+                                    <property name="tooltip_text" translatable="yes">ascending order</property>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkMenuItem" id="IMIDesc">
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="has_tooltip">True</property>
+                                    <property name="tooltip_markup">descending order</property>
+                                    <property name="tooltip_text" translatable="yes">descending order</property>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkMenuItem" id="IMIType">
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="has_tooltip">True</property>
+                                    <property name="tooltip_markup">sort on types:
+- state
+- combinatorial
+- input
+- error</property>
+                                    <property name="tooltip_text" translatable="yes">sort on types:
+- state
+- combinatorial
+- input
+- error</property>
+                                    <signal name="activate" handler="sort_treeview_types"/>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkScrolledWindow" id="sw_top">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="shadow_type">etched-in</property>
+            <child>
+              <widget class="GtkTreeView" id="treeview">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="search_column">0</property>
+                <signal name="motion-notify-event" handler="on_treeview_motion_notify_event"/>
+              </widget>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+</glade-interface>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml.xml
new file mode 100644
index 0000000000000000000000000000000000000000..146ce28f888793017e9d4ef6c62c2c97b15bd08d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml.xml
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Roberto Cavada and Cristian Mattarei and Anthony Fernandes Pires-->
+<!-- Version: 0.2 -->
+<!-- Date: 2014/10/03 -->
+
+<effects_model_library>
+  <effects_model name="StuckAtByReference_I">
+    <description>
+       Force the output to follow the value of an input.
+    </description>
+    <definition loc="eml_behavior/stuckatbyreference/instantaneous/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="StuckAtByReference_D">
+    <description>
+       Force the output to follow the value of an input.
+    </description>
+    <definition loc="eml_behavior/stuckatbyreference/delayed/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="StuckAtByValue_I">
+    <description>
+       Stuck the output to a value.
+    </description>
+    <definition loc="eml_behavior/stuckatbyvalue/instantaneous/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="StuckAtByValue_D">
+    <description>
+       Stuck the output to a value.
+    </description>
+    <definition loc="eml_behavior/stuckatbyvalue/delayed/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="Frozen">
+    <description>
+       Stuck the output to its last value when the fault happens
+    </description>
+    <definition loc="eml_behavior/frozen/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="NonDeterminismByReference_Num_I">
+    <description>
+      Force the output to give non deterministic value. For numeric output.
+    </description>
+    <definition loc="eml_behavior/nondeterminismbyreference_num/instantaneous/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="NonDeterminismByReference_Num_D">
+    <description>
+      Force the output to give non deterministic value. For numeric output.
+    </description>
+    <definition loc="eml_behavior/nondeterminismbyreference_num/delayed/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="NonDeterminismByValue_Num_I">
+    <description>
+      Stuck the output to a non deterministic value. For numeric output.
+    </description>
+    <definition loc="eml_behavior/nondeterminismbyvalue_num/instantaneous/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="NonDeterminismByValue_Num_D">
+    <description>
+      Stuck the output to a non deterministic value. For numeric output.
+    </description>
+    <definition loc="eml_behavior/nondeterminismbyvalue_num/delayed/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="NonDeterminismByReference_Bool">
+    <description>
+      Force the output to give non deterministic value. For binary output.
+    </description>
+    <definition loc="eml_behavior/nondeterminismbyreference_bool/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="NonDeterminismByValue_Bool">
+    <description>
+      Stuck the output to a non deterministic value. For binary output.
+    </description>
+    <definition loc="eml_behavior/nondeterminismbyvalue_bool/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="Conditional_I">
+    <description>
+       Stuck the output to the term depending on a condition on the environment at the entrance in fault
+    </description>
+    <definition loc="eml_behavior/conditional/instantaneous/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="Conditional_D">
+    <description>
+       Stuck the output to the term depending on a condition on the environment at the entrance in fault
+    </description>
+    <definition loc="eml_behavior/conditional/delayed/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="Inverted">
+    <description>
+      Inverts the output of a binary variable
+    </description>
+    <definition loc="eml_behavior/inverted/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="RampDown">
+    <description>
+      Decreases the value of a variable of a fixed amount each cycle, down to a minimun value
+    </description>
+    <definition loc="eml_behavior/rampdown/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="TestTemplate">
+    <description>
+      Test of template in effect models.
+    </description>
+    <definition loc="eml_behavior/testtemplate/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="StuckAtFixed">
+    <description>
+      Stuck the output value
+    </description>
+    <definition loc="eml_behavior/stuckatfixed/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="ConditionalDualOutputs_I">
+    <description>
+       Stuck two outputs to the terms depending on a condition on the environment at the entrance in fault
+    </description>
+    <definition loc="eml_behavior/conditionaldualoutputs/instantaneous/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="ConditionalDualOutputs_D">
+    <description>
+       Stuck two outputs to the terms depending on a condition on the environment at the entrance in fault
+    </description>
+    <definition loc="eml_behavior/conditionaldualoutputs/delayed/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="RandomByReference">
+    <description>
+       Random value for the output
+    </description>
+    <definition loc="eml_behavior/randombyreference/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="RandomByValue">
+    <description>
+       Random value for the output
+    </description>
+    <definition loc="eml_behavior/randombyvalue/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="ErroneousByReference">
+    <description>
+       Random value for the output, except the nominal value
+    </description>
+    <definition loc="eml_behavior/erroneousbyreference/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="ErroneousByValue">
+    <description>
+       Random value for the output, except the nominal value
+    </description>
+    <definition loc="eml_behavior/erroneousbyvalue/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="DeltaOutByReference">
+    <description>
+       Output can take any value out of [nominal value - delta; nominal value + delta]
+    </description>
+    <definition loc="eml_behavior/deltaoutbyreference/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="DeltaOutByValue">
+    <description>
+       Output can take any value out of [nominal value - delta; nominal value + delta]
+    </description>
+    <definition loc="eml_behavior/deltaoutbyvalue/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="DeltaInRandomByReference">
+    <description>
+       Output can take any value in [nominal value - delta; nominal value + delta]
+    </description>
+    <definition loc="eml_behavior/deltainrandombyreference/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="DeltaInRandomByValue">
+    <description>
+       Output can take any value in [nominal value - delta; nominal value + delta]
+    </description>
+    <definition loc="eml_behavior/deltainrandombyvalue/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="DeltaInErroneousByReference">
+    <description>
+       Output can take any value in [nominal value - delta; nominal value + delta], except the nominal value
+    </description>
+    <definition loc="eml_behavior/deltainerroneousbyreference/definition.xml"/>
+  </effects_model>
+
+  <effects_model name="DeltaInErroneousByValue">
+    <description>
+       Output can take any value in [nominal value - delta; nominal value + delta], except the nominal value
+    </description>
+    <definition loc="eml_behavior/deltainerroneousbyvalue/definition.xml"/>
+  </effects_model>
+
+</effects_model_library>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml.xsd b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml.xsd
new file mode 100644
index 0000000000000000000000000000000000000000..184993c84ec44e831834967e381fbd6f11628e49
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+  <xs:element name="effects_model_library">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="effects_model"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="effects_model">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="description"/>
+        <xs:element ref="definition"/>
+      </xs:sequence>
+      <xs:attribute name="name" use="required" type="xs:NCName"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="description" type="xs:string"/>
+  <xs:element name="definition">
+    <xs:complexType>
+      <xs:attribute name="loc" use="required"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/delayed/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/delayed/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..78cbccb56b4554416e658bf0bb2119fc85cff6ab
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/delayed/definition.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2014/09/10 -->
+
+<effects_model name="Conditional_D">
+  <values>
+    <input reads="condition" type="Boolean" desc="The condition to choose the value of the output during the fault. The value is fixed at the entrance in the fault."/>
+    <input reads="then_term" type="Any" desc="The value of the output if the condition at the entrance is true. Can be a constant or a variable."/>
+    <input reads="else_term" type="Any" desc="the value of the output if the condition at the entrance is false. Can be a constant or a variable."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw type="smv" local="false">raw.smv</raw>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/delayed/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/delayed/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..07b2be132426bfb9f57a6e6f08beef135795c75c
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/delayed/during.smv
@@ -0,0 +1,13 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/10
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - then_term: the value if the condition at the entrance is true. Can be a constant or a variable.
+-- - else_term: the value if the condition at the entrance is false. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = (CONDITION_AT_ENTRANCE ? then_term: else_term)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/delayed/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/delayed/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..07b2be132426bfb9f57a6e6f08beef135795c75c
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/delayed/entering.smv
@@ -0,0 +1,13 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/10
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - then_term: the value if the condition at the entrance is true. Can be a constant or a variable.
+-- - else_term: the value if the condition at the entrance is false. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = (CONDITION_AT_ENTRANCE ? then_term: else_term)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/delayed/raw.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/delayed/raw.smv
new file mode 100644
index 0000000000000000000000000000000000000000..625f81398cfef3068fd21cdb8587afcb7386770d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/delayed/raw.smv
@@ -0,0 +1,8 @@
+      VAR CONDITION_AT_ENTRANCE : boolean;
+      ASSIGN
+      init(CONDITION_AT_ENTRANCE) := condition;
+      next(CONDITION_AT_ENTRANCE) := case
+	!is_fault & next(is_fault) : CONDITION_AT_ENTRANCE;
+	is_fault & next(is_fault): CONDITION_AT_ENTRANCE;
+	TRUE : next(condition);
+      esac;
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/instantaneous/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/instantaneous/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a3d1ecd38969f92f09eda5696f80bb8b379b6488
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/instantaneous/definition.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2014/09/10 -->
+
+<effects_model name="Conditional_I">
+  <values>
+    <input reads="condition" type="Boolean" desc="The condition to choose the value of the output during the fault. The value is fixed at the entrance in the fault."/>
+    <input reads="then_term" type="Any" desc="The value of the output if the condition at the entrance is true. Can be a constant or a variable."/>
+    <input reads="else_term" type="Any" desc="the value of the output if the condition at the entrance is false. Can be a constant or a variable."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw type="smv" local="false">raw.smv</raw>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/instantaneous/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/instantaneous/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..96059c992242c456edb6c4aee8ad0feac462d5cd
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/instantaneous/during.smv
@@ -0,0 +1,13 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/10
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - then_term: the value if the condition at the entrance is true. Can be a constant or a variable.
+-- - else_term: the value if the condition at the entrance is false. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = (CONDITION_AT_ENTRANCE ? next(then_term): next(else_term))
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/instantaneous/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/instantaneous/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..96059c992242c456edb6c4aee8ad0feac462d5cd
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/instantaneous/entering.smv
@@ -0,0 +1,13 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/10
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - then_term: the value if the condition at the entrance is true. Can be a constant or a variable.
+-- - else_term: the value if the condition at the entrance is false. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = (CONDITION_AT_ENTRANCE ? next(then_term): next(else_term))
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/instantaneous/raw.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/instantaneous/raw.smv
new file mode 100644
index 0000000000000000000000000000000000000000..625f81398cfef3068fd21cdb8587afcb7386770d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditional/instantaneous/raw.smv
@@ -0,0 +1,8 @@
+      VAR CONDITION_AT_ENTRANCE : boolean;
+      ASSIGN
+      init(CONDITION_AT_ENTRANCE) := condition;
+      next(CONDITION_AT_ENTRANCE) := case
+	!is_fault & next(is_fault) : CONDITION_AT_ENTRANCE;
+	is_fault & next(is_fault): CONDITION_AT_ENTRANCE;
+	TRUE : next(condition);
+      esac;
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/delayed/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/delayed/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..38280c4fae71179bca12bb513d8f387f055641a8
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/delayed/definition.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2014/15/10 -->
+
+<effects_model name="ConditionalDualOutputs_D">
+  <values>
+    <input reads="condition" type="Boolean" desc="The condition to choose the value of the outputs during the fault. The value is fixed at the entrance in the fault."/>
+    <input reads="then_term_1" type="Any" desc="The value of the output one if the condition at the entrance is true. Can be a constant or a variable."/>
+    <input reads="else_term_1" type="Any" desc="the value of the output one if the condition at the entrance is false. Can be a constant or a variable."/>
+    <input reads="then_term_2" type="Any" desc="The value of the output two if the condition at the entrance is true. Can be a constant or a variable."/>
+    <input reads="else_term_2" type="Any" desc="the value of the output two if the condition at the entrance is false. Can be a constant or a variable."/>
+    <output writes="varout_1" reads="input_1" desc="The output variable name that reads on the input one"/>
+    <output writes="varout_2" reads="input_2" desc="The output variable name that reads on the input two"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw type="smv" local="false">raw.smv</raw>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/delayed/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/delayed/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..04448df57dcf085b4c3518f23a40bab44f1ccdd9
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/delayed/during.smv
@@ -0,0 +1,17 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/15/10
+------------------------------------------------------------------------------
+-- - varout_1: the output variable one
+-- - varout_2: the output variable two
+-- - then_term_1: the value of varout_1 if the condition at the entrance is true. Can be a constant or a variable.
+-- - else_term_1: the value of varout_1 if the condition at the entrance is false. Can be a constant or a variable.
+-- - then_term_2: the value of varout_2 if the condition at the entrance is true. Can be a constant or a variable.
+-- - else_term_2: the value of varout_2 if the condition at the entrance is false. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout_1) = (CONDITION_AT_ENTRANCE ? then_term_1: else_term_1) &
+next(varout_2) = (CONDITION_AT_ENTRANCE ? then_term_2: else_term_2)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/delayed/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/delayed/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..04448df57dcf085b4c3518f23a40bab44f1ccdd9
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/delayed/entering.smv
@@ -0,0 +1,17 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/15/10
+------------------------------------------------------------------------------
+-- - varout_1: the output variable one
+-- - varout_2: the output variable two
+-- - then_term_1: the value of varout_1 if the condition at the entrance is true. Can be a constant or a variable.
+-- - else_term_1: the value of varout_1 if the condition at the entrance is false. Can be a constant or a variable.
+-- - then_term_2: the value of varout_2 if the condition at the entrance is true. Can be a constant or a variable.
+-- - else_term_2: the value of varout_2 if the condition at the entrance is false. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout_1) = (CONDITION_AT_ENTRANCE ? then_term_1: else_term_1) &
+next(varout_2) = (CONDITION_AT_ENTRANCE ? then_term_2: else_term_2)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/delayed/raw.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/delayed/raw.smv
new file mode 100644
index 0000000000000000000000000000000000000000..625f81398cfef3068fd21cdb8587afcb7386770d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/delayed/raw.smv
@@ -0,0 +1,8 @@
+      VAR CONDITION_AT_ENTRANCE : boolean;
+      ASSIGN
+      init(CONDITION_AT_ENTRANCE) := condition;
+      next(CONDITION_AT_ENTRANCE) := case
+	!is_fault & next(is_fault) : CONDITION_AT_ENTRANCE;
+	is_fault & next(is_fault): CONDITION_AT_ENTRANCE;
+	TRUE : next(condition);
+      esac;
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/instantaneous/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/instantaneous/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c26a4282d862851081466fe90d095b193c18b3ea
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/instantaneous/definition.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2014/15/10 -->
+
+<effects_model name="ConditionalDualOutputs_I">
+  <values>
+    <input reads="condition" type="Boolean" desc="The condition to choose the value of the outputs during the fault. The value is fixed at the entrance in the fault."/>
+    <input reads="then_term_1" type="Any" desc="The value of the output one if the condition at the entrance is true. Can be a constant or a variable."/>
+    <input reads="else_term_1" type="Any" desc="the value of the output one if the condition at the entrance is false. Can be a constant or a variable."/>
+    <input reads="then_term_2" type="Any" desc="The value of the output two if the condition at the entrance is true. Can be a constant or a variable."/>
+    <input reads="else_term_2" type="Any" desc="the value of the output two if the condition at the entrance is false. Can be a constant or a variable."/>
+    <output writes="varout_1" reads="input_1" desc="The output variable name that reads on the input one"/>
+    <output writes="varout_2" reads="input_2" desc="The output variable name that reads on the input two"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw type="smv" local="false">raw.smv</raw>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/instantaneous/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/instantaneous/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..f64daf0f0717c081bca0e431cd9661f78a7ed8e9
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/instantaneous/during.smv
@@ -0,0 +1,17 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/15/10
+------------------------------------------------------------------------------
+-- - varout_1: the output variable one
+-- - varout_2: the output variable two
+-- - then_term_1: the value of varout_1 if the condition at the entrance is true. Can be a constant or a variable.
+-- - else_term_1: the value of varout_1 if the condition at the entrance is false. Can be a constant or a variable.
+-- - then_term_2: the value of varout_2 if the condition at the entrance is true. Can be a constant or a variable.
+-- - else_term_2: the value of varout_2 if the condition at the entrance is false. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout_1) = (CONDITION_AT_ENTRANCE ? next(then_term_1): next(else_term_1)) &
+next(varout_2) = (CONDITION_AT_ENTRANCE ? next(then_term_2): next(else_term_2))
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/instantaneous/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/instantaneous/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..f64daf0f0717c081bca0e431cd9661f78a7ed8e9
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/instantaneous/entering.smv
@@ -0,0 +1,17 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/15/10
+------------------------------------------------------------------------------
+-- - varout_1: the output variable one
+-- - varout_2: the output variable two
+-- - then_term_1: the value of varout_1 if the condition at the entrance is true. Can be a constant or a variable.
+-- - else_term_1: the value of varout_1 if the condition at the entrance is false. Can be a constant or a variable.
+-- - then_term_2: the value of varout_2 if the condition at the entrance is true. Can be a constant or a variable.
+-- - else_term_2: the value of varout_2 if the condition at the entrance is false. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout_1) = (CONDITION_AT_ENTRANCE ? next(then_term_1): next(else_term_1)) &
+next(varout_2) = (CONDITION_AT_ENTRANCE ? next(then_term_2): next(else_term_2))
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/instantaneous/raw.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/instantaneous/raw.smv
new file mode 100644
index 0000000000000000000000000000000000000000..625f81398cfef3068fd21cdb8587afcb7386770d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/conditionaldualoutputs/instantaneous/raw.smv
@@ -0,0 +1,8 @@
+      VAR CONDITION_AT_ENTRANCE : boolean;
+      ASSIGN
+      init(CONDITION_AT_ENTRANCE) := condition;
+      next(CONDITION_AT_ENTRANCE) := case
+	!is_fault & next(is_fault) : CONDITION_AT_ENTRANCE;
+	is_fault & next(is_fault): CONDITION_AT_ENTRANCE;
+	TRUE : next(condition);
+      esac;
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/definition.xsd b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/definition.xsd
new file mode 100644
index 0000000000000000000000000000000000000000..fabe340508b1c0272b2d6551d5cba6769ca0e693
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/definition.xsd
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+  <xs:element name="effects_model">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="0" ref="templates"/>
+        <xs:element ref="values"/>
+        <xs:element ref="effect"/>
+        <xs:element ref="raw"/>
+      </xs:sequence>
+      <xs:attribute name="name" use="required" type="xs:NCName"/>
+    </xs:complexType>
+  </xs:element>
+
+
+  <xs:element name="templates">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="template"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="template">
+    <xs:complexType mixed="true">
+      <xs:attribute name="name" use="required" type="xs:NCName"/>
+      <xs:attribute name="type" use="required" type="xs:NCName"/>
+    </xs:complexType>
+  </xs:element>
+
+
+  <xs:element name="values">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="input"/>
+        <xs:element maxOccurs="unbounded" ref="output"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="input">
+    <xs:complexType>
+      <xs:attribute name="desc" use="required"/>
+      <xs:attribute name="name" type="xs:NCName"/>
+      <xs:attribute name="reads" type="xs:NCName"/>
+      <xs:attribute name="type" use="required" type="xs:NCName"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="output">
+    <xs:complexType>
+      <xs:attribute name="desc" use="required"/>
+      <xs:attribute name="name" type="xs:NCName"/>
+      <xs:attribute name="reads" type="xs:NCName"/>
+      <xs:attribute name="writes" type="xs:NCName"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="effect">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="entering"/>
+        <xs:element ref="during"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="entering">
+    <xs:complexType>
+      <xs:simpleContent>
+        <xs:extension base="xs:NCName">
+          <xs:attribute name="local" use="required" type="xs:boolean"/>
+          <xs:attribute name="type" use="required" type="xs:NCName"/>
+        </xs:extension>
+      </xs:simpleContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="during">
+    <xs:complexType>
+      <xs:simpleContent>
+        <xs:extension base="xs:NCName">
+          <xs:attribute name="local" use="required" type="xs:boolean"/>
+          <xs:attribute name="type" use="required" type="xs:NCName"/>
+        </xs:extension>
+      </xs:simpleContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="raw">
+    <xs:complexType mixed="true">
+      <xs:attribute name="local" type="xs:boolean"/>
+      <xs:attribute name="type" type="xs:NCName"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyreference/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyreference/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1b7e00eedceac7956bdd5f7a6de836e1641efa33
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyreference/definition.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires-->
+<!-- Version: 0.1 -->
+<!-- Date: 2015/12/14 -->
+
+<effects_model name="DeltaInErroneousByReference">
+  <values>
+    <input reads="delta" type="Any" desc="The error delta."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyreference/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyreference/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..c88f41f2cc23b468681eccfb9fab3774a07d84ea
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyreference/during.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - delta: the error delta
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) >= (next(input) - delta) & next(varout) <= (next(input) + delta) & next(varout) != next(input)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyreference/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyreference/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..c88f41f2cc23b468681eccfb9fab3774a07d84ea
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyreference/entering.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - delta: the error delta
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) >= (next(input) - delta) & next(varout) <= (next(input) + delta) & next(varout) != next(input)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyvalue/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyvalue/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e83059bc73bd5d4faee05fe219e2b55e7f62ab47
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyvalue/definition.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires-->
+<!-- Version: 0.1 -->
+<!-- Date: 2015/12/14 -->
+
+<effects_model name="DeltaInErroneousByValue">
+  <values>
+    <input reads="delta" type="Any" desc="The error delta."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyvalue/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyvalue/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..db3dfc7a7a159cea5660b6c11d2527b8f3c266c0
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyvalue/during.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - delta: the error delta
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyvalue/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyvalue/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..c88f41f2cc23b468681eccfb9fab3774a07d84ea
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainerroneousbyvalue/entering.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - delta: the error delta
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) >= (next(input) - delta) & next(varout) <= (next(input) + delta) & next(varout) != next(input)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyreference/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyreference/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..29d65d94a6fa7d41e46d5d2b12b613d8519f4cf9
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyreference/definition.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires-->
+<!-- Version: 0.1 -->
+<!-- Date: 2015/12/14 -->
+
+<effects_model name="DeltaInRandomByReference">
+  <values>
+    <input reads="delta" type="Any" desc="The error delta."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyreference/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyreference/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..3ed3c1b45286818ff908b39c25118287bf0dab56
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyreference/during.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - delta: the error delta
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) >= (next(input) - delta) & next(varout) <= (next(input) + delta)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyreference/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyreference/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..3ed3c1b45286818ff908b39c25118287bf0dab56
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyreference/entering.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - delta: the error delta
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) >= (next(input) - delta) & next(varout) <= (next(input) + delta)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyvalue/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyvalue/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7c7a4d6a8d86ec23fd192ee931e704e9d42dfe20
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyvalue/definition.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires-->
+<!-- Version: 0.1 -->
+<!-- Date: 2015/12/14 -->
+
+<effects_model name="DeltaInRandomByValue">
+  <values>
+    <input reads="delta" type="Any" desc="The error delta."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyvalue/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyvalue/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..db3dfc7a7a159cea5660b6c11d2527b8f3c266c0
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyvalue/during.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - delta: the error delta
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyvalue/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyvalue/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..3ed3c1b45286818ff908b39c25118287bf0dab56
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltainrandombyvalue/entering.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - delta: the error delta
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) >= (next(input) - delta) & next(varout) <= (next(input) + delta)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyreference/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyreference/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..60cc91b434474eb3f4196c456100ea99659547ae
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyreference/definition.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires-->
+<!-- Version: 0.1 -->
+<!-- Date: 2015/12/14 -->
+
+<effects_model name="DeltaOutByReference">
+  <values>
+    <input reads="delta" type="Any" desc="The error delta."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyreference/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyreference/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..c1318ea852a0dc0a3bb9eb9f6ee173cd7fd37808
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyreference/during.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - delta: the error delta
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) < (next(input) - delta) | next(varout) > (next(input) + delta)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyreference/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyreference/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..c1318ea852a0dc0a3bb9eb9f6ee173cd7fd37808
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyreference/entering.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - delta: the error delta
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) < (next(input) - delta) | next(varout) > (next(input) + delta)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyvalue/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyvalue/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..dcf7ee1e1ed06b12bc90e5e915d219bd3725dd2d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyvalue/definition.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires-->
+<!-- Version: 0.1 -->
+<!-- Date: 2015/12/14 -->
+
+<effects_model name="DeltaOutByValue">
+  <values>
+    <input reads="delta" type="Any" desc="The error delta."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyvalue/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyvalue/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..db3dfc7a7a159cea5660b6c11d2527b8f3c266c0
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyvalue/during.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - delta: the error delta
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyvalue/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyvalue/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..c1318ea852a0dc0a3bb9eb9f6ee173cd7fd37808
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/deltaoutbyvalue/entering.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - delta: the error delta
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) < (next(input) - delta) | next(varout) > (next(input) + delta)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyreference/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyreference/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..22fc4c02ce5346cd827c30d0553a05f525af3538
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyreference/definition.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2015/12/14 -->
+
+<effects_model name="ErroneousByReference">
+  <values>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyreference/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyreference/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..853ed7fd34e405af0e74a1759f051f3679d080ee
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyreference/during.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) != next(input)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyreference/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyreference/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..853ed7fd34e405af0e74a1759f051f3679d080ee
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyreference/entering.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) != next(input)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyvalue/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyvalue/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7521f727e004cc87f3305216a16864b2efbcec77
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyvalue/definition.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2015/12/14 -->
+
+<effects_model name="ErroneousByValue">
+  <values>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyvalue/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyvalue/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..2d09b51ed9629de4f874c36414fc14399d8728c0
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyvalue/during.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyvalue/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyvalue/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..853ed7fd34e405af0e74a1759f051f3679d080ee
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/erroneousbyvalue/entering.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) != next(input)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/frozen/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/frozen/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..81413791fe8ebca72cd3b87b8ca50e95adea6266
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/frozen/definition.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2014/10/02 -->
+
+<effects_model name="Frozen">
+  <values>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/frozen/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/frozen/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..86d6c8802fab027d67938d8d319d243e81188f01
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/frozen/during.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/frozen/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/frozen/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..51b3d9f0f6ddeb5ebe66839759a626e83424da4d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/frozen/entering.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = input
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/inverted/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/inverted/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d3b55d883c5091b5fd78b4f48d5c00ae2111cf7c
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/inverted/definition.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Roberto Cavada and Cristian Mattarei -->
+<!-- Version: 0.1 -->
+<!-- Date: 2011/09/16 -->
+
+<effects_model name="Inverted">
+  <values>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/inverted/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/inverted/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..4461e77f98d7f5ac95f3238f89119ed09749e4b1
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/inverted/during.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Roberto Cavada
+-- - Version: 0.1
+-- - Date: 2011/09/16
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/inverted/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/inverted/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..a1b726141a89ce99ecaefdcaf077dc187e5c768c
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/inverted/entering.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Roberto Cavada
+-- - Version: 0.1
+-- - Date: 2011/09/16
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = !input
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/inverted/image.png b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/inverted/image.png
new file mode 100644
index 0000000000000000000000000000000000000000..37ecc9d5558fcd95c4c158dc7d6f689ee0b407ab
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/inverted/image.png differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_bool/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_bool/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f4bd205c442e2b9b771a5fb1c58474f94cd427ea
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_bool/definition.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2014/09/24 -->
+
+<effects_model name="NonDeterminismByReference_Bool">
+  <values>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one."/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_bool/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_bool/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..a781c3236cd0dd2efd809ffd5e94886192b50dd0
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_bool/during.smv
@@ -0,0 +1,10 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = FALSE | next(varout) = TRUE
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_bool/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_bool/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..a781c3236cd0dd2efd809ffd5e94886192b50dd0
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_bool/entering.smv
@@ -0,0 +1,10 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = FALSE | next(varout) = TRUE
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/delayed/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/delayed/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cded48ff2efa6acc47f4bf65915577a2da9688ac
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/delayed/definition.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires-->
+<!-- Version: 0.1 -->
+<!-- Date: 2014/09/24 -->
+
+<effects_model name="NonDeterminismByReference_Num_D">
+  <values>
+    <input reads="min_bound" type="Integer" desc="The minimal bound of the non-determinism. Can be a constant or a variable."/>
+    <input reads="max_bound" type="Integer" desc="The maximal bound of the non-determinism. Can be a constant or a variable."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/delayed/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/delayed/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..10892c72ff95012a008f78fd0706d2e96868c0f2
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/delayed/during.smv
@@ -0,0 +1,13 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - min_bound: the minimal bound of non determinism. Can be a constant or a variable.
+-- - max_bound: the maximal bound of non determinism. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) >= min_bound & next(varout) <= max_bound
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/delayed/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/delayed/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..10892c72ff95012a008f78fd0706d2e96868c0f2
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/delayed/entering.smv
@@ -0,0 +1,13 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - min_bound: the minimal bound of non determinism. Can be a constant or a variable.
+-- - max_bound: the maximal bound of non determinism. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) >= min_bound & next(varout) <= max_bound
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/instantaneous/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/instantaneous/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9eb3978cd3b2af16ec8048b62d44a14e9a75456e
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/instantaneous/definition.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires-->
+<!-- Version: 0.1 -->
+<!-- Date: 2014/09/24 -->
+
+<effects_model name="NonDeterminismByReference_Num_I">
+  <values>
+    <input reads="min_bound" type="Integer" desc="The minimal bound of the non-determinism. Can be a constant or a variable."/>
+    <input reads="max_bound" type="Integer" desc="The maximal bound of the non-determinism. Can be a constant or a variable."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/instantaneous/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/instantaneous/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..b8a5a2cd78789c29552b533766e88228c2a40a77
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/instantaneous/during.smv
@@ -0,0 +1,13 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - min_bound: the minimal bound of non determinism. Can be a constant or a variable.
+-- - max_bound: the maximal bound of non determinism. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) >= next(min_bound) & next(varout) <= next(max_bound)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/instantaneous/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/instantaneous/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..b8a5a2cd78789c29552b533766e88228c2a40a77
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyreference_num/instantaneous/entering.smv
@@ -0,0 +1,13 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - min_bound: the minimal bound of non determinism. Can be a constant or a variable.
+-- - max_bound: the maximal bound of non determinism. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) >= next(min_bound) & next(varout) <= next(max_bound)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_bool/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_bool/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..2447f6919495e2e654e6f77c0149526416629128
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_bool/definition.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2014/09/24 -->
+
+<effects_model name="NonDeterminismByValue_Bool">
+  <values>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one."/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_bool/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_bool/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..b5d3ae7c770f3165a8168428fc6e5c13ea30a0e2
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_bool/during.smv
@@ -0,0 +1,10 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_bool/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_bool/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..a781c3236cd0dd2efd809ffd5e94886192b50dd0
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_bool/entering.smv
@@ -0,0 +1,10 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = FALSE | next(varout) = TRUE
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/delayed/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/delayed/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..fc425759483de84f1e09b380f508c8b920f2aa84
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/delayed/definition.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Roberto Cavada and Cristian Mattarei and Anthony Fernandes Pires-->
+<!-- Version: 0.2 -->
+<!-- Date: 2014/09/24 -->
+
+<effects_model name="NonDeterminismByValue_Num_D">
+  <values>
+    <input reads="min_bound" type="Integer" desc="The minimal bound of the non-determinism. Can be a constant or a variable."/>
+    <input reads="max_bound" type="Integer" desc="The maximal bound of the non-determinism. Can be a constant or a variable."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/delayed/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/delayed/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..4461e77f98d7f5ac95f3238f89119ed09749e4b1
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/delayed/during.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Roberto Cavada
+-- - Version: 0.1
+-- - Date: 2011/09/16
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/delayed/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/delayed/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..d5b9c0b4b53c4af1642f0249cb769ebd994a6108
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/delayed/entering.smv
@@ -0,0 +1,13 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Roberto Cavada and Anthony Fernandes Pires
+-- - Version: 0.2
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - min_bound: the minimal bound of non determinism. Can be a constant or a variable.
+-- - max_bound: the maximal bound of non determinism. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) >= min_bound & next(varout) <= max_bound
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/delayed/image.png b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/delayed/image.png
new file mode 100644
index 0000000000000000000000000000000000000000..a6d0f5043d0fdec904bf01541264f0ae7d4eac6d
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/delayed/image.png differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/instantaneous/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/instantaneous/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d62dcb109af6ae633310269ddfaf9022bd8085f1
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/instantaneous/definition.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires-->
+<!-- Version: 0.1 -->
+<!-- Date: 2014/09/24 -->
+
+<effects_model name="NonDeterminismByValue_Num_I">
+  <values>
+    <input reads="min_bound" type="Integer" desc="The minimal bound of the non-determinism. Can be a constant or a variable."/>
+    <input reads="max_bound" type="Integer" desc="The maximal bound of the non-determinism. Can be a constant or a variable."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/instantaneous/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/instantaneous/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..86d6c8802fab027d67938d8d319d243e81188f01
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/instantaneous/during.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/instantaneous/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/instantaneous/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..b8a5a2cd78789c29552b533766e88228c2a40a77
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/nondeterminismbyvalue_num/instantaneous/entering.smv
@@ -0,0 +1,13 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - min_bound: the minimal bound of non determinism. Can be a constant or a variable.
+-- - max_bound: the maximal bound of non determinism. Can be a constant or a variable.
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) >= next(min_bound) & next(varout) <= next(max_bound)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/rampdown/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/rampdown/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a945798f54837f3399658b4065289cd744268688
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/rampdown/definition.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Roberto Cavada and Cristian Mattarei -->
+<!-- Version: 0.1 -->
+<!-- Date: 2011/09/16 -->
+
+<effects_model name="RampDown">
+  <values>
+    <input reads="decr" type="Integer" desc="The decreasing value at eath step"/>
+    <input reads="end_value" type="Integer" desc="The end value of the ramp"/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw type="smv" local="false">raw.smv</raw>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/rampdown/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/rampdown/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..05de4d39cc15af11b4454b24f64a6b069fb7ed4e
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/rampdown/during.smv
@@ -0,0 +1,16 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Roberto Cavada
+-- - Version: 0.1
+-- - Date: 2011/09/16
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - ramp_mode: the mode of the failure
+-- - decr: the decresing value at each step
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = case
+	         ramp_mode = RAMPING_DOWN : varout - decr;
+		 ramp_mode = RAMPING_DONE : varout;
+	esac
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/rampdown/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/rampdown/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..f8030e35b99a45fc70826da70c9bb8ce535417f1
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/rampdown/entering.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Roberto Cavada
+-- - Version: 0.1
+-- - Date: 2011/09/16
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - value: the value stucked
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = input
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/rampdown/raw.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/rampdown/raw.smv
new file mode 100644
index 0000000000000000000000000000000000000000..8780838a079f319edb3db0720e761dbcc047fa9a
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/rampdown/raw.smv
@@ -0,0 +1,8 @@
+      VAR ramp_mode : { RAMPING_DOWN, RAMPING_DONE };
+      ASSIGN
+      init(ramp_mode) := RAMPING_DOWN;
+      next(ramp_mode) := case
+      is_nominal: RAMPING_DOWN;
+      is_fault & varout - decr > end_value: RAMPING_DOWN;
+      TRUE: RAMPING_DONE;
+      esac;
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyreference/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyreference/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a1f42be7636ae3eebc7837b44406f623395fe688
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyreference/definition.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2015/12/14 -->
+
+<effects_model name="RandomByReference">
+  <values>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyreference/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyreference/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..098ed91f575b903c7d9c1b5933bd4e5fcd816a6d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyreference/during.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+TRUE
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyreference/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyreference/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..098ed91f575b903c7d9c1b5933bd4e5fcd816a6d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyreference/entering.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+TRUE
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyvalue/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyvalue/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..58c897efa737c351c91ecf00c4a39a0291769550
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyvalue/definition.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2015/12/14 -->
+
+<effects_model name="RandomByValue">
+  <values>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyvalue/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyvalue/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..2d09b51ed9629de4f874c36414fc14399d8728c0
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyvalue/during.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyvalue/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyvalue/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..098ed91f575b903c7d9c1b5933bd4e5fcd816a6d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/randombyvalue/entering.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2015/12/02
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+TRUE
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/delayed/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/delayed/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e221d63c224fcd663cbfbba41065c37a471d80ed
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/delayed/definition.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Roberto Cavada and Cristian Mattarei and Anthony Fernandes Pires -->
+<!-- Version: 0.2 -->
+<!-- Date: 2014/09/24 -->
+
+<effects_model name="StuckAtByReference_D">
+  <values>
+    <input reads="term" type="Any" desc="The value at which the output has to be stuck. Can be a constant or a variable."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/delayed/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/delayed/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..136284583c195b755cafbd9e3c924412cba5c7bd
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/delayed/during.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Roberto Cavada and Anthony Fernandes Pires
+-- - Version: 0.2
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - term: The value at which the output has to be stuck. Can be a constant or a variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = term
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/delayed/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/delayed/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..136284583c195b755cafbd9e3c924412cba5c7bd
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/delayed/entering.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Roberto Cavada and Anthony Fernandes Pires
+-- - Version: 0.2
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - term: The value at which the output has to be stuck. Can be a constant or a variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = term
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/delayed/image.png b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/delayed/image.png
new file mode 100644
index 0000000000000000000000000000000000000000..80af412184f2e77510a0f57250cda9260c69f334
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/delayed/image.png differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/instantaneous/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/instantaneous/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..160ddfcadcf99630b14840c66698b4efc02539c2
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/instantaneous/definition.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2014/09/24 -->
+
+<effects_model name="StuckAtByReference_I">
+  <values>
+    <input reads="term" type="Any" desc="The value at which the output has to be stuck. Can be a constant or a variable."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/instantaneous/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/instantaneous/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..df9d8427c654b5a82716ec9dd8a9f64129408719
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/instantaneous/during.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - term: The value at which the output has to be stuck. Can be a constant or a variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = next(term)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/instantaneous/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/instantaneous/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..df9d8427c654b5a82716ec9dd8a9f64129408719
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyreference/instantaneous/entering.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - term: The value at which the output has to be stuck. Can be a constant or a variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = next(term)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/delayed/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/delayed/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7db976f0ef01e7658d2d4202967a4010377c12fb
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/delayed/definition.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2014/09/24 -->
+
+<effects_model name="StuckAtByValue_D">
+  <values>
+    <input reads="term" type="Any" desc="The value at which the output has to be stuck. Can be a constant or a variable."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/delayed/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/delayed/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..3555e9930e8c88c4f4f86c9bcffd60fee12bf9d1
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/delayed/during.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - term: The value at which the output has to be stuck. Can be a constant or a variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/delayed/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/delayed/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..0054a0c48f1896381a90023bf3b7e4a3733552f6
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/delayed/entering.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - term: The value at which the output has to be stuck. Can be a constant or a variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = term
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/instantaneous/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/instantaneous/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..18f8c6731be51ca886fc09ba45d2639ecc0c6941
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/instantaneous/definition.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Anthony Fernandes Pires -->
+<!-- Version: 0.1 -->
+<!-- Date: 2014/09/24 -->
+
+<effects_model name="StuckAtByValue_I">
+  <values>
+    <input reads="term" type="Any" desc="The value at which the output has to be stuck. Can be a constant or a variable."/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/instantaneous/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/instantaneous/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..3555e9930e8c88c4f4f86c9bcffd60fee12bf9d1
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/instantaneous/during.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - term: The value at which the output has to be stuck. Can be a constant or a variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/instantaneous/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/instantaneous/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..df9d8427c654b5a82716ec9dd8a9f64129408719
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatbyvalue/instantaneous/entering.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Anthony Fernandes Pires
+-- - Version: 0.1
+-- - Date: 2014/09/24
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - term: The value at which the output has to be stuck. Can be a constant or a variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = next(term)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatfixed/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatfixed/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..957e1c1393dc918525a0e55bdfbcce12a8f1d5a8
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatfixed/definition.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Roberto Cavada and Cristian Mattarei -->
+<!-- Version: 0.1 -->
+<!-- Date: 2011/09/16 -->
+
+<effects_model name="StuckAtFixed">
+  <values>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatfixed/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatfixed/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..8543f694864c41afe82047c4857c6e1b7e60c39c
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatfixed/during.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Roberto Cavada
+-- - Version: 0.1
+-- - Date: 2011/09/16
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - value: the value stucked
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatfixed/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatfixed/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..8543f694864c41afe82047c4857c6e1b7e60c39c
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatfixed/entering.smv
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Roberto Cavada
+-- - Version: 0.1
+-- - Date: 2011/09/16
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - value: the value stucked
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatfixed/image.png b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatfixed/image.png
new file mode 100644
index 0000000000000000000000000000000000000000..765ac3c9a2879c48a7f6e68e8533f6bb809db763
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/stuckatfixed/image.png differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/testtemplate/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/testtemplate/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..31dce18076d4384d5d8487f7a3f2ac49d71314ea
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/testtemplate/definition.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Roberto Cavada and Cristian Mattarei -->
+<!-- Version: 0.1 -->
+<!-- Date: 2011/09/16 -->
+
+<effects_model name="TestTemplate">
+  <templates>
+    <template name="counter_max" type="PInteger">
+      Description of the template.
+    </template>
+  </templates>
+  <values>
+    <input reads="min_value" type="Integer" desc="The minimal value of the non-determinism"/>
+    <input reads="max_value" type="Integer" desc="The maximal value of the non-determinism"/>
+    <output writes="varout" reads="input" desc="The output variable name that reads on the input one"/>
+  </values>
+  <effect>
+    <entering type="smv" local="false">entering.smv</entering>
+    <during type="smv" local="false">during.smv</during>
+  </effect>
+  <raw/>
+</effects_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/testtemplate/during.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/testtemplate/during.smv
new file mode 100644
index 0000000000000000000000000000000000000000..4461e77f98d7f5ac95f3238f89119ed09749e4b1
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/testtemplate/during.smv
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Roberto Cavada
+-- - Version: 0.1
+-- - Date: 2011/09/16
+------------------------------------------------------------------------------
+-- - varout: the output variable
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) = varout
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/testtemplate/entering.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/testtemplate/entering.smv
new file mode 100644
index 0000000000000000000000000000000000000000..e7792f742221dd6bbc9c1d83cc46b256c297eec0
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/testtemplate/entering.smv
@@ -0,0 +1,13 @@
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+-- - Author: Roberto Cavada
+-- - Version: 0.1
+-- - Date: 2011/09/16
+------------------------------------------------------------------------------
+-- - varout: the output variable
+-- - min_value: the minimal value of non determinism
+-- - max_value: the maximal value of non determinism
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+
+next(varout) >= min_value & next(${counter_max}) <= max_value
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/testtemplate/image.png b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/testtemplate/image.png
new file mode 100644
index 0000000000000000000000000000000000000000..a6d0f5043d0fdec904bf01541264f0ae7d4eac6d
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/eml_behavior/testtemplate/image.png differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3ef91c392f89918e10d5075d94ed520b9516fe55
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Roberto Cavada and Cristian Mattarei -->
+<!-- Version: 0.1 -->
+<!-- Date: 2011/09/11 -->
+
+<local_dynamics_library>
+
+  <local_dynamics_model name="Permanent">
+    <description>
+      It gets the failure to be permanent
+    </description>
+    <definition loc="ldl_behavior/permanent/definition.xml"/>
+  </local_dynamics_model>
+
+  <local_dynamics_model name="Transient">
+    <description>
+      It provides the possibility to have a self fixing in a non-deterministic way
+    </description>
+    <definition loc="ldl_behavior/transient/definition.xml"/>
+  </local_dynamics_model>
+
+  <local_dynamics_model name="SelfFixWithCounter">
+    <description>
+      It garantees the self fixing in a fixed amount of steps
+    </description>
+    <definition loc="ldl_behavior/selffixwithcounter/definition.xml"/>
+  </local_dynamics_model>
+
+</local_dynamics_library>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl.xsd b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl.xsd
new file mode 100644
index 0000000000000000000000000000000000000000..5f1316a5aaa6d1cce9802a031db4fb36309492da
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+  <xs:element name="local_dynamics_library">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="local_dynamics_model"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="local_dynamics_model">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="description"/>
+        <xs:element ref="definition"/>
+      </xs:sequence>
+      <xs:attribute name="name" use="required" type="xs:NCName"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="description" type="xs:string"/>
+  <xs:element name="definition">
+    <xs:complexType>
+      <xs:attribute name="loc" use="required"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/definition.xsd b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/definition.xsd
new file mode 100644
index 0000000000000000000000000000000000000000..db7dc4f6eafbf2b94321952e1dff3b9ebefa99b4
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/definition.xsd
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+  <xs:element name="local_dynamics_model">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="0" ref="templates"/>
+        <xs:element ref="events"/>
+        <xs:element ref="transitions"/>
+        <xs:element ref="raw"/>
+      </xs:sequence>
+      <xs:attribute name="name" use="required" type="xs:NCName"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="templates">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="template"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="template">
+    <xs:complexType mixed="true">
+      <xs:attribute name="name" use="required" type="xs:NCName"/>
+      <xs:attribute name="type" use="required" type="xs:NCName"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="events">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="event"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="event">
+    <xs:complexType>
+      <xs:attribute name="name" use="required"/>
+      <xs:attribute name="type" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="transitions">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="transition"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="transition">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="0" ref="guard"/>
+        <xs:element minOccurs="0" ref="trigger"/>
+      </xs:sequence>
+      <xs:attribute name="from" use="required" type="xs:NCName"/>
+      <xs:attribute name="to" use="required" type="xs:NCName"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="guard" type="xs:string"/>
+  <xs:element name="trigger" type="xs:string"/>
+  <xs:element name="raw">
+    <xs:complexType mixed="true">
+      <xs:attribute name="local" type="xs:boolean"/>
+      <xs:attribute name="type" type="xs:NCName"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/permanent/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/permanent/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..50553edffad35ad2c6a2401f92a999de55c44ce7
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/permanent/definition.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Roberto Cavada and Cristian Mattarei -->
+<!-- Version: 0.1 -->
+<!-- Date: 2011/09/11 -->
+
+<local_dynamics_model name="Permanent">
+  <events>
+    <event type="output" name="failure"/>
+  </events>
+  <transitions>
+    <transition from="nominal" to="fault">
+      <trigger>failure</trigger>
+    </transition>
+    <transition from="fault" to="fault"/>
+  </transitions>
+  <raw/>
+</local_dynamics_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/permanent/image.png b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/permanent/image.png
new file mode 100644
index 0000000000000000000000000000000000000000..3caa6f6c41c06c42ad3e671f8d7e4ba1c6409793
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/permanent/image.png differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/selffixwithcounter/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/selffixwithcounter/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5127a54236c301ba7bb4739b2d5db7c1873cdb8d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/selffixwithcounter/definition.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Roberto Cavada and Cristian Mattarei -->
+<!-- Version: 0.1 -->
+<!-- Date: 2011/09/11 -->
+
+<local_dynamics_model name="SelfFixWithCounter">
+  <templates>
+    <template name="counter_max" type="PInteger">
+      Description of the template.
+    </template>
+  </templates>
+  <events>
+    <event type="output" name="failure"/>
+  </events>
+  <transitions>
+    <transition from="nominal" to="fault">
+      <trigger>failure</trigger>
+    </transition>
+    <transition from="fault" to="fault">
+      <guard>counter &lt; ${counter_max}</guard>
+    </transition>
+    <transition from="fault" to="nominal">
+      <guard>counter &gt;= ${counter_max}</guard>
+    </transition>
+  </transitions>
+  <raw type="smv" local="false">raw.smv</raw>
+</local_dynamics_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/selffixwithcounter/image.png b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/selffixwithcounter/image.png
new file mode 100644
index 0000000000000000000000000000000000000000..14541478be8622f41cf6a889c536044cad5a16c3
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/selffixwithcounter/image.png differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/selffixwithcounter/raw.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/selffixwithcounter/raw.smv
new file mode 100644
index 0000000000000000000000000000000000000000..ffe4c26e7814852b471ebdbaac7306e2a6bf259a
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/selffixwithcounter/raw.smv
@@ -0,0 +1,9 @@
+VAR 
+  counter : 0 .. $counter_max;
+ASSIGN
+  init(counter) := 0;
+  next(counter) := case
+  		     is_nominal : 0;
+  		     counter < $counter_max : counter + 1;
+                     TRUE : $counter_max;
+                   esac;
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/transient/definition.xml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/transient/definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..af303a1449c4665b4c87218e644f82ac86d74be7
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/transient/definition.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Author: Roberto Cavada and Cristian Mattarei -->
+<!-- Version: 0.1 -->
+<!-- Date: 2011/09/11 -->
+
+<local_dynamics_model name="Transient">
+  <templates>
+    <template name="self_fix" type="Identifier">
+      Description of the template.
+    </template>
+  </templates>
+  <events>
+    <event type="output" name="failure"/>
+    <event type="output" name="${self_fix}"/>
+  </events>
+  <transitions>
+    <transition from="nominal" to="fault">
+      <trigger>failure</trigger>
+    </transition>
+    <transition from="fault" to="fault">
+      <guard>!${self_fix}</guard>
+    </transition>
+    <transition from="fault" to="nominal">
+      <trigger>${self_fix}</trigger>
+    </transition>
+  </transitions>
+  <raw/>
+</local_dynamics_model>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/transient/image.png b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/transient/image.png
new file mode 100644
index 0000000000000000000000000000000000000000..f3bfc23542ed5a6005a4b89633d74da6c171a622
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/fm_library/ldl_behavior/transient/image.png differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/failure-modes.xsd b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/failure-modes.xsd
new file mode 100644
index 0000000000000000000000000000000000000000..b618e0fc81c0171305924f7aa4f7726713a1c571
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/failure-modes.xsd
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="compass">
+    <xs:complexType>
+      <xs:sequence>
+
+        <!-- fm list -->
+        <xs:element name="fmlist" minOccurs="1" maxOccurs="1">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="fm" maxOccurs="unbounded">
+                <xs:complexType>
+                  <xs:sequence>
+                    <xs:element name="latent" minOccurs="0" maxOccurs="1">
+                      <xs:complexType>
+                        <xs:attribute name="probability" type="xs:string" use="required"/>
+                      </xs:complexType>
+                    </xs:element>
+                  </xs:sequence>
+                  <xs:attribute name="name" type="xs:string" use="required"/>
+                  <xs:attribute name="nominal_value" type="xs:string" use="required"/>
+                  <xs:attribute name="probability" type="xs:string"/>
+                  <xs:attribute name="history" type="xs:string"/>
+                </xs:complexType>
+              </xs:element>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+
+        <!-- cc list -->
+        <xs:element name="cclist" minOccurs="0" maxOccurs="1">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="cc" minOccurs="0" maxOccurs="unbounded">
+                <xs:complexType>
+                  <xs:sequence>
+                    <xs:element name="cc_mode" minOccurs="1" maxOccurs="unbounded">
+                      <xs:complexType>
+                        <xs:attribute name="name" type="xs:string" use="required"/>
+                        <xs:attribute name="low" type="xs:integer" use="required"/>
+                        <xs:attribute name="high" type="xs:integer" use="required"/>
+                      </xs:complexType>
+                    </xs:element>
+                  </xs:sequence>
+                  <xs:attribute name="name" type="xs:string" use="required"/>
+                  <xs:attribute name="fm" type="xs:string" use="required"/>
+                  <xs:attribute name="probability" type="xs:string"/>
+                </xs:complexType>
+              </xs:element>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+
+        <!-- obs list -->
+        <xs:element name="obslist" minOccurs="0" maxOccurs="1">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="obs" minOccurs="0" maxOccurs="unbounded">
+                <xs:complexType>
+                  <xs:attribute name="name" type="xs:string" use="required"/>
+                </xs:complexType>
+              </xs:element>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/fault-tree.xsd b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/fault-tree.xsd
new file mode 100644
index 0000000000000000000000000000000000000000..0096893587c6d60e46a7d2973e0de6a23c5b496e
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/fault-tree.xsd
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+  <!-- gate type -->
+  <xs:complexType name="gateType">
+    <xs:sequence>
+      <xs:element name="event" minOccurs="0" maxOccurs="unbounded">
+        <xs:complexType>
+          <xs:attribute name="name" type="xs:string" use="required"/>
+          <xs:attribute name="description" type="xs:string" use="required"/>
+          <xs:attribute name="probability" type="xs:string"/>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="gate" type="gateType" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="type" use="required">
+      <xs:simpleType>
+        <xs:restriction base="xs:string">
+          <xs:enumeration value="AND"/>
+          <xs:enumeration value="PAND"/>
+          <xs:enumeration value="OR"/>
+          <xs:enumeration value="XOR"/>
+          <xs:enumeration value="NULL"/>
+        </xs:restriction>
+      </xs:simpleType>
+    </xs:attribute>
+    <xs:attribute name="name" type="xs:string" use="required"/>
+    <xs:attribute name="description" type="xs:string" use="required"/>
+    <xs:attribute name="probability" type="xs:string"/>
+    <xs:attribute name="page" use="required">
+      <xs:simpleType>
+        <xs:restriction base="xs:string">
+          <xs:enumeration value="On"/>
+          <xs:enumeration value="Off"/>
+        </xs:restriction>
+      </xs:simpleType>
+    </xs:attribute>
+  </xs:complexType>
+
+  <!-- fault tree element -->
+  <xs:element name="fault-tree">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="gate" type="gateType" minOccurs="1" maxOccurs="1"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/fe.dtd b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/fe.dtd
new file mode 100644
index 0000000000000000000000000000000000000000..aea77e8e162bddc22e73d566a8a37254f324f8f1
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/fe.dtd
@@ -0,0 +1,154 @@
+<!--
+     Author: Alessandro Mariotti
+     Date:   2011.11.18
+
+     Author: Roberto Cavada
+     Date:   2014.07.22  (Common Cause)
+     Date:   2014.09.05  (fei text support)
+-->
+
+<!ENTITY % lineattr
+'lineno   CDATA       #IMPLIED'>
+
+
+<!ELEMENT fault_extension (extensions, common_causes?)>
+<!ATTLIST fault_extension
+          name CDATA #REQUIRED
+          smv_file CDATA #REQUIRED
+          fei_txt CDATA #IMPLIED
+          %lineattr;>
+<!ELEMENT extensions (nominal_component_extensions*)>
+<!ELEMENT nominal_component_extensions (fault_models)>
+<!ATTLIST nominal_component_extensions
+          module CDATA #REQUIRED
+          desc CDATA #IMPLIED
+          %lineattr;>
+
+<!ELEMENT fault_models (fault_model)*>
+<!ELEMENT fault_model (instances?, fault_modes?, global_dynamics_model?)>
+
+<!ATTLIST fault_model
+          name CDATA #REQUIRED
+          symbols CDATA #REQUIRED
+          desc CDATA #IMPLIED
+          %lineattr;>
+
+<!ELEMENT instances (pat)*>
+<!ELEMENT pat (#PCDATA)>
+
+<!ELEMENT fault_modes (fault_mode)*>
+
+<!ELEMENT fault_mode (effects_model?, local_dynamics_model?, latent?)>
+
+<!ATTLIST fault_mode
+          name CDATA #REQUIRED
+          symbols CDATA #REQUIRED
+          probability CDATA #IMPLIED
+          %lineattr;>
+
+<!ELEMENT effects_model (values?, effect?, raw?)>
+
+<!ATTLIST effects_model
+          name CDATA #REQUIRED
+          %lineattr;>
+
+<!ELEMENT latent EMPTY>
+
+<!ATTLIST latent
+          is_latent (yes | no) #REQUIRED
+          probability CDATA #IMPLIED
+          %lineattr;>
+
+<!ELEMENT values (input | output)*>
+
+<!ELEMENT input EMPTY>
+
+<!ATTLIST input
+          reads CDATA #REQUIRED
+          value CDATA #IMPLIED>
+
+<!ELEMENT output EMPTY>
+
+<!ATTLIST output
+          reads CDATA #REQUIRED
+          writes CDATA #REQUIRED
+          binds CDATA #REQUIRED
+          type CDATA #REQUIRED>
+
+<!ELEMENT effect ((during, entering) | (entering, during))>
+
+<!ELEMENT raw (#PCDATA)>
+
+<!ELEMENT entering (#PCDATA)>
+
+<!ATTLIST entering
+          language (smv) #IMPLIED>
+
+<!ELEMENT during (#PCDATA)>
+
+<!ATTLIST during
+          language (smv) #IMPLIED>
+
+<!-- Here we mean that each tag MUST appear once, no matter the order.-->
+
+<!ELEMENT local_dynamics_model (events?, transitions?, raw?)>
+
+<!ATTLIST local_dynamics_model
+          name CDATA #REQUIRED
+          desc CDATA #IMPLIED
+          %lineattr;>
+
+<!ELEMENT events (event)*>
+
+<!ELEMENT event EMPTY>
+
+<!ATTLIST event
+          type (input | output) #REQUIRED
+          name CDATA #REQUIRED
+          connected (yes | no) #REQUIRED
+          value CDATA #IMPLIED
+          binds CDATA #IMPLIED
+          %lineattr;>
+
+<!ELEMENT transitions (transition)*>
+
+<!ELEMENT transition (trigger | guard)*>
+
+<!ATTLIST transition
+          from CDATA #REQUIRED
+          to CDATA #REQUIRED
+          %lineattr;>
+
+<!ELEMENT trigger (#PCDATA)>
+
+<!ELEMENT guard (#PCDATA)>
+
+<!ELEMENT global_dynamics_model (events?, transitions?)>
+<!ATTLIST global_dynamics_model
+          %lineattr;>
+
+<!--
+     Common Cause stuff
+-->
+<!ELEMENT common_causes (cause)*>
+<!ELEMENT cause (cc_module)*>
+<!ATTLIST cause
+	  name CDATA #REQUIRED
+	  desc CDATA #IMPLIED
+          probability CDATA #IMPLIED
+          %lineattr;>
+<!ELEMENT cc_module (instances?, cc_mode*)>
+<!ATTLIST cc_module
+	  name CDATA #REQUIRED
+	  desc CDATA #IMPLIED
+          %lineattr;>
+<!ELEMENT cc_mode (cc_range)>
+<!ATTLIST cc_mode
+	  slice CDATA #REQUIRED
+	  mode CDATA #REQUIRED
+          %lineattr;>
+<!ELEMENT cc_range EMPTY>
+<!ATTLIST cc_range
+          low CDATA #REQUIRED
+          high CDATA #REQUIRED
+          %lineattr;>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/fmea-table.xsd b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/fmea-table.xsd
new file mode 100644
index 0000000000000000000000000000000000000000..b07ccc20a3b11ed6f10dfb5c79b5cb196bbc3341
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/fmea-table.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="fmea_table">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="row" maxOccurs="unbounded">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="id" type="xs:positiveInteger"/>
+              <xs:element name="entry" type="xs:string" minOccurs="0"/>
+              <xs:element name="failure_mode" type="xs:string"/>
+              <xs:element name="failure_effects" type="xs:string"/>
+              <xs:element name="trace_file_name" type="xs:string" minOccurs="0"/>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/tfpg.xsd b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/tfpg.xsd
new file mode 100644
index 0000000000000000000000000000000000000000..fb34d88c94ac1c0863627a71560eabd1172f324d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/tfpg.xsd
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+<xsd:schema
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+  elementFormDefault="qualified">
+
+
+  <!-- TFPG -->
+
+  <xsd:element name="tfpg" type="tfpgType" />
+
+  <xsd:complexType name="tfpgType">
+    <xsd:sequence>
+      <xsd:element name="nodesList" type="nodesListType" />
+      <xsd:element name="modesList" type="modesListType" />
+      <xsd:element name="edgesList" type="edgesListType" />
+    </xsd:sequence>
+    <xsd:attribute name="name" type="identifierType" />
+    <xsd:attribute name="infty_semantics" type="xsd:string" />
+  </xsd:complexType>
+
+
+
+  <!-- Nodes -->
+
+  <xsd:complexType name="nodesListType">
+    <xsd:sequence>
+       <xsd:element name="node" type="nodeType" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="nodeType">
+    <xsd:sequence>
+      <xsd:element name="type" type="nodeValType" />
+    </xsd:sequence>
+    <xsd:attribute name="name" type="identifierType" />
+    <xsd:attribute name="isMonitored" type="xsd:boolean" use="optional"/>
+  </xsd:complexType>
+
+
+
+  <!-- Modes -->
+
+  <xsd:complexType name="modesListType">
+    <xsd:sequence>
+      <xsd:element name="mode" type="identifierType" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+
+  <!-- Edges -->
+
+  <xsd:complexType name="edgesListType">
+    <xsd:sequence>
+      <xsd:element name="edge" type="edgeType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="edgeType">
+    <xsd:sequence>
+      <xsd:element name="srcNode" type="identifierType" />
+      <xsd:element name="tMin" type="xsd:float" />
+      <xsd:element name="tMax" type="xsd:float" />
+      <xsd:element name="modesList" type="modesListType" />
+      <xsd:element name="destNode" type="identifierType" />
+    </xsd:sequence>
+    <xsd:attribute name="name" type="identifierType" />
+  </xsd:complexType>
+
+  <!-- Define the type of an Identifier -->
+
+  <xsd:simpleType name="identifierType">
+    <xsd:restriction base="xsd:string">
+      <xsd:pattern value="([a-zA-Z0-9_-])+"/>
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <!-- Define the type of a Node -->
+  <xsd:simpleType name="nodeValType">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="AND"/>
+      <xsd:enumeration value="OR"/>
+      <xsd:enumeration value="FM"/>
+    </xsd:restriction>
+  </xsd:simpleType>
+
+</xsd:schema>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/tfpg_associations.xsd b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/tfpg_associations.xsd
new file mode 100644
index 0000000000000000000000000000000000000000..4dceb4f6e98a2f4a6a2d882f00ff8e0cc08dc794
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/data/schema/tfpg_associations.xsd
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<xsd:schema
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+  elementFormDefault="qualified">
+
+  <xsd:element name="associations" type="associationsType" />
+
+  <xsd:complexType name="associationsType">
+    <xsd:sequence>
+      <xsd:element name="failureModes" type="failureModesListType"/>
+      <xsd:element name="monitoredDiscrepancies" type="monitoredDiscrepanciesListType"/>
+      <xsd:element name="unmonitoredDiscrepancies" type="unmonitoredDiscrepanciesListType"/>
+      <xsd:element name="tfpgModes" type="tfpgModesListType"/>
+    </xsd:sequence>
+  </xsd:complexType>
+
+
+  <xsd:complexType name="failureModesListType">
+    <xsd:sequence>
+      <xsd:element name="assoc" type="assocType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="monitoredDiscrepanciesListType">
+    <xsd:sequence>
+      <xsd:element name="assoc" type="assocType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="unmonitoredDiscrepanciesListType">
+    <xsd:sequence>
+      <xsd:element name="assoc" type="assocType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="tfpgModesListType">
+    <xsd:sequence>
+      <xsd:element name="assoc" type="assocType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="assocType">
+    <xsd:attribute name="id" type="xsd:string" />
+    <xsd:attribute name="expr" type="xsd:string" />
+  </xsd:complexType>
+
+</xsd:schema>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/doc/user/xsap-manual.pdf b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/doc/user/xsap-manual.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..137507ae926cf06c8e6042bc4aa654f771c5c60b
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/doc/user/xsap-manual.pdf differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB1_conditions.cond b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB1_conditions.cond
new file mode 100644
index 0000000000000000000000000000000000000000..e0423af2d6c60761787cff9e654e4713b3d81c62
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB1_conditions.cond
@@ -0,0 +1,2 @@
+CONDITION_L  (CN.cmd_to_BB1 = cmd_open & (SC.BB1.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.BB1.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_BB1 = cmd_closed & (SC.BB1.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.BB1.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure))
+CONDITION_R !(CN.cmd_to_BB1 = cmd_open & (SC.BB1.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.BB1.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_BB1 = cmd_closed & (SC.BB1.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.BB1.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure))
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB1_observables.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB1_observables.obs
new file mode 100644
index 0000000000000000000000000000000000000000..a906d2343b02b4e4771f54f18b3fba82bbfd9b31
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB1_observables.obs
@@ -0,0 +1,2 @@
+SC.BB1.state
+CN.cmd_to_BB1
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB2_conditions.cond b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB2_conditions.cond
new file mode 100644
index 0000000000000000000000000000000000000000..ca74d7c8c563f4c430c8d8eb452612ab324e4c9f
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB2_conditions.cond
@@ -0,0 +1,2 @@
+CONDITION_L  (CN.cmd_to_BB2 = cmd_open & (SC.BB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.BB2.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_BB2 = cmd_closed & (SC.BB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.BB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#failure))
+CONDITION_R !(CN.cmd_to_BB2 = cmd_open & (SC.BB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.BB2.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_BB2 = cmd_closed & (SC.BB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.BB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#failure))
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB2_observables.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB2_observables.obs
new file mode 100644
index 0000000000000000000000000000000000000000..6ebb521f0e9123866118eac85e5ce415cca98200
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB2_observables.obs
@@ -0,0 +1,2 @@
+SC.BB2.state
+CN.cmd_to_BB2
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB3_conditions.cond b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB3_conditions.cond
new file mode 100644
index 0000000000000000000000000000000000000000..19eaceb06322b4d7250f7f52e62e830718e92d8f
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB3_conditions.cond
@@ -0,0 +1,2 @@
+CONDITION_L  (CN.cmd_to_BB3 = cmd_open & (SC.BB3.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.BB3.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_BB3 = cmd_closed & (SC.BB3.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.BB3.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure))
+CONDITION_R !(CN.cmd_to_BB3 = cmd_open & (SC.BB3.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.BB3.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_BB3 = cmd_closed & (SC.BB3.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.BB3.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure))
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB3_observables.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB3_observables.obs
new file mode 100644
index 0000000000000000000000000000000000000000..aa3574fc0983f0e3009aff05d792722fca0d4847
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/BB3_observables.obs
@@ -0,0 +1,2 @@
+SC.BB3.state
+CN.cmd_to_BB3
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G1.asl b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G1.asl
new file mode 100644
index 0000000000000000000000000000000000000000..9dd08e02f3072524033e4cd4a6676f0b2cd9f03f
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G1.asl
@@ -0,0 +1,3 @@
+NAME: ALARM_G1
+CONDITION: (CN.cmd_to_G1 = cmd_on & (SC.G1.Gen_StuckOff.mode != NOMINAL | SC.G1.Gen_StuckOff.event = stuckAt_Off#failure))
+TYPE: finite
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G1_conditions.cond b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G1_conditions.cond
new file mode 100644
index 0000000000000000000000000000000000000000..3a34d7acf31d5678272d7be19ac47e49f984491f
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G1_conditions.cond
@@ -0,0 +1,3 @@
+CONDITION_L  (CN.cmd_to_G1 = cmd_on & (SC.G1.Gen_StuckOff.mode != NOMINAL | SC.G1.Gen_StuckOff.event = stuckAt_Off#failure))
+CONDITION_R !(CN.cmd_to_G1 = cmd_on & (SC.G1.Gen_StuckOff.mode != NOMINAL | SC.G1.Gen_StuckOff.event = stuckAt_Off#failure))
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G1_observables.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G1_observables.obs
new file mode 100644
index 0000000000000000000000000000000000000000..f702bb74fed858556c1abc9e2bec9511210fdad6
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G1_observables.obs
@@ -0,0 +1,2 @@
+SC.G1.state
+CN.cmd_to_G1
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G1_with_context.asl b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G1_with_context.asl
new file mode 100644
index 0000000000000000000000000000000000000000..df070bd99d52095b8770fd2792bca0e045943ee6
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G1_with_context.asl
@@ -0,0 +1,4 @@
+NAME: myAlarm
+CONDITION: SC.G1.Gen_StuckOff.mode != NOMINAL
+TYPE: finite
+CONTEXT: G F [0,5] CN.cmd_to_G1 = cmd_on
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G2_conditions.cond b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G2_conditions.cond
new file mode 100644
index 0000000000000000000000000000000000000000..18e0e3eeb70f47e8139315da76a916c20ed082cd
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G2_conditions.cond
@@ -0,0 +1,2 @@
+CONDITION_L  (CN.cmd_to_G2 = cmd_on & (SC.G2.Gen_StuckOff.mode != NOMINAL | SC.G2.Gen_StuckOff.event = stuckAt_Off#failure))
+CONDITION_R !(CN.cmd_to_G2 = cmd_on & (SC.G2.Gen_StuckOff.mode != NOMINAL | SC.G2.Gen_StuckOff.event = stuckAt_Off#failure))
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G2_observables.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G2_observables.obs
new file mode 100644
index 0000000000000000000000000000000000000000..a584e11db12ed21dfe68a0a93b27b68c89a031c0
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G2_observables.obs
@@ -0,0 +1,2 @@
+SC.G2.state
+CN.cmd_to_G2
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G3_conditions.cond b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G3_conditions.cond
new file mode 100644
index 0000000000000000000000000000000000000000..475a5352463fb5cdd933432023ccca38b8af5eda
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G3_conditions.cond
@@ -0,0 +1,2 @@
+CONDITION_L  (CN.cmd_to_G3 = cmd_on & (SC.G3.Gen_StuckOff.mode != NOMINAL | SC.G3.Gen_StuckOff.event = stuckAt_Off#failure))
+CONDITION_R !(CN.cmd_to_G3 = cmd_on & (SC.G3.Gen_StuckOff.mode != NOMINAL | SC.G3.Gen_StuckOff.event = stuckAt_Off#failure)) 
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G3_observables.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G3_observables.obs
new file mode 100644
index 0000000000000000000000000000000000000000..e55803481bcc3b1fe535bc6216842b635e9b259b
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/G3_observables.obs
@@ -0,0 +1,2 @@
+SC.G3.state
+CN.cmd_to_G3
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB1_conditions.cond b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB1_conditions.cond
new file mode 100644
index 0000000000000000000000000000000000000000..8410c549554ecbef52be52d7b8828e639f534f66
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB1_conditions.cond
@@ -0,0 +1,2 @@
+CONDITION_L  (CN.cmd_to_GB1 = cmd_open & (SC.GB1.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.GB1.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_GB1 = cmd_closed & (SC.GB1.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.GB1.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure))
+CONDITION_R !(CN.cmd_to_GB1 = cmd_open & (SC.GB1.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.GB1.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_GB1 = cmd_closed & (SC.GB1.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.GB1.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure))
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB1_observables.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB1_observables.obs
new file mode 100644
index 0000000000000000000000000000000000000000..f4ec4bd0d9c4d4d845f176f9c8e9ebdb26ab1cb0
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB1_observables.obs
@@ -0,0 +1,2 @@
+SC.GB1.state
+CN.cmd_to_GB1
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB2_conditions.cond b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB2_conditions.cond
new file mode 100644
index 0000000000000000000000000000000000000000..daf889ced59acebc3542066c987646b58074696c
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB2_conditions.cond
@@ -0,0 +1,2 @@
+CONDITION_L  (CN.cmd_to_GB2 = cmd_closed & (SC.GB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.GB2.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure)) | (CN.cmd_to_GB2 = cmd_open & (SC.GB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.GB2.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure))
+CONDITION_R !(CN.cmd_to_GB2 = cmd_closed & (SC.GB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.GB2.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure)) | (CN.cmd_to_GB2 = cmd_open & (SC.GB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.GB2.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure))
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB2_observables.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB2_observables.obs
new file mode 100644
index 0000000000000000000000000000000000000000..18c84856c5ac67aa224eae4bf74e640bb729656e
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB2_observables.obs
@@ -0,0 +1,2 @@
+SC.GB2.state
+CN.cmd_to_GB2
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB3_conditions.cond b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB3_conditions.cond
new file mode 100644
index 0000000000000000000000000000000000000000..75e1dffaa413d763a0627b7d5848d3978732692a
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB3_conditions.cond
@@ -0,0 +1,2 @@
+CONDITION_L  (CN.cmd_to_GB3 = cmd_closed & (SC.GB3.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.GB3.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure)) | (CN.cmd_to_GB3 = cmd_open & (SC.GB3.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.GB3.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure))
+CONDITION_R !(CN.cmd_to_GB3 = cmd_closed & (SC.GB3.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.GB3.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure)) | (CN.cmd_to_GB3 = cmd_open & (SC.GB3.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.GB3.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure))
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB3_observables.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB3_observables.obs
new file mode 100644
index 0000000000000000000000000000000000000000..70def0a4a63f209b57989634bd417145f068e951
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/GB3_observables.obs
@@ -0,0 +1,2 @@
+SC.GB3.state
+CN.cmd_to_GB3
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/full_observables.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/full_observables.obs
new file mode 100644
index 0000000000000000000000000000000000000000..3cddf5ea2131785fb26e6ee1f646233eae154c25
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/diag/full_observables.obs
@@ -0,0 +1,45 @@
+SC.G1.state
+CN.cmd_to_G1
+SC.G2.state
+CN.cmd_to_G2
+SC.G3.state
+CN.cmd_to_G3
+SC.GB1.state
+CN.cmd_to_GB1
+SC.GB2.state
+CN.cmd_to_GB2
+SC.GB3.state
+CN.cmd_to_GB3
+SC.BB1.state
+CN.cmd_to_BB1
+SC.BB2.state
+CN.cmd_to_BB2
+SC.BB3.state
+CN.cmd_to_BB3
+SC.B1_poweredby_G3_R
+SC.B1_poweredby_G3_L
+SC.B1_poweredby_G2_R
+SC.B1_poweredby_G2_L
+SC.B1_poweredby_G1_U
+SC.B2_poweredby_G3_R
+SC.B2_poweredby_G3_L
+SC.B2_poweredby_G2_U
+SC.B2_poweredby_G1_R
+SC.B2_poweredby_G1_L
+SC.B3_poweredby_G3_U
+SC.B3_poweredby_G2_R
+SC.B3_poweredby_G2_L
+SC.B3_poweredby_G1_R
+SC.B3_poweredby_G1_L
+SC.B1_poweredby_G3
+SC.B1_poweredby_G2
+SC.B1_poweredby_G1
+SC.B2_poweredby_G3
+SC.B2_poweredby_G2
+SC.B2_poweredby_G1
+SC.B3_poweredby_G3
+SC.B3_poweredby_G2
+SC.B3_poweredby_G1
+SC.B1.state
+SC.B2.state
+SC.B3.state
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/extended_SC_TMG.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/extended_SC_TMG.smv
new file mode 100644
index 0000000000000000000000000000000000000000..b1526d86509d139df98cceed13b73a596609da3c
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/extended_SC_TMG.smv
@@ -0,0 +1,703 @@
+
+-- ===============================================================================
+MODULE main
+    VAR
+        CN : Controller_Synth(SC.mode_event_Gs, SC.mode_event_CBs, SC.init_state_Gs, SC.init_state_CBs);
+        SC : System_Configuration(CN.cmd_to_Gs, CN.cmd_to_CBs);
+        _masterCC : MasterCC#;
+    DEFINE
+        base_conf := ((((((((SC.G1.is_on & SC.G2.is_on) & SC.G3.is_off) & SC.GB1.is_closed) & SC.GB2.is_closed) & SC.GB3.is_open) & SC.BB1.is_open) & SC.BB2.is_closed) & SC.BB3.is_open);
+
+    CTLSPEC NAME system_can_always_fail_true := AG (CN.MN.faults_counter = 0 -> EX CN.MN.faults_counter > 0);
+
+    CTLSPEC NAME system_can_always_work_true := EG CN.MN.faults_counter = 0;
+
+    CTLSPEC NAME G1_can_always_fail_true := AG (CN.MN.mode_est_G1 = ok -> EX CN.MN.mode_est_G1 = ko);
+
+    CTLSPEC NAME G2_can_always_fail_true := AG (CN.MN.mode_est_G2 = ok -> EX CN.MN.mode_est_G2 = ko);
+
+    CTLSPEC NAME G3_can_always_fail_true := AG (CN.MN.mode_est_G3 = ok -> EX CN.MN.mode_est_G3 = ko);
+
+    CTLSPEC NAME GB1_can_always_fail_true := AG (CN.MN.mode_est_GB1 = ok -> (EX CN.MN.mode_est_GB1 = ko_open & EX CN.MN.mode_est_GB1 = ko_closed));
+
+    CTLSPEC NAME GB2_can_always_fail_true := AG (CN.MN.mode_est_GB2 = ok -> (EX CN.MN.mode_est_GB2 = ko_open & EX CN.MN.mode_est_GB2 = ko_closed));
+
+    CTLSPEC NAME GB3_can_always_fail_true := AG (CN.MN.mode_est_GB3 = ok -> (EX CN.MN.mode_est_GB3 = ko_open & EX CN.MN.mode_est_GB3 = ko_closed));
+
+    CTLSPEC NAME BB1_can_always_fail_true := AG (CN.MN.mode_est_BB1 = ok -> (EX CN.MN.mode_est_BB1 = ko_open & EX CN.MN.mode_est_BB1 = ko_closed));
+
+    CTLSPEC NAME BB2_can_always_fail_true := AG (CN.MN.mode_est_BB2 = ok -> (EX CN.MN.mode_est_BB2 = ko_open & EX CN.MN.mode_est_BB2 = ko_closed));
+
+    CTLSPEC NAME BB3_can_always_fail_true := AG (CN.MN.mode_est_BB3 = ok -> (EX CN.MN.mode_est_BB3 = ko_open & EX CN.MN.mode_est_BB3 = ko_closed));
+
+    LTLSPEC NAME system_in_base_configuration_until_fault_true := ((base_conf U CN.MN.faults_counter > 0) |  G base_conf);
+
+    INVARSPEC NAME R1_true := !((SC.B1.is_broken | SC.B2.is_broken) | SC.B3.is_broken);
+
+    INVARSPEC NAME R2_true := ((((SC.G1.is_on | SC.G2.is_on) | SC.G3.is_on) & CN.MN.faults_counter < 3) -> ((SC.B1.is_powered & SC.B2.is_powered) & SC.B3.is_powered));
+
+    INVARSPEC NAME R2_false := (((SC.G1.is_on | SC.G2.is_on) | SC.G3.is_on) -> ((SC.B1.is_powered & SC.B2.is_powered) & SC.B3.is_powered));
+
+    INVARSPEC NAME R2_fta := ((SC.B1.is_powered & SC.B2.is_powered) & SC.B3.is_powered);
+
+    INVARSPEC NAME R2_fta_B1 := SC.B1.is_powered;
+
+    INVARSPEC NAME R2_fta_B2 := SC.B2.is_powered;
+
+    INVARSPEC NAME R2_fta_B3 := SC.B3.is_powered;
+
+    INVARSPEC NAME R4_true := (((SC.G1.is_off & SC.G2.is_off) & SC.G3.is_off) -> ((!SC.B1.is_powered & !SC.B2.is_powered) & !SC.B3.is_powered));
+
+    INVARSPEC NAME R6_true := (CN.MN.faults_counter = 0 -> ((SC.G1.is_off | SC.G2.is_off) | SC.G3.is_off));
+
+    INVARSPEC NAME Monitor_State_Consistency_true := ((((((((SC.G1.state = CN.MN.state_est_G1 & SC.G2.state = CN.MN.state_est_G2) & SC.G3.state = CN.MN.state_est_G3) & SC.GB1.state = CN.MN.state_est_GB1) & SC.GB2.state = CN.MN.state_est_GB2) & SC.GB3.state = CN.MN.state_est_GB3) & SC.BB1.state = CN.MN.state_est_BB1) & SC.BB2.state = CN.MN.state_est_BB2) & SC.BB3.state = CN.MN.state_est_BB3);
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Controller_Synth(mode_event_Gs, mode_event_CBs, init_state_Gs, init_state_CBs)
+    VAR
+        MN : Monitor(mode_event_Gs, mode_event_CBs, cmd_to_Gs, cmd_to_CBs, init_state_Gs, init_state_CBs);
+    IVAR
+        cmd_to_GB1 : {cmd_closed, cmd_open, nop};
+        cmd_to_GB2 : {cmd_closed, cmd_open, nop};
+        cmd_to_GB3 : {cmd_closed, cmd_open, nop};
+        cmd_to_BB1 : {cmd_closed, cmd_open, nop};
+        cmd_to_BB2 : {cmd_closed, cmd_open, nop};
+        cmd_to_BB3 : {cmd_closed, cmd_open, nop};
+        cmd_to_G1 : {cmd_on, cmd_off, nop};
+        cmd_to_G2 : {cmd_on, cmd_off, nop};
+        cmd_to_G3 : {cmd_on, cmd_off, nop};
+
+    DEFINE
+        B1_poweredby_G3_R := (B2_poweredby_G3_R & next(MN.state_est_BB1) = closed);
+        B1_poweredby_G3_L := (B3_poweredby_G3_U & next(MN.state_est_BB3) = closed);
+        B1_poweredby_G2_R := (B2_poweredby_G2_U & next(MN.state_est_BB1) = closed);
+        B1_poweredby_G2_L := (B3_poweredby_G2_L & next(MN.state_est_BB3) = closed);
+        B1_poweredby_G1_U := (next(MN.state_est_G1) = on & next(MN.state_est_GB1) = closed);
+        B2_poweredby_G3_R := (B3_poweredby_G3_U & next(MN.state_est_BB2) = closed);
+        B2_poweredby_G3_L := (B1_poweredby_G3_L & next(MN.state_est_BB1) = closed);
+        B2_poweredby_G2_U := (next(MN.state_est_G2) = on & next(MN.state_est_GB2) = closed);
+        B2_poweredby_G1_R := (B3_poweredby_G1_R & next(MN.state_est_BB2) = closed);
+        B2_poweredby_G1_L := (B1_poweredby_G1_U & next(MN.state_est_BB1) = closed);
+        B3_poweredby_G3_U := (next(MN.state_est_G3) = on & next(MN.state_est_GB3) = closed);
+        B3_poweredby_G2_R := (B1_poweredby_G2_R & next(MN.state_est_BB3) = closed);
+        B3_poweredby_G2_L := (B2_poweredby_G2_U & next(MN.state_est_BB2) = closed);
+        B3_poweredby_G1_R := (B1_poweredby_G1_U & next(MN.state_est_BB3) = closed);
+        B3_poweredby_G1_L := (B2_poweredby_G1_L & next(MN.state_est_BB2) = closed);
+        B1_poweredby_G3 := (B1_poweredby_G3_R | B1_poweredby_G3_L);
+        B1_poweredby_G2 := (B1_poweredby_G2_R | B1_poweredby_G2_L);
+        B1_poweredby_G1 := B1_poweredby_G1_U;
+        B2_poweredby_G3 := (B2_poweredby_G3_R | B2_poweredby_G3_L);
+        B2_poweredby_G2 := B2_poweredby_G2_U;
+        B2_poweredby_G1 := (B2_poweredby_G1_R | B2_poweredby_G1_L);
+        B3_poweredby_G3 := B3_poweredby_G3_U;
+        B3_poweredby_G2 := (B3_poweredby_G2_R | B3_poweredby_G2_L);
+        B3_poweredby_G1 := (B3_poweredby_G1_R | B3_poweredby_G1_L);
+        B1_is_working := (((B1_poweredby_G1 -> !B1_poweredby_G2) & (B1_poweredby_G2 -> !B1_poweredby_G3)) & (B1_poweredby_G3 -> !B1_poweredby_G1));
+        B2_is_working := (((B2_poweredby_G1 -> !B2_poweredby_G2) & (B2_poweredby_G2 -> !B2_poweredby_G3)) & (B2_poweredby_G3 -> !B2_poweredby_G1));
+        B3_is_working := (((B3_poweredby_G1 -> !B3_poweredby_G2) & (B3_poweredby_G2 -> !B3_poweredby_G3)) & (B3_poweredby_G3 -> !B3_poweredby_G1));
+        cmd_B1_poweredby_G3_R := (cmd_B2_poweredby_G3_R & cmd_to_BB1 = cmd_closed);
+        cmd_B1_poweredby_G3_L := (cmd_B3_poweredby_G3_U & cmd_to_BB3 = cmd_closed);
+        cmd_B1_poweredby_G2_L := (cmd_B3_poweredby_G2_L & cmd_to_BB3 = cmd_closed);
+        cmd_B1_poweredby_G2_R := (cmd_B2_poweredby_G2_U & cmd_to_BB1 = cmd_closed);
+        cmd_B1_poweredby_G1_U := (cmd_to_G1 = cmd_on & cmd_to_GB1 = cmd_closed);
+        cmd_B2_poweredby_G3_L := (cmd_B1_poweredby_G3_L & cmd_to_BB1 = cmd_closed);
+        cmd_B2_poweredby_G3_R := (cmd_B3_poweredby_G3_U & cmd_to_BB2 = cmd_closed);
+        cmd_B2_poweredby_G1_R := (cmd_B3_poweredby_G1_R & cmd_to_BB2 = cmd_closed);
+        cmd_B2_poweredby_G1_L := (cmd_B1_poweredby_G1_U & cmd_to_BB1 = cmd_closed);
+        cmd_B2_poweredby_G2_U := (cmd_to_G2 = cmd_on & cmd_to_GB2 = cmd_closed);
+        cmd_B3_poweredby_G3_U := (cmd_to_G3 = cmd_on & cmd_to_GB3 = cmd_closed);
+        cmd_B3_poweredby_G1_L := (cmd_B2_poweredby_G1_L & cmd_to_BB2 = cmd_closed);
+        cmd_B3_poweredby_G1_R := (cmd_B1_poweredby_G1_U & cmd_to_BB3 = cmd_closed);
+        cmd_B3_poweredby_G2_R := (cmd_B1_poweredby_G2_R & cmd_to_BB3 = cmd_closed);
+        cmd_B3_poweredby_G2_L := (cmd_B2_poweredby_G2_U & cmd_to_BB2 = cmd_closed);
+        can_do_B1_poweredby_G3_R := (can_do_B2_poweredby_G3_R & next(MN.mode_est_BB1) in ok union ko_closed);
+        can_do_B1_poweredby_G3_L := (can_do_B3_poweredby_G3_U & next(MN.mode_est_BB3) in ok union ko_closed);
+        can_do_B1_poweredby_G2_L := (can_do_B3_poweredby_G2_L & next(MN.mode_est_BB3) in ok union ko_closed);
+        can_do_B1_poweredby_G2_R := (can_do_B2_poweredby_G2_U & next(MN.mode_est_BB1) in ok union ko_closed);
+        can_do_B1_poweredby_G1_U := (next(MN.mode_est_G1) = ok & next(MN.mode_est_GB1) in ok union ko_closed);
+        can_do_B2_poweredby_G3_L := (can_do_B1_poweredby_G3_L & next(MN.mode_est_BB1) in ok union ko_closed);
+        can_do_B2_poweredby_G3_R := (can_do_B3_poweredby_G3_U & next(MN.mode_est_BB2) in ok union ko_closed);
+        can_do_B2_poweredby_G1_R := (can_do_B3_poweredby_G1_R & next(MN.mode_est_BB2) in ok union ko_closed);
+        can_do_B2_poweredby_G1_L := (can_do_B1_poweredby_G1_U & next(MN.mode_est_BB1) in ok union ko_closed);
+        can_do_B2_poweredby_G2_U := (next(MN.mode_est_G2) = ok & next(MN.mode_est_GB2) in ok union ko_closed);
+        can_do_B3_poweredby_G3_U := (next(MN.mode_est_G3) = ok & next(MN.mode_est_GB3) in ok union ko_closed);
+        can_do_B3_poweredby_G1_L := (can_do_B2_poweredby_G1_L & next(MN.mode_est_BB2) in ok union ko_closed);
+        can_do_B3_poweredby_G1_R := (can_do_B1_poweredby_G1_U & next(MN.mode_est_BB3) in ok union ko_closed);
+        can_do_B3_poweredby_G2_R := (can_do_B1_poweredby_G2_R & next(MN.mode_est_BB3) in ok union ko_closed);
+        can_do_B3_poweredby_G2_L := (can_do_B2_poweredby_G2_U & next(MN.mode_est_BB2) in ok union ko_closed);
+
+    DEFINE
+        cmd_to_CBs := [cmd_to_GB1, cmd_to_GB2, cmd_to_GB3, cmd_to_BB1, cmd_to_BB2, cmd_to_BB3];
+        cmd_to_Gs := [cmd_to_G1, cmd_to_G2, cmd_to_G3];
+
+    TRANS (next(MN.state_est_GB1) = open -> cmd_to_G1 = cmd_off);
+
+    TRANS (next(MN.state_est_GB2) = open -> cmd_to_G2 = cmd_off);
+
+    TRANS (next(MN.state_est_GB3) = open -> cmd_to_G3 = cmd_off);
+
+    TRANS ((B1_is_working & B2_is_working) & B3_is_working);
+
+    TRANS case
+can_do_B1_poweredby_G1_U : cmd_B1_poweredby_G1_U;
+can_do_B1_poweredby_G2_R : cmd_B1_poweredby_G2_R;
+can_do_B1_poweredby_G2_L : cmd_B1_poweredby_G2_L;
+can_do_B1_poweredby_G3_L : cmd_B1_poweredby_G3_L;
+can_do_B1_poweredby_G3_R : cmd_B1_poweredby_G3_R;
+TRUE : TRUE;
+esac;
+
+    TRANS case
+can_do_B2_poweredby_G2_U : cmd_B2_poweredby_G2_U;
+can_do_B2_poweredby_G1_L : cmd_B2_poweredby_G1_L;
+can_do_B2_poweredby_G1_R : cmd_B2_poweredby_G1_R;
+can_do_B2_poweredby_G3_R : cmd_B2_poweredby_G3_R;
+can_do_B2_poweredby_G3_L : cmd_B2_poweredby_G3_L;
+TRUE : TRUE;
+esac;
+
+    TRANS case
+can_do_B3_poweredby_G2_L : cmd_B3_poweredby_G2_L;
+can_do_B3_poweredby_G2_R : cmd_B3_poweredby_G2_R;
+can_do_B3_poweredby_G1_R : cmd_B3_poweredby_G1_R;
+can_do_B3_poweredby_G1_L : cmd_B3_poweredby_G1_L;
+can_do_B3_poweredby_G3_U : cmd_B3_poweredby_G3_U;
+TRUE : TRUE;
+esac;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Monitor(mode_event_Gs, mode_event_CBs, cmd_to_Gs, cmd_to_CBs, init_state_Gs, init_state_CBs)
+    VAR
+        mode_est_GB1 : {ok, ko_open, ko_closed};
+        mode_est_GB2 : {ok, ko_open, ko_closed};
+        mode_est_GB3 : {ok, ko_open, ko_closed};
+        mode_est_BB1 : {ok, ko_open, ko_closed};
+        mode_est_BB2 : {ok, ko_open, ko_closed};
+        mode_est_BB3 : {ok, ko_open, ko_closed};
+        mode_est_G1 : {ok, ko};
+        mode_est_G2 : {ok, ko};
+        mode_est_G3 : {ok, ko};
+        state_est_G1 : {on, off};
+        state_est_G2 : {on, off};
+        state_est_G3 : {on, off};
+        state_est_GB1 : {closed, open};
+        state_est_GB2 : {closed, open};
+        state_est_GB3 : {closed, open};
+        state_est_BB1 : {closed, open};
+        state_est_BB2 : {closed, open};
+        state_est_BB3 : {closed, open};
+
+    DEFINE
+        faults_counter := count(mode_est_GB1 != ok, mode_est_GB2 != ok, mode_est_GB3 != ok, mode_est_BB1 != ok, mode_est_BB2 != ok, mode_est_BB3 != ok, mode_est_G1 != ok, mode_est_G2 != ok, mode_est_G3 != ok);
+        index_G3 := 2;
+        index_G2 := 1;
+        index_G1 := 0;
+        index_BB3 := 5;
+        index_BB2 := 4;
+        index_BB1 := 3;
+        index_GB3 := 2;
+        index_GB2 := 1;
+        index_GB1 := 0;
+        nominal_event_Gs := mode_event_Gs[1];
+        fault_event_off_Gs := mode_event_Gs[0];
+        nominal_event_CBs := mode_event_CBs[2];
+        fault_event_closed_CBs := mode_event_CBs[1];
+        fault_event_open_CBs := mode_event_CBs[0];
+
+    ASSIGN
+        init(mode_est_GB1) := ok;
+        init(mode_est_GB2) := ok;
+        init(mode_est_GB3) := ok;
+        init(mode_est_BB1) := ok;
+        init(mode_est_BB2) := ok;
+        init(mode_est_BB3) := ok;
+        init(mode_est_G1) := ok;
+        init(mode_est_G2) := ok;
+        init(mode_est_G3) := ok;
+        init(state_est_G1) := init_state_Gs[index_G1];
+        init(state_est_G2) := init_state_Gs[index_G2];
+        init(state_est_G3) := init_state_Gs[index_G3];
+        init(state_est_GB1) := init_state_CBs[index_GB1];
+        init(state_est_GB2) := init_state_CBs[index_GB2];
+        init(state_est_GB3) := init_state_CBs[index_GB3];
+        init(state_est_BB1) := init_state_CBs[index_BB1];
+        init(state_est_BB2) := init_state_CBs[index_BB2];
+        init(state_est_BB3) := init_state_CBs[index_BB3];
+        next(mode_est_GB1) := case
+fault_event_open_CBs[index_GB1] : ko_open;
+fault_event_closed_CBs[index_GB1] : ko_closed;
+nominal_event_CBs[index_GB1] : ok;
+TRUE : mode_est_GB1;
+esac;
+
+        next(mode_est_GB2) := case
+fault_event_open_CBs[index_GB2] : ko_open;
+fault_event_closed_CBs[index_GB2] : ko_closed;
+nominal_event_CBs[index_GB2] : ok;
+TRUE : mode_est_GB2;
+esac;
+
+        next(mode_est_GB3) := case
+fault_event_open_CBs[index_GB3] : ko_open;
+fault_event_closed_CBs[index_GB3] : ko_closed;
+nominal_event_CBs[index_GB3] : ok;
+TRUE : mode_est_GB3;
+esac;
+
+        next(mode_est_BB1) := case
+fault_event_open_CBs[index_BB1] : ko_open;
+fault_event_closed_CBs[index_BB1] : ko_closed;
+nominal_event_CBs[index_BB1] : ok;
+TRUE : mode_est_BB1;
+esac;
+
+        next(mode_est_BB2) := case
+fault_event_open_CBs[index_BB2] : ko_open;
+fault_event_closed_CBs[index_BB2] : ko_closed;
+nominal_event_CBs[index_BB2] : ok;
+TRUE : mode_est_BB2;
+esac;
+
+        next(mode_est_BB3) := case
+fault_event_open_CBs[index_BB3] : ko_open;
+fault_event_closed_CBs[index_BB3] : ko_closed;
+nominal_event_CBs[index_BB3] : ok;
+TRUE : mode_est_BB3;
+esac;
+
+        next(mode_est_G1) := case
+fault_event_off_Gs[index_G1] : ko;
+nominal_event_Gs[index_G1] : ok;
+TRUE : mode_est_G1;
+esac;
+
+        next(mode_est_G2) := case
+fault_event_off_Gs[index_G2] : ko;
+nominal_event_Gs[index_G2] : ok;
+TRUE : mode_est_G2;
+esac;
+
+        next(mode_est_G3) := case
+fault_event_off_Gs[index_G3] : ko;
+nominal_event_Gs[index_G3] : ok;
+TRUE : mode_est_G3;
+esac;
+
+        next(state_est_G1) := case
+fault_event_off_Gs[index_G1] : off;
+(next(mode_est_G1) = ok & cmd_to_Gs[index_G1] = cmd_on) : on;
+(next(mode_est_G1) = ok & cmd_to_Gs[index_G1] = cmd_off) : off;
+TRUE : state_est_G1;
+esac;
+
+        next(state_est_G2) := case
+fault_event_off_Gs[index_G2] : off;
+(next(mode_est_G2) = ok & cmd_to_Gs[index_G2] = cmd_on) : on;
+(next(mode_est_G2) = ok & cmd_to_Gs[index_G2] = cmd_off) : off;
+TRUE : state_est_G2;
+esac;
+
+        next(state_est_G3) := case
+fault_event_off_Gs[index_G3] : off;
+(next(mode_est_G3) = ok & cmd_to_Gs[index_G3] = cmd_on) : on;
+(next(mode_est_G3) = ok & cmd_to_Gs[index_G3] = cmd_off) : off;
+TRUE : state_est_G3;
+esac;
+
+        next(state_est_GB1) := case
+fault_event_open_CBs[index_GB1] : open;
+fault_event_closed_CBs[index_GB1] : closed;
+(next(mode_est_GB1) = ok & cmd_to_CBs[index_GB1] = cmd_open) : open;
+(next(mode_est_GB1) = ok & cmd_to_CBs[index_GB1] = cmd_closed) : closed;
+TRUE : state_est_GB1;
+esac;
+
+        next(state_est_GB2) := case
+fault_event_open_CBs[index_GB2] : open;
+fault_event_closed_CBs[index_GB2] : closed;
+(next(mode_est_GB2) = ok & cmd_to_CBs[index_GB2] = cmd_open) : open;
+(next(mode_est_GB2) = ok & cmd_to_CBs[index_GB2] = cmd_closed) : closed;
+TRUE : state_est_GB2;
+esac;
+
+        next(state_est_GB3) := case
+fault_event_open_CBs[index_GB3] : open;
+fault_event_closed_CBs[index_GB3] : closed;
+(next(mode_est_GB3) = ok & cmd_to_CBs[index_GB3] = cmd_open) : open;
+(next(mode_est_GB3) = ok & cmd_to_CBs[index_GB3] = cmd_closed) : closed;
+TRUE : state_est_GB3;
+esac;
+
+        next(state_est_BB1) := case
+fault_event_open_CBs[index_BB1] : open;
+fault_event_closed_CBs[index_BB1] : closed;
+(next(mode_est_BB1) = ok & cmd_to_CBs[index_BB1] = cmd_open) : open;
+(next(mode_est_BB1) = ok & cmd_to_CBs[index_BB1] = cmd_closed) : closed;
+TRUE : state_est_BB1;
+esac;
+
+        next(state_est_BB2) := case
+fault_event_open_CBs[index_BB2] : open;
+fault_event_closed_CBs[index_BB2] : closed;
+(next(mode_est_BB2) = ok & cmd_to_CBs[index_BB2] = cmd_open) : open;
+(next(mode_est_BB2) = ok & cmd_to_CBs[index_BB2] = cmd_closed) : closed;
+TRUE : state_est_BB2;
+esac;
+
+        next(state_est_BB3) := case
+fault_event_open_CBs[index_BB3] : open;
+fault_event_closed_CBs[index_BB3] : closed;
+(next(mode_est_BB3) = ok & cmd_to_CBs[index_BB3] = cmd_open) : open;
+(next(mode_est_BB3) = ok & cmd_to_CBs[index_BB3] = cmd_closed) : closed;
+TRUE : state_est_BB3;
+esac;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE System_Configuration(cmd_to_Gs, cmd_to_CBs)
+    VAR
+        G1 : Generator_#Extended(cmd_to_Gs[index_G1], init_state_G1);
+        G2 : Generator_#Extended(cmd_to_Gs[index_G2], init_state_G2);
+        G3 : Generator_#Extended(cmd_to_Gs[index_G3], init_state_G3);
+        GB1 : Switch_#Extended(cmd_to_CBs[index_GB1], init_state_GB1);
+        GB2 : Switch_#Extended(cmd_to_CBs[index_GB2], init_state_GB2);
+        GB3 : Switch_#Extended(cmd_to_CBs[index_GB3], init_state_GB3);
+        BB1 : Switch_#Extended(cmd_to_CBs[index_BB1], init_state_BB1);
+        BB2 : Switch_#Extended(cmd_to_CBs[index_BB2], init_state_BB2);
+        BB3 : Switch_#Extended(cmd_to_CBs[index_BB3], init_state_BB3);
+        B1 : Bus(B1_poweredby_G1, B1_poweredby_G2, B1_poweredby_G3);
+        B2 : Bus(B2_poweredby_G1, B2_poweredby_G2, B2_poweredby_G3);
+        B3 : Bus(B3_poweredby_G1, B3_poweredby_G2, B3_poweredby_G3);
+    DEFINE
+        init_state_BB3 := open;
+        init_state_BB2 := closed;
+        init_state_BB1 := open;
+        init_state_GB3 := open;
+        init_state_GB2 := closed;
+        init_state_GB1 := closed;
+        init_state_G3 := off;
+        init_state_G2 := on;
+        init_state_G1 := on;
+        index_G3 := 2;
+        index_G2 := 1;
+        index_G1 := 0;
+        index_BB3 := 5;
+        index_BB2 := 4;
+        index_BB1 := 3;
+        index_GB3 := 2;
+        index_GB2 := 1;
+        index_GB1 := 0;
+        B1_poweredby_G3_R := (B2_poweredby_G3_R & BB1.is_closed);
+        B1_poweredby_G3_L := (B3_poweredby_G3_U & BB3.is_closed);
+        B1_poweredby_G2_R := (B2_poweredby_G2_U & BB1.is_closed);
+        B1_poweredby_G2_L := (B3_poweredby_G2_L & BB3.is_closed);
+        B1_poweredby_G1_U := (G1.is_on & GB1.is_closed);
+        B2_poweredby_G3_R := (B3_poweredby_G3_U & BB2.is_closed);
+        B2_poweredby_G3_L := (B1_poweredby_G3_L & BB1.is_closed);
+        B2_poweredby_G2_U := (G2.is_on & GB2.is_closed);
+        B2_poweredby_G1_R := (B3_poweredby_G1_R & BB2.is_closed);
+        B2_poweredby_G1_L := (B1_poweredby_G1_U & BB1.is_closed);
+        B3_poweredby_G3_U := (G3.is_on & GB3.is_closed);
+        B3_poweredby_G2_R := (B1_poweredby_G2_R & BB3.is_closed);
+        B3_poweredby_G2_L := (B2_poweredby_G2_U & BB2.is_closed);
+        B3_poweredby_G1_R := (B1_poweredby_G1_U & BB3.is_closed);
+        B3_poweredby_G1_L := (B2_poweredby_G1_L & BB2.is_closed);
+        B1_poweredby_G3 := (B1_poweredby_G3_R | B1_poweredby_G3_L);
+        B1_poweredby_G2 := (B1_poweredby_G2_R | B1_poweredby_G2_L);
+        B1_poweredby_G1 := B1_poweredby_G1_U;
+        B2_poweredby_G3 := (B2_poweredby_G3_R | B2_poweredby_G3_L);
+        B2_poweredby_G2 := B2_poweredby_G2_U;
+        B2_poweredby_G1 := (B2_poweredby_G1_R | B2_poweredby_G1_L);
+        B3_poweredby_G3 := B3_poweredby_G3_U;
+        B3_poweredby_G2 := (B3_poweredby_G2_R | B3_poweredby_G2_L);
+        B3_poweredby_G1 := (B3_poweredby_G1_R | B3_poweredby_G1_L);
+
+    DEFINE
+        init_state_CBs := [init_state_GB1, init_state_GB2, init_state_GB3, init_state_BB1, init_state_BB2, init_state_BB3];
+        init_state_Gs := [init_state_G1, init_state_G2, init_state_G3];
+        mode_event_CBs := [fault_event_open_CBs, fault_event_closed_CBs, nominal_event_CBs];
+        mode_event_Gs := [fault_event_off_Gs, nominal_event_Gs];
+        nominal_event_CBs := [GB1.nominal_event, GB2.nominal_event, GB3.nominal_event, BB1.nominal_event, BB2.nominal_event, BB3.nominal_event];
+        fault_event_closed_CBs := [GB1.fault_event_stuck_at_closed, GB2.fault_event_stuck_at_closed, GB3.fault_event_stuck_at_closed, BB1.fault_event_stuck_at_closed, BB2.fault_event_stuck_at_closed, BB3.fault_event_stuck_at_closed];
+        fault_event_open_CBs := [GB1.fault_event_stuck_at_open, GB2.fault_event_stuck_at_open, GB3.fault_event_stuck_at_open, BB1.fault_event_stuck_at_open, BB2.fault_event_stuck_at_open, BB3.fault_event_stuck_at_open];
+        nominal_event_Gs := [G1.nominal_event, G2.nominal_event, G3.nominal_event];
+        fault_event_off_Gs := [G1.fault_event_stuck_at_off, G2.fault_event_stuck_at_off, G3.fault_event_stuck_at_off];
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Generator_#Extended(cmd, init_state)
+    VAR
+        Gen_StuckOff : Gen_StuckOff_FM_Mod(state_#nominal, off, fault_event_stuck_at_off);
+    VAR
+        state_#nominal : {on, off};
+
+    IVAR
+        fault_event_stuck_at_off : boolean;
+        nominal_event : boolean;
+
+    DEFINE
+        is_on := state = on;
+        is_off := state = off;
+        state := Gen_StuckOff.state_#fault;
+
+    ASSIGN
+        init(state_#nominal) := init_state;
+        next(state_#nominal) := case
+cmd = cmd_on : on;
+cmd = cmd_off : off;
+TRUE : state;
+esac;
+
+    TRANS nominal_event = FALSE;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Gen_StuckOff_FM_Mod(state__#read, term_#1, fault_event_stuck_at_off#event)
+    VAR
+        stuckAt_Off : stuckAt_Off_fm_Mod(mode = NOMINAL, mode_is_stuckAt_Off, term_#1, state__#read, state__#write, event = stuckAt_Off#failure, event = _#NoEvent);
+    VAR
+        mode : {NOMINAL, stuckAt_Off#FAULT};
+        state__#write : {on, off};
+
+    IVAR
+        event : {_#NoEvent, stuckAt_Off#failure};
+
+    DEFINE
+        NoEvent := event = _#NoEvent;
+        cando_stuckAt_Off#FAULT := ((mode = NOMINAL & stuckAt_Off.trans_trig_guard_#0) | (mode = stuckAt_Off#FAULT & stuckAt_Off.trans_trig_guard_#1));
+        state_#fault := case
+mode = NOMINAL : state__#read;
+mode_is_stuckAt_Off : state__#write;
+TRUE : state__#read;
+esac;
+        mode_is_stuckAt_Off := mode = stuckAt_Off#FAULT;
+
+    INIT mode = NOMINAL;
+
+    TRANS (event in stuckAt_Off#failure <-> fault_event_stuck_at_off#event);
+
+    TRANS case
+((mode = stuckAt_Off#FAULT & stuckAt_Off.trans_trig_guard_#1) | (mode = NOMINAL & stuckAt_Off.trans_trig_guard_#0)) : next(mode) = stuckAt_Off#FAULT;
+TRUE : (next(mode) = mode & NoEvent);
+esac;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_Off_fm_Mod(is_nominal, is_fault, term, input, varout, _failure, ev_#NoEvent)
+    VAR
+        stuckAt_OffEM : stuckAt_Off_fm_EM_Mod(is_nominal, is_fault, term, input, varout);
+    DEFINE
+        failure := _failure;
+        NoEvent := ev_#NoEvent;
+        trans_trig_guard_#0 := failure;
+        trans_trig_guard_#1 := NoEvent;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_Off_fm_EM_Mod(is_nominal, is_fault, term, input, varout)
+    TRANS (!(!is_fault & next(is_fault)) | next(varout) = term);
+
+    TRANS (!(is_fault & next(is_fault)) | next(varout) = varout);
+
+    TRANS (!(is_nominal & next(is_nominal)) | next(varout) = varout);
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Switch_#Extended(cmd, init_state)
+    VAR
+        Switch_StuckClosed_StuckOpen : Switch_StuckClosed_StuckOpen_FM_Mod(state_#nominal, closed, open, fault_event_stuck_at_closed, nominal_event, fault_event_stuck_at_open);
+    VAR
+        state_#nominal : {open, closed};
+
+    IVAR
+        fault_event_stuck_at_closed : boolean;
+        fault_event_stuck_at_open : boolean;
+        nominal_event : boolean;
+
+    DEFINE
+        is_closed := state = closed;
+        is_open := state = open;
+        state := Switch_StuckClosed_StuckOpen.state_#fault;
+
+    ASSIGN
+        init(state_#nominal) := init_state;
+        next(state_#nominal) := case
+cmd = cmd_open : open;
+cmd = cmd_closed : closed;
+TRUE : state;
+esac;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Switch_StuckClosed_StuckOpen_FM_Mod(state__#read, term_#1, term_#2, fault_event_stuck_at_closed#event, nominal_event#event, fault_event_stuck_at_open#event)
+    VAR
+        stuckAt_Closed : stuckAt_Closed_fm_Mod(mode = NOMINAL, mode_is_stuckAt_Closed, term_#1, state__#read, state__#write, event = stuckAt_Closed#failure, event = stuckAt_Closed#self_fixed, event = _#NoEvent);
+        stuckAt_Open : stuckAt_Open_fm_Mod(mode = NOMINAL, mode_is_stuckAt_Open, term_#2, state__#read, state__#write, event = stuckAt_Open#failure, event = stuckAt_Open#self_fixed, event = _#NoEvent);
+    VAR
+        mode : {NOMINAL, stuckAt_Closed#FAULT, stuckAt_Open#FAULT};
+        state__#write : {open, closed};
+
+    IVAR
+        event : {_#NoEvent, stuckAt_Closed#failure, stuckAt_Closed#self_fixed, stuckAt_Open#failure, stuckAt_Open#self_fixed};
+
+    DEFINE
+        NoEvent := event = _#NoEvent;
+        cando_stuckAt_Open#FAULT := ((mode = NOMINAL & stuckAt_Open.trans_trig_guard_#0) | (mode = stuckAt_Open#FAULT & stuckAt_Open.trans_trig_guard_#1));
+        cando_stuckAt_Closed#FAULT := ((mode = NOMINAL & stuckAt_Closed.trans_trig_guard_#0) | (mode = stuckAt_Closed#FAULT & stuckAt_Closed.trans_trig_guard_#1));
+        state_#fault := case
+mode = NOMINAL : state__#read;
+(mode_is_stuckAt_Open | mode_is_stuckAt_Closed) : state__#write;
+TRUE : state__#read;
+esac;
+        mode_is_stuckAt_Closed := mode = stuckAt_Closed#FAULT;
+        mode_is_stuckAt_Open := mode = stuckAt_Open#FAULT;
+
+    INIT mode = NOMINAL;
+
+    TRANS (event in stuckAt_Closed#failure <-> fault_event_stuck_at_closed#event);
+
+    TRANS (event in stuckAt_Open#self_fixed union stuckAt_Closed#self_fixed <-> nominal_event#event);
+
+    TRANS (event in stuckAt_Open#failure <-> fault_event_stuck_at_open#event);
+
+    TRANS case
+(mode = stuckAt_Open#FAULT & stuckAt_Open.trans_trig_guard_#2) : next(mode) = NOMINAL;
+((mode = stuckAt_Open#FAULT & stuckAt_Open.trans_trig_guard_#1) | (mode = NOMINAL & stuckAt_Open.trans_trig_guard_#0)) : next(mode) = stuckAt_Open#FAULT;
+(mode = stuckAt_Closed#FAULT & stuckAt_Closed.trans_trig_guard_#2) : next(mode) = NOMINAL;
+((mode = stuckAt_Closed#FAULT & stuckAt_Closed.trans_trig_guard_#1) | (mode = NOMINAL & stuckAt_Closed.trans_trig_guard_#0)) : next(mode) = stuckAt_Closed#FAULT;
+TRUE : (next(mode) = mode & NoEvent);
+esac;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_Closed_fm_Mod(is_nominal, is_fault, term, input, varout, _failure, _self_fixed, ev_#NoEvent)
+    VAR
+        stuckAt_ClosedEM : stuckAt_Closed_fm_EM_Mod(is_nominal, is_fault, term, input, varout);
+    DEFINE
+        failure := _failure;
+        self_fixed := _self_fixed;
+        NoEvent := ev_#NoEvent;
+        trans_trig_guard_#0 := failure;
+        trans_trig_guard_#1 := (NoEvent & !self_fixed);
+        trans_trig_guard_#2 := self_fixed;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_Closed_fm_EM_Mod(is_nominal, is_fault, term, input, varout)
+    TRANS (!(!is_fault & next(is_fault)) | next(varout) = term);
+
+    TRANS (!(is_fault & next(is_fault)) | next(varout) = varout);
+
+    TRANS (!(is_nominal & next(is_nominal)) | next(varout) = varout);
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_Open_fm_Mod(is_nominal, is_fault, term, input, varout, _failure, _self_fixed, ev_#NoEvent)
+    VAR
+        stuckAt_OpenEM : stuckAt_Open_fm_EM_Mod(is_nominal, is_fault, term, input, varout);
+    DEFINE
+        failure := _failure;
+        self_fixed := _self_fixed;
+        NoEvent := ev_#NoEvent;
+        trans_trig_guard_#0 := failure;
+        trans_trig_guard_#1 := (NoEvent & !self_fixed);
+        trans_trig_guard_#2 := self_fixed;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_Open_fm_EM_Mod(is_nominal, is_fault, term, input, varout)
+    TRANS (!(!is_fault & next(is_fault)) | next(varout) = term);
+
+    TRANS (!(is_fault & next(is_fault)) | next(varout) = varout);
+
+    TRANS (!(is_nominal & next(is_nominal)) | next(varout) = varout);
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Bus(in1, in2, in3)
+    VAR
+        state : {working, broken};
+
+    DEFINE
+        is_broken := state = broken;
+        is_powered := (state = working & count(in1, in2, in3) = 1);
+
+    ASSIGN
+        init(state) := case
+count(in1, in2, in3) > 1 : broken;
+TRUE : working;
+esac;
+        next(state) := case
+next(count(in1, in2, in3) > 1) : broken;
+TRUE : state;
+esac;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE MasterCC#
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/simplified_model.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/simplified_model.smv
new file mode 100644
index 0000000000000000000000000000000000000000..8c0f80d460b229ce28242062db56f6c70f66cb49
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/simplified_model.smv
@@ -0,0 +1,397 @@
+
+
+MODULE main
+
+    IVAR
+        cmd_to_G1 : {cmd_on, cmd_off, nop};
+	cmd_to_G2 : {cmd_on, cmd_off, nop};
+	cmd_to_G3 : {cmd_on, cmd_off, nop};
+        cmd_to_GB1 : {cmd_closed, cmd_open, nop};
+	cmd_to_GB2 : {cmd_closed, cmd_open, nop};
+        cmd_to_GB3 : {cmd_closed, cmd_open, nop};
+        cmd_to_BB1 : {cmd_closed, cmd_open, nop};
+        cmd_to_BB2 : {cmd_closed, cmd_open, nop};
+        cmd_to_BB3 : {cmd_closed, cmd_open, nop};
+
+    VAR
+        v_cmd_to_G1 : {cmd_on, cmd_off, nop};
+	v_cmd_to_G2 : {cmd_on, cmd_off, nop};
+	v_cmd_to_G3 : {cmd_on, cmd_off, nop};
+	v_cmd_to_GB1 : {cmd_closed, cmd_open, nop};
+	v_cmd_to_GB2 : {cmd_closed, cmd_open, nop};
+	v_cmd_to_GB3 : {cmd_closed, cmd_open, nop};
+	v_cmd_to_BB1 : {cmd_closed, cmd_open, nop};
+	v_cmd_to_BB2 : {cmd_closed, cmd_open, nop};
+	v_cmd_to_BB3 : {cmd_closed, cmd_open, nop};
+
+    ASSIGN
+      init(v_cmd_to_G1) := nop;
+      next(v_cmd_to_G1) := cmd_to_G1;
+      init(v_cmd_to_G2) := nop;
+      next(v_cmd_to_G2) := cmd_to_G2;
+      init(v_cmd_to_G3) := nop;
+      next(v_cmd_to_G3) := cmd_to_G3;
+      init(v_cmd_to_GB1) := nop;
+      next(v_cmd_to_GB1) := cmd_to_GB1;
+      init(v_cmd_to_GB2) := nop;
+      next(v_cmd_to_GB2) := cmd_to_GB2;
+      init(v_cmd_to_GB3) := nop;
+      next(v_cmd_to_GB3) := cmd_to_GB3;
+      init(v_cmd_to_BB1) := nop;
+      next(v_cmd_to_BB1) := cmd_to_BB1;
+      init(v_cmd_to_BB2) := nop;
+      next(v_cmd_to_BB2) := cmd_to_BB2;
+      init(v_cmd_to_BB3) := nop;
+      next(v_cmd_to_BB3) := cmd_to_BB3;
+
+    VAR
+        SC : System_Configuration(cmd_to_G1, cmd_to_G2, cmd_to_G3, 
+				  cmd_to_GB1, cmd_to_GB2, cmd_to_GB3, cmd_to_BB1, cmd_to_BB2, cmd_to_BB3);
+        _masterCC : MasterCC#;
+
+    -- Requirements
+
+    -- R1. No bus will be connected to more than 1 power source at any time
+    INVAR (SC.B1_poweredby_G1 -> !(SC.B1_poweredby_G2 | SC.B1_poweredby_G3));
+    INVAR (SC.B1_poweredby_G2 -> !(SC.B1_poweredby_G1 | SC.B1_poweredby_G3));
+    INVAR (SC.B1_poweredby_G3 -> !(SC.B1_poweredby_G1 | SC.B1_poweredby_G2));
+
+    INVAR (SC.B2_poweredby_G1 -> !(SC.B2_poweredby_G2 | SC.B2_poweredby_G3));
+    INVAR (SC.B2_poweredby_G2 -> !(SC.B2_poweredby_G1 | SC.B2_poweredby_G3));
+    INVAR (SC.B2_poweredby_G3 -> !(SC.B2_poweredby_G1 | SC.B2_poweredby_G2));
+
+    INVAR (SC.B3_poweredby_G1 -> !(SC.B3_poweredby_G2 | SC.B3_poweredby_G3));
+    INVAR (SC.B3_poweredby_G2 -> !(SC.B3_poweredby_G1 | SC.B3_poweredby_G3));
+    INVAR (SC.B3_poweredby_G3 -> !(SC.B3_poweredby_G1 | SC.B3_poweredby_G2));
+
+    -- R4. If no power source is on, then all buses will be unpowered
+    INVARSPEC ((SC.G1.is_off & SC.G2.is_off & SC.G3.is_off) -> (!SC.B1.is_powered & !SC.B2.is_powered & !SC.B3.is_powered));
+
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE System_Configuration(cmd_to_G1, cmd_to_G2, cmd_to_G3,
+			    cmd_to_GB1, cmd_to_GB2, cmd_to_GB3, cmd_to_BB1, cmd_to_BB2, cmd_to_BB3)
+    VAR
+        G1 : Generator_#Extended(cmd_to_G1, init_state_G1);
+        G2 : Generator_#Extended(cmd_to_G2, init_state_G2);
+        G3 : Generator_#Extended(cmd_to_G3, init_state_G3);
+        GB1 : Switch_#Extended(cmd_to_GB1, init_state_GB1);
+        GB2 : Switch_#Extended(cmd_to_GB2, init_state_GB2);
+        GB3 : Switch_#Extended(cmd_to_GB3, init_state_GB3);
+        BB1 : Switch_#Extended(cmd_to_BB1, init_state_BB1);
+        BB2 : Switch_#Extended(cmd_to_BB2, init_state_BB2);
+        BB3 : Switch_#Extended(cmd_to_BB3, init_state_BB3);
+        B1 : Bus(B1_poweredby_G1, B1_poweredby_G2, B1_poweredby_G3);
+        B2 : Bus(B2_poweredby_G1, B2_poweredby_G2, B2_poweredby_G3);
+        B3 : Bus(B3_poweredby_G1, B3_poweredby_G2, B3_poweredby_G3);
+    DEFINE
+        init_state_BB3 := open;
+        init_state_BB2 := closed;
+        init_state_BB1 := open;
+        init_state_GB3 := open;
+        init_state_GB2 := closed;
+        init_state_GB1 := closed;
+        init_state_G3 := off;
+        init_state_G2 := on;
+        init_state_G1 := on;
+        B1_poweredby_G3_R := (B2_poweredby_G3_R & BB1.is_closed);
+        B1_poweredby_G3_L := (B3_poweredby_G3_U & BB3.is_closed);
+        B1_poweredby_G2_R := (B2_poweredby_G2_U & BB1.is_closed);
+        B1_poweredby_G2_L := (B3_poweredby_G2_L & BB3.is_closed);
+        B1_poweredby_G1_U := (G1.is_on & GB1.is_closed);
+        B2_poweredby_G3_R := (B3_poweredby_G3_U & BB2.is_closed);
+        B2_poweredby_G3_L := (B1_poweredby_G3_L & BB1.is_closed);
+        B2_poweredby_G2_U := (G2.is_on & GB2.is_closed);
+        B2_poweredby_G1_R := (B3_poweredby_G1_R & BB2.is_closed);
+        B2_poweredby_G1_L := (B1_poweredby_G1_U & BB1.is_closed);
+        B3_poweredby_G3_U := (G3.is_on & GB3.is_closed);
+        B3_poweredby_G2_R := (B1_poweredby_G2_R & BB3.is_closed);
+        B3_poweredby_G2_L := (B2_poweredby_G2_U & BB2.is_closed);
+        B3_poweredby_G1_R := (B1_poweredby_G1_U & BB3.is_closed);
+        B3_poweredby_G1_L := (B2_poweredby_G1_L & BB2.is_closed);
+        B1_poweredby_G3 := (B1_poweredby_G3_R | B1_poweredby_G3_L);
+        B1_poweredby_G2 := (B1_poweredby_G2_R | B1_poweredby_G2_L);
+        B1_poweredby_G1 := B1_poweredby_G1_U;
+        B2_poweredby_G3 := (B2_poweredby_G3_R | B2_poweredby_G3_L);
+        B2_poweredby_G2 := B2_poweredby_G2_U;
+        B2_poweredby_G1 := (B2_poweredby_G1_R | B2_poweredby_G1_L);
+        B3_poweredby_G3 := B3_poweredby_G3_U;
+        B3_poweredby_G2 := (B3_poweredby_G2_R | B3_poweredby_G2_L);
+        B3_poweredby_G1 := (B3_poweredby_G1_R | B3_poweredby_G1_L);
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Generator_#Extended(cmd, init_state)
+    VAR
+        Gen_StuckOff : Gen_StuckOff_FM_Mod(state_#nominal, off, fault_event_stuck_at_off);
+    VAR
+        state_#nominal : {on, off};
+
+    IVAR
+        fault_event_stuck_at_off : boolean;
+        nominal_event : boolean;
+
+    DEFINE
+        is_on := state = on;
+        is_off := state = off;
+        state := Gen_StuckOff.state_#fault;
+
+    -- Synthesis does not accept DEFINEs as observables
+    VAR v_state : {on, off};
+    ASSIGN v_state := state;
+
+    ASSIGN
+        init(state_#nominal) := init_state;
+        next(state_#nominal) := case
+cmd = cmd_on : on;
+cmd = cmd_off : off;
+TRUE : state;
+esac;
+
+    TRANS nominal_event = FALSE;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Gen_StuckOff_FM_Mod(state__#read, term_#1, fault_event_stuck_at_off#event)
+    VAR
+        stuckAt_Off : stuckAt_Off_fm_Mod(mode = NOMINAL, mode_is_stuckAt_Off, term_#1, state__#read, state__#write, event = stuckAt_Off#failure, event = _#NoEvent);
+    VAR
+        mode : {NOMINAL, stuckAt_Off#FAULT};
+        state__#write : {on, off};
+
+    IVAR
+        event : {_#NoEvent, stuckAt_Off#failure};
+
+    DEFINE
+        NoEvent := event = _#NoEvent;
+        cando_stuckAt_Off#FAULT := ((mode = NOMINAL & stuckAt_Off.trans_trig_guard_#0) | (mode = stuckAt_Off#FAULT & stuckAt_Off.trans_trig_guard_#1));
+        state_#fault := case
+mode = NOMINAL : state__#read;
+mode_is_stuckAt_Off : state__#write;
+TRUE : state__#read;
+esac;
+        mode_is_stuckAt_Off := mode = stuckAt_Off#FAULT;
+
+    INIT mode = NOMINAL;
+
+    TRANS (event in stuckAt_Off#failure <-> fault_event_stuck_at_off#event);
+
+    TRANS case
+((mode = stuckAt_Off#FAULT & stuckAt_Off.trans_trig_guard_#1) | (mode = NOMINAL & stuckAt_Off.trans_trig_guard_#0)) : next(mode) = stuckAt_Off#FAULT;
+TRUE : (next(mode) = mode & NoEvent);
+esac;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_Off_fm_Mod(is_nominal, is_fault, term, input, varout, _failure, ev_#NoEvent)
+    VAR
+        stuckAt_OffEM : stuckAt_Off_fm_EM_Mod(is_nominal, is_fault, term, input, varout);
+    DEFINE
+        failure := _failure;
+        NoEvent := ev_#NoEvent;
+        trans_trig_guard_#0 := failure;
+        trans_trig_guard_#1 := NoEvent;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_Off_fm_EM_Mod(is_nominal, is_fault, term, input, varout)
+    TRANS (!(!is_fault & next(is_fault)) | next(varout) = term);
+
+    TRANS (!(is_fault & next(is_fault)) | next(varout) = varout);
+
+    TRANS (!(is_nominal & next(is_nominal)) | next(varout) = varout);
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Switch_#Extended(cmd, init_state)
+    VAR
+        Switch_StuckClosed_StuckOpen : Switch_StuckClosed_StuckOpen_FM_Mod(state_#nominal, closed, open, fault_event_stuck_at_closed, nominal_event, fault_event_stuck_at_open);
+    VAR
+        state_#nominal : {open, closed};
+
+    IVAR
+        fault_event_stuck_at_closed : boolean;
+        fault_event_stuck_at_open : boolean;
+        nominal_event : boolean;
+
+    DEFINE
+        is_closed := state = closed;
+        is_open := state = open;
+        state := Switch_StuckClosed_StuckOpen.state_#fault;
+
+    VAR v_state : {open, closed};
+    ASSIGN v_state := state;
+
+    ASSIGN
+        init(state_#nominal) := init_state;
+        next(state_#nominal) := case
+cmd = cmd_open : open;
+cmd = cmd_closed : closed;
+TRUE : state;
+esac;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Switch_StuckClosed_StuckOpen_FM_Mod(state__#read, term_#1, term_#2, fault_event_stuck_at_closed#event, nominal_event#event, fault_event_stuck_at_open#event)
+    VAR
+        stuckAt_Closed : stuckAt_Closed_fm_Mod(mode = NOMINAL, mode_is_stuckAt_Closed, term_#1, state__#read, state__#write, event = stuckAt_Closed#failure, event = stuckAt_Closed#self_fixed, event = _#NoEvent);
+        stuckAt_Open : stuckAt_Open_fm_Mod(mode = NOMINAL, mode_is_stuckAt_Open, term_#2, state__#read, state__#write, event = stuckAt_Open#failure, event = stuckAt_Open#self_fixed, event = _#NoEvent);
+    VAR
+        mode : {NOMINAL, stuckAt_Closed#FAULT, stuckAt_Open#FAULT};
+        state__#write : {open, closed};
+
+    IVAR
+        event : {_#NoEvent, stuckAt_Closed#failure, stuckAt_Closed#self_fixed, stuckAt_Open#failure, stuckAt_Open#self_fixed};
+
+    DEFINE
+        NoEvent := event = _#NoEvent;
+        cando_stuckAt_Closed#FAULT := ((mode = NOMINAL & stuckAt_Closed.trans_trig_guard_#0) | (mode = stuckAt_Closed#FAULT & stuckAt_Closed.trans_trig_guard_#1));
+        cando_stuckAt_Open#FAULT := ((mode = NOMINAL & stuckAt_Open.trans_trig_guard_#0) | (mode = stuckAt_Open#FAULT & stuckAt_Open.trans_trig_guard_#1));
+        state_#fault := case
+mode = NOMINAL : state__#read;
+(mode_is_stuckAt_Open | mode_is_stuckAt_Closed) : state__#write;
+TRUE : state__#read;
+esac;
+        mode_is_stuckAt_Closed := mode = stuckAt_Closed#FAULT;
+        mode_is_stuckAt_Open := mode = stuckAt_Open#FAULT;
+
+    INIT mode = NOMINAL;
+
+    TRANS (event in stuckAt_Closed#failure <-> fault_event_stuck_at_closed#event);
+
+    TRANS (event in stuckAt_Open#self_fixed union stuckAt_Closed#self_fixed <-> nominal_event#event);
+
+    TRANS (event in stuckAt_Open#failure <-> fault_event_stuck_at_open#event);
+
+    TRANS case
+(mode = stuckAt_Open#FAULT & stuckAt_Open.trans_trig_guard_#2) : next(mode) = NOMINAL;
+((mode = stuckAt_Open#FAULT & stuckAt_Open.trans_trig_guard_#1) | (mode = NOMINAL & stuckAt_Open.trans_trig_guard_#0)) : next(mode) = stuckAt_Open#FAULT;
+(mode = stuckAt_Closed#FAULT & stuckAt_Closed.trans_trig_guard_#2) : next(mode) = NOMINAL;
+((mode = stuckAt_Closed#FAULT & stuckAt_Closed.trans_trig_guard_#1) | (mode = NOMINAL & stuckAt_Closed.trans_trig_guard_#0)) : next(mode) = stuckAt_Closed#FAULT;
+TRUE : (next(mode) = mode & NoEvent);
+esac;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_Closed_fm_Mod(is_nominal, is_fault, term, input, varout, _failure, _self_fixed, ev_#NoEvent)
+    VAR
+        stuckAt_ClosedEM : stuckAt_Closed_fm_EM_Mod(is_nominal, is_fault, term, input, varout);
+    DEFINE
+        failure := _failure;
+        self_fixed := _self_fixed;
+        NoEvent := ev_#NoEvent;
+        trans_trig_guard_#0 := failure;
+        trans_trig_guard_#1 := (NoEvent & !self_fixed);
+        trans_trig_guard_#2 := self_fixed;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_Closed_fm_EM_Mod(is_nominal, is_fault, term, input, varout)
+    TRANS (!(!is_fault & next(is_fault)) | next(varout) = term);
+
+    TRANS (!(is_fault & next(is_fault)) | next(varout) = varout);
+
+    TRANS (!(is_nominal & next(is_nominal)) | next(varout) = varout);
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_Open_fm_Mod(is_nominal, is_fault, term, input, varout, _failure, _self_fixed, ev_#NoEvent)
+    VAR
+        stuckAt_OpenEM : stuckAt_Open_fm_EM_Mod(is_nominal, is_fault, term, input, varout);
+    DEFINE
+        failure := _failure;
+        self_fixed := _self_fixed;
+        NoEvent := ev_#NoEvent;
+        trans_trig_guard_#0 := failure;
+        trans_trig_guard_#1 := (NoEvent & !self_fixed);
+        trans_trig_guard_#2 := self_fixed;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_Open_fm_EM_Mod(is_nominal, is_fault, term, input, varout)
+    TRANS (!(!is_fault & next(is_fault)) | next(varout) = term);
+
+    TRANS (!(is_fault & next(is_fault)) | next(varout) = varout);
+
+    TRANS (!(is_nominal & next(is_nominal)) | next(varout) = varout);
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Bus(in1, in2, in3)
+    VAR
+        state : {working, broken};
+
+    DEFINE
+        is_broken := state = broken;
+        is_powered := (state = working & count(in1, in2, in3) = 1);
+
+    ASSIGN
+        init(state) := case
+count(in1, in2, in3) > 1 : broken;
+TRUE : working;
+esac;
+        next(state) := case
+next(count(in1, in2, in3) > 1) : broken;
+TRUE : state;
+esac;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE MasterCC#
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB1.asl b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB1.asl
new file mode 100644
index 0000000000000000000000000000000000000000..7a25e5d59a47aa229a3caf994fbc6b003543eb52
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB1.asl
@@ -0,0 +1,3 @@
+NAME: FAULT
+CONDITION: (CN.cmd_to_BB1 = cmd_open & (SC.BB1.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT & SC.BB1.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_BB1 = cmd_closed & (SC.BB1.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.BB1.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure))
+TYPE: finite
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB1.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB1.obs
new file mode 100644
index 0000000000000000000000000000000000000000..c8ecc47899f33744543ddbc5a7ae166b4335e8a5
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB1.obs
@@ -0,0 +1,2 @@
+CN.cmd_to_BB2
+SC.BB2.state
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB2.asl b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB2.asl
new file mode 100644
index 0000000000000000000000000000000000000000..d5f31f0eebad73bfd20613fba68ea85e3af57e7d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB2.asl
@@ -0,0 +1,3 @@
+NAME: FAULT
+CONDITION: (CN.cmd_to_BB2 = cmd_open & (SC.BB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.BB2.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_BB2 = cmd_closed & (SC.BB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.BB2.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure))
+TYPE: finite
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB2.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB2.obs
new file mode 100644
index 0000000000000000000000000000000000000000..c8ecc47899f33744543ddbc5a7ae166b4335e8a5
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB2.obs
@@ -0,0 +1,2 @@
+CN.cmd_to_BB2
+SC.BB2.state
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB3.asl b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB3.asl
new file mode 100644
index 0000000000000000000000000000000000000000..e7d496bdf442e0a269c78c81ebb12d3ade198f7b
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB3.asl
@@ -0,0 +1,3 @@
+NAME: FAULT
+CONDITION: (CN.cmd_to_BB3 = cmd_open & (SC.BB3.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.BB3.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_BB3 = cmd_closed & (SC.BB3.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.BB3.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure))
+TYPE: finite
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB3.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB3.obs
new file mode 100644
index 0000000000000000000000000000000000000000..0a64212ec0834319f6059d7c8a322fbba1ed3573
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/BB3.obs
@@ -0,0 +1,2 @@
+CN.cmd_to_BB3
+SC.BB3.state
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G1.asl b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G1.asl
new file mode 100644
index 0000000000000000000000000000000000000000..5da9cafd87c5be2543210e60242ee5e7f2745352
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G1.asl
@@ -0,0 +1,4 @@
+NAME: FAULT
+CONDITION: SC.G1.Gen_StuckOff.mode != NOMINAL
+TYPE: finite
+CONTEXT: G F (CN.cmd_to_G1 = cmd_on)
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G1.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G1.obs
new file mode 100644
index 0000000000000000000000000000000000000000..b3c43312ef532fb0819ccc5808aea8ef7d493064
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G1.obs
@@ -0,0 +1,2 @@
+CN.cmd_to_G1
+SC.G1.state
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G2.asl b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G2.asl
new file mode 100644
index 0000000000000000000000000000000000000000..6378aeaf7fe13446ed99fc345a08850c30a45a94
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G2.asl
@@ -0,0 +1,3 @@
+NAME: FAULT
+CONDITION: CN.cmd_to_G2 = cmd_on & (SC.G2.Gen_StuckOff.mode != NOMINAL | SC.G2.Gen_StuckOff.event = stuckAt_Off#failure)
+TYPE: finite
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G2.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G2.obs
new file mode 100644
index 0000000000000000000000000000000000000000..2e372e011c189a088bc556c104c8b4c6884feaa6
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G2.obs
@@ -0,0 +1,2 @@
+CN.cmd_to_G2
+SC.G2.state
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G3.asl b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G3.asl
new file mode 100644
index 0000000000000000000000000000000000000000..a54b02be9f137b6866d2afbc4ff59a383c3f25ee
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G3.asl
@@ -0,0 +1,3 @@
+NAME: FAULT
+CONDITION: CN.cmd_to_G3 = cmd_on & (SC.G3.Gen_StuckOff.mode != NOMINAL | SC.G3.Gen_StuckOff.event = stuckAt_Off#failure)
+TYPE: finite
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G3.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G3.obs
new file mode 100644
index 0000000000000000000000000000000000000000..afce39b4f22c2c95605ada7dbbf7cab695196960
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/G3.obs
@@ -0,0 +1,2 @@
+CN.cmd_to_G3
+SC.G3.state
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB1.asl b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB1.asl
new file mode 100644
index 0000000000000000000000000000000000000000..1cb212a5d0fa74334c2265f4aefb3db78a52bd91
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB1.asl
@@ -0,0 +1,3 @@
+NAME: FAULT
+CONDITION:  (CN.cmd_to_GB1 = cmd_open & (SC.GB1.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.GB1.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_GB1 = cmd_closed & (SC.GB1.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.GB1.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure))
+TYPE: finite
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB1.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB1.obs
new file mode 100644
index 0000000000000000000000000000000000000000..f60f89baecf30dc41a35a9ae042d709528227277
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB1.obs
@@ -0,0 +1,2 @@
+CN.cmd_to_GB1
+SC.GB1.state
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB2.asl b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB2.asl
new file mode 100644
index 0000000000000000000000000000000000000000..b1001aaf8e82ed78dd9f1ea05fcb6c6887190881
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB2.asl
@@ -0,0 +1,3 @@
+NAME: FAULT
+CONDITION:  (CN.cmd_to_GB2 = cmd_open & (SC.GB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.GB2.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_GB2 = cmd_closed & (SC.GB2.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.GB2.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure))
+TYPE: finite
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB2.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB2.obs
new file mode 100644
index 0000000000000000000000000000000000000000..818bc0bd231e4b462d0c0e917f3a876f454bfcec
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB2.obs
@@ -0,0 +1,2 @@
+CN.cmd_to_GB2
+SC.GB2.state
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB3.asl b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB3.asl
new file mode 100644
index 0000000000000000000000000000000000000000..d4c8a2a940c6b221cdccb67100234ff109f62bb3
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB3.asl
@@ -0,0 +1,3 @@
+NAME: FAULT
+CONDITION:  (CN.cmd_to_GB3 = cmd_open & (SC.GB3.Switch_StuckClosed_StuckOpen.mode = stuckAt_Closed#FAULT | SC.GB3.Switch_StuckClosed_StuckOpen.event = stuckAt_Closed#failure)) | (CN.cmd_to_GB3 = cmd_closed & (SC.GB3.Switch_StuckClosed_StuckOpen.mode = stuckAt_Open#FAULT | SC.GB3.Switch_StuckClosed_StuckOpen.event = stuckAt_Open#failure))
+TYPE: finite
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB3.obs b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB3.obs
new file mode 100644
index 0000000000000000000000000000000000000000..1c60748c6d9c84e185d6ce14bd643335d61f02ad
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/GB3.obs
@@ -0,0 +1,2 @@
+CN.cmd_to_GB3
+SC.GB3.state
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_BB1.source b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_BB1.source
new file mode 100644
index 0000000000000000000000000000000000000000..1350161abc90193325e4d9f230bcdc2b32bdbdba
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_BB1.source
@@ -0,0 +1,6 @@
+set on_failure_script_quits
+set synth_asynchronous_composition_semantics 0
+go
+synth_FD -o ../diag/BB1_observables.obs -a BB1.asl
+synth_dump_fdir -o BB1_synthesized_model.smv -c
+quit
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_BB2.source b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_BB2.source
new file mode 100644
index 0000000000000000000000000000000000000000..7000e7658bea841db9069fe279dd679a9bd26520
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_BB2.source
@@ -0,0 +1,6 @@
+set on_failure_script_quits
+set synth_asynchronous_composition_semantics 0
+go
+synth_FD -o ../diag/BB2_observables.obs -a BB2.asl
+synth_dump_fdir -o BB2_synthesized_model.smv -c
+quit
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_BB3.source b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_BB3.source
new file mode 100644
index 0000000000000000000000000000000000000000..727c14ce8c8a43dd738dcb4d118b6e840833feba
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_BB3.source
@@ -0,0 +1,6 @@
+set on_failure_script_quits
+set synth_asynchronous_composition_semantics 0
+go
+synth_FD -o ../diag/BB3_observables.obs -a BB3.asl
+synth_dump_fdir -o BB3_synthesized_model.smv -c
+quit
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_G1.source b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_G1.source
new file mode 100644
index 0000000000000000000000000000000000000000..4ea88bf3f6f1109f3ba0248864c6cea9823c9a36
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_G1.source
@@ -0,0 +1,7 @@
+set on_failure_script_quits
+set synth_asynchronous_composition_semantics 0
+set synth_enable_fairness 1
+go
+synth_FD -o ../diag/G1_observables.obs -a G1.asl
+synth_dump_fdir -o G1_synthesized_model.smv -c
+quit
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_G2.source b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_G2.source
new file mode 100644
index 0000000000000000000000000000000000000000..ee9d68c93d8b45d7fdfc1caff11bab858c010822
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_G2.source
@@ -0,0 +1,6 @@
+set on_failure_script_quits
+set synth_asynchronous_composition_semantics 0
+go
+synth_FD -o ../diag/G2_observables.obs -a G2.asl
+synth_dump_fdir -o G2_synthesized_model.smv -c
+quit
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_G3.source b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_G3.source
new file mode 100644
index 0000000000000000000000000000000000000000..5ffa704102937478906eceb0d07f7d72a5456cf5
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_G3.source
@@ -0,0 +1,6 @@
+set on_failure_script_quits
+set synth_asynchronous_composition_semantics 0
+go
+synth_FD -o ../diag/G3_observables.obs -a G3.asl
+synth_dump_fdir -o G3_synthesized_model.smv -c
+quit
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_GB1.source b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_GB1.source
new file mode 100644
index 0000000000000000000000000000000000000000..30eb463a0523de7be9c9fcff636f19a795d90c28
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_GB1.source
@@ -0,0 +1,6 @@
+set on_failure_script_quits
+set synth_asynchronous_composition_semantics 0
+go
+synth_FD -o ../diag/GB1_observables.obs -a GB1.asl
+synth_dump_fdir -o GB1_synthesized_model.smv -c
+quit
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_GB2.source b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_GB2.source
new file mode 100644
index 0000000000000000000000000000000000000000..15387f0f0d131edf0006d272fb05b98b6cc75df5
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_GB2.source
@@ -0,0 +1,6 @@
+set on_failure_script_quits
+set synth_asynchronous_composition_semantics 0
+go
+synth_FD -o ../diag/GB2_observables.obs -a GB2.asl
+synth_dump_fdir -o GB2_synthesized_model.smv -c
+quit
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_GB3.source b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_GB3.source
new file mode 100644
index 0000000000000000000000000000000000000000..eae673b55e31d6f5d62e9652ef838d44d77982a0
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/FDI/synth/synthesize_GB3.source
@@ -0,0 +1,6 @@
+set on_failure_script_quits
+set synth_asynchronous_composition_semantics 0
+go
+synth_FD -o ../diag/GB3_observables.obs -a GB3.asl
+synth_dump_fdir -o GB3_synthesized_model.smv -c
+quit
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/dynamic/generator.fei b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/dynamic/generator.fei
new file mode 100644
index 0000000000000000000000000000000000000000..9dbb327fcd09404104893ae0a864c66315a77d70
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/dynamic/generator.fei
@@ -0,0 +1,12 @@
+FAULT EXTENSION FE_GENERATOR
+  EXTENSION OF MODULE generator
+     /-- Description of Fault Slice gen_faults --/
+     SLICE gen_faults AFFECTS voltage WITH
+       /-- Description of fault mode voltage_low --/
+       MODE voltage_low : Permanent Conditional_D(
+                  data condition << active,
+                  data then_term << low,
+    		  data else_term << voltage,
+                  data input << voltage,
+                  data varout >> voltage,
+                  event failure);
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/dynamic/generator.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/dynamic/generator.smv
new file mode 100644
index 0000000000000000000000000000000000000000..b91463d51a72d062d4609d4f252cca5dcdddfb76
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/dynamic/generator.smv
@@ -0,0 +1,89 @@
+----------------------
+-- MODULE generator --
+----------------------
+
+MODULE generator(cmd)
+
+VAR
+  active: boolean;
+  voltage: {high, low};
+
+ASSIGN
+  init(active):= cmd = on;
+  next(active):= case
+                   cmd = on: TRUE;
+                   cmd = off: FALSE;
+                   TRUE: active;
+                 esac;
+
+  voltage := high;
+
+
+-------------------
+-- MODULE device --
+-------------------
+
+MODULE device(voltage)
+
+-- device is not alive if voltage goes to low for at least 2 time steps
+
+VAR counter: 0..2;
+
+ASSIGN
+  init(counter):= case
+                  voltage = high: 0;
+                  TRUE: 1;
+                esac;
+  next(counter):= case
+                  voltage = high: 0;
+                  voltage = low & counter < 2: counter+1;
+                  TRUE: 2;
+                esac;
+
+DEFINE
+  alive:= (counter < 2);
+
+
+-----------------
+-- MODULE main --
+-----------------
+
+MODULE main
+
+VAR
+  mode: {primary_mode, spare_mode};
+  primary: generator(cmd_primary);
+  spare:   generator(cmd_spare);
+  cmd_primary: {on, off, nop};
+  cmd_spare: {on, off, nop};
+  voltage: {high, low};
+  dev:     device(voltage);
+
+ASSIGN
+  -- initially in primary mode
+  -- goes to spare mode and stays there, if primary voltage is low
+
+  init(mode) := primary_mode;
+  next(mode) := case
+                  mode = primary_mode & primary.voltage = high: primary_mode;
+                  TRUE: spare_mode;
+                 esac;
+
+  voltage:= case
+              mode = primary_mode: primary.voltage;
+              TRUE: spare.voltage;
+            esac;
+
+  init(cmd_primary):= on;
+  next(cmd_primary):= case
+                        mode = primary_mode & primary.voltage = low: off;
+                        TRUE: nop;
+                      esac;
+
+  init(cmd_spare):= off;
+  next(cmd_spare):= case
+                        mode = primary_mode & primary.voltage = low: on;
+                        TRUE: nop;
+                      esac;
+
+INVARSPEC NAME alive:=  dev.alive;
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/dynamic/generator_real.fei b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/dynamic/generator_real.fei
new file mode 100644
index 0000000000000000000000000000000000000000..ccecbe1044da42c5221c14e55488ebef32b512ed
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/dynamic/generator_real.fei
@@ -0,0 +1,12 @@
+FAULT EXTENSION FE_GENERATOR
+  EXTENSION OF MODULE generator
+     /-- Description of Fault Slice gen_faults --/
+     SLICE gen_faults AFFECTS voltage WITH
+       /-- Description of fault mode voltage_low --/
+       MODE voltage_low : Permanent Conditional_D(
+                  data condition << active,
+                  data then_term << 5,
+    		  data else_term << voltage,
+                  data input << voltage,
+                  data varout >> voltage,
+                  event failure);
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/dynamic/generator_real.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/dynamic/generator_real.smv
new file mode 100644
index 0000000000000000000000000000000000000000..8e07c0070fcbcb4e64bfe58165c741a495c0816b
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/dynamic/generator_real.smv
@@ -0,0 +1,89 @@
+----------------------
+-- MODULE generator --
+----------------------
+
+MODULE generator(cmd)
+
+VAR
+  active: boolean;
+  voltage: real;
+
+ASSIGN
+  init(active):= cmd = on;
+  next(active):= case
+                   cmd = on: TRUE;
+                   cmd = off: FALSE;
+                   TRUE: active;
+                 esac;
+
+  voltage := 12;
+
+
+-------------------
+-- MODULE device --
+-------------------
+
+MODULE device(voltage)
+
+-- device is not alive if voltage is low (below 6) for at least 2 time steps
+
+VAR counter: 0..2;
+
+ASSIGN
+  init(counter):= case
+                  voltage >= 6: 0;
+                  TRUE: 1;
+                esac;
+  next(counter):= case
+                  voltage >= 6: 0;
+                  voltage < 6 & counter < 2: counter+1;
+                  TRUE: 2;
+                esac;
+
+DEFINE
+  alive:= (counter < 2);
+
+
+-----------------
+-- MODULE main --
+-----------------
+
+MODULE main
+
+VAR
+  mode: {primary_mode, spare_mode};
+  primary: generator(cmd_primary);
+  spare:   generator(cmd_spare);
+  cmd_primary: {on, off, nop};
+  cmd_spare: {on, off, nop};
+  voltage: real;
+  dev:     device(voltage);
+
+ASSIGN
+  -- initially in primary mode
+  -- goes to spare mode and stays there, if primary voltage is low ( below 6)
+
+  init(mode) := primary_mode;
+  next(mode) := case
+                  mode = primary_mode & primary.voltage >= 6: primary_mode;
+                  TRUE: spare_mode;
+                 esac;
+
+  voltage:= case
+              mode = primary_mode: primary.voltage;
+              TRUE: spare.voltage;
+            esac;
+
+  init(cmd_primary):= on;
+  next(cmd_primary):= case
+                        mode = primary_mode & primary.voltage < 6: off;
+                        TRUE: nop;
+                      esac;
+
+  init(cmd_spare):= off;
+  next(cmd_spare):= case
+                        mode = primary_mode & primary.voltage < 6: on;
+                        TRUE: nop;
+                      esac;
+
+INVARSPEC NAME alive:=  dev.alive;
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/power_distribution/pdist.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/power_distribution/pdist.smv
new file mode 100644
index 0000000000000000000000000000000000000000..076cbd6e109a07284831ac3c3498430bc34eee63
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/power_distribution/pdist.smv
@@ -0,0 +1,443 @@
+#define max(val1, val2) case val1 > val2: val1; val1 <= val2: val2; esac
+
+---------------------------------------------------------------------------
+-- POWER DISTRIBUTION SYSTEM CONTROLLER                                  --
+---------------------------------------------------------------------------
+
+-- This SMV program models a controller for a power distribution system
+-- It includes modules both for the physical system (circuit breakers,
+-- switches, lines), and for the controller.
+
+-- Recommended SMV flag: -f
+
+---------------------------------------------------------------------------
+-- CIRCUIT BREAKER                                                       --
+---------------------------------------------------------------------------
+
+MODULE cbreaker(action)
+-- input parameters:
+--   action is the action from the controller (open, close, nop)
+
+-- internal state
+-- the breaker can be opened or closed
+VAR
+  status : {opened, closed};
+-- the status changes according to the commands of the controller
+-- if no command is given by the controller, the status does not change
+ASSIGN
+  next(status) := case
+	action = open  : opened;
+	action = close : closed;
+	action = nop   : status;
+        TRUE : status;
+  	esac;
+
+-- output of the circuit breaker
+-- output is high if only if the breaker is closed
+DEFINE
+  out := (status = closed);
+
+
+---------------------------------------------------------------------------
+-- SWITCH                                                                --
+---------------------------------------------------------------------------
+
+MODULE switch(left_feed, right_feed, action)
+-- input parameters:
+--   left_feed  is high if the switch is fed from the left
+--   right_feed is high if the switch is fed from the right
+--   action is the action from the controller (open, close, nop)
+
+-- internal state
+-- the switch can be opened, closed, or broken
+-- a closed switch can be in one of these substates: not_feeding,
+-- feeding_left, feeding_right
+VAR
+  status : {opened, not_feeding, feeding_left, feeding_right, broken};
+
+-- the switch gets broken if it is fed simultaneously from the left
+-- and from the right; if it is broken, it remains broken forever;
+-- otherwise, it opens or closes according to the commands of the controller;
+-- an opened switch does not feed the lines it is connected to;
+-- a closed switch feeds the opposite line with respect to the one it is
+-- fed by (if any)
+ASSIGN
+  next(status) := case
+	status = broken : broken;
+	action = open   : opened;
+	action = close  : case
+		left_feed & right_feed : broken;
+		left_feed              : feeding_right;
+		right_feed             : feeding_left;
+		TRUE                   : not_feeding;
+		esac;
+	action = nop : case
+		status = opened        : opened;
+		left_feed & right_feed : broken;
+		left_feed              : feeding_right;
+		right_feed             : feeding_left;
+		TRUE                   : not_feeding;
+		esac;
+	esac;
+
+-- outputs of the switch:
+--   out_left  is high if and only if the switch is feeding the left  line
+--   out_right is high if and only if the switch is feeding the right line
+DEFINE
+  out_left  := (status = feeding_left);
+  out_right := (status = feeding_right);
+
+
+---------------------------------------------------------------------------
+-- LINE WITH TWO CONNECTIONS                                             --
+---------------------------------------------------------------------------
+
+MODULE line_2(left_feed, right_feed)
+-- input parameters:
+--   left_feed  is high if the line is fed from the left
+--   right_feed is high if the line is fed from the right
+
+-- internal state
+-- the line can be closed, broken, or faulty
+-- a closed line can be in one of these substates: not_feeding,
+-- feeding_left, feeding_right
+VAR
+  status : {not_feeding, feeding_left, feeding_right, broken, faulty};
+
+IVAR
+  fault_event_stuck_at_faulty : boolean;
+  nominal_event : boolean;
+  
+-- the line gets broken if it is fed simultaneously from the left
+-- and from the right; broken and faulty states are permanent; a closed line
+-- feeds the opposite device with respect to the one it is fed by (if any)
+ASSIGN
+  next(status) := case
+	status = broken        : broken;
+	status = faulty        : faulty;
+	left_feed & right_feed : broken;
+	left_feed              : feeding_right;
+	right_feed             : feeding_left;
+	TRUE                   : not_feeding;
+	esac;
+
+-- outputs of the line:
+--   out_left  is high if and only if the line is feeding the left  device
+--   out_right is high if and only if the line is feeding the right device
+--   operational is true if the line is feeding (left or right)
+DEFINE
+  out_left  := (status = feeding_left);
+  out_right := (status = feeding_right);
+DEFINE
+  operational := (out_left | out_right);
+
+
+---------------------------------------------------------------------------
+-- LINE WITH THREE CONNECTIONS                                           --
+---------------------------------------------------------------------------
+
+MODULE line_3(left_feed, right_feed, up_feed)
+-- input parameters:
+--   left_feed  is high if the line is fed from the left
+--   right_feed is high if the line is fed from the right
+--   up_feed    is high if the line is fed from above
+
+-- internal state
+-- the line can be closed, broken, or faulty
+-- a closed line can be in one of these substates: not_feeding,
+-- feeding_left_right, feeding_left_up, feeding_right_up
+VAR
+  status : {not_feeding, feeding_left_right, feeding_left_up, feeding_right_up,
+            broken, faulty};
+
+-- the line gets broken if it is fed simultaneously from two different
+-- directions; broken and faulty states are permanent; a closed line feeds
+-- the remaining two devices with respect to the one it is fed by (if any)
+ASSIGN
+  next(status) := case
+	status = broken                           : broken;
+	status = faulty                           : faulty;
+	count(left_feed, right_feed, up_feed) > 1 : broken;
+	count(left_feed, right_feed, up_feed) = 0 : not_feeding;
+	left_feed                                 : feeding_right_up;
+	right_feed                                : feeding_left_up;
+        up_feed                                   : feeding_left_right;
+        TRUE                                      : status;
+	esac;
+
+-- outputs of the line:
+--    out_left  is high if and only if the line is feeding the left  device
+--    out_right is high if and only if the line is feeding the right device
+--    out_up    is high if and only if the line is feeding the upper device
+--    operational is true if the line is feeding (left, right, or up)
+DEFINE
+  out_left  := (status in {feeding_left_up,    feeding_left_right});
+  out_right := (status in {feeding_left_right, feeding_right_up  });
+  out_up    := (status in {feeding_left_up,    feeding_right_up  });
+DEFINE
+  operational := (out_left | out_right | out_up);
+
+
+---------------------------------------------------------------------------
+-- CONTROLLER                                                            --
+---------------------------------------------------------------------------
+
+MODULE controller(status_CB1,
+                  status_CB2,
+                  status_CB3,
+                  status_SD1,
+                  status_SD2,
+                  status_SD3,
+                  status_SD4,
+                  status_SD5,
+                  status_SD6,
+                  status_SD7,
+                  status_L1,
+                  status_L2,
+                  status_L3,
+                  status_L4,
+                  status_L5,
+                  status_L6,
+                  status_L7)
+
+-- inputs of the controller:
+-- the status of all the components of the system
+
+-- outputs of the controller are {open, close, nop} commands for
+-- the circuit breakers and the switches
+VAR
+  action_CB1 : {open, close, nop};
+  action_CB2 : {open, close, nop};
+  action_CB3 : {open, close, nop};
+  action_SD1 : {open, close, nop};
+  action_SD2 : {open, close, nop};
+  action_SD3 : {open, close, nop};
+  action_SD4 : {open, close, nop};
+  action_SD5 : {open, close, nop};
+  action_SD6 : {open, close, nop};
+  action_SD7 : {open, close, nop};
+
+-- some useful definitions
+-- the controller does not perform any action
+DEFINE
+  no_actions := (action_CB1 = nop &
+                 action_CB2 = nop &
+                 action_CB3 = nop &
+                 action_SD1 = nop &
+                 action_SD2 = nop &
+                 action_SD3 = nop &
+                 action_SD4 = nop &
+                 action_SD5 = nop &
+                 action_SD6 = nop &
+                 action_SD7 = nop);
+-- failures
+DEFINE
+  failure_L1 := (status_L1 = faulty);
+  failure_L2 := (status_L2 = faulty);
+  failure_L3 := (status_L3 = faulty);
+  failure_L4 := (status_L4 = faulty);
+  failure_L5 := (status_L5 = faulty);
+  failure_L6 := (status_L6 = faulty);
+  failure_L7 := (status_L7 = faulty);
+DEFINE
+  failure_occurring := (failure_L1 |
+                        failure_L2 | 
+                        failure_L3 |
+                        failure_L4 |
+                        failure_L5 |
+                        failure_L6 |
+                        failure_L7);
+
+-- the delay
+-- the controller uses this variable to wait for a fixed delay
+-- (see below)
+DEFINE
+  DELAY := 10;
+VAR
+  delay : 0..10;
+ASSIGN
+  init(delay) := DELAY;
+  next(delay) := case
+	status in {waiting1, waiting2} : max(0, delay - 1);
+	TRUE                           : DELAY;
+	esac;
+
+-- internal state
+-- the controller can be in the following states:
+--    monitoring: the controller is monitoring the system waiting for failures
+--      to happen
+--    waiting1: the controller waits for a fixed delay before initiating any
+--      action (this allows the failure to propagate through the network)
+--    operating: the controller issues suitable actions to the components
+--      after a failure
+--    waiting2: the controller waits for a fixed delay before terminating
+--      (this allows to observe the effects of the performed operations)
+--    finished: the controller terminates
+VAR
+  status : {monitoring, waiting1, operating, waiting2, finished};
+
+-- logic of the controller
+-- a simple controller:
+-- it takes into account only single failures
+ASSIGN
+  init(status) := monitoring;
+  next(status) := case
+	            status = monitoring : case
+		                            failure_occurring : waiting1;
+		                            TRUE              : monitoring;
+		                          esac;
+	            status = waiting1 : case
+		                          delay > 0 : waiting1;
+		                          TRUE      : operating;
+		                        esac;
+	            status = operating : waiting2;
+	            status = waiting2 : case
+		                          delay > 0 : waiting2;
+		                          TRUE      : finished;
+		                        esac;
+	            status = finished : finished;
+                    TRUE : status;                    
+	          esac;
+
+-- actions are performed while in operating status
+TRANS
+  (status != operating) -> no_actions
+-- the controller takes into account single failures of the lines
+-- L3, L4, L5, L6
+-- and issues suitable actions to reconfigurate the network
+TRANS
+  status = operating -> (
+      (failure_L5 -> (action_CB1 = close & 
+                      action_CB2 = open  &
+                      action_CB3 = nop   &
+                      action_SD1 = nop   &
+                      action_SD2 = nop   &
+                      action_SD3 = nop   &
+                      action_SD4 = open  &
+                      action_SD5 = close &
+                      action_SD6 = nop   &
+                      action_SD7 = nop)) &
+      (failure_L6 & !failure_L5 ->
+                     (action_CB1 = close & 
+                      action_CB2 = nop   &
+                      action_CB3 = nop   &
+                      action_SD1 = nop   &
+                      action_SD2 = open  &
+                      action_SD3 = nop   &
+                      action_SD4 = open  &
+                      action_SD5 = close &
+                      action_SD6 = nop   &
+                      action_SD7 = nop   )) &
+      (failure_L4 & !failure_L5 & !failure_L6 ->
+                     (action_CB1 = close & 
+                      action_CB2 = nop   &
+                      action_CB3 = close &
+                      action_SD1 = open  &
+                      action_SD2 = open  &
+                      action_SD3 = nop   &
+                      action_SD4 = nop   &
+                      action_SD5 = close &
+                      action_SD6 = nop   &
+                      action_SD7 = nop   )) &
+      (failure_L3 & !failure_L5 & !failure_L6 & !failure_L4 ->
+                     (action_CB1 = nop   & 
+                      action_CB2 = nop   &
+                      action_CB3 = close &
+                      action_SD1 = open  &
+                      action_SD2 = nop   &
+                      action_SD3 = nop   &
+                      action_SD4 = nop   &
+                      action_SD5 = nop   &
+                      action_SD6 = nop   &
+                      action_SD7 = nop   )) &
+      (!failure_L3 & !failure_L5 & !failure_L6 & !failure_L4 ->
+                     (action_CB1 = nop   & 
+                      action_CB2 = nop   &
+                      action_CB3 = nop   &
+                      action_SD1 = nop   &
+                      action_SD2 = nop   &
+                      action_SD3 = nop   &
+                      action_SD4 = nop   &
+                      action_SD5 = nop   &
+                      action_SD6 = nop   &
+                      action_SD7 = nop   )))
+
+
+---------------------------------------------------------------------------
+-- MAIN                                                                  --
+---------------------------------------------------------------------------
+
+MODULE main
+
+-- the topology
+
+VAR
+  CB1  : cbreaker(CTRL.action_CB1);
+  CB2  : cbreaker(CTRL.action_CB2);
+  CB3  : cbreaker(CTRL.action_CB3);
+
+  SD1  : switch(L3.out_right, L4.out_left,  CTRL.action_SD1);
+  SD2  : switch(L6.out_left,  L4.out_up,    CTRL.action_SD2);
+  SD3  : switch(L7.out_right, L4.out_right, CTRL.action_SD3);
+  SD4  : switch(L5.out_right, L6.out_right, CTRL.action_SD4);
+  SD5  : switch(L2.out_right, L3.out_left,  CTRL.action_SD5);
+  SD6  : switch(L1.out_right, L2.out_left,  CTRL.action_SD6);
+  SD7  : switch(L2.out_up,    L6.out_up,    CTRL.action_SD7);
+
+  L1   : line_2(CB1.out,       SD6.out_left);
+  L2   : line_3(SD6.out_right, SD5.out_left,  SD7.out_left);
+  L3   : line_2(SD5.out_right, SD1.out_left);
+  L4   : line_3(SD1.out_right, SD3.out_right, SD2.out_right);
+  L5   : line_2(CB2.out,       SD4.out_left);
+  L6   : line_3(SD2.out_left,  SD4.out_right, SD7.out_right);
+  L7   : line_2(CB3.out,       SD3.out_left);
+
+  CTRL : controller(CB1.status,
+                    CB2.status,
+                    CB3.status,
+                    SD1.status,
+                    SD2.status,
+                    SD3.status,
+                    SD4.status,
+                    SD5.status,
+                    SD6.status,
+                    SD7.status,
+                    L1.status,
+                    L2.status,
+                    L3.status,
+                    L4.status,
+                    L5.status,
+                    L6.status,
+                    L7.status);
+
+-- the initial state
+INIT
+  CB1.status = opened             &
+  CB2.status = closed             &
+  CB3.status = opened             &
+  SD1.status = feeding_left       &
+  SD2.status = feeding_right      &
+  SD3.status = opened             &
+  SD4.status = feeding_right      &
+  SD5.status = opened             &
+  SD6.status = not_feeding        &
+  SD7.status = opened             &
+   L1.status = not_feeding        &
+   L2.status = not_feeding        &
+   L3.status = feeding_left       &
+   L4.status = feeding_left_right &
+   L5.status = feeding_right      &
+   L6.status = feeding_left_up    &
+   L7.status = not_feeding
+
+-- some useful definitions
+-- number of operational lines
+DEFINE
+  NR_OPERATIONAL_LINES :=
+	count(L1.operational,
+	      L2.operational,
+	      L3.operational,
+ 	      L4.operational,
+ 	      L5.operational,
+ 	      L6.operational,
+ 	      L7.operational);
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/power_distribution/pdist.txt b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/power_distribution/pdist.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d241017ebc3af74ffc85470665815fe9c410cb57
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/power_distribution/pdist.txt
@@ -0,0 +1,16 @@
+FAULT EXTENSION FE_PDIST /-- ... --/
+EXTENSION OF MODULE line_2
+  /-- Description of Fault Model for Switch --/
+    SLICE Line_2_StuckAt_Faulty
+    AFFECTS status WITH
+    /-- Description of fault mode StuckAt Closed --/
+      MODE stuckAt_faulty : Transient StuckAtByValue_D (
+                                               data term << faulty,
+                                               data input << status,
+                                               data varout >> status,
+                                               template self_fix = self_fixed,
+                                               event failure >> fault_event_stuck_at_faulty,
+                                               event self_fixed >> nominal_event );
+
+
+                                          
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG.fei b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG.fei
new file mode 100644
index 0000000000000000000000000000000000000000..8f48937466b1e0e2c9b7e5e18c766c0e3c8f6104
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG.fei
@@ -0,0 +1,39 @@
+/-- Description of the whole fault extension
+    (multiline)
+--/
+FAULT EXTENSION FE_SC_TMG
+
+  EXTENSION OF MODULE Generator
+     /-- Description of Fault Slice Gen_StuckOff --/
+     SLICE Gen_StuckOff AFFECTS state WITH
+
+       /-- Description of fault mode stuckAt_Off --/
+       MODE stuckAt_Off : Permanent StuckAtByValue_D(
+    		  data term << off,
+                  data input << state,
+                  data varout >> state,
+                  event failure >> fault_event_stuck_at_off);
+
+
+  EXTENSION OF MODULE Switch
+
+     /-- Description of Fault Model for Switch --/
+     SLICE Switch_StuckClosed_StuckOpen
+      AFFECTS state WITH
+
+        /-- Description of fault mode StuckAt_Closed --/
+        MODE stuckAt_Closed : Transient StuckAtByValue_D(
+                  data term << closed,
+                  data input << state,
+                  data varout >> state,
+                  template self_fix = self_fixed,
+                  event failure >> fault_event_stuck_at_closed,
+                  event self_fixed >> nominal_event);
+
+        /-- Description of fault mode StuckAt_Open --/
+        MODE stuckAt_Open : Transient StuckAtByValue_D(data term << open,
+                  data input << state,
+                  data varout >> state,
+                  template self_fix = self_fixed,
+                  event failure >> fault_event_stuck_at_open,
+                  event self_fixed >> nominal_event);
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG.smv
new file mode 100644
index 0000000000000000000000000000000000000000..545b091b4748a538da305863debe775637be9ba2
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG.smv
@@ -0,0 +1,901 @@
+MODULE main
+  VAR
+    CN : Controller_Synth(SC.mode_event_Gs, SC.mode_event_CBs, SC.init_state_Gs, SC.init_state_CBs);
+    SC: System_Configuration(CN.cmd_to_Gs, CN.cmd_to_CBs);
+
+   -- -----------------------------------------------------------
+   -- Definition of the properties that verify the requirements:
+
+   -- R1: No bus will be connected to more than 1 power source at any time.
+   --
+   -- is_broken is true iff the bus is (or was) connected to more than 1
+   -- power source.
+   INVARSPEC NAME R1_true := !(SC.B1.is_broken | SC.B2.is_broken | SC.B3.is_broken);
+
+   -- R2: If any power source is on, then all busses will be powered
+   --
+   -- In R2 we verify that the requirement holds, if there are less than 3 faults
+   INVARSPEC
+     NAME R2_true :=
+      ((SC.G1.is_on | SC.G2.is_on | SC.G3.is_on) & (CN.MN.faults_counter < 3)) ->
+            (SC.B1.is_powered & SC.B2.is_powered & SC.B3.is_powered);
+
+   -- In R2 we verify that there is at least a configuration in which all the
+   -- buses are unpowered. (E.g., the safe configuration where everything is
+   -- off)
+   INVARSPEC
+     NAME R2_false :=
+      ((SC.G1.is_on | SC.G2.is_on | SC.G3.is_on)) ->
+            (SC.B1.is_powered & SC.B2.is_powered & SC.B3.is_powered);
+
+   INVARSPEC NAME R2_fta := (SC.B1.is_powered & SC.B2.is_powered & SC.B3.is_powered);
+   INVARSPEC NAME R2_fta_B1 := (SC.B1.is_powered);
+   INVARSPEC NAME R2_fta_B2 := (SC.B2.is_powered);
+   INVARSPEC NAME R2_fta_B3 := (SC.B3.is_powered);
+
+   -- R4: If no power source is on, then all buses will be unpowered
+   INVARSPEC
+     NAME R4_true :=
+      ((SC.G1.is_off & SC.G2.is_off & SC.G3.is_off) ->
+        (!SC.B1.is_powered & !SC.B2.is_powered & !SC.B3.is_powered));
+
+   -- R6: Never more than two generators on unless required in case of failure
+   INVARSPEC
+     NAME R6_true :=
+      (CN.MN.faults_counter = 0) -> (SC.G1.is_off | SC.G2.is_off | SC.G3.is_off)
+
+   -- ---------------------------------------------------------------------
+  -- ----------------------------------------------------------
+  -- We verify that the monitor correctly knows the state of
+  -- the system at anytime
+
+   INVARSPEC NAME Monitor_State_Consistency_true :=
+     (SC.G1.state = CN.MN.state_est_G1) &
+     (SC.G2.state = CN.MN.state_est_G2) &
+     (SC.G3.state = CN.MN.state_est_G3) &
+     (SC.GB1.state = CN.MN.state_est_GB1) &
+     (SC.GB2.state = CN.MN.state_est_GB2) &
+     (SC.GB3.state = CN.MN.state_est_GB3) &
+     (SC.BB1.state = CN.MN.state_est_BB1) &
+     (SC.BB2.state = CN.MN.state_est_BB2) &
+     (SC.BB3.state = CN.MN.state_est_BB3);
+
+   -- -------------------------------------------------------------------------
+   -- From each nominal state it is always possible to end up in a faulty state
+   CTLSPEC
+     NAME system_can_always_fail_true :=
+      AG( CN.MN.faults_counter = 0 -> EX (CN.MN.faults_counter >0))
+
+   -- We also verify that there is always a path in which there is no fault
+   CTLSPEC
+     NAME system_can_always_work_true :=
+      EG (CN.MN.faults_counter = 0);
+   -- -------------------------------------------------------------------------
+
+   -- -------------------------------------------------------------------
+   -- We can verify that each component can always go from a nominal state
+   -- to a faulty state:
+
+   -- Generators can always go to a faulty state
+   CTLSPEC
+     NAME G1_can_always_fail_true :=
+      AG( CN.MN.mode_est_G1 = ok -> EX (CN.MN.mode_est_G1 = ko))
+
+   CTLSPEC
+     NAME G2_can_always_fail_true :=
+      AG( CN.MN.mode_est_G2 = ok -> EX (CN.MN.mode_est_G2 = ko))
+
+   CTLSPEC
+     NAME G3_can_always_fail_true :=
+      AG( CN.MN.mode_est_G3 = ok -> EX (CN.MN.mode_est_G3 = ko))
+
+   -- and also switches can always become stuck_at_open or stuck_at_close
+   -- GB1, GB2, GB3:
+   CTLSPEC
+     NAME GB1_can_always_fail_true :=
+      AG( CN.MN.mode_est_GB1 = ok ->
+                EX (CN.MN.mode_est_GB1 = ko_open) &
+                EX (CN.MN.mode_est_GB1 = ko_closed) )
+   CTLSPEC
+     NAME GB2_can_always_fail_true :=
+      AG( CN.MN.mode_est_GB2 = ok ->
+                EX (CN.MN.mode_est_GB2 = ko_open) &
+                EX (CN.MN.mode_est_GB2 = ko_closed) )
+   CTLSPEC
+     NAME GB3_can_always_fail_true :=
+      AG( CN.MN.mode_est_GB3 = ok ->
+                EX (CN.MN.mode_est_GB3 = ko_open) &
+                EX (CN.MN.mode_est_GB3 = ko_closed) )
+   -- BB1, BB2, BB3:
+   CTLSPEC
+     NAME BB1_can_always_fail_true :=
+      AG( CN.MN.mode_est_BB1 = ok ->
+                EX (CN.MN.mode_est_BB1 = ko_open) &
+                EX (CN.MN.mode_est_BB1 = ko_closed) )
+   CTLSPEC
+     NAME BB2_can_always_fail_true :=
+      AG( CN.MN.mode_est_BB2 = ok ->
+                EX (CN.MN.mode_est_BB2 = ko_open) &
+                EX (CN.MN.mode_est_BB2 = ko_closed) )
+   CTLSPEC
+     NAME BB3_can_always_fail_true :=
+      AG( CN.MN.mode_est_BB3 = ok ->
+                EX (CN.MN.mode_est_BB3 = ko_open) &
+                EX (CN.MN.mode_est_BB3 = ko_closed) )
+
+   -- ---------------------------------------------------------------
+
+   -- ---------------------------------------------------------------
+   -- If there are no faults, the system is in the base configuration
+   DEFINE
+     base_conf := SC.G1.is_on & SC.G2.is_on & SC.G3.is_off &
+               SC.GB1.is_closed & SC.GB2.is_closed & SC.GB3.is_open &
+               SC.BB1.is_open & SC.BB2.is_closed & SC.BB3.is_open;
+
+   LTLSPEC
+     NAME system_in_base_configuration_until_fault_true :=
+       ( base_conf U (CN.MN.faults_counter > 0)) | G base_conf;
+
+   -- ---------------------------------------------------------------
+
+
+  -- END MODULE MAIN --
+
+MODULE System_Configuration(cmd_to_Gs, cmd_to_CBs)
+
+  DEFINE
+    init_state_G1 := on;
+    init_state_G2 := on;
+    init_state_G3 := off;
+
+    init_state_GB1 := closed;
+    init_state_GB2 := closed;
+    init_state_GB3 := open;
+    init_state_BB1 := open;
+    init_state_BB2 := closed;
+    init_state_BB3 := open;
+
+  VAR
+    G1 : Generator(cmd_to_Gs[index_G1], init_state_G1);
+    G2 : Generator(cmd_to_Gs[index_G2], init_state_G2);
+    G3 : Generator(cmd_to_Gs[index_G3], init_state_G3);
+
+    GB1 : Switch(cmd_to_CBs[index_GB1], init_state_GB1);
+    GB2 : Switch(cmd_to_CBs[index_GB2], init_state_GB2);
+    GB3 : Switch(cmd_to_CBs[index_GB3], init_state_GB3);
+
+    BB1 : Switch(cmd_to_CBs[index_BB1], init_state_BB1);
+    BB2 : Switch(cmd_to_CBs[index_BB2], init_state_BB2);
+    BB3 : Switch(cmd_to_CBs[index_BB3], init_state_BB3);
+
+    B1 : Bus(B1_poweredby_G1, B1_poweredby_G2, B1_poweredby_G3);
+    B2 : Bus(B2_poweredby_G1, B2_poweredby_G2, B2_poweredby_G3);
+    B3 : Bus(B3_poweredby_G1, B3_poweredby_G2, B3_poweredby_G3);
+
+  -- Definition of the signals (in matrix format) used by Controller to know the state of the single components --
+
+  DEFINE
+    init_state_Gs := [
+      init_state_G1,
+      init_state_G2,
+      init_state_G3];
+
+    init_state_CBs := [
+      init_state_GB1,
+      init_state_GB2,
+      init_state_GB3,
+      init_state_BB1,
+      init_state_BB2,
+      init_state_BB3];
+
+  DEFINE
+    index_GB1 := 0;
+    index_GB2 := 1;
+    index_GB3 := 2;
+
+    index_BB1 := 3;
+    index_BB2 := 4;
+    index_BB3 := 5;
+
+    index_G1 := 0;
+    index_G2 := 1;
+    index_G3 := 2;
+
+  DEFINE
+    mode_event_Gs := [
+      fault_event_off_Gs,
+      nominal_event_Gs];
+
+    mode_event_CBs := [
+      fault_event_open_CBs,
+      fault_event_closed_CBs,
+      nominal_event_CBs];
+
+  DEFINE
+    fault_event_open_CBs := [
+      GB1.fault_event_stuck_at_open,
+      GB2.fault_event_stuck_at_open,
+      GB3.fault_event_stuck_at_open,
+      BB1.fault_event_stuck_at_open,
+      BB2.fault_event_stuck_at_open,
+      BB3.fault_event_stuck_at_open];
+
+    fault_event_closed_CBs := [
+      GB1.fault_event_stuck_at_closed,
+      GB2.fault_event_stuck_at_closed,
+      GB3.fault_event_stuck_at_closed,
+      BB1.fault_event_stuck_at_closed,
+      BB2.fault_event_stuck_at_closed,
+      BB3.fault_event_stuck_at_closed];
+
+    nominal_event_CBs := [
+      GB1.nominal_event,
+      GB2.nominal_event,
+      GB3.nominal_event,
+      BB1.nominal_event,
+      BB2.nominal_event,
+      BB3.nominal_event];
+
+  DEFINE
+    fault_event_off_Gs := [
+      G1.fault_event_stuck_at_off,
+      G2.fault_event_stuck_at_off,
+      G3.fault_event_stuck_at_off];
+
+    nominal_event_Gs := [
+      G1.nominal_event,
+      G2.nominal_event,
+      G3.nominal_event];
+
+
+  -- Definition of the possible paths to Bus 1 --
+
+  DEFINE
+    B1_poweredby_G1_U := (G1.is_on) & (GB1.is_closed);
+    B1_poweredby_G2_L := B3_poweredby_G2_L & (BB3.is_closed);
+    B1_poweredby_G2_R := B2_poweredby_G2_U & (BB1.is_closed);
+    B1_poweredby_G3_L := B3_poweredby_G3_U & (BB3.is_closed);
+    B1_poweredby_G3_R := B2_poweredby_G3_R & (BB1.is_closed);
+
+  -- Definition of the possible paths to Bus 2 --
+
+  DEFINE
+    B2_poweredby_G1_L := B1_poweredby_G1_U & (BB1.is_closed);
+    B2_poweredby_G1_R := B3_poweredby_G1_R & (BB2.is_closed);
+    B2_poweredby_G2_U := (G2.is_on) & (GB2.is_closed);
+    B2_poweredby_G3_L := B1_poweredby_G3_L & (BB1.is_closed);
+    B2_poweredby_G3_R := B3_poweredby_G3_U & (BB2.is_closed);
+
+  -- Definition of the possible paths to Bus 3 --
+
+  DEFINE
+    B3_poweredby_G1_L := B2_poweredby_G1_L & (BB2.is_closed);
+    B3_poweredby_G1_R := B1_poweredby_G1_U & (BB3.is_closed);
+    B3_poweredby_G2_L := B2_poweredby_G2_U & (BB2.is_closed);
+    B3_poweredby_G2_R := B1_poweredby_G2_R & (BB3.is_closed);
+    B3_poweredby_G3_U := (G3.is_on) & (GB3.is_closed);
+
+
+  -- Definition of the possible inputs for Bus 1 --
+
+  DEFINE
+    B1_poweredby_G1 := B1_poweredby_G1_U;
+    B1_poweredby_G2 := B1_poweredby_G2_R | B1_poweredby_G2_L;
+    B1_poweredby_G3 := B1_poweredby_G3_R | B1_poweredby_G3_L;
+
+  -- Definition of the possible inputs for Bus 2 --
+
+  DEFINE
+    B2_poweredby_G1 := B2_poweredby_G1_R | B2_poweredby_G1_L;
+    B2_poweredby_G2 := B2_poweredby_G2_U;
+    B2_poweredby_G3 := B2_poweredby_G3_R | B2_poweredby_G3_L;
+
+  -- Definition of the possible inputs for Bus 3 --
+
+  DEFINE
+    B3_poweredby_G1 := B3_poweredby_G1_R | B3_poweredby_G1_L;
+    B3_poweredby_G2 := B3_poweredby_G2_R | B3_poweredby_G2_L;
+    B3_poweredby_G3 := B3_poweredby_G3_U;
+
+  -- END MODULE SYSTEM CONFIGURATION --
+
+MODULE Generator(cmd, init_state)
+  VAR
+    state : {on, off};
+
+  -- Definition of the transition labels between nominal and faulty state --
+  IVAR
+    fault_event_stuck_at_off : boolean;
+    nominal_event : boolean;
+  TRANS
+    nominal_event = FALSE;
+
+  DEFINE
+    is_on := (state = on);
+  DEFINE
+    is_off := (state = off);
+
+  ASSIGN
+    next(state) :=
+      case
+        (cmd = cmd_on) : on;
+        (cmd = cmd_off) : off;
+        TRUE : state;
+      esac;
+
+  ASSIGN
+   init(state) := init_state;
+
+  -- END MODULE GENERATOR --
+
+
+MODULE Switch(cmd, init_state)
+  VAR
+    state : {open, closed};
+
+  -- Definition of the transition labels between nominal and faulty states --
+  IVAR
+    fault_event_stuck_at_closed : boolean;
+    fault_event_stuck_at_open : boolean;
+    nominal_event : boolean;
+
+  DEFINE
+    is_closed := (state = closed);
+
+  DEFINE
+    is_open := (state = open);
+
+  ASSIGN
+    next(state) :=
+      case
+        (cmd = cmd_open) : open;
+        (cmd = cmd_closed) : closed;
+        TRUE : state;
+      esac;
+
+  ASSIGN
+    init(state) := init_state;
+
+  -- END MODULE SWITCH --
+
+MODULE Bus(in1, in2, in3)
+  VAR
+    state : {working, broken};
+
+  DEFINE
+    is_broken := (state = broken);
+  DEFINE
+    is_powered := (state = working) & (count((in1), (in2), (in3)) = 1);
+
+  -- When the bus is overpowered it becomes broken and unfixable --
+  ASSIGN
+    init(state) :=
+      case
+        (count((in1), (in2), (in3)) > 1) : broken;
+        TRUE : working;
+      esac;
+
+    next(state) :=
+      case
+        next((count((in1), (in2), (in3)) > 1)) : broken;
+        TRUE : state;
+      esac;
+
+  -- END MODULE BUS --
+-- The Synthesized controller is built by defining the constraints that
+-- we want our system to satisfy. When a fault occurs, the controller
+-- will try to find a configuration for the system that satisfies all
+-- the requirements.
+-- As opposed to the Explicit Faults controller, this strategy results
+-- in a much simpler (and compact) controller.
+--
+-- In order to work, the Synthesized controller uses a Monitor. The
+-- Monitor has two goals:
+-- 1. keep track of the modes of each component
+-- 2. predict the behaviour of a command
+-- With these information, the controller can reason on what would
+-- happen if he issues a certain command. E.g., if G1 is faulty
+-- (stuck_at_off) then the controller can issue the command do_on
+-- but this will have no effect since the generator is faulty.
+-- The monitor will, therefore, estimate that this command will
+-- not be useful and say that the component will stay
+
+-- The module takes as parameter the mode events and the initial states
+-- of the components. The mode events are the signals that denote a
+-- transition from healthy to faulty (or viceversa).
+MODULE Controller_Synth(mode_event_Gs, mode_event_CBs, init_state_Gs, init_state_CBs)
+
+  -- The controller uses a Monitor. This monitor takes as parameter
+  -- the mode signals (mode_event_*) the command signals (cmd_to_*)
+  -- and the initial configuration of each component (init_state_*)
+  VAR
+    MN : Monitor(mode_event_Gs, mode_event_CBs, cmd_to_Gs, cmd_to_CBs, init_state_Gs, init_state_CBs);
+
+  -- We define the possible commands for each component.
+  -- Apart from the commands to bring the system into
+  -- a particular state, we have also the nop command.
+  -- This command is useful if we know that a component
+  -- is already in a particular state and we do not want
+  -- to modify it.
+  IVAR
+    cmd_to_GB1 : {cmd_closed, cmd_open, nop};
+    cmd_to_GB2 : {cmd_closed, cmd_open, nop};
+    cmd_to_GB3 : {cmd_closed, cmd_open, nop};
+
+    cmd_to_BB1 : {cmd_closed, cmd_open, nop};
+    cmd_to_BB2 : {cmd_closed, cmd_open, nop};
+    cmd_to_BB3 : {cmd_closed, cmd_open, nop};
+
+    cmd_to_G1 : {cmd_on, cmd_off, nop};
+    cmd_to_G2 : {cmd_on, cmd_off, nop};
+    cmd_to_G3 : {cmd_on, cmd_off, nop};
+
+  -- We now group the commands by component's type:
+  -- cmd_to_Gs and cmd_to_CBs
+  DEFINE
+    cmd_to_Gs := [
+      cmd_to_G1,
+      cmd_to_G2,
+      cmd_to_G3];
+
+    cmd_to_CBs := [
+      cmd_to_GB1,
+      cmd_to_GB2,
+      cmd_to_GB3,
+      cmd_to_BB1,
+      cmd_to_BB2,
+      cmd_to_BB3];
+
+  -- In general, there are two ways of disable the block
+  -- G1+GB1: 1) turn off G1 or 2) open GB1 (or both).
+  -- To avoid this non-determinism we add the following
+  -- assumption: When GBn is open the Gn must be off.
+  TRANS
+    (next(MN.state_est_GB1) = open) -> (cmd_to_G1 = cmd_off);
+
+  TRANS
+    (next(MN.state_est_GB2) = open) -> (cmd_to_G2 = cmd_off);
+
+  TRANS
+    (next(MN.state_est_GB3) = open) -> (cmd_to_G3 = cmd_off);
+
+
+  -- Similarly to what we did in the System model, we need
+  -- to keep track of the information of which Bus is powered
+  -- by which generator and how.
+  -- Note, however, that in this case we are not interested in
+  -- the current state of the system, but in the future state
+  -- (i.e., next( ) ).
+  -- This means that, e.g., B1_poweredby_G1_U should be read
+  -- as follows: the bus B1 will be powered by G1 from above.
+  -- Remember that Up,Left and Right indicate where the power
+  -- comes from from the point of view of the Bus. E.g.,
+  -- B1_poweredby_G2_L identify the path BB2+BB3 from G2 to B1
+
+  -- Definition of the possible paths to Bus 1 --
+  DEFINE
+    B1_poweredby_G1_U := (next(MN.state_est_G1) = on) & (next(MN.state_est_GB1) = closed);
+    B1_poweredby_G2_L := B3_poweredby_G2_L & (next(MN.state_est_BB3) = closed);
+    B1_poweredby_G2_R := B2_poweredby_G2_U & (next(MN.state_est_BB1) = closed);
+    B1_poweredby_G3_L := B3_poweredby_G3_U & (next(MN.state_est_BB3) = closed);
+    B1_poweredby_G3_R := B2_poweredby_G3_R & (next(MN.state_est_BB1) = closed);
+
+  -- Definition of the possible paths to Bus 2 --
+  DEFINE
+    B2_poweredby_G1_L := B1_poweredby_G1_U & (next(MN.state_est_BB1) = closed);
+    B2_poweredby_G1_R := B3_poweredby_G1_R & (next(MN.state_est_BB2) = closed);
+    B2_poweredby_G2_U := (next(MN.state_est_G2) = on) & (next(MN.state_est_GB2) = closed);
+    B2_poweredby_G3_L := B1_poweredby_G3_L & (next(MN.state_est_BB1) = closed);
+    B2_poweredby_G3_R := B3_poweredby_G3_U & (next(MN.state_est_BB2) = closed);
+
+  -- Definition of the possible paths to Bus 3 --
+  DEFINE
+    B3_poweredby_G1_L := B2_poweredby_G1_L & (next(MN.state_est_BB2) = closed);
+    B3_poweredby_G1_R := B1_poweredby_G1_U & (next(MN.state_est_BB3) = closed);
+    B3_poweredby_G2_L := B2_poweredby_G2_U & (next(MN.state_est_BB2) = closed);
+    B3_poweredby_G2_R := B1_poweredby_G2_R & (next(MN.state_est_BB3) = closed);
+    B3_poweredby_G3_U := (next(MN.state_est_G3) = on) & (next(MN.state_est_GB3) = closed);
+
+  -- We now abstract from the particular path used to power
+  -- the bus, and simply say which generator will power
+  -- the bus.
+  DEFINE
+    B1_poweredby_G1 := B1_poweredby_G1_U;
+    B1_poweredby_G2 := B1_poweredby_G2_R | B1_poweredby_G2_L;
+    B1_poweredby_G3 := B1_poweredby_G3_R | B1_poweredby_G3_L;
+
+  DEFINE
+    B2_poweredby_G1 := B2_poweredby_G1_R | B2_poweredby_G1_L;
+    B2_poweredby_G2 := B2_poweredby_G2_U;
+    B2_poweredby_G3 := B2_poweredby_G3_R | B2_poweredby_G3_L;
+
+  DEFINE
+    B3_poweredby_G1 := B3_poweredby_G1_R | B3_poweredby_G1_L;
+    B3_poweredby_G2 := B3_poweredby_G2_R | B3_poweredby_G2_L;
+    B3_poweredby_G3 := B3_poweredby_G3_U;
+
+
+  -- We can now encode the logic of the controller.
+  -- In order to do so, we define the constraints that represent
+  -- our requirements.
+
+  -- Requirement R1 --
+  -- R1: No bus will be connected to more than 1 power source at any time.
+  --
+  -- This requirement is formalized in two steps:
+  -- 1. We explicit that a Bus is working if and only if
+  -- it is not powered by more than two generators
+  -- 2. We force all the Buses to be working.
+  DEFINE
+    B1_is_working :=
+      (B1_poweredby_G1 -> !B1_poweredby_G2) &
+      (B1_poweredby_G2 -> !B1_poweredby_G3) &
+      (B1_poweredby_G3 -> !B1_poweredby_G1);
+
+  DEFINE
+    B2_is_working :=
+      (B2_poweredby_G1 -> !B2_poweredby_G2) &
+      (B2_poweredby_G2 -> !B2_poweredby_G3) &
+      (B2_poweredby_G3 -> !B2_poweredby_G1);
+
+  DEFINE
+    B3_is_working :=
+      (B3_poweredby_G1 -> !B3_poweredby_G2) &
+      (B3_poweredby_G2 -> !B3_poweredby_G3) &
+      (B3_poweredby_G3 -> !B3_poweredby_G1);
+
+  -- This TRANS forces all the buses to be working.
+  TRANS
+    B1_is_working &
+    B2_is_working &
+    B3_is_working;
+
+
+  -- In order to encode R3, we need to define the commands
+  -- that will bring our system into a configuration
+  -- in which a bus will be powered by a particular generator
+  -- through a particular path.
+  -- E.g., cmd_B1_poweredby_G1_U is the command that requires
+  -- G1 to go in the state on and GB1 in the state closed.
+
+  DEFINE
+    cmd_B1_poweredby_G1_U := (cmd_to_G1 = cmd_on) & (cmd_to_GB1 = cmd_closed);
+    cmd_B1_poweredby_G2_R := cmd_B2_poweredby_G2_U & (cmd_to_BB1 = cmd_closed);
+    cmd_B1_poweredby_G2_L := cmd_B3_poweredby_G2_L & (cmd_to_BB3 = cmd_closed);
+    cmd_B1_poweredby_G3_L := cmd_B3_poweredby_G3_U & (cmd_to_BB3 = cmd_closed);
+    cmd_B1_poweredby_G3_R := cmd_B2_poweredby_G3_R & (cmd_to_BB1 = cmd_closed);
+
+  DEFINE
+    cmd_B2_poweredby_G2_U := (cmd_to_G2 = cmd_on) & (cmd_to_GB2 = cmd_closed);
+    cmd_B2_poweredby_G1_L := cmd_B1_poweredby_G1_U & (cmd_to_BB1 = cmd_closed);
+    cmd_B2_poweredby_G1_R := cmd_B3_poweredby_G1_R & (cmd_to_BB2 = cmd_closed);
+    cmd_B2_poweredby_G3_R := cmd_B3_poweredby_G3_U & (cmd_to_BB2 = cmd_closed);
+    cmd_B2_poweredby_G3_L := cmd_B1_poweredby_G3_L & (cmd_to_BB1 = cmd_closed);
+
+  DEFINE
+    cmd_B3_poweredby_G2_L := cmd_B2_poweredby_G2_U & (cmd_to_BB2 = cmd_closed);
+    cmd_B3_poweredby_G2_R := cmd_B1_poweredby_G2_R & (cmd_to_BB3 = cmd_closed);
+    cmd_B3_poweredby_G1_R := cmd_B1_poweredby_G1_U & (cmd_to_BB3 = cmd_closed);
+    cmd_B3_poweredby_G1_L := cmd_B2_poweredby_G1_L & (cmd_to_BB2 = cmd_closed);
+    cmd_B3_poweredby_G3_U := (cmd_to_G3 = cmd_on) & (cmd_to_GB3 = cmd_closed);
+
+  -- Since there could be faults in the system, we need to check whether it is
+  -- possible to go into a particular configuration. For example, if a
+  -- switch is stuck_at_open, we cannot go into a configuration that requires
+  -- the switch to be closed. We identify with these can_do_* DEFINEs.
+  DEFINE
+    can_do_B1_poweredby_G1_U := (next(MN.mode_est_G1) = ok) & (next(MN.mode_est_GB1) in {ok, ko_closed});
+    can_do_B1_poweredby_G2_R := can_do_B2_poweredby_G2_U & (next(MN.mode_est_BB1) in {ok, ko_closed});
+    can_do_B1_poweredby_G2_L := can_do_B3_poweredby_G2_L & (next(MN.mode_est_BB3) in {ok, ko_closed});
+    can_do_B1_poweredby_G3_L := can_do_B3_poweredby_G3_U & (next(MN.mode_est_BB3) in {ok, ko_closed});
+    can_do_B1_poweredby_G3_R := can_do_B2_poweredby_G3_R & (next(MN.mode_est_BB1) in {ok, ko_closed});
+
+  DEFINE
+    can_do_B2_poweredby_G2_U := (next(MN.mode_est_G2) = ok) & (next(MN.mode_est_GB2) in {ok, ko_closed});
+    can_do_B2_poweredby_G1_L := can_do_B1_poweredby_G1_U & (next(MN.mode_est_BB1) in {ok, ko_closed});
+    can_do_B2_poweredby_G1_R := can_do_B3_poweredby_G1_R & (next(MN.mode_est_BB2) in {ok, ko_closed});
+    can_do_B2_poweredby_G3_R := can_do_B3_poweredby_G3_U & (next(MN.mode_est_BB2) in {ok, ko_closed});
+    can_do_B2_poweredby_G3_L := can_do_B1_poweredby_G3_L & (next(MN.mode_est_BB1) in {ok, ko_closed});
+
+
+  DEFINE
+    can_do_B3_poweredby_G2_L := can_do_B2_poweredby_G2_U & (next(MN.mode_est_BB2) in {ok, ko_closed});
+    can_do_B3_poweredby_G2_R := can_do_B1_poweredby_G2_R & (next(MN.mode_est_BB3) in {ok, ko_closed});
+    can_do_B3_poweredby_G1_R := can_do_B1_poweredby_G1_U & (next(MN.mode_est_BB3) in {ok, ko_closed});
+    can_do_B3_poweredby_G1_L := can_do_B2_poweredby_G1_L & (next(MN.mode_est_BB2) in {ok, ko_closed});
+    can_do_B3_poweredby_G3_U := (next(MN.mode_est_G3) = ok) & (next(MN.mode_est_GB3) in {ok, ko_closed});
+
+
+  -- Requirement R3 --
+  -- R3: Path and Generator priority
+  --
+  -- R3 is formalized by specifying the priority of the
+  -- different configurations. In particular, we use a
+  -- case statement in order to prioritize the choices
+  -- for each bus.
+  -- E.g., for B1 we specify that the best configuration
+  -- is being powered by G1 from above (G1_U),
+  -- followed by being powered by G2 from the right
+  -- (G2_R) etc.
+
+  -- B1 preferences
+  TRANS
+    case
+      can_do_B1_poweredby_G1_U : cmd_B1_poweredby_G1_U;
+      can_do_B1_poweredby_G2_R : cmd_B1_poweredby_G2_R;
+      can_do_B1_poweredby_G2_L : cmd_B1_poweredby_G2_L;
+      can_do_B1_poweredby_G3_L : cmd_B1_poweredby_G3_L;
+      can_do_B1_poweredby_G3_R : cmd_B1_poweredby_G3_R;
+      TRUE : TRUE;
+    esac;
+
+  -- B2 preferences
+  TRANS
+    case
+      can_do_B2_poweredby_G2_U : cmd_B2_poweredby_G2_U;
+      can_do_B2_poweredby_G1_L : cmd_B2_poweredby_G1_L;
+      can_do_B2_poweredby_G1_R : cmd_B2_poweredby_G1_R;
+      can_do_B2_poweredby_G3_R : cmd_B2_poweredby_G3_R;
+      can_do_B2_poweredby_G3_L : cmd_B2_poweredby_G3_L;
+      TRUE : TRUE;
+    esac;
+
+  -- B3 preferences
+  TRANS
+    case
+      can_do_B3_poweredby_G2_L : cmd_B3_poweredby_G2_L;
+      can_do_B3_poweredby_G2_R : cmd_B3_poweredby_G2_R;
+      can_do_B3_poweredby_G1_R : cmd_B3_poweredby_G1_R;
+      can_do_B3_poweredby_G1_L : cmd_B3_poweredby_G1_L;
+      can_do_B3_poweredby_G3_U : cmd_B3_poweredby_G3_U;
+      TRUE : TRUE;
+    esac;
+
+  -- END MODULE CONTROLLER --
+MODULE Monitor(mode_event_Gs, mode_event_CBs, cmd_to_Gs, cmd_to_CBs, init_state_Gs, init_state_CBs)
+
+  -- Definition of the monitors for the circuit components --
+  VAR
+    mode_est_GB1 : {ok, ko_open, ko_closed};
+    mode_est_GB2 : {ok, ko_open, ko_closed};
+    mode_est_GB3 : {ok, ko_open, ko_closed};
+
+    mode_est_BB1 : {ok, ko_open, ko_closed};
+    mode_est_BB2 : {ok, ko_open, ko_closed};
+    mode_est_BB3 : {ok, ko_open, ko_closed};
+
+    mode_est_G1 : {ok, ko};
+    mode_est_G2 : {ok, ko};
+    mode_est_G3 : {ok, ko};
+
+  VAR
+    state_est_G1 : {on, off};
+    state_est_G2 : {on, off};
+    state_est_G3 : {on, off};
+
+    state_est_GB1 : {closed, open};
+    state_est_GB2 : {closed, open};
+    state_est_GB3 : {closed, open};
+
+    state_est_BB1 : {closed, open};
+    state_est_BB2 : {closed, open};
+    state_est_BB3 : {closed, open};
+
+  DEFINE
+    faults_counter := count(
+      (mode_est_GB1 != ok),
+      (mode_est_GB2 != ok),
+      (mode_est_GB3 != ok),
+      (mode_est_BB1 != ok),
+      (mode_est_BB2 != ok),
+      (mode_est_BB3 != ok),
+      (mode_est_G1 != ok),
+      (mode_est_G2 != ok),
+      (mode_est_G3 != ok));
+
+
+  -- Definition of the components signals used to monitor their funtionality --
+  DEFINE
+    fault_event_open_CBs := mode_event_CBs[0];
+    fault_event_closed_CBs := mode_event_CBs[1];
+    nominal_event_CBs := mode_event_CBs[2];
+
+    fault_event_off_Gs := mode_event_Gs[0];
+    nominal_event_Gs := mode_event_Gs[1];
+
+    index_GB1 := 0;
+    index_GB2 := 1;
+    index_GB3 := 2;
+
+    index_BB1 := 3;
+    index_BB2 := 4;
+    index_BB3 := 5;
+
+    index_G1 := 0;
+    index_G2 := 1;
+    index_G3 := 2;
+
+  ASSIGN
+    init(mode_est_GB1) := ok;
+    next(mode_est_GB1) :=
+      case
+        fault_event_open_CBs[index_GB1] : ko_open;
+        fault_event_closed_CBs[index_GB1] : ko_closed;
+        nominal_event_CBs[index_GB1] : ok;
+        TRUE : mode_est_GB1;
+      esac;
+
+  ASSIGN
+    init(mode_est_GB2) := ok;
+    next(mode_est_GB2) :=
+      case
+        fault_event_open_CBs[index_GB2] : ko_open;
+        fault_event_closed_CBs[index_GB2] : ko_closed;
+        nominal_event_CBs[index_GB2] : ok;
+        TRUE : mode_est_GB2;
+      esac;
+
+  ASSIGN
+    init(mode_est_GB3) := ok;
+    next(mode_est_GB3) :=
+      case
+        fault_event_open_CBs[index_GB3] : ko_open;
+        fault_event_closed_CBs[index_GB3] : ko_closed;
+        nominal_event_CBs[index_GB3] : ok;
+        TRUE : mode_est_GB3;
+      esac;
+
+  ASSIGN
+    init(mode_est_BB1) := ok;
+    next(mode_est_BB1) :=
+      case
+        fault_event_open_CBs[index_BB1] : ko_open;
+        fault_event_closed_CBs[index_BB1] : ko_closed;
+        nominal_event_CBs[index_BB1] : ok;
+        TRUE : mode_est_BB1;
+      esac;
+
+  ASSIGN
+    init(mode_est_BB2) := ok;
+    next(mode_est_BB2) :=
+      case
+        fault_event_open_CBs[index_BB2] : ko_open;
+        fault_event_closed_CBs[index_BB2] : ko_closed;
+        nominal_event_CBs[index_BB2] : ok;
+        TRUE : mode_est_BB2;
+      esac;
+
+
+    init(mode_est_BB3) := ok;
+    next(mode_est_BB3) :=
+      case
+        fault_event_open_CBs[index_BB3] : ko_open;
+        fault_event_closed_CBs[index_BB3] : ko_closed;
+        nominal_event_CBs[index_BB3] : ok;
+        TRUE : mode_est_BB3;
+      esac;
+
+  ASSIGN
+    init(mode_est_G1) := ok;
+    next(mode_est_G1) :=
+      case
+        fault_event_off_Gs[index_G1] : ko;
+        nominal_event_Gs[index_G1] : ok;
+        TRUE : mode_est_G1;
+      esac;
+
+  ASSIGN
+    init(mode_est_G2) := ok;
+    next(mode_est_G2) :=
+      case
+        fault_event_off_Gs[index_G2] : ko;
+        nominal_event_Gs[index_G2] : ok;
+        TRUE : mode_est_G2;
+      esac;
+
+  ASSIGN
+    init(mode_est_G3) := ok;
+    next(mode_est_G3) :=
+      case
+        fault_event_off_Gs[index_G3] : ko;
+        nominal_event_Gs[index_G3] : ok;
+        TRUE : mode_est_G3;
+      esac;
+
+  ASSIGN
+    init(state_est_G1) := init_state_Gs[index_G1];
+    next(state_est_G1) :=
+      case
+        fault_event_off_Gs[index_G1] : off;
+ (next(mode_est_G1) = ok) & (cmd_to_Gs[index_G1] = cmd_on) : on;
+ (next(mode_est_G1) = ok) & (cmd_to_Gs[index_G1] = cmd_off) : off;
+        TRUE : state_est_G1;
+      esac;
+
+  ASSIGN
+    init(state_est_G2) := init_state_Gs[index_G2];
+    next(state_est_G2) :=
+      case
+        fault_event_off_Gs[index_G2] : off;
+ (next(mode_est_G2) = ok) & (cmd_to_Gs[index_G2] = cmd_on) : on;
+ (next(mode_est_G2) = ok) & (cmd_to_Gs[index_G2] = cmd_off) : off;
+        TRUE : state_est_G2;
+      esac;
+
+  ASSIGN
+    init(state_est_G3) := init_state_Gs[index_G3];
+    next(state_est_G3) :=
+      case
+        fault_event_off_Gs[index_G3] : off;
+ (next(mode_est_G3) = ok) & (cmd_to_Gs[index_G3] = cmd_on) : on;
+ (next(mode_est_G3) = ok) & (cmd_to_Gs[index_G3] = cmd_off) : off;
+        TRUE : state_est_G3;
+      esac;
+
+  ASSIGN
+    init(state_est_GB1) := init_state_CBs[index_GB1];
+    next(state_est_GB1) :=
+      case
+        fault_event_open_CBs[index_GB1] : open;
+        fault_event_closed_CBs[index_GB1] : closed;
+ (next(mode_est_GB1) = ok) & (cmd_to_CBs[index_GB1] = cmd_open) : open;
+ (next(mode_est_GB1) = ok) & (cmd_to_CBs[index_GB1] = cmd_closed) : closed;
+        TRUE : state_est_GB1;
+      esac;
+
+  ASSIGN
+    init(state_est_GB2) := init_state_CBs[index_GB2];
+    next(state_est_GB2) :=
+      case
+        fault_event_open_CBs[index_GB2] : open;
+        fault_event_closed_CBs[index_GB2] : closed;
+ (next(mode_est_GB2) = ok) & (cmd_to_CBs[index_GB2] = cmd_open) : open;
+ (next(mode_est_GB2) = ok) & (cmd_to_CBs[index_GB2] = cmd_closed) : closed;
+        TRUE : state_est_GB2;
+      esac;
+
+  ASSIGN
+    init(state_est_GB3) := init_state_CBs[index_GB3];
+    next(state_est_GB3) :=
+      case
+        fault_event_open_CBs[index_GB3] : open;
+        fault_event_closed_CBs[index_GB3] : closed;
+ (next(mode_est_GB3) = ok) & (cmd_to_CBs[index_GB3] = cmd_open) : open;
+ (next(mode_est_GB3) = ok) & (cmd_to_CBs[index_GB3] = cmd_closed) : closed;
+        TRUE : state_est_GB3;
+      esac;
+
+  ASSIGN
+    init(state_est_BB1) := init_state_CBs[index_BB1];
+    next(state_est_BB1) :=
+      case
+        fault_event_open_CBs[index_BB1] : open;
+        fault_event_closed_CBs[index_BB1] : closed;
+ (next(mode_est_BB1) = ok) & (cmd_to_CBs[index_BB1] = cmd_open) : open;
+ (next(mode_est_BB1) = ok) & (cmd_to_CBs[index_BB1] = cmd_closed) : closed;
+        TRUE : state_est_BB1;
+      esac;
+
+  ASSIGN
+    init(state_est_BB2) := init_state_CBs[index_BB2];
+    next(state_est_BB2) :=
+      case
+        fault_event_open_CBs[index_BB2] : open;
+        fault_event_closed_CBs[index_BB2] : closed;
+ (next(mode_est_BB2) = ok) & (cmd_to_CBs[index_BB2] = cmd_open) : open;
+ (next(mode_est_BB2) = ok) & (cmd_to_CBs[index_BB2] = cmd_closed) : closed;
+        TRUE : state_est_BB2;
+      esac;
+
+  ASSIGN
+    init(state_est_BB3) := init_state_CBs[index_BB3];
+    next(state_est_BB3) :=
+      case
+        fault_event_open_CBs[index_BB3] : open;
+        fault_event_closed_CBs[index_BB3] : closed;
+ (next(mode_est_BB3) = ok) & (cmd_to_CBs[index_BB3] = cmd_open) : open;
+ (next(mode_est_BB3) = ok) & (cmd_to_CBs[index_BB3] = cmd_closed) : closed;
+        TRUE : state_est_BB3;
+      esac;
+
+  -- END MODULE MONITOR --
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG_CC.fei b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG_CC.fei
new file mode 100644
index 0000000000000000000000000000000000000000..26d37c956a8ba5056e704776b6cbff49860f7f7f
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG_CC.fei
@@ -0,0 +1,49 @@
+/-- Description of the whole fault extension
+    (multiline)
+--/
+FAULT EXTENSION FE_SC_TMG
+
+  EXTENSION OF MODULE Generator
+     /-- Description of Fault Slice Gen_StuckOff --/
+     SLICE Gen_StuckOff AFFECTS state WITH
+
+       /-- Description of fault mode stuckAt_Off --/
+       MODE stuckAt_Off : Permanent StuckAtByValue_D(
+    		  data term << off,
+                  data input << state,
+                  data varout >> state,
+                  event failure >> fault_event_stuck_at_off);
+
+
+  EXTENSION OF MODULE Switch
+
+     /-- Description of Fault Model for Switch --/
+     SLICE Switch_StuckClosed_StuckOpen
+      AFFECTS state WITH
+
+        /-- Description of fault mode StuckAt_Closed --/
+        MODE stuckAt_Closed : Transient StuckAtByValue_D(
+                  data term << closed,
+                  data input << state,
+                  data varout >> state,
+                  template self_fix = self_fixed,
+                  event failure >> fault_event_stuck_at_closed,
+                  event self_fixed >> nominal_event);
+
+        /-- Description of fault mode StuckAt_Open --/
+        MODE stuckAt_Open : Transient StuckAtByValue_D(data term << open,
+                  data input << state,
+                  data varout >> state,
+                  template self_fix = self_fixed,
+                  event failure >> fault_event_stuck_at_open,
+                  event self_fixed >> nominal_event);
+
+  COMMON CAUSES
+       CAUSE CC2
+         MODULE Generator
+           FOR INSTANCES SC.G[12]
+           MODE Gen_StuckOff.stuckAt_Off WITHIN 0 .. 0;
+
+       CAUSE CC3
+         MODULE Generator
+           MODE Gen_StuckOff.stuckAt_Off WITHIN 1 .. 2;
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG_CC_prob.fei b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG_CC_prob.fei
new file mode 100644
index 0000000000000000000000000000000000000000..43ea4eca58e2ab622a72822e0cc6b5375505ed56
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG_CC_prob.fei
@@ -0,0 +1,49 @@
+/-- Description of the whole fault extension
+    (multiline)
+--/
+FAULT EXTENSION FE_SC_TMG
+
+  EXTENSION OF MODULE Generator
+     /-- Description of Fault Slice Gen_StuckOff --/
+     SLICE Gen_StuckOff AFFECTS state WITH
+
+       /-- Description of fault mode stuckAt_Off --/
+       MODE stuckAt_Off {1.e-7} : Permanent StuckAtByValue_D(
+    		  data term << off,
+                  data input << state,
+                  data varout >> state,
+                  event failure >> fault_event_stuck_at_off);
+
+
+  EXTENSION OF MODULE Switch
+
+     /-- Description of Fault Model for Switch --/
+     SLICE Switch_StuckClosed_StuckOpen
+      AFFECTS state WITH
+
+        /-- Description of fault mode StuckAt_Closed --/
+        MODE stuckAt_Closed : Transient StuckAtByValue_D(
+                  data term << closed,
+                  data input << state,
+                  data varout >> state,
+                  template self_fix = self_fixed,
+                  event failure >> fault_event_stuck_at_closed,
+                  event self_fixed >> nominal_event);
+
+        /-- Description of fault mode StuckAt_Open --/
+        MODE stuckAt_Open {0.25} : Transient StuckAtByValue_D(data term << open,
+                  data input << state,
+                  data varout >> state,
+                  template self_fix = self_fixed,
+                  event failure >> fault_event_stuck_at_open,
+                  event self_fixed >> nominal_event);
+
+  COMMON CAUSES
+       CAUSE CC1 {1.5e-8}
+         MODULE Generator
+           FOR INSTANCES SC.G[12]
+           MODE Gen_StuckOff.stuckAt_Off WITHIN 0 .. 0;
+
+       CAUSE CC3
+         MODULE Generator
+           MODE Gen_StuckOff.stuckAt_Off WITHIN 1 .. 2;
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG_CC_prob_latent.fei b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG_CC_prob_latent.fei
new file mode 100644
index 0000000000000000000000000000000000000000..817d3f4f7558472aab39fed2467e51dd5f27f595
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/SC_TMG_CC_prob_latent.fei
@@ -0,0 +1,49 @@
+/-- Description of the whole fault extension
+    (multiline)
+--/
+FAULT EXTENSION FE_SC_TMG
+
+  EXTENSION OF MODULE Generator
+     /-- Description of Fault Slice Gen_StuckOff --/
+     SLICE Gen_StuckOff AFFECTS state WITH
+
+       /-- Description of fault mode stuckAt_Off --/
+       MODE stuckAt_Off {prob:1.e-7, latent:yes, latent_prob:1.e-6} : Permanent StuckAtByValue_D(
+    		  data term << off,
+                  data input << state,
+                  data varout >> state,
+                  event failure >> fault_event_stuck_at_off);
+
+
+  EXTENSION OF MODULE Switch
+
+     /-- Description of Fault Model for Switch --/
+     SLICE Switch_StuckClosed_StuckOpen
+      AFFECTS state WITH
+
+        /-- Description of fault mode StuckAt_Closed --/
+        MODE stuckAt_Closed : Transient StuckAtByValue_D(
+                  data term << closed,
+                  data input << state,
+                  data varout >> state,
+                  template self_fix = self_fixed,
+                  event failure >> fault_event_stuck_at_closed,
+                  event self_fixed >> nominal_event);
+
+        /-- Description of fault mode StuckAt_Open --/
+        MODE stuckAt_Open {0.25} : Transient StuckAtByValue_D(data term << open,
+                  data input << state,
+                  data varout >> state,
+                  template self_fix = self_fixed,
+                  event failure >> fault_event_stuck_at_open,
+                  event self_fixed >> nominal_event);
+
+  COMMON CAUSES
+       CAUSE CC1 {prob:1.5e-8}
+         MODULE Generator
+           FOR INSTANCES SC.G[12]
+           MODE Gen_StuckOff.stuckAt_Off WITHIN 0 .. 0;
+
+       CAUSE CC3
+         MODULE Generator
+           MODE Gen_StuckOff.stuckAt_Off WITHIN 1 .. 2;
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/SC_TMG.axml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/SC_TMG.axml
new file mode 100644
index 0000000000000000000000000000000000000000..8e06fd4bae795ae58ccaa24cb2edb7dece43768e
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/SC_TMG.axml
@@ -0,0 +1,71 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<associations>
+  <failureModes>
+
+    <!-- generator: stuck off -->
+    <!--
+    <assoc id="G1_stuck_off" expr="SC.G1.Gen_StuckOff.mode_is_stuckAt_Off"/>
+    <assoc id="G2_stuck_off" expr="SC.G2.Gen_StuckOff.mode_is_stuckAt_Off"/>
+    <assoc id="G3_stuck_off" expr="SC.G3.Gen_StuckOff.mode_is_stuckAt_Off"/>
+    -->
+
+    <!-- circuit breakers: stuck open -->
+    <assoc id="GB1_stuck_open" expr="SC.GB1.Switch_StuckClosed_StuckOpen.mode_is_stuckAt_Open"/>
+    <assoc id="GB2_stuck_open" expr="SC.GB2.Switch_StuckClosed_StuckOpen.mode_is_stuckAt_Open"/>
+    <assoc id="GB3_stuck_open" expr="SC.GB3.Switch_StuckClosed_StuckOpen.mode_is_stuckAt_Open"/>
+    <assoc id="BB1_stuck_open" expr="SC.BB1.Switch_StuckClosed_StuckOpen.mode_is_stuckAt_Open"/>
+    <assoc id="BB2_stuck_open" expr="SC.BB2.Switch_StuckClosed_StuckOpen.mode_is_stuckAt_Open"/>
+    <assoc id="BB3_stuck_open" expr="SC.BB3.Switch_StuckClosed_StuckOpen.mode_is_stuckAt_Open"/>
+    <!--
+    -->
+
+    <!-- circuit breakers: stuck closed -->
+    <!--
+    <assoc id="GB1_stuck_closed" expr="SC.GB1.Switch_StuckClosed_StuckOpen.mode_is_stuckAt_Closed"/>
+    <assoc id="GB2_stuck_closed" expr="SC.GB2.Switch_StuckClosed_StuckOpen.mode_is_stuckAt_Closed"/>
+    <assoc id="GB3_stuck_closed" expr="SC.GB3.Switch_StuckClosed_StuckOpen.mode_is_stuckAt_Closed"/>
+    <assoc id="BB1_stuck_closed" expr="SC.BB1.Switch_StuckClosed_StuckOpen.mode_is_stuckAt_Closed"/>
+    <assoc id="BB2_stuck_closed" expr="SC.BB2.Switch_StuckClosed_StuckOpen.mode_is_stuckAt_Closed"/>
+    <assoc id="BB3_stuck_closed" expr="SC.BB3.Switch_StuckClosed_StuckOpen.mode_is_stuckAt_Closed"/>
+    -->
+
+  </failureModes>
+  <monitoredDiscrepancies>
+
+    <!-- double power generation: two generators are on -->
+    <!--
+    <assoc id="DoublePowerUsage" expr="count(SC.G1.is_on, SC.G2.is_on, SC.G3.is_on) = 2"/>
+    -->
+
+    <!-- triple power generation: three generators are on -->
+    <assoc id="TriplePowerUsage" expr="count(SC.G1.is_on, SC.G2.is_on, SC.G3.is_on) = 3"/>
+
+  </monitoredDiscrepancies>
+  <unmonitoredDiscrepancies>
+
+    <!-- bus: broken -->
+    <!--
+    <assoc id="B1_broken" expr="SC.B1.is_broken"/>
+    <assoc id="B2_broken" expr="SC.B2.is_broken"/>
+    <assoc id="B3_broken" expr="SC.B3.is_broken"/>
+    -->
+
+    <!-- inconsistent power usage: some power src is on, but some bus is not powered -->
+    <assoc id="InconsPowerUsage" expr="count(SC.G1.is_on, SC.G2.is_on, SC.G3.is_on) &gt; 0 &amp; count(SC.B1.is_powered, SC.B2.is_powered, SC.B3.is_powered) &lt; 3"/>
+
+  </unmonitoredDiscrepancies>
+  <tfpgModes>
+
+    <!-- we regard power routing configurations as the modes of interest -->
+
+    <assoc id="R1" expr="(SC.GB1.is_open &amp; SC.GB2.is_closed &amp; SC.GB3.is_closed &amp; SC.BB1.is_open &amp; SC.BB2.is_closed &amp; SC.BB3.is_open)"/>
+    <assoc id="R2" expr="(SC.GB1.is_closed &amp; SC.GB2.is_open &amp; SC.GB3.is_closed &amp; SC.BB1.is_open &amp; SC.BB2.is_open &amp; SC.BB3.is_closed)"/>
+    <assoc id="R3" expr="(SC.GB1.is_closed &amp; SC.GB2.is_closed &amp; SC.GB3.is_open &amp; SC.BB1.is_closed &amp; SC.BB2.is_open &amp; SC.BB3.is_open)"/>
+    <assoc id="RX" expr="
+        !(SC.GB1.is_open &amp; SC.GB2.is_closed &amp; SC.GB3.is_closed &amp; SC.BB1.is_open &amp; SC.BB2.is_closed &amp; SC.BB3.is_open) &amp;
+        !(SC.GB1.is_closed &amp; SC.GB2.is_open &amp; SC.GB3.is_closed &amp; SC.BB1.is_open &amp; SC.BB2.is_open &amp; SC.BB3.is_closed) &amp;
+        !(SC.GB1.is_closed &amp; SC.GB2.is_closed &amp; SC.GB3.is_open &amp; SC.BB1.is_closed &amp; SC.BB2.is_open &amp; SC.BB3.is_open) "/>
+
+  </tfpgModes>
+</associations>
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/SC_TMG_synthesized.txml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/SC_TMG_synthesized.txml
new file mode 100644
index 0000000000000000000000000000000000000000..2748ed35172123270692453d076bcbe58547cc10
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/SC_TMG_synthesized.txml
@@ -0,0 +1,178 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<tfpg name="DependencyGraph">
+  <nodesList>
+    <node name="BB1_stuck_open" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="BB3_stuck_open" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="InconsPowerUsage" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="BB2_stuck_open" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="intermediateNode_1" isMonitored="false">
+      <type>AND</type>
+    </node>
+    <node name="GB1_stuck_open" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="GB2_stuck_open" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="GB3_stuck_open" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="intermediateNode_2" isMonitored="false">
+      <type>AND</type>
+    </node>
+    <node name="TriplePowerUsage" isMonitored="true">
+      <type>AND</type>
+    </node>
+    <node name="intermediateNode_3" isMonitored="false">
+      <type>AND</type>
+    </node>
+  </nodesList>
+  <modesList>
+    <mode>R1</mode>
+    <mode>R2</mode>
+    <mode>RX</mode>
+    <mode>R3</mode>
+  </modesList>
+  <edgesList>
+    <edge name="EDGE1">
+      <srcNode>intermediateNode_1</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+      <mode>R1</mode>
+      <mode>R2</mode>
+      <mode>RX</mode>
+      <mode>R3</mode>
+      </modesList>
+      <destNode>InconsPowerUsage</destNode>
+    </edge>
+    <edge name="EDGE2">
+      <srcNode>intermediateNode_2</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+      <mode>R1</mode>
+      <mode>R2</mode>
+      <mode>RX</mode>
+      <mode>R3</mode>
+      </modesList>
+      <destNode>InconsPowerUsage</destNode>
+    </edge>
+    <edge name="EDGE3">
+      <srcNode>intermediateNode_3</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+      <mode>R1</mode>
+      <mode>R2</mode>
+      <mode>RX</mode>
+      <mode>R3</mode>
+      </modesList>
+      <destNode>InconsPowerUsage</destNode>
+    </edge>
+    <edge name="EDGE4">
+      <srcNode>BB1_stuck_open</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+      <mode>R1</mode>
+      <mode>R2</mode>
+      <mode>RX</mode>
+      <mode>R3</mode>
+      </modesList>
+      <destNode>intermediateNode_1</destNode>
+    </edge>
+    <edge name="EDGE5">
+      <srcNode>BB3_stuck_open</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+      <mode>R1</mode>
+      <mode>R2</mode>
+      <mode>RX</mode>
+      <mode>R3</mode>
+      </modesList>
+      <destNode>intermediateNode_1</destNode>
+    </edge>
+    <edge name="EDGE6">
+      <srcNode>BB1_stuck_open</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+      <mode>R1</mode>
+      <mode>R2</mode>
+      <mode>RX</mode>
+      <mode>R3</mode>
+      </modesList>
+      <destNode>intermediateNode_2</destNode>
+    </edge>
+    <edge name="EDGE7">
+      <srcNode>BB2_stuck_open</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+      <mode>R1</mode>
+      <mode>R2</mode>
+      <mode>RX</mode>
+      <mode>R3</mode>
+      </modesList>
+      <destNode>intermediateNode_2</destNode>
+    </edge>
+    <edge name="EDGE8">
+      <srcNode>BB2_stuck_open</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+      <mode>R1</mode>
+      <mode>R2</mode>
+      <mode>RX</mode>
+      <mode>R3</mode>
+      </modesList>
+      <destNode>TriplePowerUsage</destNode>
+    </edge>
+    <edge name="EDGE9">
+      <srcNode>BB3_stuck_open</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+      <mode>R1</mode>
+      <mode>R2</mode>
+      <mode>RX</mode>
+      <mode>R3</mode>
+      </modesList>
+      <destNode>TriplePowerUsage</destNode>
+    </edge>
+    <edge name="EDGE10">
+      <srcNode>BB2_stuck_open</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+      <mode>R1</mode>
+      <mode>R2</mode>
+      <mode>RX</mode>
+      <mode>R3</mode>
+      </modesList>
+      <destNode>intermediateNode_3</destNode>
+    </edge>
+    <edge name="EDGE11">
+      <srcNode>BB3_stuck_open</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+      <mode>R1</mode>
+      <mode>R2</mode>
+      <mode>RX</mode>
+      <mode>R3</mode>
+      </modesList>
+      <destNode>intermediateNode_3</destNode>
+    </edge>
+  </edgesList>
+</tfpg>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/SC_TMG_refined.tfpg b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/SC_TMG_refined.tfpg
new file mode 100644
index 0000000000000000000000000000000000000000..e5553616e80a86022f6b9e858dac34f99f750fa8
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/SC_TMG_refined.tfpg
@@ -0,0 +1,31 @@
+NAME DependencyGraph
+INFINITY_SEMANTICS_CLOSED
+
+FM BB1_stuck_open
+FM BB2_stuck_open
+FM BB3_stuck_open
+
+FM GB1_stuck_open
+FM GB2_stuck_open
+FM GB3_stuck_open
+
+AND BB1_BB2_stucked
+AND BB1_BB3_stucked
+AND BB2_BB3_stucked
+
+OR InconsPowerUsage
+AND TriplePowerUsage MONITORED
+
+MODES R1,R2,R3,RX
+
+EDGE EDGE1 BB1_BB3_stucked InconsPowerUsage 0.0 1.0 (R1,R3)
+EDGE EDGE2 BB1_BB2_stucked InconsPowerUsage 0.0 1.0 (R1,R2)
+EDGE EDGE3 BB2_BB3_stucked InconsPowerUsage 0.0 1.0 (R2,R3)
+EDGE EDGE4 BB1_stuck_open BB1_BB3_stucked 0.0 INFINITY (R1,R3)
+EDGE EDGE5 BB3_stuck_open BB1_BB3_stucked 0.0 INFINITY (R1,R3)
+EDGE EDGE6 BB1_stuck_open BB1_BB2_stucked 0.0 INFINITY (R1,R2)
+EDGE EDGE7 BB2_stuck_open BB1_BB2_stucked 0.0 INFINITY (R1,R2)
+EDGE EDGE8 BB2_stuck_open TriplePowerUsage 0.0 INFINITY (R2,R3)
+EDGE EDGE9 BB3_stuck_open TriplePowerUsage 0.0 INFINITY (R2,R3)
+EDGE EDGE10 BB2_stuck_open BB2_BB3_stucked 0.0 INFINITY (R2,R3)
+EDGE EDGE11 BB3_stuck_open BB2_BB3_stucked 0.0 INFINITY (R2,R3)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/scen_1.sc b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/scen_1.sc
new file mode 100644
index 0000000000000000000000000000000000000000..c48528645cd02ecfbd276edac7e105d7387a14a9
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/scen_1.sc
@@ -0,0 +1,6 @@
+#BB3_stuck_open True
+BB3_stuck_open 0
+#BB2_stuck_open True
+BB2_stuck_open 1
+#TriplePowerUsage True
+TriplePowerUsage 1
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/scen_1_not_possible.sc b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/scen_1_not_possible.sc
new file mode 100644
index 0000000000000000000000000000000000000000..10184d9e2cb614968f12acc45de8d275640e50ab
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/scen_1_not_possible.sc
@@ -0,0 +1,3 @@
+BB3_stuck_open 0
+BB2_stuck_open 1
+TriplePowerUsage 0
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/scen_2.sc b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/scen_2.sc
new file mode 100644
index 0000000000000000000000000000000000000000..c48528645cd02ecfbd276edac7e105d7387a14a9
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/scen_2.sc
@@ -0,0 +1,6 @@
+#BB3_stuck_open True
+BB3_stuck_open 0
+#BB2_stuck_open True
+BB2_stuck_open 1
+#TriplePowerUsage True
+TriplePowerUsage 1
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/scen_3.sc b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/scen_3.sc
new file mode 100644
index 0000000000000000000000000000000000000000..b790a0efaeb331b7c54b665bb9214c976fc3aafb
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/fe/triple_modular_generator/tfpg/smt/scen_3.sc
@@ -0,0 +1,4 @@
+#BB3_stuck_open True
+#BB2_stuck_open True
+#TriplePowerUsage True
+#mode R3
\ No newline at end of file
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/battery_sensor_fdir/battery_sensor_fdir.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/battery_sensor_fdir/battery_sensor_fdir.smv
new file mode 100644
index 0000000000000000000000000000000000000000..734f7a271622353af71ffcb5f01070afd73df5bb
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/battery_sensor_fdir/battery_sensor_fdir.smv
@@ -0,0 +1,265 @@
+
+-- ===============================================================================
+MODULE main
+    VAR
+        G1 : Generator_#Extended;
+        G2 : Generator_#Extended;
+        B1 : Battery(TRUE, G1.has_power, mode, t_#delta);
+        B2 : Battery(FALSE, G2.has_power, mode, t_#delta);
+        S1 : Sensor_#Extended(sensor_1_power_in, mode, t_#delta);
+        S2 : Sensor_#Extended(sensor_2_power_in, mode, t_#delta);
+        fdir : FDIR(B1, B2);
+        _masterCC : MasterCC#;
+    VAR
+        mode : {Primary, Secondary1, Secondary2};
+        done_delta : boolean;
+
+    IVAR
+        t_#delta : 0 .. 1;
+
+    DEFINE
+        timed := t_#delta > 0;
+        sensor_1_power_in := case
+mode in Primary union Secondary1 : B1.power_out;
+mode = Secondary2 : B2.power_out;
+esac;
+        sensor_2_power_in := case
+mode in Primary union Secondary2 : B2.power_out;
+mode = Secondary1 : B1.power_out;
+esac;
+        is_alive := (S1.reading_out | S2.reading_out);
+
+    INIT !done_delta;
+
+    INIT mode = Primary;
+
+    TRANS (timed -> (!done_delta & next(done_delta)));
+
+    TRANS (!timed -> !next(done_delta));
+
+    TRANS (!timed -> next(mode) = fdir.rec_mode);
+
+    TRANS (timed -> next(mode) = mode);
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Generator_#Extended
+    VAR
+        Gen_StuckAtFalse : Gen_StuckAtFalse_FM_Mod(has_power_#nominal, FALSE);
+    VAR
+        has_power_#nominal : boolean;
+
+    DEFINE
+        has_power := Gen_StuckAtFalse.has_power_#fault;
+
+    ASSIGN
+        init(has_power_#nominal) := TRUE;
+        next(has_power_#nominal) := TRUE;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Gen_StuckAtFalse_FM_Mod(has_power__#read, term_#1)
+    VAR
+        stuckAt_False : stuckAt_False_fm_Mod(mode = NOMINAL, mode_is_stuckAt_False, term_#1, has_power__#read, has_power__#write, event = stuckAt_False#failure, event = _#NoEvent);
+    VAR
+        mode : {NOMINAL, stuckAt_False#FAULT};
+        has_power__#write : boolean;
+
+    IVAR
+        event : {_#NoEvent, stuckAt_False#failure};
+
+    DEFINE
+        NoEvent := event = _#NoEvent;
+        cando_stuckAt_False#FAULT := ((mode = NOMINAL & stuckAt_False.trans_trig_guard_#0) | (mode = stuckAt_False#FAULT & stuckAt_False.trans_trig_guard_#1));
+        has_power_#fault := case
+mode = NOMINAL : has_power__#read;
+mode_is_stuckAt_False : has_power__#write;
+TRUE : has_power__#read;
+esac;
+        mode_is_stuckAt_False := mode = stuckAt_False#FAULT;
+
+    INIT mode = NOMINAL;
+
+    TRANS case
+((mode = stuckAt_False#FAULT & stuckAt_False.trans_trig_guard_#1) | (mode = NOMINAL & stuckAt_False.trans_trig_guard_#0)) : next(mode) = stuckAt_False#FAULT;
+TRUE : (next(mode) = mode & NoEvent);
+esac;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_False_fm_Mod(is_nominal, is_fault, term, input, varout, _failure, ev_#NoEvent)
+    VAR
+        stuckAt_FalseEM : stuckAt_False_fm_EM_Mod(is_nominal, is_fault, term, input, varout);
+    DEFINE
+        failure := _failure;
+        NoEvent := ev_#NoEvent;
+        trans_trig_guard_#0 := failure;
+        trans_trig_guard_#1 := NoEvent;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE stuckAt_False_fm_EM_Mod(is_nominal, is_fault, term, input, varout)
+    TRANS (!(!is_fault & next(is_fault)) | next(varout) = term);
+
+    TRANS (!(is_fault & next(is_fault)) | next(varout) = varout);
+
+    TRANS (!(is_nominal & next(is_nominal)) | next(varout) = varout);
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Battery(id_1, power_in, mode, t_#delta)
+    VAR
+        power_out : boolean;
+        charge : 0 .. 10;
+        level_low : boolean;
+
+    DEFINE
+        no_discharging := ((mode = Secondary1 & !id_1) | (mode = Secondary2 & id_1));
+        discharge_rate := case
+no_discharging : 0;
+mode = Primary : 1;
+TRUE : 2;
+esac;
+
+    ASSIGN
+        init(power_out) := TRUE;
+        init(level_low) := (charge >= 2 & charge < 5);
+        init(charge) := 6 .. 10;
+        next(power_out) := case
+t_#delta > 0 : power_out;
+TRUE : next((charge >= 2 | power_in));
+esac;
+
+        next(level_low) := case
+t_#delta > 0 : level_low;
+TRUE : next((charge >= 2 & charge < 5));
+esac;
+
+        next(charge) := case
+t_#delta = 0 : charge;
+power_in :  (charge + 1 < 10 ? charge + 1 : 10) ;
+TRUE :  (charge - discharge_rate < 0 ? 0 : charge - discharge_rate) ;
+esac;
+
+    TRANS (level_low != next(level_low) -> mode = next(mode));
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Sensor_#Extended(power_in, mode, t_#delta)
+    VAR
+        Sensor_StuckAtFalse : Sensor_StuckAtFalse_FM_Mod(has_power_#nominal, FALSE);
+    VAR
+        residual_charge : 0 .. 2;
+        rnd_discharge : 1 .. 2;
+        has_power_#nominal : boolean;
+        reading_out : boolean;
+
+    DEFINE
+        has_power := Sensor_StuckAtFalse.has_power_#fault;
+
+    ASSIGN
+        init(has_power_#nominal) := power_in;
+        init(residual_charge) := 2;
+        init(reading_out) := TRUE;
+        next(has_power_#nominal) := next(power_in);
+
+        next(residual_charge) := case
+t_#delta = 0 : residual_charge;
+has_power : 2;
+TRUE :  (0 < residual_charge - rnd_discharge ? residual_charge - rnd_discharge : 0) ;
+esac;
+
+        next(reading_out) := case
+t_#delta > 0 : reading_out;
+TRUE : next(residual_charge > 0);
+esac;
+
+    TRANS (reading_out != next(reading_out) -> mode = next(mode));
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE Sensor_StuckAtFalse_FM_Mod(has_power__#read, term_#1)
+    VAR
+        stuckAt_False : stuckAt_False_fm_Mod(mode = NOMINAL, mode_is_stuckAt_False, term_#1, has_power__#read, has_power__#write, event = stuckAt_False#failure, event = _#NoEvent);
+    VAR
+        mode : {NOMINAL, stuckAt_False#FAULT};
+        has_power__#write : boolean;
+
+    IVAR
+        event : {_#NoEvent, stuckAt_False#failure};
+
+    DEFINE
+        NoEvent := event = _#NoEvent;
+        cando_stuckAt_False#FAULT := ((mode = NOMINAL & stuckAt_False.trans_trig_guard_#0) | (mode = stuckAt_False#FAULT & stuckAt_False.trans_trig_guard_#1));
+        has_power_#fault := case
+mode = NOMINAL : has_power__#read;
+mode_is_stuckAt_False : has_power__#write;
+TRUE : has_power__#read;
+esac;
+        mode_is_stuckAt_False := mode = stuckAt_False#FAULT;
+
+    INIT mode = NOMINAL;
+
+    TRANS case
+((mode = stuckAt_False#FAULT & stuckAt_False.trans_trig_guard_#1) | (mode = NOMINAL & stuckAt_False.trans_trig_guard_#0)) : next(mode) = stuckAt_False#FAULT;
+TRUE : (next(mode) = mode & NoEvent);
+esac;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE FDIR(batt_1, batt_2)
+    VAR
+        rec_mode : {Primary, Secondary1, Secondary2};
+
+    ASSIGN
+        init(rec_mode) := Primary;
+        next(rec_mode) := case
+(!batt_1.level_low & !batt_2.level_low) : Primary;
+(!batt_1.level_low & batt_2.level_low) : Secondary1;
+(batt_1.level_low & !batt_2.level_low) : Secondary2;
+TRUE : rec_mode;
+esac;
+
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
+
+-- ===============================================================================
+MODULE MasterCC#
+
+-- ===============================================================================
+--                               End of module
+-- ===============================================================================
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/battery_sensor_fdir/battery_sensor_fdir.tfpga b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/battery_sensor_fdir/battery_sensor_fdir.tfpga
new file mode 100644
index 0000000000000000000000000000000000000000..b4b457a859e99befe3c625ac49c065d5b54194dd
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/battery_sensor_fdir/battery_sensor_fdir.tfpga
@@ -0,0 +1,25 @@
+
+FAILURE_MODES
+G1_Off G1.Gen_StuckAtFalse.mode_is_stuckAt_False
+G2_Off G2.Gen_StuckAtFalse.mode_is_stuckAt_False
+S1_Off S1.Sensor_StuckAtFalse.mode_is_stuckAt_False
+S2_Off S2.Sensor_StuckAtFalse.mode_is_stuckAt_False
+
+MONITORED_DISCREPANCIES
+B1_LOW B1.level_low
+B2_LOW B2.level_low
+System_Dead !is_alive
+
+UNMONITORED_DISCREPANCIES
+G1_DEAD G1.has_power = FALSE
+G2_DEAD G2.has_power = FALSE
+S1_WO S1.reading_out = FALSE
+S2_WO S2.reading_out = FALSE
+B1_DEAD B1.power_out = FALSE
+B2_DEAD B2.power_out = FALSE
+
+MODES
+Primary mode = Primary
+Secondary1 mode = Secondary1
+Secondary2 mode = Secondary2
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/battery_sensor_fdir/battery_sensor_fdir.txml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/battery_sensor_fdir/battery_sensor_fdir.txml
new file mode 100644
index 0000000000000000000000000000000000000000..3fc1d76c80687d9ffe77823ef628802287d07d0a
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/battery_sensor_fdir/battery_sensor_fdir.txml
@@ -0,0 +1,213 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<tfpg name="DependencyGraph_tightened" infty_semantics="closed">
+  <nodesList>
+    <node name="G1_Off" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="S2_Off" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="S1_Off" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="G2_Off" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="S1_WO" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="G1_DEAD" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="G2_DEAD" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="S2_WO" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="B2_LOW" isMonitored="true">
+      <type>OR</type>
+    </node>
+    <node name="B1_LOW" isMonitored="true">
+      <type>OR</type>
+    </node>
+    <node name="System_Dead" isMonitored="true">
+      <type>AND</type>
+    </node>
+    <node name="B1_DEAD" isMonitored="false">
+      <type>AND</type>
+    </node>
+    <node name="B2_DEAD" isMonitored="false">
+      <type>AND</type>
+    </node>
+  </nodesList>
+  <modesList>
+    <mode>Primary</mode>
+    <mode>Secondary1</mode>
+    <mode>Secondary2</mode>
+  </modesList>
+  <edgesList>
+    <edge name="EDGE1">
+      <srcNode>S1_Off</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary1</mode>
+        <mode>Secondary2</mode>
+      </modesList>
+      <destNode>S1_WO</destNode>
+    </edge>
+    <edge name="EDGE2">
+      <srcNode>B1_DEAD</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+        <mode>Secondary1</mode>
+      </modesList>
+      <destNode>S1_WO</destNode>
+    </edge>
+    <edge name="EDGE3">
+      <srcNode>B2_DEAD</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary2</mode>
+      </modesList>
+      <destNode>S1_WO</destNode>
+    </edge>
+    <edge name="EDGE4">
+      <srcNode>S1_WO</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary1</mode>
+        <mode>Secondary2</mode>
+      </modesList>
+      <destNode>System_Dead</destNode>
+    </edge>
+    <edge name="EDGE5">
+      <srcNode>S2_WO</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary1</mode>
+        <mode>Secondary2</mode>
+      </modesList>
+      <destNode>System_Dead</destNode>
+    </edge>
+    <edge name="EDGE6">
+      <srcNode>G1_Off</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary1</mode>
+      </modesList>
+      <destNode>G1_DEAD</destNode>
+    </edge>
+    <edge name="EDGE7">
+      <srcNode>G2_Off</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary2</mode>
+      </modesList>
+      <destNode>G2_DEAD</destNode>
+    </edge>
+    <edge name="EDGE8">
+      <srcNode>S2_Off</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary1</mode>
+        <mode>Secondary2</mode>
+      </modesList>
+      <destNode>S2_WO</destNode>
+    </edge>
+    <edge name="EDGE9">
+      <srcNode>B1_DEAD</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary1</mode>
+      </modesList>
+      <destNode>S2_WO</destNode>
+    </edge>
+    <edge name="EDGE10">
+      <srcNode>B2_DEAD</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+        <mode>Secondary2</mode>
+      </modesList>
+      <destNode>S2_WO</destNode>
+    </edge>
+    <edge name="EDGE11">
+      <srcNode>G2_DEAD</srcNode>
+      <tMin>2.0</tMin>
+      <tMax>6.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary2</mode>
+      </modesList>
+      <destNode>B2_LOW</destNode>
+    </edge>
+    <edge name="EDGE12">
+      <srcNode>B2_LOW</srcNode>
+      <tMin>2.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary1</mode>
+      </modesList>
+      <destNode>B1_DEAD</destNode>
+    </edge>
+    <edge name="EDGE13">
+      <srcNode>B1_LOW</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>3.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary1</mode>
+      </modesList>
+      <destNode>B1_DEAD</destNode>
+    </edge>
+    <edge name="EDGE14">
+      <srcNode>G1_DEAD</srcNode>
+      <tMin>2.0</tMin>
+      <tMax>6.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary1</mode>
+      </modesList>
+      <destNode>B1_LOW</destNode>
+    </edge>
+    <edge name="EDGE15">
+      <srcNode>B2_LOW</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>3.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary2</mode>
+      </modesList>
+      <destNode>B2_DEAD</destNode>
+    </edge>
+    <edge name="EDGE16">
+      <srcNode>B1_LOW</srcNode>
+      <tMin>2.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+        <mode>Primary</mode>
+        <mode>Secondary2</mode>
+      </modesList>
+      <destNode>B2_DEAD</destNode>
+    </edge>
+  </edgesList>
+</tfpg>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/cassini/cassini_param_2_2_2_2.axml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/cassini/cassini_param_2_2_2_2.axml
new file mode 100644
index 0000000000000000000000000000000000000000..c383b92455346b6be5d688b9462d9be3fdf5186f
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/cassini/cassini_param_2_2_2_2.axml
@@ -0,0 +1,37 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<associations>
+  <failureModes>
+    <assoc id="HT_leak" expr="HT.internal_leakage = leakage"/>
+    <assoc id="V2_leak" expr="V2.internal_leakage = leakage &amp; V2.state = open"/>
+    <assoc id="V3_leak" expr="V3.internal_leakage = leakage &amp; V3.state = open"/>
+    <assoc id="V4_leak" expr="V4.internal_leakage = leakage &amp; V4.state = open"/>
+    <assoc id="FT_leak" expr="FT.internal_leakage = leakage"/>
+    <assoc id="OT_leak" expr="OT.internal_leakage = leakage"/>
+    <assoc id="G9_leak" expr="V9_SEGMENT.NR_FAILURES > 0"/>
+    <assoc id="G10_leak" expr="V10_SEGMENT.NR_FAILURES > 0"/>
+    <assoc id="G11_leak" expr="V11_SEGMENT.NR_FAILURES > 0"/>
+    <assoc id="G12_leak" expr="V12_SEGMENT.NR_FAILURES > 0"/>
+  </failureModes>
+  <monitoredDiscrepancies>
+  </monitoredDiscrepancies>
+  <unmonitoredDiscrepancies>
+    <!-- common discrepancies -->
+    <assoc id="d_V1" expr="V1.state = open &amp; V1.p_out != HT.p_out"/>
+    <assoc id="d_V2" expr="V2.state = open &amp; V2.p_out != HT.p_out"/>
+    <assoc id="d_V3" expr="V3.state = open &amp; V3.p_out != PP1.p_out"/>
+    <assoc id="d_PV4" expr="PV4.state = open &amp; PV4.p_out != PP1.p_out"/>
+    <assoc id="d_FT" expr="FT.p_out != v3_pv3_p_out"/>
+    <assoc id="d_PV5" expr="PV5.state = open &amp; PV5.p_out != FT.p_out"/>
+    <assoc id="d_PV8" expr="PV8.state = open &amp; PV8.p_out != OT.p_out"/>
+    <assoc id="d_V13" expr="V13.state = open &amp; V13.p_out != V9_SEGMENT.p_out"/>
+    <!-- use-case specific discrepancies -->
+    <assoc id="d_V9_2" expr="config_fuel_segment=standard &amp; V9_SEGMENT.diff_vb_2"/>
+    <assoc id="d_V11_2" expr="config_fuel_segment=backup &amp; V11_SEGMENT.diff_vb_2"/>
+  </unmonitoredDiscrepancies>
+  <tfpgModes>
+    <assoc id="hsfs" expr="config_helium_segment=standard &amp; config_fuel_segment=standard"/>
+    <assoc id="hsfb" expr="config_helium_segment=standard &amp; config_fuel_segment=backup"/>
+    <assoc id="hbfs" expr="config_helium_segment=backup &amp; config_fuel_segment=standard"/>
+    <assoc id="hbfb" expr="config_helium_segment=backup &amp; config_fuel_segment=backup"/>
+  </tfpgModes>
+</associations>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/cassini/cassini_param_2_2_2_2.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/cassini/cassini_param_2_2_2_2.smv
new file mode 100644
index 0000000000000000000000000000000000000000..80ec4edcca922a5fdbc0ae1bc7bc50f38d4478c4
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/cassini/cassini_param_2_2_2_2.smv
@@ -0,0 +1,174 @@
+
+#include "cassini_param_common.smv"
+
+MODULE main
+
+  -- time
+
+  IVAR t_#delta : real;
+  TRANS t_#delta >= 0;
+  DEFINE timed := t_#delta > 0;
+
+  -- No two consecutive timed transitions.
+  VAR done_delta : boolean;
+  INIT !done_delta
+  TRANS timed -> !done_delta & next(done_delta);
+  TRANS !timed -> !next(done_delta);
+
+  -- configuration modes
+
+  FROZENVAR config_helium_segment : {standard, backup};
+  FROZENVAR config_fuel_segment : {standard, backup};
+
+  -- tanks, valves, and pipes;
+
+  VAR HT  : HELIUMTANK (t_#delta);
+
+  VAR V1  : VALVE (HT.p_out, t_#delta);
+  VAR V2  : VALVE (HT.p_out, t_#delta);
+  VAR PV1 : PYROVALVE (V1.p_out, t_#delta);
+  VAR PV2 : PYROVALVE (V2.p_out, t_#delta);
+
+  INVAR V1.state = open <-> config_helium_segment = backup;
+  INVAR V2.state = open <-> config_helium_segment = standard;
+  INVAR PV1.state = open <-> config_helium_segment = backup;
+  INVAR PV2.state = open <-> config_helium_segment = standard;
+
+  DEFINE pv1_pv2_p_out := COMBO_OUT(PV1, PV2);
+
+  VAR PP1 : PIPE(pv1_pv2_p_out, 5, 7, t_#delta);
+
+  VAR V3  : VALVE (PP1.p_out, t_#delta);
+  VAR V4  : VALVE (PP1.p_out, t_#delta);
+  VAR PV3 : PYROVALVE (PP1.p_out, t_#delta);
+  VAR PV4 : PYROVALVE (PP1.p_out, t_#delta);
+
+  INVAR V3.state = open <-> config_helium_segment = standard;
+  INVAR V4.state = open <-> config_helium_segment = standard;
+  INVAR PV3.state = open <-> config_helium_segment = backup;
+  INVAR PV4.state = open <-> config_helium_segment = backup;
+
+  DEFINE v3_pv3_p_out := COMBO_OUT(V3, PV3);
+  DEFINE v4_pv4_p_out := COMBO_OUT(V4, PV4);
+
+  VAR FT : PROPELLANTTANK (v3_pv3_p_out, t_#delta);
+  VAR OT : PROPELLANTTANK (v4_pv4_p_out, t_#delta);
+
+  VAR PV5 : PYROVALVE (FT.p_out, t_#delta);
+  VAR PV6 : PYROVALVE (OT.p_out, t_#delta);
+  VAR PV7 : PYROVALVE (FT.p_out, t_#delta);
+  VAR PV8 : PYROVALVE (OT.p_out, t_#delta);
+
+  INVAR PV5.state = open <-> config_fuel_segment = standard;
+  INVAR PV6.state = open <-> config_fuel_segment = standard;
+  INVAR PV7.state = open <-> config_fuel_segment = backup;
+  INVAR PV8.state = open <-> config_fuel_segment = backup;
+
+  VAR V9_SEGMENT : VALVE_CHAIN_2 (PV5.p_out, config_fuel_segment=standard, t_#delta);
+  VAR V10_SEGMENT : VALVE_CHAIN_2 (PV6.p_out, config_fuel_segment=standard, t_#delta);
+  VAR V11_SEGMENT : VALVE_CHAIN_2 (PV7.p_out, config_fuel_segment=backup, t_#delta);
+  VAR V12_SEGMENT : VALVE_CHAIN_2 (PV8.p_out, config_fuel_segment=backup, t_#delta);
+
+  VAR V13 : VALVE (V9_SEGMENT.p_out, t_#delta);
+  VAR V14 : VALVE (V10_SEGMENT.p_out, t_#delta);
+  VAR V15 : VALVE (V11_SEGMENT.p_out, t_#delta);
+  VAR V16 : VALVE (V12_SEGMENT.p_out, t_#delta);
+
+  INVAR V13.state = open <-> config_fuel_segment = standard;
+  INVAR V14.state = open <-> config_fuel_segment = standard;
+  INVAR V15.state = open <-> config_fuel_segment = backup;
+  INVAR V16.state = open <-> config_fuel_segment = backup;
+
+  VAR PRIMARY_ENGINE : ENGINE (V13.p_out, V14.p_out, t_#delta);
+  VAR BACKUP_ENGINE  : ENGINE (V15.p_out, V16.p_out, t_#delta);
+
+  VAR ACC : ACCELEROMETER (PRIMARY_ENGINE.thrust, BACKUP_ENGINE.thrust, t_#delta);
+
+  DEFINE NR_FAILURES := HT.NR_FAILURES +
+                        OT.NR_FAILURES +
+                        FT.NR_FAILURES +
+                        V1.NR_FAILURES +
+                        V2.NR_FAILURES +
+                        V3.NR_FAILURES +
+                        V4.NR_FAILURES +
+                        V13.NR_FAILURES +
+                        V14.NR_FAILURES +
+                        V15.NR_FAILURES +
+                        V16.NR_FAILURES +
+                        V9_SEGMENT.NR_FAILURES +
+                        V10_SEGMENT.NR_FAILURES +
+                        V11_SEGMENT.NR_FAILURES +
+                        V12_SEGMENT.NR_FAILURES
+                        ;
+
+  ---------------------------------------------------------- OPERATIONAL CONTEXT
+
+  -- CONTEXT RESTRICTIONS
+
+  DEFINE TANKS_ARE_FULL := HT.state=ok & FT.state=ok & OT.state=ok;
+  DEFINE TANKS_ARE_FULL_AND_PRESSURIZED := TANKS_ARE_FULL & !FT.no_helium & !OT.no_helium;
+
+  INVAR TANKS_ARE_FULL;
+  --INVAR TANKS_ARE_FULL_AND_PRESSURIZED;
+
+  -- at most one failure
+  INVAR NR_FAILURES < 2;
+
+
+  ------------------------------------------------------- FAULT DYNAMICS (TANKS)
+
+  --INVAR HT.internal_leakage = none;
+  INIT HT.internal_leakage = none;
+  TRANS HT.internal_leakage = leakage -> next(HT.internal_leakage = leakage);
+
+  --INVAR FT.internal_leakage = none;
+  INIT FT.internal_leakage = none;
+  TRANS FT.internal_leakage = leakage -> next(FT.internal_leakage = leakage);
+
+  --INVAR OT.internal_leakage = none;
+  INIT OT.internal_leakage = none;
+  TRANS OT.internal_leakage = leakage -> next(OT.internal_leakage = leakage);
+
+
+  ------------------------------------------------------ FAULT DYNAMICS (VALVES)
+
+  INVAR V1.internal_leakage = none;
+  INIT V1.internal_leakage = none;
+  TRANS V1.internal_leakage = leakage -> next(V1.internal_leakage = leakage);
+  INVAR !V1.is_stuck;
+
+  --INVAR V2.internal_leakage = none;
+  INIT V2.internal_leakage = none;
+  TRANS V2.internal_leakage = leakage -> next(V2.internal_leakage = leakage);
+  INVAR !V2.is_stuck;
+
+  --INVAR V3.internal_leakage = none;
+  INIT V3.internal_leakage = none;
+  TRANS V3.internal_leakage = leakage -> next(V3.internal_leakage = leakage);
+  INVAR !V3.is_stuck;
+
+  --INVAR V4.internal_leakage = none;
+  INIT V4.internal_leakage = none;
+  TRANS V4.internal_leakage = leakage -> next(V4.internal_leakage = leakage);
+  INVAR !V4.is_stuck;
+
+  INVAR V13.internal_leakage = none;
+  INIT V13.internal_leakage = none;
+  TRANS V13.internal_leakage = leakage -> next(V13.internal_leakage = leakage);
+  INVAR !V13.is_stuck;
+
+  INVAR V14.internal_leakage = none;
+  INIT V14.internal_leakage = none;
+  TRANS V14.internal_leakage = leakage -> next(V14.internal_leakage = leakage);
+  INVAR !V14.is_stuck;
+
+  INVAR V15.internal_leakage = none;
+  INIT V15.internal_leakage = none;
+  TRANS V15.internal_leakage = leakage -> next(V15.internal_leakage = leakage);
+  INVAR !V15.is_stuck;
+
+  INVAR V16.internal_leakage = none;
+  INIT V16.internal_leakage = none;
+  TRANS V16.internal_leakage = leakage -> next(V16.internal_leakage = leakage);
+  INVAR !V16.is_stuck;
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/cassini/cassini_param_2_2_2_2.txml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/cassini/cassini_param_2_2_2_2.txml
new file mode 100644
index 0000000000000000000000000000000000000000..e424951fac08cbdd8a50dd1a435bce2a1675641e
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/cassini/cassini_param_2_2_2_2.txml
@@ -0,0 +1,271 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<tfpg name="DependencyGraph">
+  <nodesList>
+
+    <node name="HT_leak" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="V2_leak" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="V3_leak" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="V4_leak" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="FT_leak" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="OT_leak" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="G9_leak" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="G10_leak" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="G11_leak" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="G12_leak" isMonitored="false">
+      <type>FM</type>
+    </node>
+
+    <!-- common discrepancies -->
+    <node name="d_V1" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="d_V2" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="d_V3" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="d_FT" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="d_PV4" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="d_PV5" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="d_PV8" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="d_V13" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <!-- use-case specific discrepancies -->
+    <node name="d_V9_2" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="d_V11_2" isMonitored="false">
+      <type>OR</type>
+    </node>
+  </nodesList>
+  <modesList>
+    <mode>hsfs</mode>
+    <mode>hsfb</mode>
+    <mode>hbfs</mode>
+    <mode>hbfb</mode>
+  </modesList>
+  <edgesList>
+    <!-- common edges -->
+    <edge name="EDGE1">
+      <srcNode>HT_leak</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+      <mode>hsfs</mode>
+      <mode>hsfb</mode>
+      </modesList>
+      <destNode>d_V2</destNode>
+    </edge>
+    <edge name="EDGE2">
+      <srcNode>V2_leak</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+      <mode>hsfs</mode>
+      <mode>hsfb</mode>
+      </modesList>
+      <destNode>d_V2</destNode>
+    </edge>
+    <edge name="EDGE3">
+      <srcNode>d_V2</srcNode>
+      <tMin>5.0</tMin>
+      <tMax>7.0</tMax>
+      <modesList>
+      <mode>hsfs</mode>
+      <mode>hsfb</mode>
+      </modesList>
+      <destNode>d_V3</destNode>
+    </edge>
+    <edge name="EDGE4">
+      <srcNode>V3_leak</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+      <mode>hsfs</mode>
+      <mode>hsfb</mode>
+      </modesList>
+      <destNode>d_V3</destNode>
+    </edge>
+    <edge name="EDGE5">
+      <srcNode>d_V3</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+      <mode>hsfs</mode>
+      <mode>hsfb</mode>
+      </modesList>
+      <destNode>d_FT</destNode>
+    </edge>
+    <edge name="EDGE6">
+      <srcNode>FT_leak</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+      <mode>hsfs</mode>
+      <mode>hsfb</mode>
+      <mode>hbfs</mode>
+      <mode>hbfb</mode>
+      </modesList>
+      <destNode>d_FT</destNode>
+    </edge>
+    <edge name="EDGE7">
+      <srcNode>HT_leak</srcNode>
+      <tMin>5.0</tMin>
+      <tMax>7.0</tMax>
+      <modesList>
+      <mode>hbfs</mode>
+      <mode>hbfb</mode>
+      </modesList>
+      <destNode>d_FT</destNode>
+    </edge>
+    <edge name="EDGE8">
+      <srcNode>d_FT</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+      <mode>hsfs</mode>
+      <mode>hbfs</mode>
+      </modesList>
+      <destNode>d_PV5</destNode>
+    </edge>
+    <edge name="EDGE9">
+      <srcNode>V4_leak</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+      <mode>hsfb</mode>
+      </modesList>
+      <destNode>d_PV8</destNode>
+    </edge>
+    <edge name="EDGE10">
+      <srcNode>OT_leak</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+      <mode>hsfb</mode>
+      <mode>hbfb</mode>
+      </modesList>
+      <destNode>d_PV8</destNode>
+    </edge>
+    <edge name="EDGE11">
+      <srcNode>HT_leak</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+      <mode>hbfs</mode>
+      <mode>hbfb</mode>
+      </modesList>
+      <destNode>d_V1</destNode>
+    </edge>
+    <edge name="EDGE12">
+      <srcNode>d_V1</srcNode>
+      <tMin>5.0</tMin>
+      <tMax>7.0</tMax>
+      <modesList>
+      <mode>hbfs</mode>
+      <mode>hbfb</mode>
+      </modesList>
+      <destNode>d_PV4</destNode>
+    </edge>
+    <edge name="EDGE13">
+      <srcNode>d_PV4</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+      <mode>hbfb</mode>
+      </modesList>
+      <destNode>d_PV8</destNode>
+    </edge>
+    <edge name="EDGE14">
+      <srcNode>d_V2</srcNode>
+      <tMin>5.0</tMin>
+      <tMax>7.0</tMax>
+      <modesList>
+      <mode>hsfb</mode>
+      </modesList>
+      <destNode>d_PV8</destNode>
+    </edge>
+
+    <!-- use-case specific edges -->
+
+    <edge name="EDGE_S1">
+      <srcNode>d_PV5</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+      <mode>hsfs</mode>
+      <mode>hbfs</mode>
+      </modesList>
+      <destNode>d_V9_2</destNode>
+    </edge>
+    <edge name="EDGE_S2">
+      <srcNode>d_FT</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+      <mode>hsfb</mode>
+      <mode>hbfb</mode>
+      </modesList>
+      <destNode>d_V11_2</destNode>
+    </edge>
+    <edge name="EDGE_S3">
+      <srcNode>G11_leak</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+      <mode>hsfb</mode>
+      <mode>hbfb</mode>
+      </modesList>
+      <destNode>d_V11_2</destNode>
+    </edge>
+    <edge name="EDGE_S4">
+      <srcNode>d_V9_2</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+      <mode>hsfs</mode>
+      <mode>hbfs</mode>
+      </modesList>
+      <destNode>d_V13</destNode>
+    </edge>
+    <edge name="EDGE_S5">
+      <srcNode>G9_leak</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+      <mode>hsfs</mode>
+      <mode>hbfs</mode>
+      </modesList>
+      <destNode>d_V9_2</destNode>
+    </edge>
+
+  </edgesList>
+</tfpg>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/cassini/cassini_param_common.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/cassini/cassini_param_common.smv
new file mode 100644
index 0000000000000000000000000000000000000000..664ae900244b95f3d61a43f3640fb524db16b334
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/cassini/cassini_param_common.smv
@@ -0,0 +1,644 @@
+
+#define COMBO_OUT(V1, V2)  case                \
+              V1.p_out > V2.p_out : V1.p_out;  \
+              V2.p_out > V1.p_out : V2.p_out;  \
+              TRUE : V1.p_out;                 \
+              esac
+
+
+------------------------------------------------ HELIUM TANK
+
+MODULE HELIUMTANK (t_#delta)
+
+  VAR
+    state            : {ok, empty};
+    internal_leakage : {none, leakage};
+    p_out            : 0..2;
+
+  DEFINE
+    NR_FAILURES := count(internal_leakage=leakage);
+    timed := t_#delta > 0;
+
+  ASSIGN
+
+    init(state) := ok;
+    next(state) := case
+      timed : state;
+      state = ok : {ok, empty};
+      TRUE : state;
+      esac;
+
+    init(p_out) := 2;
+    next(p_out) := case
+      next(state) = empty : 0;
+      internal_leakage = leakage : 1;
+      TRUE : 2;
+      esac;
+
+   TRANS
+     timed -> internal_leakage = next(internal_leakage);
+
+   TRANS
+     p_out != next(p_out) -> !timed;
+
+
+-------------------------------------------- PROPELLANT TANK
+
+MODULE PROPELLANTTANK (p_in, t_#delta)
+
+  VAR
+    state            : {ok, empty};
+    internal_leakage : {none, leakage};
+    p_out            : 0..2;
+
+  DEFINE
+    no_helium := p_in = 0 | p_in = 1;
+    NR_FAILURES := count(internal_leakage=leakage);
+    timed := t_#delta > 0;
+
+  ASSIGN
+
+    init(state) := ok;
+    next(state) := case
+      timed : state;
+      state = ok : {ok, empty};
+      TRUE : state;
+      esac;
+
+    init(p_out) := case
+      no_helium : 1;
+      TRUE : 2;
+      esac;
+    next(p_out) := case
+      state = empty : 0;
+      no_helium & internal_leakage = leakage : 0;
+      no_helium | internal_leakage = leakage : 1;
+      TRUE : 2;
+      esac;
+
+   TRANS
+     timed -> internal_leakage = next(internal_leakage);
+
+   TRANS
+     p_out != next(p_out) -> !timed;
+
+
+----------------------------------------------------- ENGINE
+
+MODULE ENGINE (fuel_p_in, oxidizer_p_in, t_#delta)
+
+  VAR
+    thrust : 0..4;
+
+  DEFINE
+    will_ignite := fuel_p_in > 0 & oxidizer_p_in > 0;
+    will_go_full_thrust := fuel_p_in = 2 & oxidizer_p_in = 2;
+    timed := t_#delta > 0;
+
+  ASSIGN
+
+    init(thrust) := 0;
+    next(thrust) := case
+
+      timed : thrust;
+
+      !will_ignite & thrust > 0 : thrust - 1;
+      !will_ignite & thrust = 0 : 0;
+
+      will_ignite & !will_go_full_thrust & thrust < 2 : thrust + 1;
+      will_ignite & !will_go_full_thrust & thrust > 2 : thrust - 1;
+      will_ignite & !will_go_full_thrust & thrust = 2 : 2;
+
+      will_go_full_thrust & thrust < 4 : thrust + 1;
+      will_go_full_thrust & thrust = 4 : 4;
+
+      TRUE : thrust;
+
+      esac;
+
+
+---------------------------------------------- ACCELEROMETER 
+
+MODULE ACCELEROMETER (thrust_primary, thrust_backup, t_#delta)
+
+  VAR
+    acceleration : {none, low, high};
+
+  DEFINE
+    timed := t_#delta > 0;
+
+  ASSIGN
+
+    init(acceleration) := case
+      thrust_primary + thrust_backup = 0 : none;
+      thrust_primary + thrust_backup < 3 : low;
+      TRUE : high;
+      esac;
+    next(acceleration) := case
+      timed : acceleration;
+      thrust_primary + thrust_backup = 0 : none;
+      thrust_primary + thrust_backup < 3 : low;
+      TRUE : high;
+      esac;
+
+
+-------------------------------------------------- PYROVALVE
+
+MODULE PYROVALVE (p_in, t_#delta)
+
+  VAR
+    state   : {open, closed};
+    ignited : boolean;
+    p_out   : 0..2;
+
+  IVAR
+    cmdin : {open, close, none};
+
+  DEFINE
+    NO_CMD := cmdin = none;
+    timed := t_#delta > 0;
+
+  ASSIGN
+
+    -- initial state constraint should be set at a higher level
+    next(state) := case
+      timed : state;
+      ignited : state;
+      cmdin = open : open;
+      cmdin = close : closed;
+      TRUE : state;
+      esac;
+
+    init(ignited) := FALSE;
+    next(ignited) := case
+      timed : ignited;
+      ignited : TRUE;
+      state = open & cmdin = close : TRUE;
+      state = closed & cmdin = open : TRUE;
+      TRUE : ignited;
+      esac;
+
+    init(p_out) := case
+      state = closed : 0;
+      TRUE : p_in;
+      esac;
+    next(p_out) := case
+      next(state) = closed : 0;
+      TRUE : p_in;
+      esac;
+
+  TRANS
+    timed -> NO_CMD;
+
+   TRANS
+     p_out != next(p_out) -> !timed;
+
+  INVARSPEC next(p_in) <= p_in;
+
+
+------------------------------------------------------ VALVE
+
+MODULE VALVE (p_in, t_#delta)
+
+  VAR
+    state            : {open, closed};
+    internal_leakage : {none, leakage};
+    is_stuck         : boolean;
+    p_out            : 0..2;
+
+  IVAR
+    cmdin : {open, close, none};
+
+  DEFINE
+    NO_CMD := cmdin = none;
+    NR_FAILURES := count(is_stuck, internal_leakage=leakage);
+    timed := t_#delta > 0;
+
+  ASSIGN
+
+    -- initial state constraint should be set at a higher level
+    next(state) := case
+      timed : state;
+      is_stuck : state;
+      cmdin = open : open;
+      cmdin = close : closed;
+      TRUE : state;
+      esac;
+
+    init(p_out) := case
+      state = closed : 0;
+      TRUE : p_in;
+      esac;
+    next(p_out) := case
+      next(state) = closed : 0;
+      internal_leakage = none : p_in;
+      p_in = 2 : 1;
+      TRUE : 0;
+      esac;
+
+  TRANS
+    timed -> internal_leakage = next(internal_leakage);
+
+  TRANS
+    timed -> is_stuck = next(is_stuck);
+
+  TRANS
+    timed -> NO_CMD;
+
+  TRANS
+    p_out != next(p_out) -> !timed;
+
+  INVARSPEC next(p_in) <= p_in;
+
+
+------------------------------------------------------ VALVE BLOCK
+
+MODULE VALVE_BLOCK (p_in, vb_open, t_#delta)
+
+  VAR v : VALVE (p_in, t_#delta);
+  INVAR v.state = open <-> vb_open;
+  TRANS v.NO_CMD;
+
+  -- valve can leak
+  --INVAR v.internal_leakage = none;
+
+  -- leakage is a permanent failure
+  TRANS v.internal_leakage != none -> next(v.internal_leakage != none);
+
+  -- valve cannot get stuck
+  INVAR !v.is_stuck;
+
+  VAR pv : PYROVALVE (p_in, t_#delta);
+  INVAR pv.state = closed;
+
+  DEFINE p_out := COMBO_OUT(v, pv);
+
+
+----------------------------------------------------- VALVE CHAINS
+
+MODULE VALVE_CHAIN_2 (p_in, vc_open, t_#delta)
+  VAR vb_1 : VALVE_BLOCK(p_in, vc_open, t_#delta);
+  VAR pp_12 : PIPE(vb_1.p_out, 1, 2, t_#delta);
+  VAR vb_2 : VALVE_BLOCK(pp_12.p_out, vc_open, t_#delta);
+  DEFINE p_out := vb_2.p_out;
+  DEFINE NR_FAILURES :=
+    vb_1.v.NR_FAILURES +
+    vb_2.v.NR_FAILURES;
+
+  DEFINE diff_vb_2 := vb_2.p_in != vb_2.p_out;
+
+
+MODULE VALVE_CHAIN_4 (p_in, vc_open, t_#delta)
+  VAR vb_1 : VALVE_BLOCK(p_in, vc_open, t_#delta);
+  VAR pp_12 : PIPE(vb_1.p_out, 2, 3, t_#delta);
+  VAR vb_2 : VALVE_BLOCK(pp_12.p_out, vc_open, t_#delta);
+  VAR pp_23 : PIPE(vb_2.p_out, 1, 2, t_#delta);
+  VAR vb_3 : VALVE_BLOCK(pp_23.p_out, vc_open, t_#delta);
+  VAR pp_34 : PIPE(vb_3.p_out, 2, 2, t_#delta);
+  VAR vb_4 : VALVE_BLOCK(pp_34.p_out, vc_open, t_#delta);
+  DEFINE p_out := vb_4.p_out;
+  DEFINE NR_FAILURES :=
+    vb_1.v.NR_FAILURES +
+    vb_2.v.NR_FAILURES +
+    vb_3.v.NR_FAILURES +
+    vb_4.v.NR_FAILURES;
+
+  DEFINE diff_vb_2 := vb_2.p_in != vb_2.p_out;
+  DEFINE diff_vb_3 := vb_3.p_in != vb_3.p_out;
+  DEFINE diff_vb_4 := vb_4.p_in != vb_4.p_out;
+
+
+MODULE VALVE_CHAIN_6 (p_in, vc_open, t_#delta)
+  VAR vb_1 : VALVE_BLOCK(p_in, vc_open, t_#delta);
+  VAR pp_12 : PIPE(vb_1.p_out, 2, 3, t_#delta);
+  VAR vb_2 : VALVE_BLOCK(pp_12.p_out, vc_open, t_#delta);
+  VAR pp_23 : PIPE(vb_2.p_out, 1, 2, t_#delta);
+  VAR vb_3 : VALVE_BLOCK(pp_23.p_out, vc_open, t_#delta);
+  VAR pp_34 : PIPE(vb_3.p_out, 2, 2, t_#delta);
+  VAR vb_4 : VALVE_BLOCK(pp_34.p_out, vc_open, t_#delta);
+  VAR pp_45 : PIPE(vb_4.p_out, 2, 2, t_#delta);
+  VAR vb_5 : VALVE_BLOCK(pp_45.p_out, vc_open, t_#delta);
+  VAR pp_56 : PIPE(vb_5.p_out, 3, 4, t_#delta);
+  VAR vb_6 : VALVE_BLOCK(pp_56.p_out, vc_open, t_#delta);
+  DEFINE p_out := vb_4.p_out;
+  DEFINE NR_FAILURES :=
+    vb_1.v.NR_FAILURES +
+    vb_2.v.NR_FAILURES +
+    vb_3.v.NR_FAILURES +
+    vb_4.v.NR_FAILURES +
+    vb_5.v.NR_FAILURES +
+    vb_6.v.NR_FAILURES;
+
+  DEFINE diff_vb_2 := vb_2.p_in != vb_2.p_out;
+  DEFINE diff_vb_3 := vb_3.p_in != vb_3.p_out;
+  DEFINE diff_vb_4 := vb_4.p_in != vb_4.p_out;
+  DEFINE diff_vb_5 := vb_5.p_in != vb_5.p_out;
+  DEFINE diff_vb_6 := vb_6.p_in != vb_6.p_out;
+
+
+MODULE VALVE_CHAIN_8 (p_in, vc_open, t_#delta)
+  VAR vb_1 : VALVE_BLOCK(p_in, vc_open, t_#delta);
+  VAR pp_12 : PIPE(vb_1.p_out, 2, 3, t_#delta);
+  VAR vb_2 : VALVE_BLOCK(pp_12.p_out, vc_open, t_#delta);
+  VAR pp_23 : PIPE(vb_2.p_out, 1, 2, t_#delta);
+  VAR vb_3 : VALVE_BLOCK(pp_23.p_out, vc_open, t_#delta);
+  VAR pp_34 : PIPE(vb_3.p_out, 2, 2, t_#delta);
+  VAR vb_4 : VALVE_BLOCK(pp_34.p_out, vc_open, t_#delta);
+  VAR pp_45 : PIPE(vb_4.p_out, 2, 2, t_#delta);
+  VAR vb_5 : VALVE_BLOCK(pp_45.p_out, vc_open, t_#delta);
+  VAR pp_56 : PIPE(vb_5.p_out, 3, 4, t_#delta);
+  VAR vb_6 : VALVE_BLOCK(pp_56.p_out, vc_open, t_#delta);
+  VAR pp_67 : PIPE(vb_6.p_out, 1, 5, t_#delta);
+  VAR vb_7 : VALVE_BLOCK(pp_67.p_out, vc_open, t_#delta);
+  VAR pp_78 : PIPE(vb_7.p_out, 2, 4, t_#delta);
+  VAR vb_8 : VALVE_BLOCK(pp_78.p_out, vc_open, t_#delta);
+  DEFINE p_out := vb_4.p_out;
+  DEFINE NR_FAILURES :=
+    vb_1.v.NR_FAILURES +
+    vb_2.v.NR_FAILURES +
+    vb_3.v.NR_FAILURES +
+    vb_4.v.NR_FAILURES +
+    vb_5.v.NR_FAILURES +
+    vb_6.v.NR_FAILURES +
+    vb_7.v.NR_FAILURES +
+    vb_8.v.NR_FAILURES;
+
+  DEFINE diff_vb_2 := vb_2.p_in != vb_2.p_out;
+  DEFINE diff_vb_3 := vb_3.p_in != vb_3.p_out;
+  DEFINE diff_vb_4 := vb_4.p_in != vb_4.p_out;
+  DEFINE diff_vb_5 := vb_5.p_in != vb_5.p_out;
+  DEFINE diff_vb_6 := vb_6.p_in != vb_6.p_out;
+  DEFINE diff_vb_7 := vb_7.p_in != vb_7.p_out;
+  DEFINE diff_vb_8 := vb_8.p_in != vb_8.p_out;
+
+
+MODULE VALVE_CHAIN_10 (p_in, vc_open, t_#delta)
+  VAR vb_1 : VALVE_BLOCK(p_in, vc_open, t_#delta);
+  VAR pp_12 : PIPE(vb_1.p_out, 2, 3, t_#delta);
+  VAR vb_2 : VALVE_BLOCK(pp_12.p_out, vc_open, t_#delta);
+  VAR pp_23 : PIPE(vb_2.p_out, 1, 2, t_#delta);
+  VAR vb_3 : VALVE_BLOCK(pp_23.p_out, vc_open, t_#delta);
+  VAR pp_34 : PIPE(vb_3.p_out, 2, 2, t_#delta);
+  VAR vb_4 : VALVE_BLOCK(pp_34.p_out, vc_open, t_#delta);
+  VAR pp_45 : PIPE(vb_4.p_out, 2, 2, t_#delta);
+  VAR vb_5 : VALVE_BLOCK(pp_45.p_out, vc_open, t_#delta);
+  VAR pp_56 : PIPE(vb_5.p_out, 3, 4, t_#delta);
+  VAR vb_6 : VALVE_BLOCK(pp_56.p_out, vc_open, t_#delta);
+  VAR pp_67 : PIPE(vb_6.p_out, 1, 5, t_#delta);
+  VAR vb_7 : VALVE_BLOCK(pp_67.p_out, vc_open, t_#delta);
+  VAR pp_78 : PIPE(vb_7.p_out, 2, 4, t_#delta);
+  VAR vb_8 : VALVE_BLOCK(pp_78.p_out, vc_open, t_#delta);
+  VAR pp_89 : PIPE(vb_8.p_out, 3, 4, t_#delta);
+  VAR vb_9 : VALVE_BLOCK(pp_89.p_out, vc_open, t_#delta);
+  VAR pp_910 : PIPE(vb_9.p_out, 1, 5, t_#delta);
+  VAR vb_10 : VALVE_BLOCK(pp_910.p_out, vc_open, t_#delta);
+  DEFINE p_out := vb_4.p_out;
+  DEFINE NR_FAILURES :=
+    vb_1.v.NR_FAILURES +
+    vb_2.v.NR_FAILURES +
+    vb_3.v.NR_FAILURES +
+    vb_4.v.NR_FAILURES +
+    vb_5.v.NR_FAILURES +
+    vb_6.v.NR_FAILURES +
+    vb_7.v.NR_FAILURES +
+    vb_8.v.NR_FAILURES +
+    vb_9.v.NR_FAILURES + 
+    vb_10.v.NR_FAILURES; 
+
+  DEFINE diff_vb_2 := vb_2.p_in != vb_2.p_out;
+  DEFINE diff_vb_3 := vb_3.p_in != vb_3.p_out;
+  DEFINE diff_vb_4 := vb_4.p_in != vb_4.p_out;
+  DEFINE diff_vb_5 := vb_5.p_in != vb_5.p_out;
+  DEFINE diff_vb_6 := vb_6.p_in != vb_6.p_out;
+  DEFINE diff_vb_7 := vb_7.p_in != vb_7.p_out;
+  DEFINE diff_vb_8 := vb_8.p_in != vb_8.p_out;
+  DEFINE diff_vb_9 := vb_9.p_in != vb_9.p_out;
+  DEFINE diff_vb_10 := vb_10.p_in != vb_10.p_out;
+
+
+MODULE VALVE_CHAIN_12 (p_in, vc_open, t_#delta)
+  VAR vb_1 : VALVE_BLOCK(p_in, vc_open, t_#delta);
+  VAR pp_12 : PIPE(vb_1.p_out, 2, 3, t_#delta);
+  VAR vb_2 : VALVE_BLOCK(pp_12.p_out, vc_open, t_#delta);
+  VAR pp_23 : PIPE(vb_2.p_out, 1, 2, t_#delta);
+  VAR vb_3 : VALVE_BLOCK(pp_23.p_out, vc_open, t_#delta);
+  VAR pp_34 : PIPE(vb_3.p_out, 2, 2, t_#delta);
+  VAR vb_4 : VALVE_BLOCK(pp_34.p_out, vc_open, t_#delta);
+  VAR pp_45 : PIPE(vb_4.p_out, 2, 2, t_#delta);
+  VAR vb_5 : VALVE_BLOCK(pp_45.p_out, vc_open, t_#delta);
+  VAR pp_56 : PIPE(vb_5.p_out, 3, 4, t_#delta);
+  VAR vb_6 : VALVE_BLOCK(pp_56.p_out, vc_open, t_#delta);
+  VAR pp_67 : PIPE(vb_6.p_out, 1, 5, t_#delta);
+  VAR vb_7 : VALVE_BLOCK(pp_67.p_out, vc_open, t_#delta);
+  VAR pp_78 : PIPE(vb_7.p_out, 2, 4, t_#delta);
+  VAR vb_8 : VALVE_BLOCK(pp_78.p_out, vc_open, t_#delta);
+  VAR pp_89 : PIPE(vb_8.p_out, 3, 4, t_#delta);
+  VAR vb_9 : VALVE_BLOCK(pp_89.p_out, vc_open, t_#delta);
+  VAR pp_910 : PIPE(vb_9.p_out, 1, 5, t_#delta);
+  VAR vb_10 : VALVE_BLOCK(pp_910.p_out, vc_open, t_#delta);
+  VAR pp_1011 : PIPE(vb_10.p_out, 2, 4, t_#delta);
+  VAR vb_11 : VALVE_BLOCK(pp_1011.p_out, vc_open, t_#delta);
+  VAR pp_1112 : PIPE(vb_11.p_out, 3, 3, t_#delta);
+  VAR vb_12 : VALVE_BLOCK(pp_1112.p_out, vc_open, t_#delta);
+  DEFINE p_out := vb_4.p_out;
+  DEFINE NR_FAILURES :=
+    vb_1.v.NR_FAILURES +
+    vb_2.v.NR_FAILURES +
+    vb_3.v.NR_FAILURES +
+    vb_4.v.NR_FAILURES +
+    vb_5.v.NR_FAILURES +
+    vb_6.v.NR_FAILURES +
+    vb_7.v.NR_FAILURES +
+    vb_8.v.NR_FAILURES +
+    vb_9.v.NR_FAILURES + 
+    vb_10.v.NR_FAILURES +
+    vb_11.v.NR_FAILURES +
+    vb_12.v.NR_FAILURES;
+
+  DEFINE diff_vb_2 := vb_2.p_in != vb_2.p_out;
+  DEFINE diff_vb_3 := vb_3.p_in != vb_3.p_out;
+  DEFINE diff_vb_4 := vb_4.p_in != vb_4.p_out;
+  DEFINE diff_vb_5 := vb_5.p_in != vb_5.p_out;
+  DEFINE diff_vb_6 := vb_6.p_in != vb_6.p_out;
+  DEFINE diff_vb_7 := vb_7.p_in != vb_7.p_out;
+  DEFINE diff_vb_8 := vb_8.p_in != vb_8.p_out;
+  DEFINE diff_vb_9 := vb_9.p_in != vb_9.p_out;
+  DEFINE diff_vb_10 := vb_10.p_in != vb_10.p_out;
+  DEFINE diff_vb_11 := vb_11.p_in != vb_11.p_out;
+  DEFINE diff_vb_12 := vb_12.p_in != vb_12.p_out;
+
+
+MODULE VALVE_CHAIN_14 (p_in, vc_open, t_#delta)
+  VAR vb_1 : VALVE_BLOCK(p_in, vc_open, t_#delta);
+  VAR pp_12 : PIPE(vb_1.p_out, 2, 3, t_#delta);
+  VAR vb_2 : VALVE_BLOCK(pp_12.p_out, vc_open, t_#delta);
+  VAR pp_23 : PIPE(vb_2.p_out, 1, 2, t_#delta);
+  VAR vb_3 : VALVE_BLOCK(pp_23.p_out, vc_open, t_#delta);
+  VAR pp_34 : PIPE(vb_3.p_out, 2, 2, t_#delta);
+  VAR vb_4 : VALVE_BLOCK(pp_34.p_out, vc_open, t_#delta);
+  VAR pp_45 : PIPE(vb_4.p_out, 2, 2, t_#delta);
+  VAR vb_5 : VALVE_BLOCK(pp_45.p_out, vc_open, t_#delta);
+  VAR pp_56 : PIPE(vb_5.p_out, 3, 4, t_#delta);
+  VAR vb_6 : VALVE_BLOCK(pp_56.p_out, vc_open, t_#delta);
+  VAR pp_67 : PIPE(vb_6.p_out, 1, 5, t_#delta);
+  VAR vb_7 : VALVE_BLOCK(pp_67.p_out, vc_open, t_#delta);
+  VAR pp_78 : PIPE(vb_7.p_out, 2, 4, t_#delta);
+  VAR vb_8 : VALVE_BLOCK(pp_78.p_out, vc_open, t_#delta);
+  VAR pp_89 : PIPE(vb_8.p_out, 3, 4, t_#delta);
+  VAR vb_9 : VALVE_BLOCK(pp_89.p_out, vc_open, t_#delta);
+  VAR pp_910 : PIPE(vb_9.p_out, 1, 5, t_#delta);
+  VAR vb_10 : VALVE_BLOCK(pp_910.p_out, vc_open, t_#delta);
+  VAR pp_1011 : PIPE(vb_10.p_out, 2, 4, t_#delta);
+  VAR vb_11 : VALVE_BLOCK(pp_1011.p_out, vc_open, t_#delta);
+  VAR pp_1112 : PIPE(vb_11.p_out, 3, 3, t_#delta);
+  VAR vb_12 : VALVE_BLOCK(pp_1112.p_out, vc_open, t_#delta);
+  VAR pp_1213 : PIPE(vb_12.p_out, 1, 4, t_#delta);
+  VAR vb_13 : VALVE_BLOCK(pp_1213.p_out, vc_open, t_#delta);
+  VAR pp_1314 : PIPE(vb_13.p_out, 2, 3, t_#delta);
+  VAR vb_14 : VALVE_BLOCK(pp_1314.p_out, vc_open, t_#delta);
+  DEFINE p_out := vb_4.p_out;
+  DEFINE NR_FAILURES :=
+    vb_1.v.NR_FAILURES +
+    vb_2.v.NR_FAILURES +
+    vb_3.v.NR_FAILURES +
+    vb_4.v.NR_FAILURES +
+    vb_5.v.NR_FAILURES +
+    vb_6.v.NR_FAILURES +
+    vb_7.v.NR_FAILURES +
+    vb_8.v.NR_FAILURES +
+    vb_9.v.NR_FAILURES + 
+    vb_10.v.NR_FAILURES +
+    vb_11.v.NR_FAILURES +
+    vb_12.v.NR_FAILURES +
+    vb_13.v.NR_FAILURES + 
+    vb_14.v.NR_FAILURES;
+
+  DEFINE diff_vb_2 := vb_2.p_in != vb_2.p_out;
+  DEFINE diff_vb_3 := vb_3.p_in != vb_3.p_out;
+  DEFINE diff_vb_4 := vb_4.p_in != vb_4.p_out;
+  DEFINE diff_vb_5 := vb_5.p_in != vb_5.p_out;
+  DEFINE diff_vb_6 := vb_6.p_in != vb_6.p_out;
+  DEFINE diff_vb_7 := vb_7.p_in != vb_7.p_out;
+  DEFINE diff_vb_8 := vb_8.p_in != vb_8.p_out;
+  DEFINE diff_vb_9 := vb_9.p_in != vb_9.p_out;
+  DEFINE diff_vb_10 := vb_10.p_in != vb_10.p_out;
+  DEFINE diff_vb_11 := vb_11.p_in != vb_11.p_out;
+  DEFINE diff_vb_12 := vb_12.p_in != vb_12.p_out;
+  DEFINE diff_vb_13 := vb_13.p_in != vb_13.p_out;
+  DEFINE diff_vb_14 := vb_14.p_in != vb_14.p_out;
+
+
+MODULE VALVE_CHAIN_16 (p_in, vc_open, t_#delta)
+  VAR vb_1 : VALVE_BLOCK(p_in, vc_open, t_#delta);
+  VAR pp_12 : PIPE(vb_1.p_out, 2, 3, t_#delta);
+  VAR vb_2 : VALVE_BLOCK(pp_12.p_out, vc_open, t_#delta);
+  VAR pp_23 : PIPE(vb_2.p_out, 1, 2, t_#delta);
+  VAR vb_3 : VALVE_BLOCK(pp_23.p_out, vc_open, t_#delta);
+  VAR pp_34 : PIPE(vb_3.p_out, 2, 2, t_#delta);
+  VAR vb_4 : VALVE_BLOCK(pp_34.p_out, vc_open, t_#delta);
+  VAR pp_45 : PIPE(vb_4.p_out, 2, 2, t_#delta);
+  VAR vb_5 : VALVE_BLOCK(pp_45.p_out, vc_open, t_#delta);
+  VAR pp_56 : PIPE(vb_5.p_out, 3, 4, t_#delta);
+  VAR vb_6 : VALVE_BLOCK(pp_56.p_out, vc_open, t_#delta);
+  VAR pp_67 : PIPE(vb_6.p_out, 1, 5, t_#delta);
+  VAR vb_7 : VALVE_BLOCK(pp_67.p_out, vc_open, t_#delta);
+  VAR pp_78 : PIPE(vb_7.p_out, 2, 4, t_#delta);
+  VAR vb_8 : VALVE_BLOCK(pp_78.p_out, vc_open, t_#delta);
+  VAR pp_89 : PIPE(vb_8.p_out, 3, 4, t_#delta);
+  VAR vb_9 : VALVE_BLOCK(pp_89.p_out, vc_open, t_#delta);
+  VAR pp_910 : PIPE(vb_9.p_out, 1, 5, t_#delta);
+  VAR vb_10 : VALVE_BLOCK(pp_910.p_out, vc_open, t_#delta);
+  VAR pp_1011 : PIPE(vb_10.p_out, 2, 4, t_#delta);
+  VAR vb_11 : VALVE_BLOCK(pp_1011.p_out, vc_open, t_#delta);
+  VAR pp_1112 : PIPE(vb_11.p_out, 3, 3, t_#delta);
+  VAR vb_12 : VALVE_BLOCK(pp_1112.p_out, vc_open, t_#delta);
+  VAR pp_1213 : PIPE(vb_12.p_out, 1, 4, t_#delta);
+  VAR vb_13 : VALVE_BLOCK(pp_1213.p_out, vc_open, t_#delta);
+  VAR pp_1314 : PIPE(vb_13.p_out, 2, 3, t_#delta);
+  VAR vb_14 : VALVE_BLOCK(pp_1314.p_out, vc_open, t_#delta);
+  VAR pp_1415 : PIPE(vb_14.p_out, 6, 8, t_#delta);
+  VAR vb_15 : VALVE_BLOCK(pp_1415.p_out, vc_open, t_#delta);
+  VAR pp_1516 : PIPE(vb_15.p_out, 7, 10, t_#delta);
+  VAR vb_16 : VALVE_BLOCK(pp_1516.p_out, vc_open, t_#delta);
+  DEFINE p_out := vb_4.p_out;
+  DEFINE NR_FAILURES :=
+    vb_1.v.NR_FAILURES +
+    vb_2.v.NR_FAILURES +
+    vb_3.v.NR_FAILURES +
+    vb_4.v.NR_FAILURES +
+    vb_5.v.NR_FAILURES +
+    vb_6.v.NR_FAILURES +
+    vb_7.v.NR_FAILURES +
+    vb_8.v.NR_FAILURES +
+    vb_9.v.NR_FAILURES + 
+    vb_10.v.NR_FAILURES +
+    vb_11.v.NR_FAILURES +
+    vb_12.v.NR_FAILURES +
+    vb_13.v.NR_FAILURES + 
+    vb_14.v.NR_FAILURES +
+    vb_15.v.NR_FAILURES +
+    vb_16.v.NR_FAILURES;
+
+  DEFINE diff_vb_2 := vb_2.p_in != vb_2.p_out;
+  DEFINE diff_vb_3 := vb_3.p_in != vb_3.p_out;
+  DEFINE diff_vb_4 := vb_4.p_in != vb_4.p_out;
+  DEFINE diff_vb_5 := vb_5.p_in != vb_5.p_out;
+  DEFINE diff_vb_6 := vb_6.p_in != vb_6.p_out;
+  DEFINE diff_vb_7 := vb_7.p_in != vb_7.p_out;
+  DEFINE diff_vb_8 := vb_8.p_in != vb_8.p_out;
+  DEFINE diff_vb_9 := vb_9.p_in != vb_9.p_out;
+  DEFINE diff_vb_10 := vb_10.p_in != vb_10.p_out;
+  DEFINE diff_vb_11 := vb_11.p_in != vb_11.p_out;
+  DEFINE diff_vb_12 := vb_12.p_in != vb_12.p_out;
+  DEFINE diff_vb_13 := vb_13.p_in != vb_13.p_out;
+  DEFINE diff_vb_14 := vb_14.p_in != vb_14.p_out;
+  DEFINE diff_vb_15 := vb_15.p_in != vb_15.p_out;
+  DEFINE diff_vb_16 := vb_16.p_in != vb_16.p_out;
+
+
+------------------------------------------------------ PIPE
+
+MODULE PIPE (p_in, min_pipe_delay, max_pipe_delay, t_#delta)
+  -- A pipe implements a delay in the propagation of flow
+  -- changes. Here it is assumed that only one such change
+  -- can occur at a time, as there is no memory of previous
+  -- flow values. This means that before the new value is not
+  -- propagated to the output, a second change should not occur.
+  --
+  -- When a difference in input and output flow is detected,
+  -- a timer is started and the output flow is set to the
+  -- input flow when the timer reaches the maximum delay.
+
+  VAR p_out : 0..2;
+  VAR counter : real;
+
+  DEFINE
+    timed := t_#delta > 0;
+
+  ASSIGN init(p_out) := p_in;
+  ASSIGN next(p_out) := case
+    p_in != p_out & counter < min_pipe_delay : p_out;
+    p_in != p_out & counter >= min_pipe_delay & counter < max_pipe_delay : {p_out, p_in};
+    TRUE : p_in;
+    esac;
+
+  ASSIGN init(counter) := -1;
+  ASSIGN next(counter) := case
+    next(p_in = p_out) : -1;
+    counter = -1 : 0;
+    TRUE : counter + t_#delta;
+    esac;
+
+  -- Timed transitions need to be interrupted as soon as
+  -- the maximum pipe delay is reached.
+  TRANS counter + t_#delta <= max_pipe_delay;
+
+  -- No pressure propagation during timed transitions.
+  TRANS
+    p_out != next(p_out) -> !timed;
+
+  INVARSPEC (timed -> (p_out=next(p_out) & p_in=next(p_in)));
+  INVARSPEC counter <= max_pipe_delay;
+  INVARSPEC (next(p_in != p_out) & counter = -1) -> (p_in = p_out);
+  INVARSPEC (p_in != p_out) -> (p_in >= next(p_in));
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/forgerobot/forgerobot.axml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/forgerobot/forgerobot.axml
new file mode 100644
index 0000000000000000000000000000000000000000..840d9497509b01177b9a27349a7bad2956ae81c5
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/forgerobot/forgerobot.axml
@@ -0,0 +1,23 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<associations>
+
+  <failureModes>
+    <assoc id="F_LOCOMOTION" expr="robot.f_locomotion"/>
+    <assoc id="F_COOLING" expr="robot.f_cooling"/>
+  </failureModes>
+
+  <monitoredDiscrepancies>
+  </monitoredDiscrepancies>
+
+  <unmonitoredDiscrepancies>
+    <assoc id="NON_CRITICAL_OVERHEATING" expr="robot.non_crit_overheating"/>
+    <assoc id="CRITICAL_OVERHEATING" expr="robot.crit_overheating"/>
+    <assoc id="UNIT_STUCK" expr="!robot.can_move"/>
+  </unmonitoredDiscrepancies>
+
+  <tfpgModes>
+    <assoc id="safe_zone" expr="robot.position=safe_zone"/>
+    <assoc id="critical_zone" expr="robot.position=critical_zone"/>
+  </tfpgModes>
+
+</associations>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/forgerobot/forgerobot.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/forgerobot/forgerobot.smv
new file mode 100644
index 0000000000000000000000000000000000000000..0e1952586a2e4a321f826d5a5446403759bd3309
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/forgerobot/forgerobot.smv
@@ -0,0 +1,160 @@
+
+--#define HMON(h_mon, var) VAR h_mon : boolean; INIT h_mon <-> var; TRANS next(h_mon) <-> (h_mon | next(var));
+
+--------------------------------------------------------------------------------
+
+MODULE forge_environment
+
+  VAR workload : {low, mid, high};
+  VAR heat : {low, high};
+
+--------------------------------------------------------------------------------
+
+MODULE forge_robot (env_workload, env_heat, time_delta, do_timed, done_timed)
+
+  -- hack!
+  TRANS non_crit_overheating != next(non_crit_overheating) -> position = next(position);
+  TRANS crit_overheating != next(crit_overheating) -> position = next(position);
+
+  -- discretization constraints
+  TRANS heat_level < 10 -> !next(heat_level > 10);
+  TRANS heat_level < 13 -> !next(heat_level > 13);
+  TRANS heat_level < 15 -> !next(heat_level > 15);
+  TRANS work_done < 6 -> !next(work_done > 6);
+
+  VAR non_crit_overheating : boolean;
+  ASSIGN init(non_crit_overheating) := FALSE;
+  ASSIGN next(non_crit_overheating) := case
+    heat_level >= 10 : TRUE;
+    TRUE : FALSE;
+    esac;
+
+  --INVARSPEC (non_crit_overheating != next(non_crit_overheating)) -> !do_timed;
+
+  VAR crit_overheating : boolean;
+  ASSIGN init(crit_overheating) := FALSE;
+  ASSIGN next(crit_overheating) := case
+    heat_level >= 15 : TRUE;
+    TRUE : FALSE;
+    esac;
+
+  --INVARSPEC (crit_overheating != next(crit_overheating)) -> !do_timed;
+
+  -- robot position
+
+  DEFINE can_move := !f_locomotion & heat_level < 13;
+
+  VAR position : {critical_zone, safe_zone};
+  ASSIGN init(position) := safe_zone;
+  ASSIGN next(position) := case
+    do_timed : position;
+    !can_move : position;
+    -- stay in critical zone until work is done
+    position=critical_zone & work_done < 6 : critical_zone;
+    -- leave critical zone once work is done
+    position=critical_zone & work_done = 6 : safe_zone;
+    -- do not enter critical zone with positive heat level
+    position=safe_zone & heat_level > 0 : safe_zone;
+    -- random choice
+    TRUE : {critical_zone, safe_zone};
+    esac;
+
+  -- robot heat level
+
+  VAR heat_level : real;
+  ASSIGN init(heat_level) := 0;
+  ASSIGN next(heat_level) := case
+    !do_timed : heat_level;
+    -- heat development in safe zone
+    position=safe_zone : max(0, heat_level - time_delta);
+    -- heat development leaving critical zone
+    position=critical_zone & next(position=safe_zone) : heat_level;
+    -- heat development in critical zone
+    f_cooling & env_heat = high : heat_level + time_delta * 2;
+    TRUE : heat_level + time_delta;
+    esac;
+
+  --LTLSPEC G ((position=safe_zone & X (position=critical_zone)) -> heat_level=0);
+
+  -- status of work in critical zone
+
+  VAR work_done : real;
+  ASSIGN init(work_done) := 6;
+  ASSIGN next(work_done) := case
+    -- no work
+    next(position=safe_zone) : 6;
+    -- start work
+    position=safe_zone & next(position=critical_zone) : 0;
+    -- doing work
+    env_workload=low : work_done + time_delta * 3;
+    env_workload=mid : work_done + time_delta * 2;
+    TRUE : work_done + time_delta;
+    esac;
+
+  -- failure of robot cooling system (permanent)
+
+  VAR f_cooling : boolean;
+  TRANS f_cooling -> next(f_cooling);
+  TRANS do_timed -> f_cooling=next(f_cooling);
+
+  -- failure of robot locomotion (permanent)
+
+  VAR f_locomotion : boolean;
+  TRANS f_locomotion -> next(f_locomotion);
+  TRANS do_timed -> f_locomotion=next(f_locomotion);
+
+  --LTLSPEC G (f_cooling -> G f_cooling);
+  --LTLSPEC G (f_locomotion -> G f_locomotion);
+
+--------------------------------------------------------------------------------
+
+MODULE main
+
+  -- environment modeling amount of heat and workload in critical zone
+  VAR environment : forge_environment;
+
+  -- assume environment is stable when robot enters critical zone,
+  -- but can be different each time the robot enters the zone.
+  TRANS robot.position=critical_zone -> environment.workload = next(environment.workload);
+  TRANS robot.position=critical_zone -> environment.heat = next(environment.heat);
+
+  VAR robot : forge_robot(environment.workload, environment.heat, time_delta,
+                          do_timed, done_timed);
+
+  IVAR time_delta : real;
+  FAIRNESS time_delta > 0;
+  TRANS time_delta >= 0;
+
+  -- guard to prevent discrete updates during timed transitions
+  VAR do_timed : boolean;
+  TRANS do_timed <-> time_delta > 0;
+  TRANS do_timed -> !next(do_timed);
+
+  -- guard to enable discrete updates after each timed transition
+  VAR done_timed : boolean;
+  INIT !done_timed;
+  TRANS do_timed <-> next(done_timed);
+
+  --INVARSPEC do_timed -> !done_timed;
+  --INVARSPEC done_timed -> !do_timed;
+  --LTLSPEC G F do_timed;
+
+
+--  HMON(h_F_LOCOMOTION, robot.f_locomotion)
+--  INVARSPEC time_delta=1 -> (h_F_LOCOMOTION = next(h_F_LOCOMOTION));
+--
+--  HMON(h_F_COOLING, robot.f_cooling)
+--  INVARSPEC time_delta=1 -> (h_F_COOLING = next(h_F_COOLING));
+--
+--  DEFINE def_NON_CRITICAL_OVERHEATING:= robot.heat_level >= 10;
+--  HMON(h_NON_CRITICAL_OVERHEATING, def_NON_CRITICAL_OVERHEATING)
+--  INVARSPEC time_delta=1 -> (h_NON_CRITICAL_OVERHEATING = next(h_NON_CRITICAL_OVERHEATING));
+--
+--  DEFINE def_CRITICAL_OVERHEATING:= robot.heat_level = 15;
+--  HMON(h_CRITICAL_OVERHEATING, def_CRITICAL_OVERHEATING)
+--  INVARSPEC time_delta=1 -> (h_CRITICAL_OVERHEATING = next(h_CRITICAL_OVERHEATING));
+--
+--  DEFINE def_UNIT_STUCK:= !robot.can_move;
+--  HMON(h_UNIT_STUCK, def_UNIT_STUCK)
+--  INVARSPEC time_delta=1 -> (h_UNIT_STUCK = next(h_UNIT_STUCK));
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/forgerobot/forgerobot.txml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/forgerobot/forgerobot.txml
new file mode 100644
index 0000000000000000000000000000000000000000..90f41f8da2c63a44510de2f1002f690c52e3def3
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/forgerobot/forgerobot.txml
@@ -0,0 +1,72 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<tfpg name="DependencyGraph">
+  <nodesList>
+    <node name="NON_CRITICAL_OVERHEATING" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="UNIT_STUCK" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="F_COOLING" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="CRITICAL_OVERHEATING" isMonitored="false">
+      <type>AND</type>
+    </node>
+    <node name="F_LOCOMOTION" isMonitored="false">
+      <type>FM</type>
+    </node>
+  </nodesList>
+  <modesList>
+    <mode>safe_zone</mode>
+    <mode>critical_zone</mode>
+  </modesList>
+  <edgesList>
+    <edge name="EDGE1">
+      <srcNode>UNIT_STUCK</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>20.0</tMax>
+      <modesList>
+      <mode>critical_zone</mode>
+      </modesList>
+      <destNode>NON_CRITICAL_OVERHEATING</destNode>
+    </edge>
+    <edge name="EDGE2">
+      <srcNode>F_COOLING</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>20.0</tMax>
+      <modesList>
+      <mode>critical_zone</mode>
+      </modesList>
+      <destNode>NON_CRITICAL_OVERHEATING</destNode>
+    </edge>
+    <edge name="EDGE3">
+      <srcNode>F_LOCOMOTION</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+      <mode>safe_zone</mode>
+      <mode>critical_zone</mode>
+      </modesList>
+      <destNode>UNIT_STUCK</destNode>
+    </edge>
+    <edge name="EDGE4">
+      <srcNode>UNIT_STUCK</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>30.0</tMax>
+      <modesList>
+      <mode>critical_zone</mode>
+      </modesList>
+      <destNode>CRITICAL_OVERHEATING</destNode>
+    </edge>
+    <edge name="EDGE5">
+      <srcNode>NON_CRITICAL_OVERHEATING</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>4.0</tMax>
+      <modesList>
+      <mode>critical_zone</mode>
+      </modesList>
+      <destNode>CRITICAL_OVERHEATING</destNode>
+    </edge>
+  </edgesList>
+</tfpg>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/guidance/guidance.axml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/guidance/guidance.axml
new file mode 100644
index 0000000000000000000000000000000000000000..24526ad4134999e247c02f7f4d14f1dc630f823d
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/guidance/guidance.axml
@@ -0,0 +1,37 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<associations>
+  <failureModes>
+    <assoc id="cont_3EO_start" expr="cs.cont_3EO_start"/>
+    <assoc id="region_selected" expr="cs.region_selected"/>
+    <assoc id="meco_confrm" expr="meco_confirmed"/>
+    <assoc id="q_bar_a_LT_qbar_oms_dump" expr="q_bar_a_LT_qbar_oms_dump"/>
+    <assoc id="excess_propellant" expr="excess_OMS_propellant"/>
+    <assoc id="pre_sep" expr="pre_sep"/>
+  </failureModes>
+  <monitoredDiscrepancies>
+  </monitoredDiscrepancies>
+  <unmonitoredDiscrepancies>
+    <assoc id="frz_3eo" expr="cg.frz_3eo"/>
+    <assoc id="cont_sep_cplt" expr="cg.cont_sep_cplt"/>
+    <assoc id="abrt_declared" expr="cs.RTLS_abort_declared"/>
+    <assoc id="abrt_task_call" expr="cg.call_RTLS_abort_task"/>
+    <assoc id="sep_man_init" expr="cg.et_sep_man_initiate"/>
+    <assoc id="orbiter_dump_ena" expr="cg.orbiter_dump_ena"/>
+    <assoc id="oms_rcs_i_c_inh_ena_cmd" expr="cg.oms_rcs_i_c_inh_ena_cmd"/>
+  </unmonitoredDiscrepancies>
+  <tfpgModes>
+    <assoc id="mm102" expr="cs.m_mode=mm102"/>
+    <assoc id="mm103" expr="cs.m_mode=mm103"/>
+    <assoc id="mm601" expr="cs.m_mode=mm601"/>
+  </tfpgModes>
+</associations>
+
+<!-- useless nodes
+    <assoc id="rcs_all_jet_inhibit" expr="rcs_all_jet_inhibit"/>
+    <assoc id="emerg_sep" expr="cg.emerg_sep"/>
+    <assoc id="early_sep" expr="cg.early_sep"/>
+    <assoc id="high_rate_sep" expr="cg.high_rate_sep"/>
+    <assoc id="beta_oor" expr="ABS_beta_n_GRT_beta_max"/>
+    <assoc id="alf_err_sep" expr="ABS_alf_err_LT_alf_sep_err"/>
+-->
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/guidance/guidance.smv b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/guidance/guidance.smv
new file mode 100644
index 0000000000000000000000000000000000000000..30b8e9ab52de129a89b98643b7faafbdc317277b
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/guidance/guidance.smv
@@ -0,0 +1,1169 @@
+--
+-- Shuttle Digital Autopilot
+--         by Sergey Berezin (berez@cs.cmu.edu)
+--
+MODULE cont_3eo_mode_select(start,smode5,vel,q_bar,apogee_alt_LT_alt_ref,
+                         h_dot_LT_hdot_reg2,alpha_n_GRT_alpha_reg2,
+                         delta_r_GRT_del_r_usp,v_horiz_dnrng_LT_0,
+                         high_rate_sep,meco_confirmed)
+
+VAR cont_3EO_start: boolean;
+    RTLS_abort_declared: boolean;
+    region_selected : boolean;
+    m_mode: {mm102, mm103, mm601};
+    r: {reg-1, reg0, reg1, reg2, reg3, reg102};
+    step : {1,2,3,4,5,6,7,8,9,10, exit, undef};
+
+ASSIGN
+ init(cont_3EO_start) := FALSE;
+ init(m_mode) := {mm102, mm103};
+ init(region_selected) := FALSE;
+ init(RTLS_abort_declared) := FALSE;
+ init(r) := reg-1;
+ init(step) := undef;
+
+ next(step) := 
+   case
+     step = 1 & m_mode = mm102 : exit;
+     step = 1 : 2;
+     step = 2 & smode5 : 5;
+     step = 2 & vel = GRT_vi_3eo_max: exit;
+     step = 2 : 3;
+     step = 3 & vel = LEQ_vi_3eo_min : 6;
+     step = 3 : 4;
+     step = 4 & apogee_alt_LT_alt_ref: exit;
+     step = 4 : 6;
+     step = 5 : 6;
+     step = 6 & r = reg0 : exit;
+     step = 6 : 7;
+     step = 7 : 8;
+     step = 8 & q_bar = GRT_qbar_reg3 & !high_rate_sep : 10;
+     step = 8 : 9;
+     step = 9 : 10;
+     step = 10: exit;
+     next(start): 1;
+     step = exit : undef;
+     TRUE: step;
+   esac;
+
+ next(cont_3EO_start) :=
+   case 
+     step = 1 & m_mode = mm102 : TRUE;
+     step = 10 & meco_confirmed : TRUE;
+     TRUE : cont_3EO_start;
+   esac;
+
+ next(r) :=
+   case
+     step = 1 & m_mode = mm102 : reg102;
+     step = 2 & !smode5 & vel = GRT_vi_3eo_max: reg0;
+     step = 4 & apogee_alt_LT_alt_ref: reg0;
+     step = 5 & v_horiz_dnrng_LT_0 & delta_r_GRT_del_r_usp : reg0;
+     step = 8 & q_bar = GRT_qbar_reg3 & !high_rate_sep : reg3;
+     step = 9: case
+                 (h_dot_LT_hdot_reg2 & alpha_n_GRT_alpha_reg2 &
+                  q_bar = GRT_qbar_reg1) | high_rate_sep :     reg2;
+                 TRUE : reg1;
+               esac;
+     next(step) = 1 : reg-1;
+     TRUE: r;
+   esac;
+
+ next(RTLS_abort_declared) :=
+   case
+     step = 10 & meco_confirmed & m_mode = mm103 : TRUE;
+     TRUE: RTLS_abort_declared;
+   esac;
+
+ next(m_mode) :=
+   case
+     step = 10 & meco_confirmed & m_mode = mm103 : mm601;
+     TRUE: m_mode;
+   esac;
+
+ next(region_selected) :=
+   case
+     next(step) = 1 : FALSE;
+     next(step) = exit : TRUE;
+     TRUE : region_selected;
+   esac;
+
+MODULE cont_3eo_guide(start,cont_3EO_start, mode_select_completed, et_sep_cmd,
+           h_dot_LT_0, q_bar_a_GRT_qbar_max_sep, m_mode, r0,
+           cont_minus_z_compl, t_nav-t_et_sep_GRT_dt_min_z_102, 
+           ABS_q_orb_GRT_q_minus_z_max, ABS_r_orb_GRT_r_minus_z_max,
+           excess_OMS_propellant, q_bar_a_LT_qbar_oms_dump,
+           entry_mnvr_couter_LE_0, rcs_all_jet_inhibit, 
+           alt_GRT_alt_min_102_dump, t_nav-t_gmtlo_LT_t_dmp_last,
+           pre_sep, cond_18, q_orb_LT_0, ABS_alf_err_LT_alf_sep_err,
+           cond_20b, cond_21, ABS_beta_n_GRT_beta_max, cond_24, cond_26, 
+           cond_27, cond_29, mm602_OK)
+VAR
+    step: {1,a1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
+           b20, c20, d20, 21,22,23,24,25,26,27,28,29,exit, undef};
+    call_RTLS_abort_task : boolean;
+    first3: boolean; -- indicates if it is the first pass
+    first8: boolean;
+    first27: boolean;
+    s_unconv : boolean;
+    mode_2_indicator : boolean;
+    et_sep_man_initiate : boolean;
+    emerg_sep : boolean;
+    cont_3eo_pr_delay : {minus_z_reg1, minus_z_reg2, 
+                minus_z_reg3, minus_z_reg4, minus_z_reg102, 0, 5};
+    etsep_y_drift : {undef, minus_z_reg1, minus_z_reg2, 
+                minus_z_reg3, minus_z_reg4, minus_z_reg102, 0};
+    fwd_rcs_dump_enable : boolean;
+    fcs_accept_icnct : boolean;
+    oms_rcs_i_c_inh_ena_cmd : boolean;
+    orbiter_dump_ena : boolean;
+    frz_3eo : boolean;
+    high_rate_sep: boolean;
+    entry_gains : boolean;
+    cont_sep_cplt : boolean;
+    pch_cmd_reg4 : boolean;
+    alpha_ok : boolean;
+    r :  {reg-1, reg0, reg1, reg2, reg3, reg4, reg102};
+    early_sep : boolean;
+--------------------------------------------
+----- Additional Variables -----------------
+--------------------------------------------
+    rtls_lo_f_d_delay : {undef, 0};
+    wcb2 : {undef, reg1_0, reg2_neg4, wcb2_3eo, reg4_0, 
+            reg102_undef, post_sep_0};
+    q_gcb_i : {undef, quat_reg1, quat_reg2, quat_reg3, quat_reg4, 
+               quat_reg102_undef, quat_entry_M50_to_cmdbody};
+    oms_nz_lim : {undef, oms_nz_lim_3eo, oms_nz_lim_iload, oms_nz_lim_std};
+    contingency_nz_lim : {undef, contingency_nz_lim_3eo, 
+                   contingency_nz_lim_iload, contingency_nz_lim_std};
+    
+
+
+ASSIGN
+ init(entry_gains) := FALSE;
+ init(frz_3eo) := FALSE;
+ init(cont_3eo_pr_delay) := 5;
+ init(etsep_y_drift) := undef;
+ init(r) := reg-1;
+ init(step) := undef;
+ init(call_RTLS_abort_task) := FALSE;
+ init(first3) := TRUE;
+ init(first8) := TRUE;
+ init(first27) := TRUE;
+ init(cont_sep_cplt) := FALSE;
+ init(et_sep_man_initiate) := FALSE;
+ init(alpha_ok) := FALSE;
+ init(pch_cmd_reg4) := FALSE;
+
+-- Assumed initializations:
+
+ init(rtls_lo_f_d_delay) := undef;
+ init(wcb2) := undef;
+ init(q_gcb_i) := undef;
+ init(oms_nz_lim) := undef;
+ init(contingency_nz_lim) := undef;
+ init(oms_rcs_i_c_inh_ena_cmd) := FALSE;
+ init(orbiter_dump_ena) := FALSE;
+-- init(early_sep) := FALSE;
+
+-------------
+
+ next(step) := nextstep;
+
+ next(r) :=
+   case
+     step = a1 & (cont_3EO_start | mode_select_completed) : r0;
+     step = 21 & cond_21 : reg4;
+     step = 23 & ABS_beta_n_GRT_beta_max & !high_rate_sep : reg1;
+     TRUE : r;
+   esac;
+
+ next(first3) :=
+   case
+     step = 3 & cont_3EO_start : FALSE;
+     TRUE : first3;
+   esac;
+
+ next(first8) :=
+   case
+     step = 8 & excess_OMS_propellant & cont_3EO_start : FALSE;
+     TRUE : first8;
+   esac;
+
+ next(first27) :=
+   case
+     step = 27 : FALSE;
+     TRUE: first27;
+   esac;
+
+ next(s_unconv) :=
+   case
+     step = 3 : FALSE;
+     TRUE : s_unconv;
+   esac;
+
+ next(call_RTLS_abort_task) := 
+   case
+     step = 3 : TRUE;
+     TRUE : call_RTLS_abort_task;
+   esac;
+
+ next(mode_2_indicator) :=
+   case
+     step = 4 : TRUE;
+     TRUE : mode_2_indicator;
+   esac;
+
+ next(et_sep_man_initiate) :=
+   case
+     step = 5 & h_dot_LT_0 & q_bar_a_GRT_qbar_max_sep & m_mode != mm102 : TRUE;
+     step = 14 & pre_sep : TRUE;
+     step = 19 & q_orb_LT_0 : TRUE;
+     step = d20 : TRUE;
+     step = 26 & cond_26 : TRUE;
+     step = 29 & cond_29 : TRUE;
+     TRUE : et_sep_man_initiate;
+   esac;
+
+ next(emerg_sep) :=
+   case
+     next(step) = 1 : FALSE;
+     step = 5 & h_dot_LT_0 & q_bar_a_GRT_qbar_max_sep  & m_mode != mm102: TRUE;
+     TRUE : emerg_sep;
+   esac;
+
+ next(cont_3eo_pr_delay) :=
+   case
+     next(step) = 1 : 5;
+     step = 5 & h_dot_LT_0 & q_bar_a_GRT_qbar_max_sep & m_mode != mm102 : 
+                                                              minus_z_reg3;
+     step = 7 & !cont_minus_z_compl & r = reg102 & 
+        t_nav-t_et_sep_GRT_dt_min_z_102 &
+        (ABS_q_orb_GRT_q_minus_z_max | ABS_r_orb_GRT_r_minus_z_max) : 0;
+     step = 14 & pre_sep : minus_z_reg102;
+     step = 19 & q_orb_LT_0 : minus_z_reg4;
+     step = d20 : minus_z_reg3;
+     step = 26 & cond_26 : minus_z_reg2;
+     step = 27 & first27 : minus_z_reg1;
+     TRUE : cont_3eo_pr_delay;
+   esac;
+
+ next(etsep_y_drift) :=
+   case
+     step = 5 & h_dot_LT_0 & q_bar_a_GRT_qbar_max_sep & m_mode != mm102 : 
+                                                              minus_z_reg3;
+     step = 7 & !cont_minus_z_compl & r = reg102 & 
+        t_nav-t_et_sep_GRT_dt_min_z_102 &
+        (ABS_q_orb_GRT_q_minus_z_max | ABS_r_orb_GRT_r_minus_z_max) : 0;
+     step = 14 & pre_sep : minus_z_reg102;
+     step = 19 & q_orb_LT_0 : minus_z_reg4;
+     step = d20 : minus_z_reg3;
+     step = 26 & cond_26 : minus_z_reg2;
+     step = 27 & first27 : minus_z_reg1;
+    TRUE : etsep_y_drift;
+   esac;
+
+ next(fwd_rcs_dump_enable) :=
+   case
+     step = 8 & excess_OMS_propellant & first8 : FALSE;
+     TRUE : fwd_rcs_dump_enable;
+   esac;
+
+ next(fcs_accept_icnct) :=
+   case
+     step = 9 & q_bar_a_LT_qbar_oms_dump & r != reg102 : TRUE;
+     TRUE : fcs_accept_icnct;
+   esac;
+
+ next(oms_rcs_i_c_inh_ena_cmd) :=
+   case
+--     next(step) = 1 & oms_rcs_i_c_inh_ena_cmd : {0,1};
+     next(step) = 1 & oms_rcs_i_c_inh_ena_cmd : FALSE; -- Assumed initialization
+     step = 9 & q_bar_a_LT_qbar_oms_dump & r != reg102 : TRUE;
+     TRUE : oms_rcs_i_c_inh_ena_cmd;
+   esac;
+
+ next(orbiter_dump_ena) :=
+   case
+     next(start) = TRUE : FALSE;                      -- Assumed initialization
+     step = 9 & q_bar_a_LT_qbar_oms_dump & r != reg102 : TRUE;
+     step = 13 & alt_GRT_alt_min_102_dump & t_nav-t_gmtlo_LT_t_dmp_last : TRUE;
+     TRUE : orbiter_dump_ena;
+   esac;
+
+ next(frz_3eo) :=
+   case
+     next(step) = 1 : FALSE;
+     step = 10 & entry_mnvr_couter_LE_0 & !rcs_all_jet_inhibit : FALSE;
+     step = 28 & !et_sep_man_initiate : TRUE;
+     TRUE : frz_3eo;
+   esac;
+
+ next(high_rate_sep) :=
+   case
+     step = 10 & entry_mnvr_couter_LE_0 & !rcs_all_jet_inhibit : FALSE;
+     step = 25 : TRUE;
+     TRUE : high_rate_sep;
+   esac;
+
+ next(entry_gains) :=
+   case
+     next(step) = 1 : FALSE;
+     step = 10 & entry_mnvr_couter_LE_0 & !rcs_all_jet_inhibit : TRUE;
+     TRUE : entry_gains;
+   esac;
+
+ next(cont_sep_cplt) :=
+   case
+     next(step) = 1 : FALSE;
+     step = 12 & mm602_OK : TRUE;
+     TRUE : cont_sep_cplt;
+   esac;
+
+ next(pch_cmd_reg4) := 
+   case
+     next(step) = 1 : FALSE;
+     step = 18 & !pch_cmd_reg4 & cond_18 : TRUE;
+     TRUE : pch_cmd_reg4;
+   esac;
+
+ next(alpha_ok) :=
+   case
+     next(step) = 1 : FALSE;
+     step = 20 & ABS_alf_err_LT_alf_sep_err : TRUE;
+     TRUE : alpha_ok;
+   esac;
+
+ next(early_sep) :=
+   case
+     step = 27 & first27 : 
+                 case 
+                   cond_27 : TRUE; 
+                   TRUE : FALSE; 
+                 esac;
+     TRUE : early_sep;
+   esac; 
+
+--------------------------------------------
+----- Additional Variables -----------------
+--------------------------------------------
+
+ next(rtls_lo_f_d_delay) :=
+   case
+     next(start) = TRUE : undef;          -- Assumed initialization
+     step = 8 & first8 & excess_OMS_propellant : 0;
+     TRUE : rtls_lo_f_d_delay;
+   esac;
+
+ next(wcb2) :=
+   case
+     next(start) = TRUE : undef;          -- Assumed initialization
+     step = 10 & entry_mnvr_couter_LE_0 : post_sep_0;
+     step = 12 : case
+                   r = reg4 : reg4_0;
+                   TRUE : wcb2_3eo;
+                 esac;
+     step = 14 & pre_sep : reg102_undef;
+     step = 15 : case
+                   r = reg4 : reg4_0;
+                   TRUE : wcb2_3eo;
+                 esac;
+     step = 25 : reg2_neg4;
+     TRUE : wcb2;
+   esac;
+
+ next(q_gcb_i) :=
+   case
+     next(start) = TRUE : undef;          -- Assumed initialization
+     step = 11 : quat_entry_M50_to_cmdbody;
+     step = 14 & pre_sep : quat_reg102_undef;
+     step = 16 : case 
+                   r = reg4 : quat_reg4;
+                   TRUE : quat_reg3;
+                 esac;
+     step = 22 : quat_reg2;
+
+-- Without this step the value "quat_reg2" would remain in "reg1":
+--     step = 23  & ABS_beta_n_GRT_beta_max & !high_rate_sep : undef;
+ 
+     TRUE : q_gcb_i;
+   esac;
+
+ next(oms_nz_lim) :=
+   case
+     next(start) = TRUE : undef;          -- Assumed initialization
+     step = 9 & q_bar_a_LT_qbar_oms_dump & r != reg102 : oms_nz_lim_3eo;
+     step = 12 & mm602_OK : oms_nz_lim_std;
+     TRUE : oms_nz_lim;
+   esac;
+
+ next(contingency_nz_lim) :=
+   case
+     next(start) = TRUE : undef;          -- Assumed initialization
+     step = 9 & q_bar_a_LT_qbar_oms_dump & r != reg102 : 
+                                        contingency_nz_lim_3eo;
+     step = 12 & mm602_OK : contingency_nz_lim_std;
+     TRUE : contingency_nz_lim;
+   esac;
+
+DEFINE
+ finished := step = exit;
+ idle := step = undef;
+
+ start_cont_3eo_mode_select := 
+   case
+     step = 1 & !cont_3EO_start : TRUE;
+     TRUE : FALSE;
+   esac;
+
+  nextstep :=
+    case
+     step = 1 : a1;
+     step = a1 : case
+                   (cont_3EO_start | mode_select_completed) : 2;
+                   TRUE : step;
+                 esac;
+     step = 2 : case 
+                  !cont_3EO_start : exit;
+                  first3 : 3;
+                  TRUE: 4;
+                esac;
+     step = 3 : 4;
+     step = 4 : case
+                  et_sep_cmd : 7;
+                  TRUE : 5;
+                esac;
+     step = 5 : case
+                  h_dot_LT_0 & q_bar_a_GRT_qbar_max_sep & 
+                                          m_mode != mm102 : exit;
+                  TRUE : 6;
+                esac;
+     step = 6 : 
+         case
+           r = reg102 : 13;
+           r in {reg3, reg4} : 15;
+           r = reg2 : 22;
+           r = reg1 : 27;
+           TRUE : exit;
+         esac;
+     step = 7 : case
+                  cont_minus_z_compl : 8;
+                  TRUE : exit;
+                esac;
+     step = 8 : case
+                  excess_OMS_propellant & first8 : 9;
+                  TRUE : 10;
+                esac;
+     step = 9 : exit;
+    step = 10 : case
+                  !entry_mnvr_couter_LE_0 | rcs_all_jet_inhibit : exit;
+                  TRUE : 11;
+                esac;
+    step = 11 : 12;
+    step = 12 : exit;
+    step = 13 : 14;
+    step = 14 : exit;
+    step = 15 : 16;
+    step = 16 : 17;
+    step = 17 : case
+                  r = reg4 : 18;
+                  TRUE : 20;
+                esac;
+    step = 18 : case
+                  pch_cmd_reg4 | cond_18 : 19;
+                  TRUE : exit;
+                esac;
+    step = 19 : exit;
+    step = 20 : case
+                  ABS_alf_err_LT_alf_sep_err : b20;
+                  TRUE : c20;
+                esac;
+    step = b20 : case
+                   cond_20b : d20;
+                   TRUE : exit;
+                 esac;
+    step = c20 : case
+                   alpha_ok : d20;
+                   TRUE : 21;
+                 esac;
+    step = d20 : exit;
+    TRUE : nextstep21;
+  esac;
+
+ nextstep21 :=
+  case
+    step = 21 : case
+                  cond_21 : 15;
+                  TRUE : exit;
+                esac;
+    step = 22 : 23;
+    step = 23 : case
+                  ABS_beta_n_GRT_beta_max & !high_rate_sep : 27;
+                  TRUE : 24;
+                esac;
+    step = 24 : case
+                  cond_24 | high_rate_sep : 25;
+                  TRUE : exit;
+                esac;
+    step = 25 : 26;
+    step = 26 : exit;
+    step = 27 : 28;
+    step = 28 : case
+                  !et_sep_man_initiate : 29;
+                  TRUE : exit;
+                esac;
+    step = 29 : exit;
+    start : 1;
+    step = exit : undef;
+    TRUE : step;
+   esac;
+
+ post_sep_mode := step in {7,8,9,10,11,12};
+
+------------------------------------------------------------------
+------------------------------------------------------------------
+
+MODULE main
+VAR
+    smode5: boolean;
+    vel : {GRT_vi_3eo_max, GRT_vi_3eo_min, LEQ_vi_3eo_min};
+    q_bar: {GRT_qbar_reg3, GRT_qbar_reg1, LEQ_qbar_reg1};
+    q_bar_a_GRT_qbar_max_sep : boolean;
+    q_bar_a_LT_qbar_oms_dump : boolean;
+    apogee_alt_LT_alt_ref : boolean;
+    h_dot_LT_hdot_reg2 : boolean;
+    h_dot_LT_0 : boolean;
+    alpha_n_GRT_alpha_reg2 : boolean;
+    delta_r_GRT_del_r_usp : boolean;
+    v_horiz_dnrng_LT_0: boolean;
+    meco_confirmed: boolean;
+    et_sep_cmd : boolean;
+    cont_minus_z_compl : boolean;
+    t_nav-t_et_sep_GRT_dt_min_z_102 : boolean;
+    ABS_q_orb_GRT_q_minus_z_max : boolean;
+    ABS_r_orb_GRT_r_minus_z_max : boolean;
+    excess_OMS_propellant : boolean;
+    entry_mnvr_couter_LE_0 : boolean;
+    rcs_all_jet_inhibit : boolean;
+    alt_GRT_alt_min_102_dump : boolean;
+    t_nav-t_gmtlo_LT_t_dmp_last : boolean;
+    pre_sep : boolean;
+    cond_18 : boolean;
+    q_orb_LT_0 : boolean;
+    ABS_alf_err_LT_alf_sep_err : boolean;
+    cond_20b : boolean;
+    cond_21 : boolean;
+    ABS_beta_n_GRT_beta_max : boolean;
+    cond_24 : boolean;
+    cond_26 : boolean;
+    cond_27 : boolean;
+    cond_29 : boolean;
+    mm602_OK : boolean;
+    start_guide : boolean;
+    mated_coast_mnvr : boolean;
+
+    cs: cont_3eo_mode_select(cg.start_cont_3eo_mode_select,
+                        smode5,vel,q_bar,apogee_alt_LT_alt_ref,
+                         h_dot_LT_hdot_reg2,alpha_n_GRT_alpha_reg2,
+                         delta_r_GRT_del_r_usp,v_horiz_dnrng_LT_0,
+                         cg.high_rate_sep,meco_confirmed);
+
+    cg: cont_3eo_guide(start_guide,
+           cs.cont_3EO_start, cs.region_selected, et_sep_cmd,
+           h_dot_LT_0, q_bar_a_GRT_qbar_max_sep, cs.m_mode, cs.r,
+           cont_minus_z_compl, t_nav-t_et_sep_GRT_dt_min_z_102, 
+           ABS_q_orb_GRT_q_minus_z_max, ABS_r_orb_GRT_r_minus_z_max,
+           excess_OMS_propellant, q_bar_a_LT_qbar_oms_dump,
+           entry_mnvr_couter_LE_0, rcs_all_jet_inhibit, 
+           alt_GRT_alt_min_102_dump, t_nav-t_gmtlo_LT_t_dmp_last,
+           pre_sep, cond_18, q_orb_LT_0, ABS_alf_err_LT_alf_sep_err,
+           cond_20b, cond_21, ABS_beta_n_GRT_beta_max, cond_24, cond_26, 
+           cond_27, cond_29, mm602_OK);
+
+ASSIGN
+ init(start_guide) := FALSE;
+ init(mated_coast_mnvr) := FALSE;
+
+ next(entry_mnvr_couter_LE_0) := 
+    case
+      !entry_mnvr_couter_LE_0 : {FALSE, TRUE};
+      TRUE : TRUE;
+    esac;
+
+---------------------------------------------------------------------
+---------------------------------------------------------------------
+ next(start_guide) :=
+   case
+     start_guide : FALSE;
+     !cg.idle  : FALSE;
+     TRUE : {FALSE, TRUE};
+   esac;
+
+ next(smode5) := 
+   case
+     fixed_values : smode5;
+     cg.idle : { FALSE, TRUE };
+     TRUE : smode5;
+   esac;
+
+ next(vel) :=
+   case
+     fixed_values :  vel;
+     cg.idle : {GRT_vi_3eo_max, GRT_vi_3eo_min, LEQ_vi_3eo_min};
+     TRUE : vel;
+   esac;
+
+ next(q_bar) := 
+   case
+     fixed_values : q_bar;
+     cg.idle : {GRT_qbar_reg3, GRT_qbar_reg1, LEQ_qbar_reg1};
+     TRUE : q_bar;
+   esac;
+
+ next(q_bar_a_GRT_qbar_max_sep) := 
+   case
+     fixed_values : q_bar_a_GRT_qbar_max_sep;
+     cg.idle : { FALSE, TRUE };
+     TRUE : q_bar_a_GRT_qbar_max_sep;
+   esac;
+
+ next(apogee_alt_LT_alt_ref) := 
+   case
+     fixed_values : apogee_alt_LT_alt_ref;
+     cg.idle : { FALSE, TRUE };
+     TRUE : apogee_alt_LT_alt_ref;
+   esac;
+
+ next(h_dot_LT_hdot_reg2) := 
+   case
+     fixed_values : h_dot_LT_hdot_reg2;
+     cg.idle : { FALSE, TRUE };
+     TRUE : h_dot_LT_hdot_reg2;
+   esac;
+
+ next(h_dot_LT_0) := 
+   case
+     fixed_values :  h_dot_LT_0;
+     cg.idle : { FALSE, TRUE };
+     TRUE : h_dot_LT_0;
+   esac;
+
+ next(alpha_n_GRT_alpha_reg2) :=  
+   case
+     fixed_values : alpha_n_GRT_alpha_reg2;
+     cg.idle : { FALSE, TRUE };
+     TRUE : alpha_n_GRT_alpha_reg2;
+   esac;
+
+ next(delta_r_GRT_del_r_usp) :=   
+   case
+     fixed_values : delta_r_GRT_del_r_usp;
+     cg.idle : { FALSE, TRUE };
+     TRUE : delta_r_GRT_del_r_usp;
+   esac;
+
+ next(v_horiz_dnrng_LT_0) :=   
+   case
+     fixed_values : v_horiz_dnrng_LT_0;
+     cg.idle : { FALSE, TRUE };
+     TRUE : v_horiz_dnrng_LT_0;
+   esac;
+
+ next(meco_confirmed) := 
+   case
+     fixed_values : meco_confirmed;
+     meco_confirmed : TRUE;
+     cg.idle : { FALSE, TRUE };
+     TRUE : meco_confirmed;
+   esac;
+
+ next(et_sep_cmd) := 
+   case
+     fixed_values : et_sep_cmd;
+     et_sep_cmd : TRUE;
+     cg.idle : { FALSE, TRUE };
+     TRUE : et_sep_cmd;
+   esac;
+
+ next(cont_minus_z_compl) := 
+   case
+     fixed_values : cont_minus_z_compl;
+     cg.idle : { FALSE, TRUE };
+     TRUE : cont_minus_z_compl;
+   esac;
+
+ next(t_nav-t_et_sep_GRT_dt_min_z_102) := 
+   case
+     fixed_values : t_nav-t_et_sep_GRT_dt_min_z_102;
+     cg.idle : { FALSE, TRUE };
+     TRUE : t_nav-t_et_sep_GRT_dt_min_z_102;
+   esac;
+
+ next(ABS_q_orb_GRT_q_minus_z_max) :=
+   case
+     fixed_values : ABS_q_orb_GRT_q_minus_z_max;
+     cg.idle : { FALSE, TRUE };
+     TRUE : ABS_q_orb_GRT_q_minus_z_max;
+   esac;
+
+ next(ABS_r_orb_GRT_r_minus_z_max) :=
+   case
+     fixed_values : ABS_r_orb_GRT_r_minus_z_max;
+     cg.idle : { FALSE, TRUE };
+     TRUE : ABS_r_orb_GRT_r_minus_z_max;
+   esac;
+
+ next(excess_OMS_propellant) :=
+   case
+     fixed_values : excess_OMS_propellant;
+     cg.idle & excess_OMS_propellant : { FALSE, TRUE };
+     TRUE : excess_OMS_propellant;
+   esac;
+
+ next(q_bar_a_LT_qbar_oms_dump) :=
+   case
+     fixed_values : q_bar_a_LT_qbar_oms_dump;
+     cg.idle : { FALSE, TRUE };
+     TRUE : q_bar_a_LT_qbar_oms_dump;
+   esac;
+
+ next(rcs_all_jet_inhibit) :=
+   case
+     fixed_values : rcs_all_jet_inhibit;
+     cg.idle : { FALSE, TRUE };
+     TRUE : rcs_all_jet_inhibit;
+   esac;
+
+ next(alt_GRT_alt_min_102_dump) :=
+   case
+     fixed_values : alt_GRT_alt_min_102_dump;
+     cg.idle : { FALSE, TRUE };
+     TRUE : alt_GRT_alt_min_102_dump;
+   esac;
+
+ next(t_nav-t_gmtlo_LT_t_dmp_last) :=
+   case
+     fixed_values : t_nav-t_gmtlo_LT_t_dmp_last;
+     cg.idle : { FALSE, TRUE };
+     TRUE : t_nav-t_gmtlo_LT_t_dmp_last;
+   esac;
+
+ next(pre_sep) :=
+   case
+     fixed_values : pre_sep;
+     cg.idle : { FALSE, TRUE };
+     TRUE : pre_sep;
+   esac;
+
+ next(cond_18) :=
+   case
+     fixed_values : cond_18;
+     cg.idle : { FALSE, TRUE };
+     TRUE : cond_18;
+   esac;
+
+ next(q_orb_LT_0) :=
+   case
+     fixed_values : q_orb_LT_0;
+     cg.idle : { FALSE, TRUE };
+     TRUE : q_orb_LT_0;
+   esac;
+
+ next(ABS_alf_err_LT_alf_sep_err) :=
+   case
+     fixed_values : ABS_alf_err_LT_alf_sep_err;
+     cg.idle : { FALSE, TRUE };
+     TRUE : ABS_alf_err_LT_alf_sep_err;
+   esac;
+
+ next(cond_20b) :=
+   case
+     fixed_values : cond_20b;
+     cg.idle : { FALSE, TRUE };
+     TRUE : cond_20b;
+   esac;
+
+ next(cond_21) :=
+   case
+     fixed_values : cond_21;
+     cg.idle : { FALSE, TRUE };
+     TRUE : cond_21;
+   esac;
+
+ next(ABS_beta_n_GRT_beta_max) :=
+   case
+     fixed_values : ABS_beta_n_GRT_beta_max;
+     cg.idle : { FALSE, TRUE };
+     TRUE : ABS_beta_n_GRT_beta_max;
+   esac;
+
+ next(cond_24) :=
+   case
+     fixed_values : cond_24;
+     cg.idle : { FALSE, TRUE };
+     TRUE : cond_24;
+   esac;
+
+ next(cond_26) :=
+   case
+     fixed_values : cond_26;
+     cg.idle : { FALSE, TRUE };
+     TRUE : cond_26;
+   esac;
+
+ next(cond_27) :=
+   case
+     fixed_values : cond_27;
+     cg.idle : { FALSE, TRUE };
+     TRUE : cond_27;
+   esac;
+
+ next(cond_29) :=
+   case
+     fixed_values : cond_29;
+     cg.idle : { FALSE, TRUE };
+     TRUE : cond_29;
+   esac;
+
+ next(mm602_OK) :=
+   case
+     fixed_values : mm602_OK;
+     cg.idle : { FALSE, TRUE };
+     TRUE :  mm602_OK;
+   esac;
+
+ next(mated_coast_mnvr) :=
+   case
+     next(cg.step) = 1 : FALSE;
+     cg.step = 6 & cg.r in {reg1, reg2, reg3, reg4, reg102} : TRUE;
+     TRUE : mated_coast_mnvr; 
+   esac;
+
+---------------------------------------------------------------------
+---------------------------------------------------------------------
+DEFINE
+  fixed_values := FALSE;
+
+  output_ok :=
+    case
+      cg.q_gcb_i = undef | cg.wcb2 = undef | 
+      cg.cont_3eo_pr_delay = 5 | 
+      cg.etsep_y_drift = undef :
+        case
+          !mated_coast_mnvr: 1;
+          TRUE : undef;
+        esac;
+      !mated_coast_mnvr: toint(cg.q_gcb_i = quat_entry_M50_to_cmdbody & 
+                         cg.wcb2 = post_sep_0); 
+-- reg1 never happens?
+--      cg.r = reg1 : (cg.q_gcb_i = quat_reg1 & cg.wcb2 = reg1_0 &
+--                   cg.cont_3eo_pr_delay = minus_z_reg1 &
+--                    cg.etsep_y_drift = minus_z_reg1) | cg.emerg_sep;
+      cg.r = reg2 : toint((cg.q_gcb_i = quat_reg2 & cg.wcb2 = reg2_neg4 &
+                    cg.cont_3eo_pr_delay = minus_z_reg2 & 
+                    cg.etsep_y_drift = minus_z_reg2) | cg.emerg_sep);
+
+      cg.r = reg3 : toint((cg.q_gcb_i = quat_reg3 & cg.wcb2 = wcb2_3eo &
+                    cg.cont_3eo_pr_delay = minus_z_reg3 & 
+                    cg.etsep_y_drift = minus_z_reg3) | cg.emerg_sep);
+      cg.r = reg4 : toint((cg.q_gcb_i = quat_reg4 & cg.wcb2 = reg4_0 &
+                    cg.cont_3eo_pr_delay = minus_z_reg4 & 
+                    cg.etsep_y_drift = minus_z_reg4) | cg.emerg_sep);
+      cg.r = reg102 : toint((cg.q_gcb_i = quat_reg102_undef & 
+                       cg.wcb2 = reg102_undef &
+                       cg.cont_3eo_pr_delay = minus_z_reg102 & 
+                       cg.etsep_y_drift = minus_z_reg102) | cg.emerg_sep);
+      TRUE : 0;
+    esac;
+
+---------------------------------------------------------------------
+-------- Specifications ---------------------------------------------
+---------------------------------------------------------------------
+
+---- Contingency Guide terminates
+--
+--SPEC AG(!cg.idle -> AF(cg.finished))
+--
+---- Contingency guide can be executed infinitely often
+--
+--SPEC AG( (cg.idle | cg.finished) -> 
+--  EF(!(cg.idle | cg.finished) & EF(cg.finished)))
+--
+---- Contingency mode select task works fine
+--
+--SPEC AG(cs.cont_3EO_start & cs.region_selected -> 
+--         ((cs.m_mode = mm102 | meco_confirmed) &
+--                       cs.r != reg-1 & cs.r != reg0))
+--
+---- Bad (initial) value never happens again once region is computed
+---- unless we restart the task
+--
+----SPEC AG(cs.r != reg-1 -> !E[!cg.start_cont_3eo_mode_select U 
+----               cs.r = reg-1 & !cg.start_cont_3eo_mode_select])
+--
+---- Comment out each of the regions and see if this is still true
+---- (Check, if ALL of the regions can happen)
+--
+----SPEC AG(cs.r in {reg-1
+----                 ,reg0
+----                 ,reg1
+----                 ,reg2
+----                 ,reg3
+----                 ,reg102
+----                 })
+--
+---- Comment out each of the regions and see if this is still true
+---- (Check, if ALL of the regions can happen)
+--
+----SPEC AG(cg.r in {reg-1
+----                 ,reg0
+----                 ,reg1
+----                 ,reg2
+----                 ,reg3
+----                 ,reg4
+----                 ,reg102
+----                 })
+--
+---- Mode_select starts at the next step after its "start" bit is set:
+--
+----SPEC AG(!cg.start_cont_3eo_mode_select -> 
+----        AX(cg.start_cont_3eo_mode_select & cs.step in {exit, undef} -> 
+----                 AX(cs.step = 1 & !cs.region_selected)))
+--
+---- During major mode 103, the inertial velocity is monitored.
+---- Below an I-loaded velocity, a MECO would constitute a contingency
+---- abort. (Must NOT be in SMODE=5 (??))
+--
+--SPEC AG(cg.start_cont_3eo_mode_select & cs.m_mode = mm103 & 
+--        vel = LEQ_vi_3eo_min & meco_confirmed & !smode5 -> 
+--            A[!cs.region_selected U cs.region_selected & cs.cont_3EO_start])
+--
+---- Above a certain inertial velocity (in mode 103), the 3E/O field
+---- is blanked, indicating that a MECO at this point would not require
+---- an OPS 6 contingency abort.
+--
+--SPEC AG(cs.region_selected -> 
+--         (cs.m_mode = mm103 & vel = GRT_vi_3eo_max -> !cs.cont_3EO_start))
+--
+---- Between the two velocities, an apogee altitude - velocity curve is 
+---- constructed based on the current inertial velocity. If the apogee
+---- altitude is above this curve, a contingency abort capability is
+---- still required and a 3E/O region index will be calculated. 
+---- Otherwise, the 3E/O field is blanked out and no further contingency
+---- abort calculations will be performed. (Must NOT be in SMODE=5 (??))
+--
+--SPEC AG(cg.start_cont_3eo_mode_select & cs.m_mode = mm103 & 
+--        vel = GRT_vi_3eo_min & meco_confirmed & !smode5 ->
+--           A[!cs.region_selected U cs.region_selected & 
+--              apogee_alt_LT_alt_ref = !cs.cont_3EO_start])
+--
+---- For an RTLS trajectory (SMODE=5), a check is made on the downrange
+---- velocity to see if the vehicle is heading away from the landing site.
+---- If this is the case, a 3E/O region index is calculated. If the vehicle
+---- is heading back to the landing site, and the current range to the MECO
+---- R-V line is greater than an I-loaded value, a 3E/O region index is
+---- calculated. Otherwise, an intact abort is possible and the 3E/O field
+---- is blanked.
+--
+--SPEC AG(cg.start_cont_3eo_mode_select & smode5 &  meco_confirmed &
+--        (!v_horiz_dnrng_LT_0 | !delta_r_GRT_del_r_usp) -> 
+--          A[!cs.region_selected U cs.region_selected & cs.cont_3EO_start])
+--
+---- If this task is called prior to SRB separation [mm102], the 3E/O region
+---- index is set to 102 and the 3E/O contingency flag is set.
+--
+--SPEC AG(cs.m_mode = mm102 & cg.start_cont_3eo_mode_select -> 
+--               AX (A [ !cs.region_selected U cs.region_selected & 
+--                                cs.r = reg102 & cs.cont_3EO_start]))
+--
+---- After SRB separation, on every pass that the 3E/O region index is
+---- calculated, a check is made to see if MECO confirmed has occured.  If
+---- so, a check is made to see if the major mode is 103. If so, an RTLS is
+---- automatically invoked to transition to major mode 601.
+--
+--SPEC AG(!cs.region_selected & cs.m_mode = mm103 & meco_confirmed ->
+--        A[!cs.region_selected U cs.region_selected & cs.r != reg0 -> 
+--              cs.m_mode = mm601 & cs.RTLS_abort_declared])
+--
+---- Once the 3E/O contingency flag has been set, this task is no longer
+---- executed.
+--
+--SPEC AG(cs.cont_3EO_start -> AG(!cg.start_cont_3eo_mode_select))
+--
+---- If MECO confirmed occurs in MM103 and an OPS 6 contingency abort
+---- procedure is still required, contingency 3E/O guidance sets the
+---- CONT_3EO_START flag ON. Contingency 3E/O guidance then switches
+---- from its display support function into an actual auto guidance
+---- steering process. [...] Contingency 3E/O guidance sets the RTLS abort
+---- declared flag and the MSC performs the transition from from major mode
+---- 103 to 601.
+--
+--SPEC AG(!cg.idle & !cg.finished & !cs.region_selected & cs.m_mode = mm103 -> 
+--       A[ !cg.finished U cg.finished & cs.region_selected & 
+--           (cs.cont_3EO_start -> cs.m_mode = mm601 & cs.RTLS_abort_declared) ])
+--
+---- If MECO confirmed occurs in a major mode 601 and a contingency abort
+---- procedure is still required, contingency 3E/O guidance sets the
+---- CONT_3EO_START flag ON. [...] Contingency 3E/O guidance then commands
+---- 3E/O auto maneuvers in major mode 601. [What are these maneuvers??]
+--
+--SPEC AG(cg.finished & cs.m_mode = mm601 & !et_sep_cmd &
+--         meco_confirmed  & cs.cont_3EO_start -> 
+--           cg.q_gcb_i in {quat_reg1, quat_reg2, quat_reg3, quat_reg4, undef}
+--           | cg.emerg_sep)
+--
+---- If MECO confirmed occurs in a first stage (MM102) [...], contingency
+---- 3E/O guidance will command a fast ET separation during SRB tailoff in
+---- major mode 102. CONT 3E/O GUID will then command maneuver post-sep in
+---- MM601 (???). [ I'm not sure what indicates fast ET sep.: emerg_sep or
+---- early_sep, or what? ]
+--
+--SPEC AG(cg.finished & cs.m_mode = mm102 & meco_confirmed & pre_sep ->
+--                                    cg.emerg_sep | et_sep_cmd
+--                                     | cg.et_sep_man_initiate
+--                                     | cg.early_sep
+--                                                       )
+--
+-----------------------------------------------
+---- Invariants from Murphi code --------------
+-----------------------------------------------
+--
+----SPEC AG(cg.finished -> (output_ok != 0 | (output_ok = undef & 
+----                          (cg.emerg_sep | !cg.cont_sep_cplt))))
+--
+----SPEC AG(!cg.finished & !cg.idle -> !mated_coast_mnvr | !et_sep_cmd)
+--
+---- Stronger version !!!
+--
+--SPEC AG(cg.finished -> output_ok != 0)
+--
+---- Contingency Guidance shall command an ET separation 
+---- [under certain conditions :-].
+--
+--SPEC AG(cs.cont_3EO_start & cg.finished & 
+--           (cg.r = reg1 -> cond_29) & 
+--           (cg.r = reg2 -> cond_24 & cond_26) &
+--           (cg.r = reg3 -> cg.alpha_ok &
+--               (ABS_alf_err_LT_alf_sep_err -> cond_20b)) &
+--           (cg.r = reg4 -> cond_18 & q_orb_LT_0) &
+--           (cg.r = reg102 -> pre_sep) ->
+--                     et_sep_cmd | cg.et_sep_man_initiate
+--                     | cg.early_sep 
+--                     | cg.emerg_sep
+--                                      )
+--
+---- Contingency Guidance shall command at most one interconnected OMS dump.
+--
+--SPEC AG(cg.finished & cg.oms_rcs_i_c_inh_ena_cmd -> 
+--        AG(!cg.oms_rcs_i_c_inh_ena_cmd -> AG(!cg.oms_rcs_i_c_inh_ena_cmd)))
+--
+---- Contingency Guidance shall command a transition to glide RTLS
+---- (flight mode 602)
+--
+--SPEC AG(cg.finished & cs.m_mode = mm601 -> 
+--                 --cg.cont_sep_cplt | cg.emerg_sep |
+--                                cg.call_RTLS_abort_task)
+--
+---- Paper, p. 28, unstated assumption 2: at step 6 the region is
+---- among 102, 1-4.
+--
+--SPEC AG(cg.step = 6 -> cg.r in {reg102, reg1, reg2, reg3, reg4})
+--
+---- The transition to mode 602 shall not occur until the entry maneuver
+---- has been calculated
+--
+--SPEC !E[cg.q_gcb_i = undef U cg.cont_sep_cplt & cg.q_gcb_i = undef]
+--
+---- The entry maneuver calculations shall not commence until the OMS/RCS
+---- interconnect, if any, is complete (??? What does it exactly mean???)
+---- !!!
+----SPEC AG(cg.oms_rcs_i_c_inh_ena_cmd -> 
+----          !E[cg.oms_rcs_i_c_inh_ena_cmd U 
+----              cg.q_gcb_i != undef & cg.oms_rcs_i_c_inh_ena_cmd])
+--
+--SPEC AG(cg.oms_rcs_i_c_inh_ena_cmd -> 
+--          !E[rcs_all_jet_inhibit U 
+--              cg.q_gcb_i != undef & rcs_all_jet_inhibit])
+--
+---- The OMS dump shall not be considered until the -Z translation is complete.
+--
+--SPEC !E[!cont_minus_z_compl & cg.r != reg102 U cg.orbiter_dump_ena]
+--
+---- Completion of -Z translation shall not be checked until ET separation
+---- has been commanded
+--
+--SPEC !E[!et_sep_cmd U cg.step = 7]
+--
+---- ET separation shall be commanded if and only if an abort maneuver
+---- region is assigned [and again there are *certain conditions*].
+--
+--SPEC AG(cg.finished & cs.cont_3EO_start & 
+--                  (cg.r = reg1 -> cond_29) & 
+--                  (cg.r = reg2 -> cond_24 & cond_26) &
+--                  (cg.r = reg3 -> cg.alpha_ok &
+--                     (ABS_alf_err_LT_alf_sep_err -> cond_20b)) &
+--                  (cg.r = reg4 -> cond_18 & q_orb_LT_0) &
+--                  (cg.r = reg102 -> pre_sep) -> 
+--          (cg.et_sep_man_initiate | et_sep_cmd
+--                 <-> cg.r in {reg1, reg2, reg3, reg4, reg102}))
+--
+---- The assigned region can not change arbitrarily.
+--
+---- Regions 1 and 2 may interchange, but will not switch to any other region:
+--
+--SPEC AG(cg.finished & cs.cont_3EO_start & cg.r in {reg1,reg2} -> 
+--                                AG(cg.finished -> cg.r in {reg1,reg2}))
+--
+---- Regions 3 and 4 may interchange, but will not switch to any other region:
+--
+--SPEC AG(cg.finished & cs.cont_3EO_start & cg.r in {reg3,reg4} -> 
+--         AG(cg.finished -> cg.r in {reg3,reg4}))
+--
+---- Region 102 never changes:
+--
+--SPEC AG(cg.finished & cg.r = reg102 -> AG(cg.finished -> cg.r = reg102))
+
+
+IVAR t_#delta : real;
+
+TRANS case
+        cg.step = 2 & next(cg.step = 3) : t_#delta = 1 | t_#delta = 2;
+        cg.step = 8 & next(cg.step = 9) : t_#delta = 1 | t_#delta = 4;
+        cg.step = 11 & next(cg.step = 12) : t_#delta = 2;
+        cg.step = c20 & next(cg.step = 21) : t_#delta = 1 | t_#delta = 4;
+        cg.step = 27 & next(cg.step = 28) : t_#delta = 1 | t_#delta = 3 | t_#delta = 4;
+        TRUE : t_#delta = 0;
+      esac;
+
+---- failure modes
+
+--cs.cont_3EO_start
+--INVARSPEC (t_#delta > 0) -> (cs.cont_3EO_start = next(cs.cont_3EO_start));
+--cs.region_selected
+--INVARSPEC (t_#delta > 0) -> (cs.region_selected = next(cs.region_selected));
+--meco_confirmed
+--INVARSPEC (t_#delta > 0) -> (meco_confirmed = next(meco_confirmed));
+--q_bar_a_LT_qbar_oms_dump
+--INVARSPEC (t_#delta > 0) -> (q_bar_a_LT_qbar_oms_dump = next(q_bar_a_LT_qbar_oms_dump));
+--excess_OMS_propellant
+--INVARSPEC (t_#delta > 0) -> (excess_OMS_propellant = next(excess_OMS_propellant));
+--pre_sep
+--INVARSPEC (t_#delta > 0) -> (pre_sep = next(pre_sep));
+
+---- discrepancies
+
+--cs.RTLS_abort_declared  -- cs.step = 10 // cg.step = 1/a1
+--INVARSPEC (t_#delta > 0) -> (cs.RTLS_abort_declared = next(cs.RTLS_abort_declared));
+--cg.call_RTLS_abort_task -- cg.step = 3
+--INVARSPEC (t_#delta > 0) -> (cg.call_RTLS_abort_task = next(cg.call_RTLS_abort_task));
+--cg.et_sep_man_initiate  -- step = 5/14/19/d20/26/29
+--INVARSPEC (t_#delta > 0) -> (cg.et_sep_man_initiate = next(cg.et_sep_man_initiate));
+--cg.oms_rcs_i_c_inh_ena_cmd  -- step = 9
+--INVARSPEC (t_#delta > 0) -> (cg.oms_rcs_i_c_inh_ena_cmd = next(cg.oms_rcs_i_c_inh_ena_cmd));
+--cg.orbiter_dump_ena  -- step = 9/13
+--INVARSPEC (t_#delta > 0) -> (cg.orbiter_dump_ena = next(cg.orbiter_dump_ena));
+--cg.cont_sep_cplt  -- cg.step = 12
+--INVARSPEC (t_#delta > 0) -> (cg.cont_sep_cplt = next(cg.cont_sep_cplt));
+--cg.frz_3eo  -- step = 28
+--INVARSPEC (t_#delta > 0) -> (cg.frz_3eo = next(cg.frz_3eo));
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/guidance/guidance.txml b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/guidance/guidance.txml
new file mode 100644
index 0000000000000000000000000000000000000000..4efb114f76799c19116d65496e7d4329df8f03ee
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/guidance/guidance.txml
@@ -0,0 +1,234 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<tfpg name="DependencyGraph" infty_semantics="closed">
+  <nodesList>
+    <node name="meco_confrm" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="excess_propellant" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="q_bar_a_LT_qbar_oms_dump" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="region_selected" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="pre_sep" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="cont_3EO_start" isMonitored="false">
+      <type>FM</type>
+    </node>
+    <node name="cont_sep_cplt" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="sep_man_init" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="orbiter_dump_ena" isMonitored="false">
+      <type>OR</type>
+    </node>
+    <node name="intermediateNode_7" isMonitored="false">
+      <type>AND</type>
+    </node>
+    <node name="intermediateNode_8" isMonitored="false">
+      <type>AND</type>
+    </node>
+    <node name="frz_3eo" isMonitored="false">
+      <type>AND</type>
+    </node>
+    <node name="oms_rcs_i_c_inh_ena_cmd" isMonitored="false">
+      <type>AND</type>
+    </node>
+    <node name="abrt_declared" isMonitored="false">
+      <type>AND</type>
+    </node>
+    <node name="abrt_task_call" isMonitored="false">
+      <type>AND</type>
+    </node>
+  </nodesList>
+  <modesList>
+    <mode>mm102</mode>
+    <mode>mm601</mode>
+    <mode>mm103</mode>
+  </modesList>
+  <edgesList>
+    <edge name="EDGE1">
+      <srcNode>abrt_task_call</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+        <mode>mm102</mode>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>intermediateNode_7</destNode>
+    </edge>
+    <edge name="EDGE2">
+      <srcNode>pre_sep</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+        <mode>mm102</mode>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>intermediateNode_7</destNode>
+    </edge>
+    <edge name="EDGE3">
+      <srcNode>abrt_declared</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>1.0</tMax>
+      <modesList>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>intermediateNode_8</destNode>
+    </edge>
+    <edge name="EDGE4">
+      <srcNode>abrt_task_call</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>intermediateNode_8</destNode>
+    </edge>
+    <edge name="EDGE5">
+      <srcNode>abrt_declared</srcNode>
+      <tMin>2.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>frz_3eo</destNode>
+    </edge>
+    <edge name="EDGE6">
+      <srcNode>abrt_task_call</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>frz_3eo</destNode>
+    </edge>
+    <edge name="EDGE7">
+      <srcNode>abrt_declared</srcNode>
+      <tMin>2.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>oms_rcs_i_c_inh_ena_cmd</destNode>
+    </edge>
+    <edge name="EDGE8">
+      <srcNode>excess_propellant</srcNode>
+      <tMin>2.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>oms_rcs_i_c_inh_ena_cmd</destNode>
+    </edge>
+    <edge name="EDGE9">
+      <srcNode>q_bar_a_LT_qbar_oms_dump</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>1.0</tMax>
+      <modesList>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>oms_rcs_i_c_inh_ena_cmd</destNode>
+    </edge>
+    <edge name="EDGE10">
+      <srcNode>orbiter_dump_ena</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>oms_rcs_i_c_inh_ena_cmd</destNode>
+    </edge>
+    <edge name="EDGE11">
+      <srcNode>meco_confrm</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>abrt_declared</destNode>
+    </edge>
+    <edge name="EDGE12">
+      <srcNode>cont_3EO_start</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>abrt_declared</destNode>
+    </edge>
+    <edge name="EDGE13">
+      <srcNode>region_selected</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>0.0</tMax>
+      <modesList>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>abrt_declared</destNode>
+    </edge>
+    <edge name="EDGE14">
+      <srcNode>abrt_task_call</srcNode>
+      <tMin>2.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+        <mode>mm102</mode>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>cont_sep_cplt</destNode>
+    </edge>
+    <edge name="EDGE15">
+      <srcNode>intermediateNode_7</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+        <mode>mm102</mode>
+      </modesList>
+      <destNode>sep_man_init</destNode>
+    </edge>
+    <edge name="EDGE16">
+      <srcNode>intermediateNode_8</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>sep_man_init</destNode>
+    </edge>
+    <edge name="EDGE17">
+      <srcNode>cont_3EO_start</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>1.0</tMax>
+      <modesList>
+        <mode>mm102</mode>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>abrt_task_call</destNode>
+    </edge>
+    <edge name="EDGE18">
+      <srcNode>region_selected</srcNode>
+      <tMin>1.0</tMin>
+      <tMax>2.0</tMax>
+      <modesList>
+        <mode>mm102</mode>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>abrt_task_call</destNode>
+    </edge>
+    <edge name="EDGE19">
+      <srcNode>abrt_task_call</srcNode>
+      <tMin>0.0</tMin>
+      <tMax>-1.0</tMax>
+      <modesList>
+        <mode>mm102</mode>
+        <mode>mm601</mode>
+      </modesList>
+      <destNode>orbiter_dump_ena</destNode>
+    </edge>
+  </edgesList>
+</tfpg>
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/battery_sensor_bug.tfpg b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/battery_sensor_bug.tfpg
new file mode 100644
index 0000000000000000000000000000000000000000..30a378a4dc05ac7a5bfaff2e49baf5251c8442cd
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/battery_sensor_bug.tfpg
@@ -0,0 +1,30 @@
+NAME tfpg
+INFINITY_SEMANTICS_OPEN
+AND SYS_DEAD MONITORED
+OR S1_WO
+OR B1_DEAD
+OR B1_LOW MONITORED
+OR G1_DEAD
+FM G1_OFF
+FM S1_OFF
+OR S2_WO
+OR B2_DEAD
+OR B2_LOW MONITORED
+OR G2_DEAD
+FM G2_OFF
+FM S2_OFF
+MODES primary,secondary_1,secondary_2
+EDGE e1 G1_OFF G1_DEAD 0 0 (primary,secondary_1,secondary_2)
+EDGE e2 G1_DEAD B1_LOW 0 100 (primary,secondary_1)
+EDGE e3 B1_LOW B1_DEAD 5 10 (primary,secondary_1)
+EDGE e4 B1_DEAD S1_WO 0 1 (primary,secondary_1)
+EDGE e5 S1_OFF S1_WO 0 0 (primary,secondary_1,secondary_2)
+EDGE e6 S1_WO SYS_DEAD 0 1 (primary,secondary_1,secondary_2)
+EDGE e7 G2_OFF G2_DEAD 0 0 (primary,secondary_1,secondary_2)
+EDGE e8 G2_DEAD B2_LOW 0 100 (primary,secondary_2)
+EDGE e9 B2_LOW B2_DEAD 5 10 (primary,secondary_2)
+EDGE e10 B2_DEAD S2_WO 0 1 (primary,secondary_1)
+EDGE e11 S2_OFF S2_WO 0 0 (primary,secondary_1,secondary_2)
+EDGE e12 S2_WO SYS_DEAD 0 1 (primary,secondary_1,secondary_2)
+EDGE e13 B1_DEAD S2_WO 0 1 (secondary_1)
+EDGE e14 B2_DEAD S1_WO 0 1 (secondary_2)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/battery_sensor_good.tfpg b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/battery_sensor_good.tfpg
new file mode 100644
index 0000000000000000000000000000000000000000..2952df14a9064d7456647174d77f582c28935ef3
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/battery_sensor_good.tfpg
@@ -0,0 +1,30 @@
+NAME tfpg
+INFINITY_SEMANTICS_OPEN
+AND SYS_DEAD MONITORED
+OR S1_WO
+OR B1_DEAD
+OR B1_LOW MONITORED
+OR G1_DEAD
+FM G1_OFF
+FM S1_OFF
+OR S2_WO
+OR B2_DEAD
+OR B2_LOW MONITORED
+OR G2_DEAD
+FM G2_OFF
+FM S2_OFF
+MODES primary,secondary_1,secondary_2
+EDGE e1  G1_OFF G1_DEAD 0 0 (primary,secondary_1,secondary_2)
+EDGE e2  G1_DEAD B1_LOW 0 100 (primary,secondary_1)
+EDGE e3  B1_LOW B1_DEAD 5 10 (primary,secondary_1)
+EDGE e4  B1_DEAD S1_WO 0 1 (primary,secondary_1)
+EDGE e5  S1_OFF S1_WO 0 0 (primary,secondary_1,secondary_2)
+EDGE e6  S1_WO SYS_DEAD 0 1 (primary,secondary_1,secondary_2)
+EDGE e7  G2_OFF G2_DEAD 0 0 (primary,secondary_1,secondary_2)
+EDGE e8  G2_DEAD B2_LOW 0 100 (primary,secondary_2)
+EDGE e9  B2_LOW B2_DEAD 5 10 (primary,secondary_2)
+EDGE e10  B2_DEAD S2_WO 0 1 (primary,secondary_2)
+EDGE e11  S2_OFF S2_WO 0 0 (primary,secondary_1,secondary_2)
+EDGE e12  S2_WO SYS_DEAD 0 1 (primary,secondary_1,secondary_2)
+EDGE e13  B1_DEAD S2_WO 0 1 (secondary_1)
+EDGE e14  B2_DEAD S1_WO 0 1 (secondary_2)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-1.sc b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-1.sc
new file mode 100644
index 0000000000000000000000000000000000000000..9ceca9093884d0709d6c9cb53424a50b92e7ad47
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-1.sc
@@ -0,0 +1,4 @@
+B1_LOW	0
+B2_LOW  0
+SYS_DEAD 1
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-2.sc b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-2.sc
new file mode 100644
index 0000000000000000000000000000000000000000..43efdf15d797114c12cd666d7e3364a69d98b823
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-2.sc
@@ -0,0 +1,5 @@
+B1_LOW  10
+B2_LOW  10
+S1_OFF  20
+S2_OFF  20
+SYS_DEAD 1
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-3.sc b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-3.sc
new file mode 100644
index 0000000000000000000000000000000000000000..93c67cc23e0e9fd816fb2fcbafbe4b8b7df98c74
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-3.sc
@@ -0,0 +1,5 @@
+#G1_OFF  True
+#G2_OFF	 False
+#S1_OFF  False
+#S2_OFF  False
+#SYS_DEAD True
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-4.sc b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-4.sc
new file mode 100644
index 0000000000000000000000000000000000000000..b89cd48f576bf39acc6abc162c5bec142176dd73
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-4.sc
@@ -0,0 +1 @@
+#B1_LOW True
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-6.sc b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-6.sc
new file mode 100644
index 0000000000000000000000000000000000000000..abe0a262cf6f5ccd379b09034f8cbe0f92d769ec
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-6.sc
@@ -0,0 +1,3 @@
+#B1_LOW  True
+#G1_OFF  False
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-7.sc b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-7.sc
new file mode 100644
index 0000000000000000000000000000000000000000..895bb0fe27cf307250cc0cd899bb1fe36e4ce814
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-7.sc
@@ -0,0 +1,5 @@
+#__mon_B1_LOW	True
+__H_mon_B1_LOW	1
+#G1_OFF		False
+#mode		primary
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-8.sc b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-8.sc
new file mode 100644
index 0000000000000000000000000000000000000000..4d51fefb758be2c34c880a464870414610f0066c
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/bpss-8.sc
@@ -0,0 +1,7 @@
+#G1_OFF		False
+#G2_OFF		True
+#S1_OFF		False
+#S2_OFF		False
+#SYS_DEAD	True
+#mode 		secondary_2
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/mapping.map b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/mapping.map
new file mode 100644
index 0000000000000000000000000000000000000000..c83c17fd88a174f01a5a4d59438d8848ddd1dca1
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/examples/tfpg/smt/mapping.map
@@ -0,0 +1,13 @@
+SYS_DEAD SYS_DEAD
+S1_WO S1_WO
+B1_DEAD B1_DEAD
+B1_LOW B1_LOW
+G1_DEAD G1_DEAD
+G1_OFF G1_OFF
+S1_OFF S1_OFF
+S2_WO S2_WO
+B2_DEAD B2_DEAD
+B2_LOW B2_LOW
+G2_DEAD G2_DEAD
+G2_OFF G2_OFF
+S2_OFF S2_OFF
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/_paths.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/_paths.py
new file mode 100644
index 0000000000000000000000000000000000000000..49d3244dcf258a2ad8963aaece4f519acc740109
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/_paths.py
@@ -0,0 +1,63 @@
+# utility to be shared among all top-level scripts
+
+import os.path
+import sys
+import platform
+
+pyver = "{0[0]}.{0[1]}".format(sys.version_info)
+
+TOP_DIR = os.path.abspath(os.path.join(
+    os.path.dirname(__file__), ".."))
+
+BUILD_DIR = os.path.abspath(os.path.join(TOP_DIR, "build"))
+
+code_dir = os.path.abspath(os.path.join(BUILD_DIR, "code"))
+if not os.path.exists(code_dir):
+    code_dir = os.path.join(TOP_DIR, "code")
+CODE_DIR = code_dir
+
+lib_dir = os.path.abspath(os.path.join(BUILD_DIR, "lib"))
+if not os.path.exists(lib_dir):
+    lib_dir = os.path.join(TOP_DIR, "lib")
+LIB_DIR = lib_dir
+
+DATA_DIR = os.path.abspath(os.path.join(TOP_DIR, "data"))
+SCHEMA_DIR = os.path.join(DATA_DIR, "schema")
+
+bin_dir = os.path.join(BUILD_DIR, "bin")
+if not os.path.exists(bin_dir):
+    bin_dir = os.path.join(TOP_DIR, "bin")
+BIN_DIR = bin_dir
+
+EXT_DIR = os.path.abspath(os.path.join(CODE_DIR, "common", "external"))
+
+# CODE_PKG_LOC this can be different from CODE_DIR when egg files are used
+egg = os.path.join(CODE_DIR, "code-python%s.egg" % pyver)
+if os.path.exists(egg):
+    CODE_PKG_LOC = egg
+elif os.path.exists(os.path.join(CODE_DIR, "feic")):
+    CODE_PKG_LOC = CODE_DIR
+else:
+    raise RuntimeError("Could not find code for the execution: "
+                       "wrong installation?")
+
+
+def setup_path():
+    paths = [CODE_PKG_LOC,
+             os.path.join(CODE_PKG_LOC, "viewers"),
+             os.path.join(EXT_DIR, "antlr/antlr-python-runtime-3.4"),
+             os.path.join(EXT_DIR, "pysmt.whl"),
+             LIB_DIR]
+
+    bits = int(platform.architecture()[0][0:-3])
+    if platform.system() == "Windows" and 64 == bits:
+        paths.append(os.path.join(EXT_DIR, "win64"))
+
+    # for xSAP Boeing package
+    if os.path.exists(os.path.join(EXT_DIR, "mathsat")):
+        paths.append(os.path.join(EXT_DIR, "mathsat"))
+
+    for _path in paths:
+        sys.path.append(_path)
+
+
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/_paths.pyc b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/_paths.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ce172a3c2481c2deca5cfb11ea08173b1ea9ed67
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/_paths.pyc differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/_utils.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/_utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..ebe2f09dd7b91a558486711b8070492095c60b70
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/_utils.py
@@ -0,0 +1,108 @@
+# common utilities for scripts
+
+import platform
+import logging
+import sys
+import os.path
+import glob
+
+import _paths
+
+
+def get_exec_fullname(name="xSAP"):
+    """Given generic name (e.g. "xSAP") provides the
+    full name of the executable, considering platform
+    and bits"""
+
+    # AMa2RC: The following two return statements are wrong: What if
+    # on windows, or different SO? Just return "xsap"??
+    if platform.system() == "Linux":
+        if os.path.isfile(name):
+            return name
+
+        if os.path.isfile(os.path.join(_paths.BIN_DIR, name)):
+            return os.path.join(_paths.BIN_DIR, name)
+
+    bits = int(platform.architecture()[0][0:-3])
+    try:
+        system, exeext = {'Linux': ('linux', '',),
+                          'Windows': ('win', '.exe'),
+                          'Darwin': ('mac', '')}[platform.system()]
+
+    except KeyError:
+        logging.error("System was not recognized: %s", platform.system())
+        sys.exit(1)
+
+    # now searches if it is available
+    path = os.path.join(_paths.BIN_DIR, "%s-%s%d%s" %
+                        (name, system, bits, exeext))
+    if os.path.isfile(path):
+        return path
+
+    # if 64 bit not found, try with 32:
+    if bits == 64:
+        path = os.path.join(_paths.BIN_DIR, "%s-%s%d" % (name, system, 32))
+        if os.path.isfile(path):
+            logging.warning("Using 32 bit version for executable %s, "
+                            "even if bits are %d", name, bits)
+            return path
+
+    # no lucky: raise an exception
+    raise IOError("Not found a valid executable for %s, "
+                  "platform is %s, bits are %d" %
+                  (name, system, bits))
+
+
+def get_suitable_smv_file(smv_fname, outdir):
+    """Searches for a good smv filename (only one canditate must match
+    to succeeed) if non specified"""
+
+    if smv_fname and os.path.isfile(smv_fname):
+        return smv_fname
+
+    if smv_fname:
+        logging.error("Specified smv file was not found: '%s'" % smv_fname)
+        return None
+
+    files = glob.glob(os.path.join(outdir, "extended_*.smv"))
+
+    if len(files) == 0:
+        logging.error("No suitable smv file was specified or found")
+        return None
+
+    if len(files) > 1:
+        logging.error("Multiple suitable smv files were found")
+        logging.error(", ".join(files))
+        logging.error("Please specify one only, with option --smv-file")
+        return None
+
+    return files.pop()
+
+
+def get_suitable_fms_file(fms_fname, smv_fname, outdir):
+    """Searches for a good fms filename (only one canditate must match
+    to succeeed) if non specified"""
+    if fms_fname and os.path.isfile(fms_fname):
+        return fms_fname
+
+    if fms_fname:
+        logging.error("Specified fms file was not found: '%s'" % fms_fname)
+        return None
+
+    fms_fname = os.path.join(outdir, get_fms_fname(smv_fname))
+    if not os.path.isfile(fms_fname):
+        logging.error("No suitable fms file was specified or found")
+        logging.error("I have searched for '%s' with no success" % fms_fname)
+        return None
+
+    return fms_fname
+
+
+def get_fms_fname(expanded_smv_fname):
+    full_base, ext = os.path.splitext(expanded_smv_fname)
+    base = os.path.basename(full_base)
+    prefix = "extended_"
+    if base.startswith(prefix):
+        base = base[len(prefix):]
+
+    return "fms_" + base + ".xml"
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/_utils.pyc b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/_utils.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d59c7b75d426458b5b867c573b34a7280c5bd443
Binary files /dev/null and b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/_utils.pyc differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/check_diagnosability.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/check_diagnosability.py
new file mode 100644
index 0000000000000000000000000000000000000000..7d9119218277ee73b660a2f8cc33cd93b044af50
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/check_diagnosability.py
@@ -0,0 +1,177 @@
+
+import sys
+import os
+import re
+import subprocess
+
+import _paths
+
+
+def handle_options():
+    """Returns options values as map."""
+
+    from xsap.utils.options import (
+      MC_ENGINE_BDD,
+      MC_ENGINE_BMC,
+      MC_ENGINE_MSAT_BMC,
+      MC_ENGINE_IC3)
+
+    import argparse
+    parser = argparse.ArgumentParser(description="")
+
+    parser.add_argument("--engine", "-E",
+                        dest="engine",
+                        choices=[MC_ENGINE_BDD, MC_ENGINE_BMC, MC_ENGINE_MSAT_BMC, MC_ENGINE_IC3],
+                        default=MC_ENGINE_IC3,
+                        help="Use given engine (default: %(default)s)")
+
+    parser.add_argument("--bmc-length", "-k",
+                        dest="bmc_len",
+                        action="store",
+                        type=int,
+                        default=10,
+                        help="Maximum path length for BMC")
+
+    parser.add_argument("--smv-file", "-m",
+                        dest="smv",
+                        action="store",
+                        default=None,
+                        help="SMV file")
+
+    parser.add_argument("--diagnosis-condition", "-c",
+                        dest="diag_cond",
+                        action="store",
+                        default=None,
+                        help="Diagnosis condition")
+
+    parser.add_argument("--alarm-pattern", "-a",
+                        dest="alarm_pattern",
+                        choices=['exact', 'bounded', 'finite'],
+                        default=None,
+                        help="Alarm pattern (default: %(default)s)")
+
+    parser.add_argument("--delay-bound", "-d",
+                        dest="delay_bound",
+                        action="store",
+                        type=int,
+                        default=None,
+                        help="Alarm pattern delay bound")
+
+    parser.add_argument("--context-expression", "-x",
+                        dest="ltl_context",
+                        action="store",
+                        default=None,
+                        help="LTL context expression")
+
+    parser.add_argument("--observables-file", "-o",
+                        dest="obs_file",
+                        action="store",
+                        default=None,
+                        help="File specifying observable variables")
+
+    parser.add_argument("--asl-file", "-f",
+                        dest="asl_file",
+                        action="store",
+                        default=None,
+                        help="File containing the alarms specification")
+
+    parser.add_argument("--verbosity-level", "-v",
+                        dest="verbose_level",
+                        action="store",
+                        type=int,
+                        default=0,
+                        help="Sets the output verbosity level")
+
+    args = parser.parse_args()
+
+    # check arguments
+
+    if args.smv is None or not os.path.exists(args.smv):
+        parser.error("The SMV model was not specified.")
+
+    if args.bmc_len < 0:
+        parser.error("Illegal BMC length.")
+
+    if args.obs_file is None or not os.path.exists(args.obs_file):
+        parser.error("The observables file was not specified.")
+
+    if args.asl_file is None:
+        if args.diag_cond is None:
+            parser.error("The diagnosis condition was not specified.")
+
+        if args.alarm_pattern is None:
+            parser.error("The alarm pattern was not chosen.")
+
+        if args.alarm_pattern in ['exact', 'bounded'] and args.delay_bound is None:
+            parser.error("For the chosen alarm pattern a delay bound needs to be specified.")
+
+        if args.alarm_pattern in ['finite'] and args.delay_bound is not None:
+            parser.error("A delay bound cannot be specified for finite-delay.")
+
+        if args.delay_bound is not None and int(args.delay_bound) < 0:
+            parser.error("Illegal delay bound.")
+    else:
+        if not os.path.exists(args.asl_file):
+            parser.error("The ASL file does not exist")
+        if args.diag_cond is not None:
+            parser.error("Cannot specify both a diagnosis condition and an ASL file")
+
+    return args
+
+
+if __name__ == "__main__":
+
+    _paths.setup_path()
+
+    # setup logging
+    import xsap.utils.misc.log
+    xsap.utils.misc.log.init()
+    args = handle_options()
+
+    from xsap.utils.options import MC_ENGINE_MSAT_BMC
+    from xsap.utils.processes.xsap_process import XsapProcess
+
+    need_msat = XsapProcess.has_infinite_domain_vars(args.smv) or MC_ENGINE_MSAT_BMC == args.engine
+
+    xsap_process = XsapProcess(args.smv, fail_obs_alm_fname=None,
+                               ord_fname=None, need_msat=need_msat,
+                               args=["-v", "%d" % args.verbose_level], stdout=subprocess.PIPE,
+                               stderr=subprocess.STDOUT,
+                               dumpers=[])
+
+    delay_bound = -1 if args.delay_bound is None else int(args.delay_bound)
+
+    results = xsap_process.check_diagnosability_ASL(args.diag_cond,
+        args.alarm_pattern, delay_bound, args.ltl_context, args.obs_file,
+        args.engine, args.bmc_len, args.asl_file)
+
+    xsap_process.kill_and_close_streams()
+
+    for i, (res, traceA, traceB) in enumerate(results):
+        if len(results) > 1:
+            print("Specification %d" % i)
+        if "Error" == res:
+            print "--------------------------------------------------"
+            print "Result: An error has occurred during the analysis."
+            print "--------------------------------------------------"
+
+        elif "Unknown" == res:
+            print "------------------------------------------------------"
+            print "Result: No counterexample found within analysis bound."
+            print "------------------------------------------------------"
+
+        elif "True" == res:
+            print "-------------------------------------------------------"
+            print "Result: The specification is diagnosable in the system."
+            print "-------------------------------------------------------"
+
+        elif "False" == res:
+            print "--------------------------------------------------------------------------------"
+            print "Result: The specification is not diagnosable in the system. A pair of traces has"
+            print "been generated that show non-diagnosability:"
+            print "Trace A:", traceA
+            print "Trace B:", traceB
+            print "--------------------------------------------------------------------------------"
+
+        else:
+            assert False, "BUG: unexpected result of diagnosability verification."
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/check_installation.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/check_installation.py
new file mode 100644
index 0000000000000000000000000000000000000000..06a9af0a055dba9d02851dad55a9ca1dcf9a5f0a
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/check_installation.py
@@ -0,0 +1,75 @@
+# Use this script to check all requirements to run scripts and tools
+
+import sys
+import _paths
+
+
+# ----------------------------------------------------------------------
+# Requirements predicates
+# ----------------------------------------------------------------------
+def check_python_version():
+    """Python version must be 2.7.x"""
+    return (2, 7) <= sys.version_info < (3, 0)
+
+
+def check_platform():
+    """Platform not supported"""
+    import platform
+    is_64bits = sys.maxsize > 2**32
+    system = platform.system().lower()
+    return (system == "linux" or
+            (system == "windows" and is_64bits))
+
+req_packages = ("gobject", "gtk", "cairo", "goocanvas", "lxml",
+                "dateutil", "numpy", "pyparsing", "matplotlib",
+                "networkx", "pygraphviz", "mathsat", )
+# ----------------------------------------------------------------------
+
+
+def check_import(module_name):
+    def __importer():
+        try:
+            __import__(module_name)
+        except ImportError:
+            return False
+        return True
+
+    __importer.__name__ = "check_import_module__" + module_name
+    __importer.__doc__ = "Module '%s' could not be imported" % module_name
+    return __importer
+
+
+def main():
+    reqs = (check_python_version,
+            check_platform,
+            ) + tuple(check_import(mod)
+                      for mod in req_packages)
+
+    checked_reqs = [(req(), req) for req in reqs]
+    failed = 0
+    print("-" * 70)
+    for rid, req in enumerate(checked_reqs):
+        if not req[0]:
+            print("ERROR-{rid} {name}: {message}".format(
+                rid="%02d" % (rid+1),
+                name=req[1].__name__,
+                message=req[1].__doc__))
+            failed += 1
+
+        else:
+            print("PASSED-{rid} {name}".format(
+                rid="%02d" % (rid+1),
+                name=req[1].__name__))
+
+    print("-" * 70)
+    if failed > 0:
+        print("FAILED! There are %d critical requirements unsatisfied" %
+              failed)
+    else:
+        print("SUCCESS! All requirements are satisfied")
+    print("-" * 70)
+
+
+if "__main__" == __name__:
+    _paths.setup_path()
+    main()
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/check_tfpg.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/check_tfpg.py
new file mode 100644
index 0000000000000000000000000000000000000000..5815bee6669eda81b68cffccefe3f43b23ba8a84
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/check_tfpg.py
@@ -0,0 +1,159 @@
+#!/usr/bin/env python
+
+import sys
+import os.path
+from argparse import ArgumentParser, RawTextHelpFormatter
+
+import _paths
+_paths.setup_path()
+
+from xsap.data_structure.tfpg.tfpg_errors import UnsupportedInfinitySemantics
+from xsap.data_structure.tfpg.tfpg import OPEN_INFINITY
+from xsap.data_structure.tfpg.tfpg import Tfpg
+from xsap.features.tfpg_smt.utils import parse_scenario_file, print_model
+from xsap.features.tfpg_smt.reasoner import TFPGReasoner
+from xsap.features.tfpg_smt.encoding import node_state_symbol
+
+
+def main():
+    parser = ArgumentParser(formatter_class=RawTextHelpFormatter,
+                            description="""
+TFPG Check (SMT): Checks multiple properties of the given TFPG.
+""")
+
+    parser.add_argument('inputTFPG', metavar='inputTFPG',
+                        type=str,
+                        help='The TFPG model to use')
+
+    parser.add_argument('--scenario', metavar='scenario',
+                        type=str,
+                        help='The scenario to be used for checking')
+
+    parser.add_argument('--possibility', '-p', action='store_true',
+                        help='Checks the possibility of the given scenario ' \
+                        'in the given TFPG')
+
+    parser.add_argument('--necessity', '-n', action='store_true',
+                        help='Checks the necessity of the given scenario ' \
+                        'in the given TFPG')
+
+    parser.add_argument('--consistency', '-x', action="store_true",
+                        help='Checks if a scenario exists for the given TFPG')
+
+    parser.add_argument('--activability', action="store_true",
+                        help='Checks if all nodes can be activated')
+
+    parser.add_argument('--all-modes', action="store_true",
+                        help='Enumerates the modes compatible with the scenario.')
+
+    parser.add_argument('--open-infinity', action='store_true',
+                        help='Force the usage of Open Infinity semantics')
+
+    args = parser.parse_args()
+
+
+    # Command line handling
+    tfpg = Tfpg.parse_tfpg(args.inputTFPG)
+    if tfpg is None:
+        sys.exit(1)
+
+    if args.open_infinity:
+        tfpg.set_infinity_semantics(OPEN_INFINITY)
+
+    try:
+        reasoner = TFPGReasoner(tfpg, include_health=False)
+    except UnsupportedInfinitySemantics:
+        print("The current version of the algorithm only supports Open Infinity Semantics.")
+        print("To force the implicit conversion, use the option --open-infinity")
+        sys.exit(1)
+
+    if args.possibility:
+        scenario_f = args.scenario
+        if scenario_f is None:
+            print("You must specify the scenario to check by using the --scenario option")
+            print("See help for further details.")
+            sys.exit(1)
+
+        scenario = parse_scenario_file(scenario_f)
+        if scenario is None:
+            print("The given scenario is invalid")
+            sys.exit(1)
+
+        print("Checking the possibility of the given scenario...")
+        res, model = reasoner.check_scenario(scenario)
+        if res:
+            print("The scenario is possible!")
+            print("A model is:")
+            print_model(model)
+        else:
+            print("The scenario is NOT possible!")
+
+    elif args.consistency:
+        res, model = reasoner.check_consistency()
+        if res:
+            print("The TFPG is consistent!")
+            print("A model is:")
+            print_model(model)
+        else:
+            print("The TFPG is NOT consistent!")
+
+    elif args.necessity:
+        scenario_f = args.scenario
+        if scenario_f is None:
+            print("You must specify the scenario to check by using the --scenario option")
+            print("See help for further details.")
+            sys.exit(1)
+
+        scenario = parse_scenario_file(scenario_f)
+        if scenario is None:
+            print("The given scenario is invalid")
+            sys.exit(1)
+
+        print("Checking the necessity of the given scenario...")
+        res, model = reasoner.check_scenario_necessity(scenario)
+        if res:
+            print("The scenario is necessary!")
+        else:
+            print("The scenario is NOT necessary!")
+            print("A counterexample scenario is:")
+            print_model(model)
+
+    elif args.activability:
+        print("Checking if all nodes can be activated...")
+        invalid_nodes = reasoner.check_activability()
+        if len(invalid_nodes) == 0:
+            print("All nodes can be activated!")
+        else:
+            print("The following nodes CANNOT be activated!")
+            print([str(n) for n in invalid_nodes])
+
+    elif args.all_modes:
+        scenario_f = args.scenario
+        if scenario_f is None:
+            print("You must specify the scenario to check by using the --scenario option")
+            print("See help for further details.")
+            sys.exit(1)
+
+        scenario = parse_scenario_file(scenario_f)
+        if scenario is None:
+            print("The given scenario is invalid")
+            sys.exit(1)
+
+        print("Checking Modes compatible with the scenario...")
+        scenario = reasoner.scenario_to_formula(scenario)
+        modes = reasoner.get_all_modes(scenario)
+        if len(modes) == 0:
+            print("NO mode compatible with the scenario!")
+        else:
+            print("The following modes are ALL the compatible modes:")
+            for mode in modes:
+                print(mode)
+
+    else:
+        print "Invalid command line parameters."
+        print "See help for further details."
+        sys.exit(1)
+
+
+if __name__ == "__main__":
+    main()
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/check_tfpg_refinement.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/check_tfpg_refinement.py
new file mode 100644
index 0000000000000000000000000000000000000000..cb69b07b5372d1f0aa55e2585aa5eb9cc73bd9d8
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/check_tfpg_refinement.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+
+import sys
+import os.path
+from argparse import ArgumentParser, RawTextHelpFormatter
+
+import _paths
+_paths.setup_path()
+
+from xsap.data_structure.tfpg.tfpg_errors import UnsupportedInfinitySemantics
+from xsap.data_structure.tfpg.tfpg import OPEN_INFINITY
+from xsap.data_structure.tfpg.tfpg import Tfpg
+from xsap.features.tfpg_smt.utils import parse_mapping_file, print_model
+from xsap.features.tfpg_smt.reasoner import TFPGReasoner
+
+
+def main():
+    parser = ArgumentParser(formatter_class=RawTextHelpFormatter,
+                            description="""
+TFPG Refinement (SMT):  Checks if a inputTFPG is a refinement of the original TFPG.
+""")
+
+    parser.add_argument('inputTFPG', metavar='inputTFPG',
+                        type=str,
+                        help='The TFPG model to use (TFPG 1)')
+
+    parser.add_argument('--mapping', '-m', metavar='mapping',
+                        type=str,
+                        help='The refinement mapping')
+
+    parser.add_argument('--refine', '-r', metavar='original',
+                        type=str,
+                        help='TFPG 2')
+
+    parser.add_argument('--open-infinity', action='store_true',
+                        help='Force the usage of Open Infinity semantics')
+
+    args = parser.parse_args()
+
+
+    # Command line handling
+    tfpg = Tfpg.parse_tfpg(args.inputTFPG)
+    if tfpg is None:
+        sys.exit(1)
+
+    if args.open_infinity:
+        tfpg.set_infinity_semantics(OPEN_INFINITY)
+
+    try:
+        reasoner = TFPGReasoner(tfpg, include_health=False)
+    except UnsupportedInfinitySemantics:
+        print("The current version of the algorithm only supports Open Infinity Semantics.")
+        print("To force the implicit conversion, use the option --open-infinity")
+        sys.exit(1)
+
+
+    if args.refine:
+        original_tfpg = Tfpg.parse_tfpg(args.refine)
+        if original_tfpg is None:
+            sys.exit(1)
+
+        mapping_f = args.mapping
+
+        if original_tfpg is None:
+            print("The given tfpg is invalid")
+            sys.exit(1)
+
+        if mapping_f is None:
+            print("You must specify the mapping by using the -m option")
+            print("See help for further details.")
+            sys.exit(1)
+
+        mapping = parse_mapping_file(mapping_f)
+        if mapping is None:
+            print("The given mapping is invalid")
+            sys.exit(1)
+
+        print("Checking the refinement...")
+        res, model = reasoner.check_refinement(original_tfpg, mapping)
+
+        if res:
+            print("The given TFPG is a refinement of original_tfpg")
+        else:
+            print("The given TFPG is NOT a refinement of original_tfpg")
+            print("A trace that has no refinement is:")
+            print_model(model)
+
+    else:
+        print "Invalid command line parameters."
+        print "See help for further details."
+        sys.exit(1)
+
+if __name__ == "__main__":
+    main()
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/compute_fmea_table.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/compute_fmea_table.py
new file mode 100644
index 0000000000000000000000000000000000000000..91a18cc9283565c2c9360d89824d6bdc7a33fd1f
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/compute_fmea_table.py
@@ -0,0 +1,197 @@
+# takes: fei (either xml or text) and smv,
+# and produces smv and fault modes files
+
+import sys
+import os.path
+import logging
+import subprocess
+
+import _paths
+import _utils
+
+
+# WARNING! ordering is important here!
+FMEA_ENGINES = "bdd bmc msat".split()
+FMEA_ENGINE_BDD, FMEA_ENGINE_BMC, FMEA_ENGINE_MSAT = FMEA_ENGINES
+
+
+def handle_options():
+    """returns (options, input_file):
+    values (as a map) and the name of the input file"""
+
+    import argparse
+    parser = argparse.ArgumentParser(description="Produces an extend smv file"
+                                     " out of given nominal smv file and fei")
+
+    parser.add_argument("--smv-file",
+                        metavar="SMV-FILE",
+                        help="The input extended smv file name")
+
+    parser.add_argument("--fms-file",
+                        metavar="FMS-FILE",
+                        help="The input fault mode xml file name")
+
+    parser.add_argument("--prop-indices", "-n",
+                        type=int,
+                        metavar="INDICES",
+                        help="Property indices to be used as TLE "
+                             "(separated by ':' or spaces, ranges like "
+                             "'0-10' are allowed)")
+
+    parser.add_argument("--props-text", "-p",
+                        metavar="PROPERTIES",
+                        help="Textual properties to be used as TLE, "
+                             "separated by ':' or by spaces")
+
+    parser.add_argument('--verbose', '-v',
+                        action='store_true',
+                        default=False,
+                        help='Sets verbosity to high level')
+
+    parser.add_argument('--engine', '-E',
+                        choices=FMEA_ENGINES,
+                        default=FMEA_ENGINE_BDD,
+                        help='Use given engine (default: %(default)s)')
+
+    parser.add_argument('--dynamic',
+                        action='store_true',
+                        default=False,
+                        help='Generates dynamic fmea table')
+
+    parser.add_argument('--compact', '-c',
+                        action='store_true',
+                        default=False,
+                        help='Generates compact fmea table')
+
+    parser.add_argument('--card', "-N",
+                        type=int,
+                        default=1,
+                        help='Cut-Set cardinality (default: %(default)d)')
+
+    parser.add_argument('--bmc-length', "-k",
+                        type=int,
+                        default=10,
+                        help='Specify BMC length (integer)')
+
+    parser.add_argument('--show', '-s',
+                        action='store_true',
+                        default=False,
+                        help='Show the generated fmea table')
+
+    parser.add_argument(
+        "-d", "--outdir",
+        default="out",
+        metavar="PATH",
+        help="Output directory, where all generated file should be "
+        "put into (default:%(default)s)")
+
+    args = parser.parse_args()
+
+    for fn in (args.smv_file, args.fms_file):
+        if fn and not os.path.isfile(fn):
+            parser.error("File not found: " + fn)
+
+    if os.path.exists(args.outdir) and not os.path.isdir(args.outdir):
+        parser.error("Not a directory: " + args.outdir)
+
+    prop = [p for p in (args.prop_indices, args.props_text)
+            if p is not None]
+    if len(prop) > 1:
+        parser.error("Properties can be specified only "
+                     "in one way (multiple used)")
+
+    if args.engine in (FMEA_ENGINE_MSAT, FMEA_ENGINE_BMC) and args.dynamic:
+        parser.error("Dynamic fmea not available with engine %s" % args.engine)
+
+    return args
+
+
+def show_fmea_table(fmea_fname, card, show):
+    count = 0
+
+    import csv
+    with open(fmea_fname, 'rb') as csvfile:
+        reader = csv.reader(csvfile, delimiter='\t', quotechar="'")
+        reader.next()
+        for row in reader:
+            if show:
+                print "-" * 70
+                print "ID: ", row[0]
+                print "TLE:", row[3]
+                print "FMS:", row[2]
+            count += 1
+
+        if show:
+            print "=" * 70
+            print "Total cut sets with cardinality %d: %d" % (card, count)
+
+        elif count == 0:
+            logging.warn("The FMEA table is empty with cardinality %d" % card)
+
+    return
+
+
+if "__main__" == __name__:
+    _paths.setup_path()
+
+    import xsap.utils.misc.log
+    from xsap.utils.processes.xsap_process import XsapProcess
+    xsap.utils.misc.log.init()
+
+    args = handle_options()
+
+    if not os.path.exists(args.outdir):
+        os.makedirs(args.outdir)
+
+    if args.verbose:
+        logging.getLogger().setLevel(logging.INFO)
+
+    prop = [('-n %d' % args.prop_indices) if args.prop_indices is not None
+            else
+            ('%s' % args.props_text) if args.props_text is not None
+            else ""]
+
+    # automatically searches for inputs when not explicitly provided
+    smv_fname = _utils.get_suitable_smv_file(args.smv_file, args.outdir)
+    if smv_fname is None:
+        sys.exit(1)
+
+    fms_fname = _utils.get_suitable_fms_file(args.fms_file,
+                                             smv_fname,
+                                             args.outdir)
+    if fms_fname is None:
+        sys.exit(1)
+
+    stdouterr_fname = os.path.join(args.outdir, "xsap_compute_fmea.out")
+    if os.path.exists(stdouterr_fname):
+        os.remove(stdouterr_fname)
+    stdouterr_file = open(stdouterr_fname, "w")
+
+    logging.info("Invoking xsap to compute fmea table")
+
+    need_msat = XsapProcess.has_infinite_domain_vars(smv_fname) or args.engine == FMEA_ENGINE_MSAT
+    with XsapProcess(smv_fname, fms_fname,
+                     need_msat=need_msat,
+                     stdout=subprocess.PIPE,
+                     stderr=subprocess.STDOUT,
+                     dumpers=[stdouterr_file]) as xsap_proc:
+
+        # set the prefix of generated files
+        full_base, _ext = os.path.splitext(smv_fname)
+        base = os.path.basename(full_base)
+        xsap_proc.set_tmp_filename_prefix(args.outdir + "/" + base)
+
+        stdouterr_file.write("\n" + "-" * 70)
+        stdouterr_file.write("\nInvoking: %s %s\n" % (xsap_proc.get_path(),
+                                                      " ".join(xsap_proc.get_args())))
+        stdouterr_file.write("\n" + "-" * 70)
+        stdouterr_file.write("\n")
+
+        res = xsap_proc.compute_fmea_table(
+            prop, args.card, dynamic=args.dynamic, bmc_length=args.bmc_length,
+            compact=args.compact, engine=args.engine)
+
+    logging.info("xsap produced fmea table in: '%s'" % res)
+    stdouterr_file.close()
+
+    show_fmea_table(res, args.card, args.show)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/compute_ft.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/compute_ft.py
new file mode 100644
index 0000000000000000000000000000000000000000..7b7041c78808193c18967a22d0099351c49a27f9
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/compute_ft.py
@@ -0,0 +1,217 @@
+# takes: fei (either xml or text) and smv,
+# and produces smv and fault modes files
+
+import sys
+import os.path
+import logging
+import subprocess
+
+import _paths
+import _utils
+
+
+# WARNING! ordering is important here!
+FT_ENGINES = "bdd bmc bddbmc msat ic3".split()
+(FT_ENGINE_BDD,
+ FT_ENGINE_BMC,
+ FT_ENGINE_BDD_BMC,
+ FT_ENGINE_MSAT,
+ FT_ENGINE_IC3, ) = FT_ENGINES
+
+
+
+def handle_options():
+    """returns (options, input_file):
+    values (as a map) and the name of the input file"""
+
+    import argparse
+    parser = argparse.ArgumentParser(description="Produces an extend smv file"
+                                     " out of given nominal smv file and fei")
+
+    parser.add_argument("--smv-file",
+                        metavar="SMV-FILE",
+                        help="The input extended smv file name")
+
+    parser.add_argument("--fms-file",
+                        metavar="FMS-FILE",
+                        help="The input fault mode xml file name")
+
+    parser.add_argument("--faults-bound", "-N",
+                        type=int,
+                        metavar="BOUND",
+                        help="Sets a bound to the maximum number of faults")
+
+    parser.add_argument("--prop-index", "-n",
+                        type=int,
+                        metavar="INDEX",
+                        help="Property index to be used as TLE")
+
+    parser.add_argument("--prop-name", "-P",
+                        metavar="NAME",
+                        help="Property name to be used as TLE")
+
+    parser.add_argument("--prop-text", "-p",
+                        metavar="PROPERTY",
+                        help="Textual property to be used as TLE")
+
+    parser.add_argument('--verbose', '-v',
+                        action='store_true',
+                        default=False,
+                        help='Sets verbosity to high level')
+
+    parser.add_argument('--engine', '-E',
+                        choices=FT_ENGINES,
+                        default=FT_ENGINE_BDD,
+                        help='Use given engine (default: %(default)s)')
+
+    parser.add_argument('--dynamic',
+                        action='store_true',
+                        default=False,
+                        help='Generates dynamic fault tree')
+
+    parser.add_argument('--gen-trace', "-e",
+                        action='store_true',
+                        default=False,
+                        help='Generates xml trace from fault tree')
+
+    parser.add_argument('--bmc-length', "-k",
+                        type=int,
+                        default=10,
+                        help='Specify BMC length (integer)')
+
+    parser.add_argument('--show', '-s',
+                        action='store_true',
+                        default=False,
+                        help='Show the generated fault tree')
+
+    parser.add_argument("--probability",
+                        action='store_true',
+                        default=False,
+                        help="Computes probability when generating FT")
+
+    parser.add_argument("--symbolic", '-S',
+                        action='store_true',
+                        default=False,
+                        help="Generates symbolic probability as well "
+                        "when computing probability",)
+
+    parser.add_argument("--quick", '-Q',
+                        action='store_true',
+                        default=False,
+                        help="For quick computation, avoid ordering the "
+                        "FT and when computing probability avoid computing"
+                        "probability of intermediate nodes. Use to"
+                        "speedup computation.",)
+
+    parser.add_argument(
+        "-d", "--outdir",
+        default="out",
+        metavar="PATH",
+        help="Output directory, where all generated file should be "
+        "put into (default:%(default)s)")
+
+    args = parser.parse_args()
+
+    for fn in (args.smv_file, args.fms_file):
+        if fn and not os.path.isfile(fn):
+            parser.error("File not found: " + fn)
+
+    if os.path.exists(args.outdir) and not os.path.isdir(args.outdir):
+        parser.error("Not a directory: " + args.outdir)
+
+    prop = [p for p in (args.prop_index, args.prop_name, args.prop_text)
+            if p is not None]
+    if len(prop) > 1:
+        parser.error("Only one property can be specified")
+
+    if args.symbolic and not args.probability:
+        parser.error("Option -S (--symbolic) requires --probability")
+
+    return args
+
+
+if "__main__" == __name__:
+
+    _paths.setup_path()
+
+    import xsap.utils.misc.log
+    from xsap.utils.processes.xsap_process import XsapProcess
+    xsap.utils.misc.log.init()
+
+    opts = handle_options()
+
+    if not os.path.exists(opts.outdir):
+        os.makedirs(opts.outdir)
+
+    if opts.verbose:
+        logging.getLogger().setLevel(logging.INFO)
+
+
+    # automatically searches for inputs when not explicitly provided
+    smv_fname = _utils.get_suitable_smv_file(opts.smv_file, opts.outdir)
+    if smv_fname is None:
+        sys.exit(1)
+
+    fms_fname = _utils.get_suitable_fms_file(opts.fms_file,
+                                             smv_fname,
+                                             opts.outdir)
+    if fms_fname is None:
+        sys.exit(1)
+
+    stdouterr_fname = os.path.join(opts.outdir, "xsap_compute_ft.out")
+    if os.path.exists(stdouterr_fname):
+        os.remove(stdouterr_fname)
+
+    stdouterr_file = open(stdouterr_fname, "w")
+
+    # instantiate the process
+    logging.info("Invoking xsap to compute fault tree")
+
+    need_msat = XsapProcess.has_infinite_domain_vars(smv_fname) or opts.engine == FT_ENGINE_MSAT
+    with  XsapProcess(smv_fname, fms_fname,
+                      ord_fname=None, need_msat=need_msat,
+                      args=["-v", "%d" % (5 if opts.verbose else 0)],
+                      stdout=subprocess.PIPE,
+                      stderr=subprocess.STDOUT,
+                      dumpers=[stdouterr_file]) as xsap_process:
+
+        # set the prefix
+        full_base, _ext = os.path.splitext(smv_fname)
+        base = os.path.basename(full_base)
+        xsap_process.set_tmp_filename_prefix(opts.outdir + "/" + base)
+
+        stdouterr_file.write("\n" + "-" * 70)
+        stdouterr_file.write("\nInvoking: %s %s\n" % (xsap_process.get_path(),
+                                                  " ".join(xsap_process.get_args())))
+        stdouterr_file.write("\n" + "-" * 70)
+        stdouterr_file.write("\n")
+
+        prop = (('-n %d' % opts.prop_index) if opts.prop_index is not None
+                else
+                ('-P "%s"' % opts.prop_name) if opts.prop_name is not None
+                else
+                ('"%s"' % opts.prop_text) if opts.prop_text is not None
+                else "")
+
+        ev_file, gates_file, xml_file = xsap_process.compute_fault_tree(
+            prop, opts.dynamic, opts.bmc_length,
+            use_bdd=opts.engine==FT_ENGINE_BDD,
+            use_bdd_bmc=opts.engine==FT_ENGINE_BDD_BMC,
+            compute_probabilities=opts.probability,
+            use_param=opts.engine==FT_ENGINE_IC3,
+            fails_nbr=opts.faults_bound,
+            symbolic=opts.symbolic,
+            quick=opts.quick,
+            gen_trace=opts.gen_trace,
+            gen_random_prefix=False)
+
+    stdouterr_file.close()
+
+    logging.info("xsap produced fault tree in: ")
+    logging.info("  events: '%s'" % ev_file)
+    logging.info("  gates: '%s'" % gates_file)
+
+    if ev_file is not None and gates_file is not None and opts.show:
+        logging.info("Now showing result fault tree")
+        import fault_tree_viewer.ftv as ftv
+        ftv.run(ev_file, gates_file, xml_file, None, None)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/compute_tfpg_diagnosis.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/compute_tfpg_diagnosis.py
new file mode 100644
index 0000000000000000000000000000000000000000..3a57387b3c34c2bcf3aeb3c8fb50aff42124e38c
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/compute_tfpg_diagnosis.py
@@ -0,0 +1,115 @@
+#!/usr/bin/env python
+
+import sys
+import os.path
+from argparse import ArgumentParser, RawTextHelpFormatter
+
+import _paths
+_paths.setup_path()
+
+from xsap.data_structure.tfpg.tfpg_errors import UnsupportedInfinitySemantics
+from xsap.data_structure.tfpg.tfpg import OPEN_INFINITY
+from xsap.data_structure.tfpg.tfpg import Tfpg
+from xsap.features.tfpg_smt.utils import parse_scenario_file, print_model
+from xsap.features.tfpg_smt.reasoner import TFPGReasoner
+from xsap.features.tfpg_smt.encoding import node_state_symbol
+
+
+def main():
+    parser = ArgumentParser(formatter_class=RawTextHelpFormatter,
+                            description="""
+TFPG Diagnosis (SMT): Diagnose the scenario for the given TFPG.
+""")
+
+    parser.add_argument('inputTFPG', metavar='inputTFPG',
+                        type=str,
+                        help='The TFPG model to use')
+
+    parser.add_argument('--diagnosability',action="store_true",
+                        help='Checks if all failure modes are diagnosable')
+
+    parser.add_argument('--diagnose', '-d', metavar='scenario',
+                        type=str,
+                        help='Enumerate the possible diagnoses for the ' \
+                        'given scenario')
+
+    parser.add_argument('--all-diag', '-a', metavar='node', type=str,
+                        help='Checks if the given node appears in all ' \
+                        'the diagnoses')
+
+    parser.add_argument('--open-infinity', action='store_true',
+                        help='Force the usage of Open Infinity semantics')
+
+    args = parser.parse_args()
+
+
+    # Command line handling
+    tfpg = Tfpg.parse_tfpg(args.inputTFPG)
+    if tfpg is None:
+        sys.exit(1)
+
+    if args.open_infinity:
+        tfpg.set_infinity_semantics(OPEN_INFINITY)
+
+    try:
+        reasoner = TFPGReasoner(tfpg, include_health=False)
+    except UnsupportedInfinitySemantics:
+        print("The current version of the algorithm only supports Open Infinity Semantics.")
+        print("To force the implicit conversion, use the option --open-infinity")
+        sys.exit(1)
+
+    if args.diagnose:
+        scenario_f = args.diagnose
+        condition_node = args.all_diag
+
+        scenario = parse_scenario_file(scenario_f)
+        if scenario is None:
+            print("The given scenario is invalid")
+            sys.exit(1)
+
+        fscenario = reasoner.scenario_to_formula(scenario)
+        if condition_node is not None:
+            print("Checking if all diagnoses imply node...")
+            beta = node_state_symbol(condition_node)
+            res, model = reasoner.certain_diagnosis(scenario, beta)
+            if res:
+                print("Node appears in all diagnoses")
+            else:
+                print("Node does NOT appear in all diagnoses!")
+                print("A diagnosis for which node is not present is:")
+                print_model(model)
+
+        else:
+            print("Getting all the diagnoses...")
+            diagnoses = reasoner.get_all_diagnosis(fscenario)
+            if len(diagnoses) == 0:
+                print("No diagnoses found.")
+            elif len(diagnoses) == 1:
+                print("One diagnosis found.")
+            else:
+                print("%d diagnoses found." % len(diagnoses))
+
+            for d in diagnoses:
+                print("------")
+                print_model(d)
+
+    elif args.diagnosability:
+        print("Checking diagnosability of the TFPG...")
+        nd_list, _ = reasoner.check_diagnosability()
+        if len(nd_list) == 0:
+            print("All Failure Modes can be diagnosed in all modes!")
+        else:
+            print("The following Failure Modes CANNOT be diagnosed in the given modes!")
+            summary = {}
+            for mode, fm in nd_list:
+                if mode not in summary: summary[mode] = []
+                summary[mode].append(fm)
+            print("\n".join(["%s : %s" % x for x in summary.items()]))
+
+    else:
+        print "Invalid command line parameters."
+        print "See help for further details."
+        sys.exit(1)
+
+if __name__ == "__main__":
+    main()
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/convert_tfpg_format.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/convert_tfpg_format.py
new file mode 100644
index 0000000000000000000000000000000000000000..128c8b919887b6250cc71fcd5ad281772312f10b
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/convert_tfpg_format.py
@@ -0,0 +1,130 @@
+\
+import sys
+import os
+import _paths
+
+
+def handle_options():
+    """Returns options values as map."""
+
+    import argparse
+    parser = argparse.ArgumentParser(description="Converts a TFPG (associations) XML file into textual format or viceversa")
+
+    parser.add_argument("--tfpg-file", "-t",
+                        dest="tfpg",
+                        action="store",
+                        default=None,
+                        help="The TFPG file (can be in XML or human readable format)")
+
+    parser.add_argument("--associations-file", "-a",
+                        dest="assoc",
+                        action="store",
+                        default=None,
+                        help="TFPG SMV associations file")
+
+    args = parser.parse_args()
+
+    if args.tfpg is not None and not os.path.exists(args.tfpg):
+        parser.error("The specified TFPG file is not valid: %s." %args.tfpg)
+        pass
+
+    if args.assoc is not None and not os.path.exists(args.assoc):
+        parser.error("The specified associations file is not valid: %s." %args.assoc)
+        pass
+
+    if args.tfpg is None and args.assoc is None:
+        parser.error("At least a TFPG file or an associations file must be specified")
+
+    return args
+
+
+if __name__ == "__main__":
+
+    _paths.setup_path()
+
+    # setup logging
+    import xsap.utils.misc.log
+    xsap.utils.misc.log.init()
+    args = handle_options()
+
+    tfpg_fname = args.tfpg       # The name of the tfpg model (XML format)
+    assoc_fname = args.assoc     # The name of the tfpg SMV associations file
+
+    if tfpg_fname is not None:
+        tfpg_file_ext = os.path.splitext(tfpg_fname)[1]
+        tfpg = None
+        errors = []
+
+        if tfpg_file_ext in [".txml", ".xml"]:
+            from xsap.data_structure.tfpg.xml.tfpg import parse_tfpg_xml_file_to_internal_struct
+            tfpg, errors = parse_tfpg_xml_file_to_internal_struct(tfpg_fname)
+        elif tfpg_file_ext == ".tfpg":
+            from xsap.data_structure.tfpg.txt.tfpg import parse_tfpg_txt_file_to_internal_struct
+            tfpg = parse_tfpg_txt_file_to_internal_struct(tfpg_fname)
+        else:
+            print "Error! Unknown format for the TFPG file: %s." %tfpg_file_ext
+            sys.exit(1)
+
+        from xsap.data_structure.tfpg.tfpg_errors import UnreachableDiscrepancy
+        if len(tfpg.get_errors_list()) > 0:
+            for err in tfpg.get_errors_list():
+                if isinstance(err, UnreachableDiscrepancy):
+                    print "Warning! " + str(err)
+        if len(errors) > 0:
+            for err in errors:
+                raise err
+
+        if tfpg_file_ext in [".txml", ".xml"]:
+            from xsap.data_structure.tfpg.txt.tfpg import dump_tfpg_to_txt_file
+            tfpg_out_fname = os.path.splitext(tfpg_fname)[0] + ".tfpg"
+            dump_tfpg_to_txt_file(tfpg, tfpg_out_fname)
+        elif tfpg_file_ext in ".tfpg":
+            tfpg_out_fname = os.path.splitext(tfpg_fname)[0] + ".txml"
+            tfpg.dump_to_xml(tfpg_out_fname)
+
+        print "TFPG dumped to file: %s" %tfpg_out_fname
+
+
+    if assoc_fname is not None:
+        assoc_file_ext = os.path.splitext(assoc_fname)[1]
+        associations = None
+
+        if assoc_file_ext in [".axml", ".xml"]:
+            from xsap.data_structure.tfpg.xml.tfpg_associations import parse_assoc_xml_file_to_internal_struct
+            from xsap.data_structure.tfpg.txt.tfpg_associations import dump_associations_to_txt_file
+
+            associations = parse_assoc_xml_file_to_internal_struct(assoc_fname)
+
+            if (len(associations.get_var_names_of_unmonitored_discr()) == 0 and len(associations.get_var_names_of_monitored_discr()) == 0) or \
+                    len(associations.get_var_names_of_failure_modes()) == 0 or \
+                    len(associations.get_var_names_of_tfpg_modes()) == 0:
+                print "Error! Associations file must contain at least a failure mode, a discrepancy and a system mode"
+                sys.exit(1)
+
+            assoc_out_fname = os.path.splitext(assoc_fname)[0] + ".tfpga"
+            dump_associations_to_txt_file(associations, assoc_out_fname)
+
+        elif assoc_file_ext == ".tfpga":
+            from xsap.data_structure.tfpg.txt.tfpg_associations import parse_assoc_txt_file_to_internal_struct
+            from xsap.data_structure.tfpg.xml.tfpg_associations import create_associations_document_from_list
+
+            associations = parse_assoc_txt_file_to_internal_struct(assoc_fname)
+
+            if (len(associations.get_var_names_of_unmonitored_discr()) == 0 and len(associations.get_var_names_of_monitored_discr()) == 0) or \
+                    len(associations.get_var_names_of_failure_modes()) == 0 or \
+                    len(associations.get_var_names_of_tfpg_modes()) == 0:
+                print "Error! Associations file must contain at least a failure mode, a discrepancy and a system mode"
+                sys.exit(1)
+
+            assoc_out_fname = os.path.splitext(assoc_fname)[0] + ".axml"
+            assoc_file = open(assoc_out_fname, "w")
+            assoc_file.write(str(create_associations_document_from_list(associations)))
+            assoc_file.close()
+
+        else:
+            print "Error! Unknown format for the TFPG associations file: %s." %assoc_file_ext
+            sys.exit(1)
+
+        print "Associations dumped to file: %s" %assoc_out_fname
+
+        pass
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/extend_model.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/extend_model.py
new file mode 100644
index 0000000000000000000000000000000000000000..8e53ae42ff43a90247e9c5638676a9acf6fdd87e
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/extend_model.py
@@ -0,0 +1,244 @@
+# takes: fei (either xml or text) and smv,
+# and produces smv and fault modes files
+
+import sys
+import os.path
+import logging
+import _paths
+import _utils
+
+
+def get_expanded_fei_fname(fei_txt_fname):
+    """Given the fei text file name, provides the file name of the
+    expanded fei """
+
+    base_in, _ext = os.path.splitext(fei_txt_fname)
+    return os.path.basename(base_in) + ".xml"
+
+
+def get_extended_smv_fname(smv_fname):
+    full_base, ext = os.path.splitext(smv_fname)
+    base = os.path.basename(full_base)
+    prefix = "extended_"
+    return prefix + base + ext
+
+
+def compile_fei(fei_xml_fname, out_xml_fname, lib_path=None):
+    from feic import feicm
+
+    feicm.main(fei_xml_fname, out_xml_fname,
+               lib_path or feicm.get_default_fault_lib_path())
+
+
+def translate_fei_to_xml(fei_txt_fname, outdir, path):
+    """returns the name of generated xml file. Raises RuntimeError
+    is an error occurs while parsing"""
+    from feic.translate import fei_translator
+
+    out_fei_xml = os.path.join(outdir, get_expanded_fei_fname(fei_txt_fname))
+
+    fei_translator.convert_fei_text_to_xml_format(
+        fei_txt_fname, out_fei_xml, path)
+    logging.info("Generated XML fei: " + out_fei_xml)
+    return out_fei_xml
+
+
+def extend_model(smv_fname, fei_fname, outdir,
+                 disable_checks=False, disable_cc=False,
+                 anonymize=False):
+    import subprocess
+
+    if not os.path.exists(_paths.BIN_DIR) or not os.path.isdir(_paths.BIN_DIR):
+        raise RuntimeError("Could not find bin directory containing xsap")
+
+    cmd_pat = """set on_failure_script_quits
+read_model -i "{smv_in}"
+flatten_hierarchy
+fe_load_doc -o "{error_fname}" {disable_checks} -p "{dtd_path}" -i "{xml_fei}"
+fe_extend_module -m "{fms_fname}" {disable_cc} {anonymize} -o "{smv_out}"
+quit
+"""
+    smv_out = os.path.join(outdir,
+                           get_extended_smv_fname(smv_fname))
+
+    fms_fname = os.path.join(outdir,
+                             _utils.get_fms_fname(smv_out))
+
+    stdouterr_fname = os.path.join(outdir, "xsap_extend_model.out")
+    if os.path.exists(stdouterr_fname):
+        os.remove(stdouterr_fname)
+
+    error_fname = os.path.join(outdir, "errors.log")
+    if os.path.exists(error_fname):
+        os.remove(error_fname)
+
+    # generate command file
+    cmd_fname = os.path.join(outdir, "xsap_extend_model.cmd")
+    with open(cmd_fname, "w") as _cmd_file:
+        _cmd_file.write(cmd_pat.format(
+            smv_in=smv_fname,
+            error_fname=error_fname,
+            disable_checks="-c" if disable_checks else "",
+            dtd_path=_paths.SCHEMA_DIR,
+            xml_fei=fei_fname,
+            fms_fname=fms_fname,
+            disable_cc="-c" if disable_cc else "",
+            anonymize="-A" if anonymize else "",
+            smv_out=smv_out))
+    logging.info("Generated xsap commands script: " + cmd_fname)
+
+    logging.info("Invoking xsap to carry out smv extension of " + smv_fname)
+
+    exe_name = _utils.get_exec_fullname()
+
+    args = [exe_name, "-source", cmd_fname]
+
+    with open(stdouterr_fname, "w") as o_file:
+        o_file.write("\n" + "-" * 70)
+        o_file.write("\nInvoking:\n" + " ".join(args))
+        o_file.write("\n" + "-" * 70)
+        o_file.write("\nContent of %s is:\n" % cmd_fname)
+        o_file.write(open(cmd_fname).read())
+        res = subprocess.call(args, stdout=o_file, stderr=subprocess.STDOUT)
+        o_file.write("\n" + "-" * 70)
+        o_file.write("\nxsap returned %d\n" % res)
+        o_file.write("-" * 70 + '\n')
+
+    if res != 0:
+        logging.error("A fatal error occurred")
+        if os.path.exists(error_fname):
+            logging.error("This is content of %s:" % error_fname)
+            with open(error_fname) as _err:
+                for line in _err:
+                    if line.strip():
+                        print ("   " + line.strip())
+
+        if os.path.exists(stdouterr_fname):
+            logging.error("(See also content of file %s)" % stdouterr_fname)
+
+        sys.exit(1)
+
+    else:
+        logging.info("Successfully created:")
+        logging.info(" - Extend smv file: '%s'" % smv_out)
+        logging.info(" - Fault modes xml file: '%s'" % fms_fname)
+
+    return smv_out, fms_fname
+
+
+def handle_options():
+    """returns (options, input_file):
+    values (as a map) and the name of the input file"""
+
+    import argparse
+    parser = argparse.ArgumentParser(description="Produces an extend smv file"
+                                     " out of given nominal smv file and fei")
+
+    parser.add_argument("smv_file",
+                        metavar="SMV-FILE",
+                        help="The input nominal smv file name")
+
+    parser.add_argument("fei_file",
+                        metavar="FEI-FILE",
+                        #dest="fei_file",
+                        help="The input fei file name")
+
+    parser.add_argument('--xml-fei', '-x',
+                        action='store_true',
+                        default=False,
+                        help='Process XML-format for input fei file')
+
+    parser.add_argument('--verbose', '-v',
+                        action='store_true',
+                        default=False,
+                        help='Sets verbosity to high level')
+
+    parser.add_argument('--disable-checks', '-c',
+                        action='store_true',
+                        default=False,
+                        help='Disable semantics checks when '
+                        'extending model (for debugging)')
+
+    parser.add_argument(
+        "-p", "--path",
+        default=os.path.join(_paths.DATA_DIR, "fm_library"),
+        metavar="PATH",
+        help="Path to the extension library (default:%(default)s)")
+
+    parser.add_argument(
+        "-d", "--outdir",
+        default="out",
+        metavar="PATH",
+        help="Output directory, where all generated file should be "
+        "put into (default:%(default)s)")
+
+    parser.add_argument('--disable-cc', '-C',
+                        action='store_true',
+                        default=False,
+                        help='Disable generation of common cause encoding '
+                        'when extending model (for debugging)')
+
+    parser.add_argument('--anonymize', '-A',
+                        action='store_true',
+                        default=False,
+                        help='Anonymize the generated extended model')
+
+    args = parser.parse_args()
+
+    for fn in (args.smv_file, args.fei_file):
+        if not os.path.isfile(fn):
+            parser.error("File not found: " + fn)
+
+    if os.path.exists(args.outdir) and not os.path.isdir(args.outdir):
+        parser.error("Not a directory: " + args.outdir)
+
+    return args
+
+
+if "__main__" == __name__:
+    _paths.setup_path()
+    args = handle_options()
+
+    if not os.path.exists(args.outdir):
+        os.makedirs(args.outdir)
+
+    if args.verbose:
+        logging.getLogger().setLevel(logging.INFO)
+
+    # convert text format if user specified text format as input
+    try:
+        fei_in = (translate_fei_to_xml(args.fei_file, args.outdir, args.path)
+                  if not args.xml_fei
+                  else args.fei_file)
+
+    except RuntimeError as e:
+        logging.error(e)
+        sys.exit(1)
+
+    base_in, _ext = os.path.splitext(args.fei_file)
+
+    out_fei_fname = os.path.join(
+        args.outdir,
+        "expanded_" + os.path.basename(base_in) + ".xml")
+
+    if os.path.isfile(out_fei_fname):
+        logging.info("Removing previously generated expanded XML fei: " +
+                     out_fei_fname)
+        os.remove(out_fei_fname)
+
+    logging.info("Generating expanded XML fei: " + out_fei_fname)
+    compile_fei(fei_in, out_fei_fname, args.path)
+
+    if not os.path.isfile(out_fei_fname):
+        logging.error("An error occurred while generating expanded XML fei: " +
+                      out_fei_fname)
+    else:
+        logging.info("Generated expanded XML fei: " + out_fei_fname)
+
+        out_smv_fname, out_fms = extend_model(
+            args.smv_file, out_fei_fname,
+            args.outdir,
+            disable_checks=args.disable_checks,
+            disable_cc=args.disable_cc,
+            anonymize=args.anonymize,
+        )
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/filter_tfpg.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/filter_tfpg.py
new file mode 100644
index 0000000000000000000000000000000000000000..88ef38f4a6fc6455543e8c94daa4bf188d02fe14
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/filter_tfpg.py
@@ -0,0 +1,225 @@
+
+import sys
+import os
+import _paths
+
+
+def handle_options():
+    """Returns options values as map."""
+
+    import argparse
+    parser = argparse.ArgumentParser(description="")
+
+    parser.add_argument("--tfpg-file", "-t",
+                        dest="tfpg",
+                        action="store",
+                        default=None,
+                        help="The TFPG file (can be in XML or human readable format)")
+
+    parser.add_argument("--filter-action", "-F",
+                        dest="filter_action",
+                        choices=['simplify', 'focus'],
+                        default=None,
+                        help="'simplify': Basic simplification routines as executed in "
+                        "TFPG synthesis are performed. Edges are assumed to be maximally "
+                        "permissive (tmin=0, tmax=inf, modes=all), otherwise soundness "
+                        "is not guaranteed. Note that all nodes in the input TFPG are "
+                        "preserved in the output TFPG."
+                        "'focus': All nodes and respective incoming edges from which the "
+                        "nodes specified with '--focus-nodes' cannot be reached are "
+                        "dropped from the TFPG.")
+
+    parser.add_argument("--focus-nodes",
+                        dest="focus_nodes",
+                        action="store",
+                        default=None,
+                        help="When selecting filter action 'focus', this option "
+                        "is used to indicate the focus nodes to consider. "
+                        "Specify as colon-separated list of node names.")
+
+    parser.add_argument("--outdir", "-O",
+                        dest="outdir",
+                        default="out",
+                        metavar="PATH",
+                        help="Output directory, where all generated file should be "
+                        "put into (default: %(default)s)")
+
+    # TODO add option to script and backend to filter also generated nodes; disabled by default.
+
+    p_args = parser.parse_args()
+
+    if p_args.tfpg is None:
+        parser.error("The TFPG file was not specified.")
+
+    if not os.path.exists(p_args.tfpg):
+        parser.error("The specified TFPG file does not exist.")
+
+    if p_args.filter_action is None:
+        parser.error("Need to specify a filter action.")
+
+    if p_args.filter_action == "focus" and p_args.focus_nodes is None:
+        parser.error("For 'focus' filtering, need to specify focus nodes.")
+
+    if os.path.exists(p_args.outdir) and not os.path.isdir(p_args.outdir):
+        parser.error("Not a directory: " + p_args.outdir)
+
+    return p_args
+
+
+if __name__ == "__main__":
+
+    # set up paths
+    _paths.setup_path()
+
+    # set up logging
+    import xsap.utils.misc.log
+    xsap.utils.misc.log.init()
+
+    # other imports
+    from xsap.data_structure.tfpg.tfpg import Tfpg
+    from xsap.features.tfpg_synthesis.tfpg_synthesizer import TfpgSynthesizer
+
+    # handle arguments
+    args = handle_options()
+
+    if not os.path.exists(args.outdir):
+        os.makedirs(args.outdir)
+
+    # parse the TFPG into internal struct
+    tfpg_struct = Tfpg.parse_tfpg(args.tfpg)
+
+    if tfpg_struct is None:
+        print "Error: Failure during TFPG parsing."
+        sys.exit(1)
+
+    # Filter Type: FOCUS
+
+    if args.filter_action == "focus":
+        focus_node_names = [n.strip() for n in args.focus_nodes.split(':')]
+        tfpg_nodes = tfpg_struct.get_nodes_list()
+        tfpg_node_names = [n.get_name() for n in tfpg_nodes]
+
+        for name in focus_node_names:
+            if name not in tfpg_node_names:
+                print "Error: '%s' is not a valid TFPG node name." % name
+                sys.exit(1)
+
+        print
+        print "TFPG Filtering> computing reachability set"
+        focus_reachable_set = tfpg_struct.compute_reachable_from_set(focus_node_names)
+
+        # drop all nodes (and respective edges) that are not in focus_reachable_set
+        print "TFPG Filtering> removing nodes from which focus nodes cannot be reached"
+        for name in tfpg_node_names:
+            if name not in focus_reachable_set:
+                tfpg_struct.remove_node(name)
+
+        # write new TFPG to XML file "TFPG_NAME_focused.txml"
+        print "TFPG Filtering> dumping result"
+        filtered_tfpg_file_name = os.path.splitext(os.path.basename(args.tfpg))[0] + "_focused.txml"
+        tfpg_struct.dump_to_xml(os.path.join(args.outdir, filtered_tfpg_file_name))
+
+        res_msg = "The filtered TPFG file has been saved at '%s'" % os.path.join(args.outdir, filtered_tfpg_file_name)
+
+        print
+        print '-' * len(res_msg)
+        print res_msg
+        print '-' * len(res_msg)
+
+    # Filter Type: SIMPLIFY
+
+    else:
+
+        if tfpg_struct.has_non_maximally_permissive_edges():
+            print "Error: TFPG has some edges that are not maximally permissive; cannot perform simplification."
+            sys.exit(1)
+
+        system_modes = tfpg_struct.get_modes_list()
+        failure_modes = [n.get_name() for n in tfpg_struct.get_fm_nodes()]
+        failure_modes_renamed = []
+        discrepancies = [n.get_name() for n in tfpg_struct.get_or_nodes() + tfpg_struct.get_and_nodes()]
+        discrepancies_renamed = []
+
+        minimal_cutsets = {}
+
+        # create node name map where generated node names are replaced, since
+        # these are reserved node names for the synthesizer.
+        map_to_new = {}
+        map_to_old = {}
+
+        for fm_orig in failure_modes:
+            if TfpgSynthesizer.is_generated_node_name(fm_orig):
+                map_to_new[fm_orig] = \
+                    TfpgSynthesizer.generate_random_id(failure_modes + discrepancies)
+            else:
+                map_to_new[fm_orig] = fm_orig
+            map_to_old[map_to_new[fm_orig]] = fm_orig
+            failure_modes_renamed.append(map_to_new[fm_orig])
+
+        for d_orig in discrepancies:
+            if TfpgSynthesizer.is_generated_node_name(d_orig):
+                map_to_new[d_orig] = \
+                    TfpgSynthesizer.generate_random_id(failure_modes + discrepancies)
+            else:
+                map_to_new[d_orig] = d_orig
+            map_to_old[map_to_new[d_orig]] = d_orig
+            discrepancies_renamed.append(map_to_new[d_orig])
+
+        assert len(failure_modes) == len(failure_modes_renamed)
+        assert len(discrepancies) == len(discrepancies_renamed)
+
+        # for all FM nodes: empty set is the only mcs.
+        for fm in tfpg_struct.get_fm_nodes():
+            minimal_cutsets[map_to_new[fm.get_name()]] = [[]]
+
+        # for all AND nodes: only one mcs is given, ie the set of predecessors.
+        for n in tfpg_struct.get_and_nodes():
+            n_predecessors = tfpg_struct.get_predecessors(n)
+            minimal_cutsets[map_to_new[n.get_name()]] = \
+                [[map_to_new[pred.get_name()] for pred in n_predecessors]]
+
+        # for all OR nodes: set of mcs are predecessors as singleton sets.
+        for n in tfpg_struct.get_or_nodes():
+            n_predecessors = tfpg_struct.get_predecessors(n)
+            minimal_cutsets[map_to_new[n.get_name()]] = \
+                [[map_to_new[pred.get_name()]] for pred in n_predecessors]
+
+        # call simplification routines from synthesis package
+        discrepancy_tuples = [(n, "not_monitored") for n in discrepancies_renamed]
+        tfpg_synthesizer = TfpgSynthesizer(system_modes, failure_modes_renamed, discrepancy_tuples,
+                                           minimal_cutsets)
+
+        # write new TFPG to XML file "TFPG_NAME_focused.txml"
+        tfpg_file_name = os.path.splitext(os.path.basename(args.tfpg))[0]
+        out_tfpg_fname = os.path.join(args.outdir, tfpg_file_name + '_simplified.txml')
+
+        res = tfpg_synthesizer.synthesize_tfpg(out_tfpg_fname, tfpg_struct.get_name(), True)
+
+        if res != "ok":
+            print "Error: An error has occurred during simplification (%s)." % res
+            sys.exit(1)
+
+        # translate back generated node names that have been modified
+        if set(failure_modes) != set(failure_modes_renamed) or \
+           set(discrepancies) != set(discrepancies_renamed):
+
+            tfpg_struct = Tfpg.parse_tfpg(out_tfpg_fname)
+            assert tfpg_struct is not None
+
+            for n_name in failure_modes_renamed:
+                if n_name not in failure_modes:
+                    tfpg_node = tfpg_struct.get_node_by_name(n_name)
+                    tfpg_node.set_name(map_to_old[tfpg_node.get_name()])
+
+            for n_name in discrepancies_renamed:
+                if n_name not in discrepancies:
+                    tfpg_node = tfpg_struct.get_node_by_name(n_name)
+                    tfpg_node.set_name(map_to_old[tfpg_node.get_name()])
+
+            tfpg_struct.dump_to_xml(out_tfpg_fname)
+
+        res_msg = "Simplified TFPG has been generated at %s." % out_tfpg_fname
+
+        print "-" * len(res_msg)
+        print res_msg
+        print "-" * len(res_msg)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/minimize_observables.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/minimize_observables.py
new file mode 100644
index 0000000000000000000000000000000000000000..fb7ed50be811909ec16d913b72e54bdbcc1af20c
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/minimize_observables.py
@@ -0,0 +1,175 @@
+
+import sys
+import os
+import re
+import subprocess
+
+import _paths
+
+
+def handle_options():
+    """Returns options values as map."""
+
+    import argparse
+    parser = argparse.ArgumentParser(description="")
+
+    parser.add_argument("--engine", "-E",
+                        dest="engine",
+                        choices=["bmc", "bmc_ic3"],
+                        default="bmc",
+                        help="Use given engine (default: %(default)s)")
+
+    parser.add_argument("--bmc-length", "-k",
+                        dest="bmc_len",
+                        action="store",
+                        type=int,
+                        default=10,
+                        help="Maximum path length for BMC")
+
+    parser.add_argument("--smv-file", "-m",
+                        dest="smv",
+                        action="store",
+                        default=None,
+                        help="SMV file")
+
+    parser.add_argument("--diagnosis-condition", "-c",
+                        dest="diag_cond",
+                        action="store",
+                        default=None,
+                        help="Diagnosis condition")
+
+    parser.add_argument("--alarm-pattern", "-a",
+                        dest="alarm_pattern",
+                        choices=['exact', 'bounded', 'finite'],
+                        default=None,
+                        help="Alarm pattern (default: %(default)s)")
+
+    parser.add_argument("--delay-bound", "-d",
+                        dest="delay_bound",
+                        action="store",
+                        type=int,
+                        default=None,
+                        help="Alarm pattern delay bound")
+
+    parser.add_argument("--context-expression", "-x",
+                        dest="ltl_context",
+                        action="store",
+                        default=None,
+                        help="LTL context expression")
+
+    parser.add_argument("--observables-file", "-o",
+                        dest="obs_file",
+                        action="store",
+                        default=None,
+                        help="File specifying observable variables")
+
+    parser.add_argument("--asl-file", "-f",
+                        dest="asl_file",
+                        action="store",
+                        default=None,
+                        help="File containing the alarms specification")
+
+    parser.add_argument("--verbosity-level", "-v",
+                        dest="verbose_level",
+                        action="store",
+                        type=int,
+                        default=0,
+                        help="Sets the output verbosity level")
+
+    parser.add_argument("--no-stdout-print",
+                        dest="no_print_stdout",
+                        action="store_true",
+                        default=False,
+                        help="Result is not printed to stdout.")
+
+    args = parser.parse_args()
+
+    # check arguments
+
+    if args.smv is None or not os.path.exists(args.smv):
+        parser.error("The SMV model was not specified.")
+
+    if args.bmc_len < 0:
+        parser.error("Illegal BMC length.")
+
+    if args.obs_file is None or not os.path.exists(args.obs_file):
+        parser.error("The observables file was not specified.")
+
+    if args.asl_file is None:
+        if args.diag_cond is None:
+            parser.error("The diagnosis condition was not specified.")
+
+        if args.alarm_pattern is None:
+            parser.error("The alarm pattern was not chosen.")
+
+        if args.alarm_pattern in ['exact', 'bounded'] and args.delay_bound is None:
+            parser.error("For the chosen alarm pattern a delay bound needs to be specified.")
+
+        if args.alarm_pattern in ['finite'] and args.delay_bound is not None:
+            parser.error("A delay bound cannot be specified for finite-delay.")
+
+        if args.delay_bound is not None and int(args.delay_bound) < 0:
+            parser.error("Illegal delay bound.")
+    else:
+        if not os.path.exists(args.asl_file):
+            parser.error("The ASL file does not exist")
+        if args.diag_cond is not None:
+            parser.error("Cannot specify both a diagnosis condition and an ASL file")
+
+    return args
+
+
+if __name__ == "__main__":
+
+    _paths.setup_path()
+
+    # setup logging
+    import xsap.utils.misc.log
+    xsap.utils.misc.log.init()
+    args = handle_options()
+
+    from xsap.utils.options import MC_ENGINE_MSAT_BMC
+    from xsap.utils.processes.xsap_process import XsapProcess
+
+    need_msat = XsapProcess.has_infinite_domain_vars(args.smv) or MC_ENGINE_MSAT_BMC == args.engine
+
+    xsap_process = XsapProcess(args.smv, fail_obs_alm_fname=None,
+                               ord_fname=None, need_msat=need_msat,
+                               args=["-v", str(args.verbose_level)],
+                               stdout=subprocess.PIPE, stderr=subprocess.STDOUT, dumpers=[])
+
+    xsap_process.send_cmd("set bmc_length %d" % args.bmc_len)
+
+    delay_bound = -1 if args.delay_bound is None else int(args.delay_bound)
+
+    (res, res_filename) = xsap_process.optimize_observables_ASL(args.diag_cond,
+        args.alarm_pattern, delay_bound, args.ltl_context, args.obs_file,
+        args.asl_file, args.engine, args.no_print_stdout)
+
+    xsap_process.kill_and_close_streams()
+
+    if "Error" == res:
+        print "--------------------------------------------------"
+        print "Result: An error has occurred during the analysis."
+        print "--------------------------------------------------"
+
+    elif "AllDiag" == res:
+        print "---------------------------------------------------"
+        print "Result: The specification is vacuously diagnosable."
+        print "---------------------------------------------------"
+
+    elif "NotDiag" == res:
+        print "------------------------------------------------------------------"
+        print "Result: The specification is not diagnosable with all observables."
+        print "------------------------------------------------------------------"
+
+    elif "OK" == res:
+        num_dashes = max(len("Result: Minimal sets of observables have been computed"),
+                         len(res_filename))
+        print "-" * num_dashes
+        print "Result: Minimal sets of observables have been computed"
+        print "        and stored in file '%s'." % res_filename
+        print "-" * num_dashes
+
+    else:
+        assert False, "BUG: unexpected result of diagnosability verification."
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/stats_tfpg.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/stats_tfpg.py
new file mode 100644
index 0000000000000000000000000000000000000000..f918b87668cc38574ed3291834c3f5d5f90e96dd
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/stats_tfpg.py
@@ -0,0 +1,52 @@
+import argparse
+import sys
+
+import _paths
+_paths.setup_path()
+
+from xsap.features.tfpg_smt.reasoner import TFPGReasoner
+from xsap.data_structure.tfpg.tfpg import OPEN_INFINITY
+from xsap.data_structure.tfpg.tfpg import Tfpg
+
+def main():
+    parser = argparse.ArgumentParser(description="Statistics information on TFPG")
+    parser.add_argument('inputTFPG', metavar='inputTFPG',
+                        type=str,
+                        help='The TFPG model to use')
+    parser.add_argument('--syntax-only', '-s',
+                        action='store_true',
+                        help='Perform only syntactical analysis')
+    options = parser.parse_args()
+
+    # Command line handling
+    tfpg = Tfpg.parse_tfpg(options.inputTFPG)
+    if tfpg is None:
+        sys.exit(1)
+
+    if not options.syntax_only:
+
+        # Coherce the semantics to open-infinity.
+        # The type of analysis here is not influenced by this.
+        tfpg.set_infinity_semantics(OPEN_INFINITY)
+        reasoner = TFPGReasoner(tfpg, include_health=False)
+        inactive = reasoner.check_activability()
+
+    print("All Nodes: %d" % len(tfpg.get_nodes_list()))
+    print("FM Nodes: %d" % len(tfpg.get_fm_nodes()))
+    print("AND Nodes: %d" % len(tfpg.get_and_nodes()))
+    print("OR Nodes: %d" % len(tfpg.get_or_nodes()))
+    print("")
+    print("Monitored Nodes: %d" % len(tfpg.get_monitored_discrepancies()))
+    print("Unmonitored Nodes: %d" % len(tfpg.get_unmonitored_discrepancies()))
+    print("")
+    print("Edges: %d" % len(tfpg.get_edges_list()))
+    print("")
+    print("Modes: %d" % len(tfpg.get_modes_list()))
+
+    if not options.syntax_only:
+        print("Activable Nodes: %d" % (len(tfpg.get_nodes_list()) - len(inactive)))
+        print("Inactivable Nodes: %d" % len(inactive))
+        print("")
+
+if __name__ == "__main__":
+    main()
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/synthesize_fd.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/synthesize_fd.py
new file mode 100644
index 0000000000000000000000000000000000000000..128bc82a56d385fbc5cfc289c162f3d453339b06
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/synthesize_fd.py
@@ -0,0 +1,113 @@
+import sys
+import os
+import re
+import subprocess
+
+import _paths
+
+
+def handle_options():
+    """Returns options values as map."""
+
+    import argparse
+    parser = argparse.ArgumentParser(description="")
+
+    parser.add_argument("--smv-file", "-m",
+                        dest="smv",
+                        action="store",
+                        default=None,
+                        help="SMV file")
+
+    parser.add_argument("--observables-file", "-o",
+                        dest="obs_file",
+                        action="store",
+                        default=None,
+                        help="File specifying observable variables")
+
+    parser.add_argument("--asl-file", "-f",
+                        dest="asl_file",
+                        action="store",
+                        default=None,
+                        help="File specifying alarm specification")
+
+    parser.add_argument("--stand-alone",
+                        dest="dump_fd_only",
+                        action="store_true",
+                        default=False,
+                        help="Output only the FD " +\
+                        "(By default outputs the combination of FD and plant)")
+
+    parser.add_argument("--out-file",
+                        dest="target_smv",
+                        action="store",
+                        default=None,
+                        help="Where to write the synthesized model")
+
+    parser.add_argument("--verbosity-level", "-v",
+                        dest="verbose_level",
+                        action="store",
+                        type=int,
+                        default=0,
+                        help="Sets the output verbosity level")
+
+    parser.add_argument("--composition-semantics",
+                        dest="composition_semantics",
+                        action="store",
+                        default="s",
+                        help="Specify composition semantics:" +\
+                        "(s)ynchronous or (a)synchronous")
+
+    parser.add_argument("--no-dag",
+                        dest="no_dag",
+                        action="store_true",
+                        default=False,
+                        help="Do not use the DAG printing of the transition relation" +\
+                        "(This should be used only on small FD)")
+
+    args = parser.parse_args()
+
+    # check arguments
+
+    if args.smv is None or not os.path.exists(args.smv):
+        parser.error("The SMV model was not specified.")
+
+    if args.obs_file is None or not os.path.exists(args.obs_file):
+        parser.error("The observables file was not specified.")
+
+    if args.asl_file is None or not os.path.exists(args.obs_file):
+        parser.error("The alarm specification file was not specified of does not exist.")
+
+    if args.target_smv is None:
+        parser.error("The output file was not specified.")
+
+    return args
+
+if __name__ == "__main__":
+    _paths.setup_path()
+
+    # setup logging
+    import xsap.utils.misc.log
+    xsap.utils.misc.log.init()
+    args = handle_options()
+
+    from xsap.utils.processes.xsap_process import XsapProcess
+    xsap_process = XsapProcess(args.smv,
+                               fail_obs_alm_fname=None,
+                               ord_fname=None,
+                               need_msat=False,
+                               stdout=subprocess.PIPE,
+                               stderr=subprocess.STDOUT,
+                               dumpers=[],
+                               verbose_level=args.verbose_level)
+    res = xsap_process.synthesize_FD(args.asl_file, args.obs_file,
+                                     args.target_smv, not args.dump_fd_only,
+                                     args.composition_semantics,
+                                     args.no_dag)
+    xsap_process.kill_and_close_streams()
+
+    if res:
+        print("FD correctly synthesized")
+    else:
+        print("Error while synthesizing the FD")
+
+    exit(0)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/synthesize_tfpg.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/synthesize_tfpg.py
new file mode 100644
index 0000000000000000000000000000000000000000..29b16e135e73fdafbcc8af859005e5844df74472
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/synthesize_tfpg.py
@@ -0,0 +1,196 @@
+
+## Input
+## - Associations file -> in SMV
+## - SMV model
+## - (optional) BMC bound
+
+
+import sys
+import os
+import _paths
+
+
+def handle_options():
+    """Returns options values as map."""
+
+    from xsap.utils.options import FT_ENGINES, FT_ENGINE_BMC
+
+    import argparse
+    parser = argparse.ArgumentParser(description="")
+
+    parser.add_argument("--associations-file", "-a",
+                        dest="assoc",
+                        action="store",
+                        default=None,
+                        help="TFPG SMV associations file")
+
+    parser.add_argument("--smv-file", "-m",
+                        dest="smv",
+                        action="store",
+                        default=None,
+                        help="SMV File")
+
+    parser.add_argument("--output-tfpg", "-o",
+                        dest="out_tfpg_fname",
+                        action="store",
+                        default=None,
+                        help="Name of the synthesized TFPG")
+
+    parser.add_argument("--engine", "-E",
+                        dest="engine",
+                        choices=FT_ENGINES,
+                        default=FT_ENGINE_BMC,
+                        help="Use given engine (default: %(default)s)")
+
+    parser.add_argument("--force-boolean-ic3", "-B",
+                        dest="boolic3",
+                        action="store_true",
+                        default=False,
+                        help="Force use of Boolean version of IC3 engine (for finite-state models)")
+
+    parser.add_argument("--bmc-length", "-k",
+                        dest="bmc_len",
+                        action="store",
+                        type=int,
+                        default=10,
+                        help="Maximum path length for BMC")
+
+    parser.add_argument("--dynamic", "-D",
+                        dest="dynamic_reorder",
+                        action="store_true",
+                        default=False,
+                        help="Enables dynamic reordering of variables")
+
+    parser.add_argument("--boolean-conversion-uses-predicate-normalization", "-b",
+                        dest="boolean_conversion",
+                        action="store_true",
+                        default=False,
+                        help="Enables predicate normalization during boolean conversion")
+
+    parser.add_argument("--disable-coi-reduction", "-c",
+                        dest="no_coi_reduction",
+                        action="store_true",
+                        default=False,
+                        help="Disables TFPG graph simplification based on cone-of-influence")
+
+    parser.add_argument("--prune-unreachable-nodes",
+                        dest="prune_unreachable_nodes",
+                        action="store_true",
+                        default=False,
+                        help="Enables a preprocessing step that removes "
+                             "unreachable nodes before synthesis is started.")
+
+    parser.add_argument("--verbosity-level", "-v",
+                        dest="verbose_level",
+                        action="store",
+                        type=int,
+                        default=0,
+                        help="Sets the output verbosity level")
+
+    parser.add_argument("--outdir", "-O",
+                        dest="outdir",
+                        default="out",
+                        metavar="PATH",
+                        help="Output directory, where all generated file should be "
+                        "put into (default: %(default)s)")
+
+    args = parser.parse_args()
+
+    if args.assoc is None or not os.path.exists(args.assoc):
+        parser.error("The TFPG SMV associations file was not specified.")
+
+    if args.smv is None or not os.path.exists(args.smv):
+        parser.error("The SMV model was not specified.")
+
+    if args.boolic3 and not args.engine == xsap.utils.options.FT_ENGINE_PARAM:
+        parser.error("Option '--force-boolean-ic3' requires IC3 engine.")
+
+    if os.path.exists(args.outdir) and not os.path.isdir(args.outdir):
+        parser.error("Not a directory: " + args.outdir)
+
+    if args.bmc_len < 0:
+        parser.error("BMC length cannot be negative.")
+
+    return args
+
+
+
+if __name__ == "__main__":
+
+    _paths.setup_path()
+    # setup logging
+    import xsap.utils.misc.log
+    xsap.utils.misc.log.init()
+    args = handle_options()
+
+    assoc_fname = args.assoc                # The name of the tfpg SMV associations file
+    smv_fname   = args.smv                   # The name of the SMV model
+    bmc_length  = args.bmc_len               # Maximum path length for BMC
+    engine      = args.engine
+    boolic3     = args.boolic3
+    prune_unreachable_nodes = args.prune_unreachable_nodes
+
+    # create directory for generated files
+    outdir = args.outdir
+    if not os.path.exists(outdir):
+        os.makedirs(outdir)
+
+    if args.out_tfpg_fname is not None:     # The name of the output tfpg
+        out_tfpg_fname = args.out_tfpg_fname
+    else:
+        out_tfpg_fname = os.path.join(outdir, os.path.splitext(os.path.basename(smv_fname))[0] + "_synth_tfpg.txml")
+
+    disable_coi = args.no_coi_reduction
+
+    # xsap options
+    xsap_dynamic_reorder    = args.dynamic_reorder
+    xsap_boolean_conversion = args.boolean_conversion
+    xsap_verbose_level      = args.verbose_level
+
+    assert assoc_fname is not None
+    assert smv_fname is not None
+
+    from xsap.data_structure.tfpg.tfpg_associations import TfpgAssociations
+    from xsap.data_structure.tfpg.tfpg_errors import UnreachableDiscrepancy
+    from xsap.data_structure.tfpg.xml.tfpg import parse_tfpg_xml_file_to_internal_struct
+    from xsap.features.tfpg_synthesis.synthesis import perform_tfpg_synthesis
+
+    # parse associations file
+
+    associations = TfpgAssociations.parse_assoc(assoc_fname)
+    if associations is None:
+        print "Error! Invalid TFPG associations file"
+        sys.exit(1)
+
+    num_failure_modes = len(associations.get_var_names_of_failure_modes())
+    num_discrepancies = len(associations.get_var_names_of_unmonitored_discr()) + len(associations.get_var_names_of_monitored_discr())
+    num_modes = len(associations.get_var_names_of_tfpg_modes())
+
+    if num_discrepancies is 0 or num_failure_modes is 0 or num_modes is 0:
+        print "Error! Associations file must contain at least a failure mode, a discrepancy and a system mode"
+        sys.exit(1)
+
+    # perform tfpg synthesis
+
+    res = perform_tfpg_synthesis(associations, smv_fname, out_tfpg_fname, bmc_length, engine, disable_coi,
+                                 xsap_dynamic_reorder, xsap_boolean_conversion,
+                                 xsap_verbose_level, boolic3, outdir,
+                                 enable_node_pruning=prune_unreachable_nodes)
+
+    if res == "ok":
+        print "  tfpg file:", out_tfpg_fname
+        tfpg, errors = parse_tfpg_xml_file_to_internal_struct(out_tfpg_fname)
+        if len(tfpg.get_errors_list()) > 0:
+            print "The synthesized TFPG contains some errors!"
+            for err in tfpg.get_errors_list():
+                if isinstance(err, UnreachableDiscrepancy):
+                    print " ",err
+                else:
+                    print " ",err
+                    raise err
+        if len(errors) > 0:
+            for err in errors:
+                raise err
+    else:
+        # Print the error message
+        print "tfpg synthesis > %s" %res
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/tighten_tfpg.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/tighten_tfpg.py
new file mode 100644
index 0000000000000000000000000000000000000000..b194ed5943f400cb2de739ae7e5887c71f723756
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/tighten_tfpg.py
@@ -0,0 +1,211 @@
+
+## Input:
+## - Tfpg file (in XML)
+## - Associations file -> in SMV
+## - SMV model
+## - (optional) BMC bound
+
+
+import os
+import sys
+
+import _paths
+
+
+def handle_options():
+    """Returns options values as map."""
+
+    import argparse
+    parser = argparse.ArgumentParser(description="")
+
+    parser.add_argument("--tfpg-file", "-t",
+                        dest="tfpg",
+                        action="store",
+                        default=None,
+                        help="The TFPG file (can be in XML or human readable format)")
+
+    parser.add_argument("--associations-file", "-a",
+                        dest="assoc",
+                        action="store",
+                        default=None,
+                        help="TFPG SMV associations file")
+
+    parser.add_argument("--smv-file", "-m",
+                        dest="smv",
+                        action="store",
+                        default=None,
+                        help="SMV File")
+
+    parser.add_argument("--tags", "-T",
+                        dest="tags",
+                        action="store",
+                        default="tmin;tmax;modes",
+                        help="Parameters to be tightened (tmin/tmax/modes; semi-colon separated)")
+
+    parser.add_argument("--delta-t-var", "-d",
+                        dest="delta_t_var",
+                        action="store",
+                        default=None,
+                        help="delta t variable name")
+
+    parser.add_argument("--engine", "-E",
+                        dest="engine",
+                        choices=['conc', 'ia'],
+                        default='conc',
+                        help="IC3 mode (default: %(default)s)")
+
+    parser.add_argument("--tmax-bound",
+                        dest="tmax_bound",
+                        action="store",
+                        type=int,
+                        default=None,
+                        help="Upper bound for tmax (for tightening of tmax=infinity).")
+
+    parser.add_argument("--bmc-length", "-k",
+                        dest="bmc_len",
+                        action="store",
+                        type=int,
+                        default=10,
+                        help="Maximum path length for BMC")
+
+    parser.add_argument("--skip-bmc",
+                        dest="skip_bmc",
+                        action="store_true",
+                        default=False,
+                        help="Use only IC3 instead of mixed BMC-IC3")
+
+    parser.add_argument("--ic3-length", "-K",
+                        dest="ic3_len",
+                        action="store",
+                        type=int,
+                        default=None,
+                        help="Maximum number of frames for IC3")
+
+    parser.add_argument("--outdir", "-O",
+                        dest="outdir",
+                        default="out",
+                        metavar="PATH",
+                        help="Output directory, where all generated file should be "
+                        "put into (default: %(default)s)")
+
+    args = parser.parse_args()
+
+    if args.tfpg is None or not os.path.exists(args.tfpg):
+        parser.error("The TFPG file was not specified.")
+
+    if args.assoc is None or not os.path.exists(args.assoc):
+        parser.error("The TFPG SMV associations file was not specified.")
+
+    if args.smv is None or not os.path.exists(args.smv):
+        parser.error("The SMV model was not specified.")
+
+    if os.path.exists(args.outdir) and not os.path.isdir(args.outdir):
+        parser.error("Not a directory: " + args.outdir)
+
+    chosen_tags = args.tags.split(';')
+
+    for tag in chosen_tags:
+        if tag not in ('tmin', 'tmax', 'modes'):
+            parser.error("Invalid tag string (%s)." % args.tags)
+
+    if len(chosen_tags) is 0:
+        parser.error("At least one tag must be chosen.")
+
+    if args.bmc_len < 1:
+        parser.error("'bmc_len' must be a positive integer.")
+
+    assert args.engine in ('conc', 'ia')
+
+    return args
+
+
+if __name__ == "__main__":
+
+    # paths and logging set up
+
+    _paths.setup_path()
+
+    import xsap.utils.misc.log
+    xsap.utils.misc.log.init()
+
+    # parse arguments
+
+    cmd_args = handle_options()
+
+    tfpg_fname = cmd_args.tfpg              # The name of the tfpg model (XML format)
+    assoc_fname = cmd_args.assoc            # The name of the tfpg SMV associations file
+    smv_fname = cmd_args.smv                # The name of the SMV model
+
+    tmax_bound = cmd_args.tmax_bound        # Upper search bound for tmax values
+    delta_t_var = cmd_args.delta_t_var      # delta t variable name
+    chosen_tags = cmd_args.tags.split(';')  # parameters to be tightened
+
+    bmc_len = cmd_args.bmc_len              # Maximum path length for BMC
+    skip_bmc = cmd_args.skip_bmc            # Flag to skip BMC in engine
+    ic3_len = cmd_args.ic3_len              # Maximum path length for IC3
+    engine = cmd_args.engine                # IC3 mode (conc / ia)
+
+    outdir = cmd_args.outdir
+    if not os.path.exists(cmd_args.outdir):
+        os.makedirs(cmd_args.outdir)
+
+    assert tfpg_fname is not None
+    assert assoc_fname is not None
+    assert smv_fname is not None
+
+    # perform tightening
+
+    print
+    print "TFPG Tightening"
+    print
+
+    tags = []
+
+    if delta_t_var is None:
+
+        if 'modes' not in chosen_tags:
+            print '--------------------------------------------------------------'
+            print 'Message: Nothing to be tightened (time delta variable not set,'
+            print '         selected tags do not contain "modes" tag).'
+            print '--------------------------------------------------------------'
+            sys.exit(0)
+
+        for tag in chosen_tags:
+            if tag != 'modes':
+                print "  > skipping tightening of parameter '%s'" % tag
+
+        tags = ['modes']
+
+    else:
+        tags = chosen_tags
+
+    options = {"tags": tags, "bmc_len": bmc_len, "ic3_len": ic3_len, "t_delta_var": delta_t_var,
+               "tmax_bound": tmax_bound, "engine": engine, "skip_bmc": skip_bmc, "outdir": outdir}
+
+    from xsap.features.tfpg_tightening.tightening import perform_edge_tightening
+    fn_tfpg_tight, err_msg = perform_edge_tightening(smv_fname, assoc_fname, tfpg_fname, options)
+
+    # present results
+
+    print
+
+    if err_msg is None:
+
+        gen_res_string = 'Result: The TFPG has been tightened.'
+        res_string = "Output file: " + fn_tfpg_tight
+
+        print '-' * max(len(gen_res_string), len(res_string))
+        print gen_res_string
+        print res_string
+        print '-' * max(len(gen_res_string), len(res_string))
+
+    else:
+
+        gen_res_string = "Result: An error has occurred during the analysis."
+
+        print '-' * max(len(gen_res_string), len(err_msg)+len('Message: '))
+        print gen_res_string
+        print 'Message:', err_msg
+        print '-' * max(len(gen_res_string), len(err_msg)+len('Message: '))
+
+    print
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/validate_tfpg_behavior.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/validate_tfpg_behavior.py
new file mode 100644
index 0000000000000000000000000000000000000000..93d045418c07d315f4a2689db26794c781414e14
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/validate_tfpg_behavior.py
@@ -0,0 +1,267 @@
+
+## Input:
+## - Tfpg file (in XML)
+## - Associations file -> in SMV
+## - SMV model
+## - (optional) BMC bound
+
+
+import sys
+import os
+import _paths
+
+
+def handle_options():
+    """Returns options values as map."""
+
+    from xsap.utils.options import MC_ENGINE_MSAT_BMC, MC_ENGINE_IC3
+
+    import argparse
+    parser = argparse.ArgumentParser(description="")
+
+    parser.add_argument("--tfpg-file", "-t",
+                        dest="tfpg",
+                        action="store",
+                        default=None,
+                        help="The TFPG file (can be in XML or human readable format)")
+
+    parser.add_argument("--associations-file", "-a",
+                        dest="assoc",
+                        action="store",
+                        default=None,
+                        help="TFPG SMV associations file")
+
+    parser.add_argument("--smv-file", "-m",
+                        dest="smv",
+                        action="store",
+                        default=None,
+                        help="SMV File")
+
+    parser.add_argument("--boolean-conversion-uses-predicate-normalization", "-b",
+                        dest="boolean_conversion",
+                        action="store_true",
+                        default=False,
+                        help="Enables predicate normalization during boolean conversion")
+
+    parser.add_argument("--dynamic-reordering", "-D",
+                        dest="dynamic_reorder",
+                        action="store_true",
+                        default=False,
+                        help="Enables dynamic reordering of BDD variables")
+
+    parser.add_argument("--delta-t-var", "-d",
+                        dest="delta_t_var",
+                        action="store",
+                        default=None,
+                        help="delta t variable name")
+
+    parser.add_argument("--bmc-length", "-k",
+                        dest="bmc_len",
+                        action="store",
+                        type=int,
+                        default=10,
+                        help="Maximum path length for BMC")
+
+    parser.add_argument("--engine", "-E",
+                        dest="engine",
+                        choices=[MC_ENGINE_MSAT_BMC, MC_ENGINE_IC3],
+                        default=MC_ENGINE_MSAT_BMC,
+                        help="Use given engine (default: %(default)s)")
+
+    parser.add_argument("--property-to-validate", "-p",
+                        dest="property_to_validate",
+                        choices=['completeness', 'edge_tightness'],
+                        default='completeness',
+                        help="Validate given property (default: %(default)s)")
+
+    parser.add_argument("--monolithic-check", "-M",
+                        dest="monolithic_check",
+                        action="store_true",
+                        default=False,
+                        help="Check completeness proof obligations using a single monolithic check")
+
+    parser.add_argument("--generate-only", "-g",
+                        dest="generate_only",
+                        action="store_true",
+                        default=False,
+                        help="Only generate files for model checking")
+
+    parser.add_argument("--parametric-dump", "-P",
+                        dest="parametric_dump",
+                        action="store_true",
+                        default=False,
+                        help="Dump parameterized completeness property")
+
+    parser.add_argument("--outdir", "-O",
+                        dest="outdir",
+                        default="out",
+                        metavar="PATH",
+                        help="Output directory, where all generated file should be "
+                        "put into (default: %(default)s)")
+
+    args = parser.parse_args()
+
+    if args.tfpg is None or not os.path.exists(args.tfpg):
+        parser.error("The TFPG file was not specified.")
+        pass
+
+    if args.assoc is None or not os.path.exists(args.assoc):
+        parser.error("The TFPG SMV associations file was not specified.")
+        pass
+
+    if args.smv is None or not os.path.exists(args.smv):
+        parser.error("The SMV model was not specified.")
+        pass
+
+    if args.parametric_dump and args.property_to_validate != 'completeness':
+        parser.error("Parametric dumping only possible for completeness check.")
+        pass
+
+    if args.parametric_dump and not args.generate_only:
+        parser.error("Parametric dumping only possible in generate-only mode.")
+        pass
+
+    if os.path.exists(args.outdir) and not os.path.isdir(args.outdir):
+        parser.error("Not a directory: " + args.outdir)
+
+    return args
+
+
+if __name__ == "__main__":
+
+    # set up paths
+    _paths.setup_path()
+
+    # set up logging
+    import xsap.utils.misc.log
+    xsap.utils.misc.log.init()
+
+    # parse arguments
+    args = handle_options()
+
+    tfpg_fname = args.tfpg                       # The name of the tfpg model (XML format)
+    assoc_fname = args.assoc                     # The name of the tfpg SMV associations file
+    smv_fname = args.smv                         # The name of the SMV model
+    bmc_length = args.bmc_len                    # Maximum path length for BMC
+    engine = args.engine                         # Model checking engine
+    delta_t_var = args.delta_t_var               # delta t variable name
+    boolean_conversion = args.boolean_conversion # predicate normalization
+    dynamic_reorder    = args.dynamic_reorder    # BDD dynamic reordering
+    property_to_validate = args.property_to_validate # property to validate (completeness or edge_tightness)
+    monolithic_check = args.monolithic_check     # completeness po's as single monolithic check
+    generate_only = args.generate_only           # don't solve mc problems
+    parametric_dump = args.parametric_dump       # dump parameterized model and proof obligations
+
+    assert tfpg_fname is not None
+    assert assoc_fname is not None
+    assert smv_fname is not None
+
+    # create directory for generated files
+    outdir = args.outdir
+    if not os.path.exists(outdir):
+        os.makedirs(outdir)
+
+    # parse the TFPG into internal struct
+    tfpg_file_ext = os.path.splitext(tfpg_fname)[1]
+    tfpg = None
+
+    if tfpg_file_ext in [".txml", ".xml"]:
+        from xsap.data_structure.tfpg.xml.tfpg import parse_tfpg_xml_file_to_internal_struct
+        tfpg, errors = parse_tfpg_xml_file_to_internal_struct(tfpg_fname)
+    elif tfpg_file_ext == ".tfpg":
+        from xsap.data_structure.tfpg.txt.tfpg import parse_tfpg_txt_file_to_internal_struct
+        tfpg = parse_tfpg_txt_file_to_internal_struct(tfpg_fname)
+    else:
+        print "Error! Unknown format for the TFPG file: %s." %tfpg_file_ext
+        sys.exit(1)
+
+    if len(tfpg.get_errors_list()) > 0:
+        for err in tfpg.get_errors_list():
+            raise err
+    if len(errors) > 0:
+        for err in errors:
+            raise err
+
+    # parse associations file
+    assoc_file_ext = os.path.splitext(assoc_fname)[1]
+    associations = None
+
+    if assoc_file_ext in [".axml", ".xml"]:
+        from xsap.data_structure.tfpg.xml.tfpg_associations import parse_assoc_xml_file_to_internal_struct
+        associations = parse_assoc_xml_file_to_internal_struct(assoc_fname)
+    elif assoc_file_ext == ".tfpga":
+        from xsap.data_structure.tfpg.txt.tfpg_associations import parse_assoc_txt_file_to_internal_struct
+        associations = parse_assoc_txt_file_to_internal_struct(assoc_fname)
+    else:
+        print "Error! Unknown format for the TFPG associations file: %s." %assoc_file_ext
+        sys.exit(1)
+
+    if (len(associations.get_var_names_of_unmonitored_discr()) == 0 and len(associations.get_var_names_of_monitored_discr()) == 0) or \
+       len(associations.get_var_names_of_failure_modes()) == 0 or \
+       len(associations.get_var_names_of_tfpg_modes()) == 0:
+        print "Error! Associations file must contain at least a failure mode, a discrepancy and a system mode"
+        sys.exit(1)
+
+    # perform behavioral validation
+    from xsap.features.tfpg_behavioral_validation.behavioral_validation import perform_behavioral_validation
+    res = perform_behavioral_validation(property_to_validate, tfpg, associations, smv_fname, bmc_length, delta_t_var, engine, boolean_conversion, dynamic_reorder, monolithic_check, generate_only, parametric_dump, outdir)
+
+    # present results
+
+    print
+
+    if res['result'] == "error":
+        print "--------------------------------------------------"
+        print "Result: An error has occurred during the analysis."
+        print "--------------------------------------------------"
+
+    elif res['result'] == "complete":
+        print "-------------------------------------------------------"
+        print "Result: The TFPG is complete with respect to the model."
+        print "-------------------------------------------------------"
+
+    elif res['result'] == "complete_bounded":
+        print "-------------------------------------------------------------------------------"
+        print "Result: The TFPG is complete with respect to the model (within analysis bound)."
+        print "-------------------------------------------------------------------------------"
+
+    elif res['result'] == "incomplete":
+        assert res['counterexample'] is not None
+        print "-----------------------------------------------------------------------------------------------"
+        print "Result: The TFPG is incomplete with respect to the model. A pair of traces have been generated."
+        for trace in res['counterexample']:
+            print "%s:" % trace,
+            print res['counterexample'][trace]
+        print "-----------------------------------------------------------------------------------------------"
+
+    elif res['result'] == "tight":
+        print "------------------------------------------------------------------"
+
+        if res['tmaxinf_tight'] is None or res['tmaxinf_tight'] == "tight":
+            print "Result: The edges of the TFPG are tight with respect to the model."
+
+        else:
+            assert res['tmaxinf_tight'] == "unknown"
+            print "Result: The edges of the TFPG are tight with respect to the model,"
+            print "        with the exception of some tmax=inf assignments for which"
+            print "        tightness couldn't be proven or disproven."
+
+        print "------------------------------------------------------------------"
+
+    elif res['result'] == "not_tight":
+        print "----------------------------------------------------------------------"
+        print "Result: The edges of the TFPG are not tight with respect to the model."
+        print "----------------------------------------------------------------------"
+
+    elif res['result'] == "not_tight_bounded":
+        print "----------------------------------------------------------------------------------------------"
+        print "Result: The edges of the TFPG are not tight with respect to the model (within analysis bound)."
+        print "----------------------------------------------------------------------------------------------"
+
+    else:
+        message = "Result: %s." % res['result']
+        print len(message) * '-'
+        print message
+        print len(message) * '-'
+
+    print
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/view_ft.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/view_ft.py
new file mode 100644
index 0000000000000000000000000000000000000000..7b3e9359d8a1cf994273e12f7bb93c66327017a9
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/view_ft.py
@@ -0,0 +1,153 @@
+# Handy launcher for the Fault Tree Viewer
+
+import os.path
+import sys
+import glob
+import logging
+import _paths
+
+
+def get_suitable_ft_files(events_fname, gates_fname, outdir):
+    """Automatically retrieve files when partially specified.
+    Returns pair (events_fname, gates_fname)
+    """
+
+    events_suffix = "events.txt"
+    gates_suffix = "gates.txt"
+
+    # searches base (if any exists)
+    base = None
+    if gates_fname is None and events_fname is not None:
+        _base = os.path.basename(events_fname)
+        if _base.endswith(events_suffix):
+            base = _base[:-len(events_suffix)]
+            logging.info("Found base name " + base)
+
+    elif gates_fname is not None and events_fname is None:
+        _base = os.path.basename(gates_fname)
+        if _base.endswith(gates_suffix):
+            base = _base[:-len(gates_suffix)]
+            logging.info("Found base name " + base)
+
+    if gates_fname is None and os.path.isdir(outdir):
+        logging.info("Searching for suitable gates file")
+
+        pat = (base if base else "*") + gates_suffix
+        gates_files = glob.glob(os.path.join(outdir, pat))
+        if len(gates_files) == 0:
+            logging.error("No gates file found in output dir '%s'. "
+                          "Specify explicitly" % outdir)
+            sys.exit(1)
+        if len(gates_files) > 1:
+            logging.error("Multiple gates files found in output dir '%s'. "
+                          "Specify explicitly" % outdir)
+            sys.exit(1)
+        gates_fname = gates_files.pop()
+        logging.info("Found gates file '%s'" % gates_fname)
+
+    if events_fname is None and os.path.isdir(outdir):
+        logging.info("Searching for suitable events file")
+
+        pat = (base if base else "*") + events_suffix
+        events_files = glob.glob(os.path.join(outdir, pat))
+        if len(events_files) == 0:
+            logging.error("No events file found in output dir '%s'. "
+                          "Specify explicitly" % outdir)
+            sys.exit(1)
+        if len(events_files) > 1:
+            logging.error("Multiple events files found in output dir '%s'. "
+                          "Specify explicitly" % outdir)
+            sys.exit(1)
+        events_fname = events_files.pop()
+        logging.info("Found events file '%s'" % events_fname)
+
+    return (events_fname, gates_fname)
+
+
+def handle_options():
+    import argparse
+
+    OUTPUT_FORMATS = "png svg pdf".split()
+    PNG_FORMAT, SVG_FORMAT, PDF_FORMAT = OUTPUT_FORMATS
+
+    parser = argparse.ArgumentParser(description="Opens the Fault Tree Viewer"
+                                     "with specified or found files")
+
+    parser.add_argument("--events-file", "-e",
+                        metavar="EVENTS-FILE",
+                        help="The input events file name")
+
+    parser.add_argument("--gates-file", "-g",
+                        metavar="GATES-FILE",
+                        help="The input gates file name")
+
+    parser.add_argument("--xml-file", "-x",
+                        metavar="XML-FILE",
+                        help="The input fault tree xml file name")
+
+    parser.add_argument(
+        "-d", "--outdir",
+        default="out",
+        metavar="PATH",
+        help="Input directory, where gates and events files are searched "
+        "when not specified (default:%(default)s)")
+
+    parser.add_argument(
+        "-o", "--output-file",
+        default=None,
+        metavar="OUTPUT-FILE",
+        help="Output file where fault tree is dumped")
+
+    parser.add_argument(
+        "-f", "--output-format",
+        default=PNG_FORMAT,
+        metavar="OUTPUT-FORMAT",
+        help="Output format for the fault tree (default: %(default)s)")
+
+    parser.add_argument('--verbose', '-v',
+                        action='store_true',
+                        default=False,
+                        help='Sets verbosity to high level')
+
+    args = parser.parse_args()
+
+    for fn in (args.gates_file, args.events_file, args.xml_file):
+        if fn and not os.path.isfile(fn):
+            parser.error("File not found: " + fn)
+
+    if ((args.gates_file or args.events_file) and args.xml_file):
+        parser.error("Cannot specify both the xml file and events and gates files. "
+                     "Please specify only the xml file or both events and gates files.")
+
+    if ((args.gates_file and args.events_file is None) or
+        (args.gates_file is None and args.events_file)):
+        parser.error("Please provide both the events and gates file or the xml file.")
+
+    return args
+
+
+def main(events_fname, gates_fname, xml_fname, output_fname, output_format):
+    import fault_tree_viewer.ftv as ftv
+    ftv.run(events_fname, gates_fname, xml_fname, output_fname, output_format)
+
+
+if "__main__" == __name__:
+    _paths.setup_path()
+    args = handle_options()
+    if args.verbose:
+        logging.getLogger().setLevel(logging.INFO)
+
+    if args.xml_file is None:
+
+        events_fname, gates_fname = get_suitable_ft_files(
+            args.events_file,
+            args.gates_file,
+            args.outdir)
+        xml_fname = None
+
+    else:
+        events_fname = None
+        gates_fname = None
+        xml_fname = args.xml_file
+
+    main(events_fname, gates_fname, xml_fname, args.output_file, args.output_format)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/view_tfpg.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/view_tfpg.py
new file mode 100644
index 0000000000000000000000000000000000000000..9e1e6d11968370ab58af15e04c2be8e3be39ee42
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/view_tfpg.py
@@ -0,0 +1,49 @@
+
+import sys
+import os
+import _paths
+
+OUTPUT_FORMATS = "pdf png dot".split()
+PDF_FORMAT, PNG_FORMAT, DOT_FORMAT = OUTPUT_FORMATS
+
+
+def handle_options():
+    import argparse
+    parser = argparse.ArgumentParser(description="Opens the TFPG Viewer")
+
+    parser.add_argument("--tfpg-file", "-t",
+                        dest="tfpg_fname",
+                        default=None,
+                        type=str,
+                        help="The input TFPG file name")
+
+    parser.add_argument("--output-file", "-o",
+                        dest="out_fname",
+                        default=None,
+                        type=str,
+                        help="The name of the output file used to dump the TFPG")
+
+    parser.add_argument("--output-format", "-f",
+                        dest="output_format",
+                        choices=OUTPUT_FORMATS,
+                        default=PDF_FORMAT,
+                        help="Output format (default: %(default)s)")
+
+    args = parser.parse_args()
+
+    if args.tfpg_fname is not None and not os.path.isfile(args.tfpg_fname):
+        parser.error("File not found: %s" % args.tfpg_fname)
+
+    return args
+
+
+def main(tfpg_fname, out_fname, output_format):
+    from tfpg_viewer import tfpgv
+    tfpgv.run(tfpg_fname, out_fname, output_format)
+    return
+
+
+if __name__ == "__main__":
+    _paths.setup_path()
+    args = handle_options()
+    main(args.tfpg_fname, args.out_fname, args.output_format)
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/view_trace.py b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/view_trace.py
new file mode 100644
index 0000000000000000000000000000000000000000..e1eee69595be12e3856b444c6375ab739c8cf80f
--- /dev/null
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP/scripts/view_trace.py
@@ -0,0 +1,13 @@
+# Handy Launcher for the Trace Viewer
+import _paths
+
+
+def main():
+    from trace_viewer import discrete_trace_viewer as tv
+    # import discrete_trace_viewer as tv
+    tv.run()
+
+
+if "__main__" == __name__:
+    _paths.setup_path()
+    main()