SMT Solvers Plug-in: Difference between revisions

From Event-B
Jump to navigationJump to search
imported>YGU
imported>YGU
Updated page to version 1.0
Line 87: Line 87:
Z3 solver can be downloaded at http://research.microsoft.com/en-us/um/redmond/projects/z3/download.html.
Z3 solver can be downloaded at http://research.microsoft.com/en-us/um/redmond/projects/z3/download.html.


== SMT solvers configurations ==
== Connecting SMT Solvers to the Rodin Platform ==
In order to use the plug-in, you must connect some SMT solvers to the platform.<br>
Such a connection is done by adding a new SMT solver in the plug-in user interface, and setting its path and kind.<br>
 
Since version 0.8.0, some SMT solvers are bundled within the plug-in, and some ad-hoc configurations are already available. To use the plug-in right now with these solvers, see [[#Usage]].
 
As to reach the SMT solvers page, open the ''Preferences'' window: ''Window > Preferences''.
 
[[Image:Preferences_menu.png|450px]]
 
 
Unfold the SMT section and go to the Solvers page.
 
[[Image:SMT_solvers.png|500px]]
 
=== Adding a New SMT Solver Connection ===
Add a new SMT solver into Rodin by clicking the ''Add'' button.
 
[[Image:Solver.png]]
 
* Fill the ''Name'' field with the name you want to give to this solver.
* Select the kind of the solver if it appears in the combo box. In this case, this will let the plug-in use some specific options of the solver to make its integration possible. If it does not appear in the list, select ''unknown''.
* Click ''Browse'' to fill the solver executable path.
* Click ''OK''.
 
=== Editing an SMT Solver Connection ===
You can edit all the informations given when adding a connection by clicking the ''Edit'' button. The bundled solvers connections cannot be edited.
 
=== Removing an SMT Solver Connection ===
You can remove the connection with the ''selected'' solver by clicking the ''Remove'' button. The bundled solvers connections cannot be removed.
 
=== Restoring Default Solvers ===
The default solvers are the bundled ones. A click on the ''Restore Defaults'' button will remove all the solvers which are not bundled within the plugin.
 
== Customizing SMT Solvers Configurations ==
In order to use the plug-in, you must set up some SMT Solvers configurations.<br>
In order to use the plug-in, you must set up some SMT Solvers configurations.<br>
We call ''SMT Solver configuration'' a settled configuration of a solver, with ad-hoc properties such as its path, its parameters and the SMT-LIB version of the benchmarks it will execute.<br>
We call ''SMT Solver configuration'' a settled configuration of a solver, with ad-hoc properties such as its parameters and the SMT-LIB version of the benchmarks it will execute.<br>
For example, such configurations can execute the same solver with different options, or different versions of the same solver, or different solvers.<br>
For example, such configurations can execute the same solver with different options, or different versions of the same solver, or different solvers.<br>


Since version 0.8.0, the SMT-solver veriT is bundled within the plug-in. A configuration of this solver is already available in the plug-in : it launches the veriT solver (without e-prover), using the translation to SMT-LIB 2.0 and with the unsat-core extraction activated. To use the plug-in right now with this configuration, see [[#Usage]].
Since version 0.8.0, some SMT solvers are bundled within the plug-in. Some configurations of these solvers is already available in the plug-in : for example, the bundled veriT configuration launches the veriT solver (without e-prover), using the translation to SMT-LIB 2.0 and with the unsat-core extraction enabled. To use the plug-in right now with these configurations, see [[#Usage]].


As to reach the SMT solver configurations page, open the ''Preferences'' window: ''Window > Preferences''.
As to reach the SMT solvers configurations page, open the ''Preferences'' window: ''Window > Preferences''.


[[Image:Preferences_menu.png|450px]]
[[Image:Preferences_menu.png|450px]]




Go to the ''SMT-Solvers'' page.
Go to the ''Configurations'' page.
 
[[Image:Smt_solvers_preferences_page.png|450px]]


[[Image:SMT_configurations.png|500px]]


=== Adding a New Solver Configuration ===
Add a new SMT solver configuration into Rodin by clicking the ''Add'' button.
Add a new SMT solver configuration into Rodin by clicking the ''Add'' button.


[[Image:Solver_configuration.png|450px]]
[[Image:Solver_configuration.png|402px]]


* Fill the ''Solver ID'' with the name you want to give to this configuration.
* Fill the ''Name'' with the name you want to give to this configuration.
* Select the solver you want to use in this configuration (if it does not appear in the list, select ''unknown'').
* Choose whether this configuration shall be run or not when calling the SMT tactic by checking the ''Enable'' checkbox. This value can be changed directly in the ''Configurations'' page too.
* Click ''Browse'' to fill the solver executable path.
* Select the solver you want to use in this configuration. A solver to choose among the connected solvers of the ''Solvers'' page.
* Fill the ''Solver arguments'' if needed. For example, you must enter here the solver option which sets the version of SMT-LIB to be used by the solver.
* Fill the ''Solver arguments'' if needed. For example, you must enter here the solver option which sets the version of SMT-LIB to be used by the solver.
* Select which version of SMT-LIB must be used by the plug-in.).
* Select which version of SMT-LIB must be used by the plug-in.
* Enter the value of the time out delay, which is, the time (in milliseconds) before which the platform will terminate the solver if it has not returned itself.
 
* Click ''OK''.
* Click ''OK''.


The selected solver configuration is the blue one. This shows which solver configuration will be used when the SMT tactic will be called.<br>
=== Enabling/Disabling a Solver Configuration ===
If you want to use another solver configuration, click on the corresponding line in the ''SMT-Solvers configurations'' list, and click ''Select''.
When you will call the SMT tactic, only the enabled configurations will be executed. This can be changed directly in the configurations page. To do this, just click on the value of the execution column corresponding to the configuration you want to enable or disable.
 
[[Image:SMT_configuration_enablement_status.png|500px]]
 
=== Editing a Solver Configuration ===
You can edit all the informations given when setting a new solver configuration by clicking the ''Edit'' button. The bundled configurations cannot be edited.
 
=== Removing a Solver Configuration ===
You can remove the selected configuration by clicking the ''Remove'' button. The bundled configurations cannot be removed.


[[Image:Selected solver.png|451px]]
=== Duplicating a Solver Configuration ===
You can duplicate any configuration by clicking the ''Duplicate'' button. This will open the configuration dialog with the information of the original configuration. Just edit them and click ''OK'' to add the duplicated configuration.


=== Restoring Default Solvers Configurations ===
The default configurations are the bundled ones. A click on the ''Restore Defaults'' button will remove all the configurations which are not bundled within the plugin.


=== SMT-LIB translation settings ===
== Setting the SMTLIB translation ==
If you want to use veriT instead of ppTrans to translate Event-B sequents to SMT-LIB benchmarks, you need to fill the veriT path, by clicking the corresponding ''Browse'' button, and selecting the veriT binary. Since version 0.8.0, the SMT plug-in integrates the SMT-solver veriT, so change this only if you want to use another veriT binary to produce SMT-LIB.
As to reach the SMT translation page, open the ''Preferences'' window: ''Window > Preferences''.


[[Image:Preferences_menu.png|450px]]
Go to the ''Translation'' page.
[[Image:SMT_translation.png|500px]]
=== Setting the veriT Path ===
If you want to use veriT instead of ppTrans to translate Event-B sequents to SMT-LIB benchmarks, you need to fill the veriT path, by clicking the corresponding ''Browse'' button, and selecting the veriT binary. Since version 0.8.0, the SMT solver veriT is bundled within the plug-in and its path used by default, so change this only if you want to use another veriT binary to produce SMT-LIB benchmarks.
=== Setting the Translation Directory Path ===
The plug-in may use some temporary files to discharge a sequent.<br>
The plug-in may use some temporary files to discharge a sequent.<br>
You can choose the directory to use for this purpose, by clicking the corresponding ''Browse'' button, and selecting the target directory.
You can change the directory to use for this purpose, by clicking the corresponding ''Browse'' button, and selecting the target directory.


== SMT Auto-Tactic profile ==
=== Restoring Default Translation Settings ===
You can restore the default translation settings values by clicking the ''Restore Defaults'' button.<br>
The default veriT path is the path of the bundled veriT solver.<br>
The default translation directory path is the system temporary directory path.
 
== SMT Auto-Tactic Profile ==
One might want to set-up one or several configurations of SMT solver to be used automatically to discharge Event-b sequents in the Rodin platform.<br>
One might want to set-up one or several configurations of SMT solver to be used automatically to discharge Event-b sequents in the Rodin platform.<br>
Since version 2.3 of Rodin, it is possible to create new ''tactic combinations'' called ''profiles'' to be applied automatically (See ''Advanced Profile Customisation'' in [[Rodin_Platform_2.3_Release_Notes]] and ''3.1.8.4 Sequent Prover / Auto/Post Tactic'' in [http://handbook.event-b.org/current/html/preferences.html the preference page of the Rodin User’s Handbook v.2.4]).<br>
Since version 2.3 of Rodin, it is possible to create new ''tactic combinations'' called ''profiles'' to be applied automatically (See ''Advanced Profile Customisation'' in [[Rodin_Platform_2.3_Release_Notes]] and ''3.1.8.4 Sequent Prover / Auto/Post Tactic'' in [http://handbook.event-b.org/current/html/preferences.html the preference page of the Rodin User’s Handbook v.2.4]).<br>
Since version 0.8.0 of the plug-in, an Auto-Tactic profile using SMT solvers is available in the plug-in. To use this profile, see [[#Selecting an SMT auto-tactic profile]].
Since version 0.8.0 of the plug-in, an Auto-Tactic profile using SMT solvers is available in the plug-in. To use this profile, see [[#Selecting an SMT auto-tactic profile]].


=== Creating a new SMT auto-tactic profile ===
=== Creating a New SMT Auto-Tactic Profile ===


A reasonable combination using the SMT tactic is an SMT tactic queued to the default auto tactic combination. We show here how to create such a ''profile''.
A reasonable combination using the SMT tactic is an SMT tactic queued to the default auto tactic combination. We show here how to create such a ''profile''.
Line 160: Line 223:




=== Selecting an SMT auto-tactic profile ===
=== Selecting an SMT Auto-Tactic Profile ===


One may want to use the new SMT auto-tactic profile (available since version 0.8.0 of the plug-in), or a user-defined profile using SMT solvers.
One may want to use the new SMT auto-tactic profile (available since version 0.8.0 of the plug-in), or a user-defined profile using SMT solvers.
Line 176: Line 239:
== Usage ==
== Usage ==


=== Discharging a sequent ===
=== Discharging a Sequent ===
We give an example of Event-B model of which proof obligation can be discharge using an SMT solver:
We give an example of Event-B model of which proof obligation can be discharge using an SMT solver:


Line 190: Line 253:




Clicking on this button will call the previously selected SMT solver, which will discharge the proof obligation if possible:
Clicking on this button will call successively every enabled SMT configurations, which will discharge the proof obligation if possible:


[[Image:Tactic applied successfully.png|450px]]
[[Image:Tactic applied successfully.png|450px]]
Line 201: Line 264:
If the solver used to discharge the sequent is able to extract an unsatisfiability core, the proof rule will be produced using it. This is the case for veriT.
If the solver used to discharge the sequent is able to extract an unsatisfiability core, the proof rule will be produced using it. This is the case for veriT.


== Bugs and features request ==
== Bugs and Features Request ==
* SMT-LIB 2.0 support with the veriT translation approach in developpment
* SMT-LIB 2.0 support with the veriT translation approach in developpment
* Full set theory support in progress
* Full set theory support in progress


== Releases Notes ==
== Releases Notes ==
'''Version 1.0.0'''
* Cvc3 SMT solver bundled with the plug-in
* User Interface entirely refactored for more intuitive experience: solvers preferences, configurations preferences and translation preferences are now separated into three preferences pages.
* Notably added a button for duplicating a configuration


'''Version 0.8.0'''
'''Version 0.8.0'''

Revision as of 15:47, 4 April 2012

For developer support, see SMT Solvers Plug-in Developer Support

Introduction

The SMT plug-in allows users to use SMT solvers within Rodin. It is still in development (See sources [1]).

Since version 0.8:

  • the SMT-Solver veriT is bundled within the plug-in. Therefore, it is not necessary (but still possible) to install another copy of the solver.
  • An Auto-Tactic with SMT profile is available. Thus, it is not necessary (but still possible) to create a new profile to use SMT solvers tactics (see #Selecting an SMT auto-tactic profile to use this profile).

Installation

You will need to:

  • Install the Rodin Platform.
  • Install the SMT Solvers Plug-in into Rodin.
  • Install any additional SMT-solvers you want to use.

Installing the Rodin Platform

Download the Rodin Platform 2.4 (Core) (around 69MB) corresponding to your operating system and install it [2].

Installing the SMT Solvers Plug-in

Launch Rodin and go to Help > Install New Software....


Select the Rodin Platform Update Site: http://rodin-b-sharp.sourceforge.net/updates.


Unfold the Prover Extensions category, and select the SMT Solvers Integration feature. Click Next.


Review the item to be installed and click Next.


Read and accept the terms of the license agreement to install the plug-in. Then click Finish.


A security warning appears because the feature content is unsigned. Click Ok.


Click Restart Now.

The SMT Solvers Plug-in is now installed.

Installing the SMT solvers

Currently, the SMT plug-in has been tested with the following solvers:

  • Alt-Ergo (INRIA Saclay)
  • CVC3 (New York and Iowa Universities)
  • veriT (Loria Nancy and UFRN)
  • Z3 (Microsoft Research)

Since version 0.8.0, the SMT-solver veriT is bundled within the plug-in. To use the plug-in right now with this solver, see #Usage.

Installing veriT

veriT solver can be downloaded at http://www.verit-solver.org/veriT-download.php. Compilation and installation instructions are in the INSTALL file.
If you want the plug-in to extract unsatisfiability cores from veriT proofs, make sure that the proof production is on in Makefile.config :

# PROOF_PRODUCTION = NO
PROOF_PRODUCTION = YES

The following tools are used in the installation process (Debian/Ubuntu platforms):

  • gcc, g++: compilers
  • make, ar, ranlib: build process
  • wget, tar, patch: to fetch GMP and Minisat
  • bison, flex, m4: build compilers and preprocessing

Do not forget to install the E-prover as well[3] (eprover package on Ubuntu platforms).

Installing Alt-Ergo

alt-ergo solver can be downloaded at http://alt-ergo.lri.fr/, or installed using the Ubuntu repository: alt-ergo package.

Installing CVC3

CVC3 solver can be downloaded at http://cs.nyu.edu/acsys/cvc3/download.html, or installed using the Ubuntu repository: cvc3 package.

Installing Z3

Z3 solver can be downloaded at http://research.microsoft.com/en-us/um/redmond/projects/z3/download.html.

Connecting SMT Solvers to the Rodin Platform

In order to use the plug-in, you must connect some SMT solvers to the platform.
Such a connection is done by adding a new SMT solver in the plug-in user interface, and setting its path and kind.

Since version 0.8.0, some SMT solvers are bundled within the plug-in, and some ad-hoc configurations are already available. To use the plug-in right now with these solvers, see #Usage.

As to reach the SMT solvers page, open the Preferences window: Window > Preferences.


Unfold the SMT section and go to the Solvers page.

Adding a New SMT Solver Connection

Add a new SMT solver into Rodin by clicking the Add button.

  • Fill the Name field with the name you want to give to this solver.
  • Select the kind of the solver if it appears in the combo box. In this case, this will let the plug-in use some specific options of the solver to make its integration possible. If it does not appear in the list, select unknown.
  • Click Browse to fill the solver executable path.
  • Click OK.

Editing an SMT Solver Connection

You can edit all the informations given when adding a connection by clicking the Edit button. The bundled solvers connections cannot be edited.

Removing an SMT Solver Connection

You can remove the connection with the selected solver by clicking the Remove button. The bundled solvers connections cannot be removed.

Restoring Default Solvers

The default solvers are the bundled ones. A click on the Restore Defaults button will remove all the solvers which are not bundled within the plugin.

Customizing SMT Solvers Configurations

In order to use the plug-in, you must set up some SMT Solvers configurations.
We call SMT Solver configuration a settled configuration of a solver, with ad-hoc properties such as its parameters and the SMT-LIB version of the benchmarks it will execute.
For example, such configurations can execute the same solver with different options, or different versions of the same solver, or different solvers.

Since version 0.8.0, some SMT solvers are bundled within the plug-in. Some configurations of these solvers is already available in the plug-in : for example, the bundled veriT configuration launches the veriT solver (without e-prover), using the translation to SMT-LIB 2.0 and with the unsat-core extraction enabled. To use the plug-in right now with these configurations, see #Usage.

As to reach the SMT solvers configurations page, open the Preferences window: Window > Preferences.


Go to the Configurations page.

Adding a New Solver Configuration

Add a new SMT solver configuration into Rodin by clicking the Add button.

  • Fill the Name with the name you want to give to this configuration.
  • Choose whether this configuration shall be run or not when calling the SMT tactic by checking the Enable checkbox. This value can be changed directly in the Configurations page too.
  • Select the solver you want to use in this configuration. A solver to choose among the connected solvers of the Solvers page.
  • Fill the Solver arguments if needed. For example, you must enter here the solver option which sets the version of SMT-LIB to be used by the solver.
  • Select which version of SMT-LIB must be used by the plug-in.
  • Enter the value of the time out delay, which is, the time (in milliseconds) before which the platform will terminate the solver if it has not returned itself.
  • Click OK.

Enabling/Disabling a Solver Configuration

When you will call the SMT tactic, only the enabled configurations will be executed. This can be changed directly in the configurations page. To do this, just click on the value of the execution column corresponding to the configuration you want to enable or disable.

Editing a Solver Configuration

You can edit all the informations given when setting a new solver configuration by clicking the Edit button. The bundled configurations cannot be edited.

Removing a Solver Configuration

You can remove the selected configuration by clicking the Remove button. The bundled configurations cannot be removed.

Duplicating a Solver Configuration

You can duplicate any configuration by clicking the Duplicate button. This will open the configuration dialog with the information of the original configuration. Just edit them and click OK to add the duplicated configuration.

Restoring Default Solvers Configurations

The default configurations are the bundled ones. A click on the Restore Defaults button will remove all the configurations which are not bundled within the plugin.

Setting the SMTLIB translation

As to reach the SMT translation page, open the Preferences window: Window > Preferences.


Go to the Translation page.

Setting the veriT Path

If you want to use veriT instead of ppTrans to translate Event-B sequents to SMT-LIB benchmarks, you need to fill the veriT path, by clicking the corresponding Browse button, and selecting the veriT binary. Since version 0.8.0, the SMT solver veriT is bundled within the plug-in and its path used by default, so change this only if you want to use another veriT binary to produce SMT-LIB benchmarks.

Setting the Translation Directory Path

The plug-in may use some temporary files to discharge a sequent.
You can change the directory to use for this purpose, by clicking the corresponding Browse button, and selecting the target directory.

Restoring Default Translation Settings

You can restore the default translation settings values by clicking the Restore Defaults button.
The default veriT path is the path of the bundled veriT solver.
The default translation directory path is the system temporary directory path.

SMT Auto-Tactic Profile

One might want to set-up one or several configurations of SMT solver to be used automatically to discharge Event-b sequents in the Rodin platform.
Since version 2.3 of Rodin, it is possible to create new tactic combinations called profiles to be applied automatically (See Advanced Profile Customisation in Rodin_Platform_2.3_Release_Notes and 3.1.8.4 Sequent Prover / Auto/Post Tactic in the preference page of the Rodin User’s Handbook v.2.4).
Since version 0.8.0 of the plug-in, an Auto-Tactic profile using SMT solvers is available in the plug-in. To use this profile, see #Selecting an SMT auto-tactic profile.

Creating a New SMT Auto-Tactic Profile

A reasonable combination using the SMT tactic is an SMT tactic queued to the default auto tactic combination. We show here how to create such a profile.

First, open the Preferences window of the Rodin platform: Window > Preferences.


Open the Auto/Post Tactic preferences page: Event-B > Sequent Prover > Auto/Post Tactic. Go to the Profiles tab.

Select the default auto tactic profile, and click Duplicate to duplicate it.

Then, select the duplicated profile, and click Edit to edit it.

In the tactic profile window, rename the profile, and drag and drop the chosen SMT tactic from the tactics list (in the first column) to the end of the combined tactics (in the second column).

Then click Finish.

Now a new profile combining the SMT tactic with other tactics is created.


Selecting an SMT Auto-Tactic Profile

One may want to use the new SMT auto-tactic profile (available since version 0.8.0 of the plug-in), or a user-defined profile using SMT solvers.

To set it on, go to the Auto/Post Tactic tab.

Set the tactic profile to be used for auto-tactics up to the one combining the SMT tactic, by using the drop-down menu.

Then click Ok.

Now, the combined tactics of your new profile, including the SMT tactic, will be automatically launched when auto-provers are called.

Usage

Discharging a Sequent

We give an example of Event-B model of which proof obligation can be discharge using an SMT solver:

thm1 is a theorem which must be proved given axioms axm2..axm5.


Since we installed SMT Plug-in into the Rodin Platform, the SMT tactic button is now accessible in the Proof Control bar.


Clicking on this button will call successively every enabled SMT configurations, which will discharge the proof obligation if possible:


When the tactic is applied successfully, this means that the reasonner created the new proof rule:

If the solver used to discharge the sequent is able to extract an unsatisfiability core, the proof rule will be produced using it. This is the case for veriT.

Bugs and Features Request

  • SMT-LIB 2.0 support with the veriT translation approach in developpment
  • Full set theory support in progress

Releases Notes

Version 1.0.0

  • Cvc3 SMT solver bundled with the plug-in
  • User Interface entirely refactored for more intuitive experience: solvers preferences, configurations preferences and translation preferences are now separated into three preferences pages.
  • Notably added a button for duplicating a configuration

Version 0.8.0

  • Support of SMT-LIB 2.0 in the PP translation approach
  • Inclusion of the SMT-Solver veriT in the plug-in
  • Addition of an SMT auto-tactic
  • Auto-Tactic profile containing the SMT auto-tactic
  • Possibility to parameterize a new SMT tactic
  • Integration of solvers successfully tested with:
    • Alt-Ergo 0.93
    • Cvc3 2011-11-21
    • veriT (included in the plug-in)
    • z3 3.2
    • Cvc4 2011-12-11 (but few theories are available for now)
  • Good results in the field of linear integer arithmetic with uninterpreted sort and function symbols
  • Good support of basic set theory
  • Full set theory support needs to be improved
  • Results showed the SMT-Solvers Plug-in was a good alternative to the Atelier-B provers

Version 0.1.0

  • Initial beta-release.
  • Two approaches for translating Event-B to SMT-LIB 1.2:
    • with ppTrans (included in Rodin official releases)
    • with veriT (must be installed)
  • Integration of solvers successfully tested with: (notice that no solver will be included in the plug-in at all)
    • Alt-Ergo 0.93
    • Cvc3 2011-07-14
    • veriT 201107
    • z3 2.19
  • Good results in the field of linear integer arithmetic with uninterpreted sort and function symbols
  • Good support of basic set theory
  • Full set theory support needs to be improved
  • No SMT-LIB 2.0 support in this release