Difference between pages "Sharing theories" and "Exporting and importing archives containing theories"

From Event-B
(Difference between pages)
Jump to navigationJump to search
(Add to Theory Plug-in category)
 
(Add to Theory Plug-in category)
 
Line 1: Line 1:
Rodin 2.0+ with [[Theory_Plug-in | theory plug-in]] makes it possible to define extensions to the standard mathematical language, that is new operators and datatypes.
+
{{TOCright}}
This page explains how to share your theories with the community and how to get theories developed by other people.
 
  
== A SourceForge tracker for Theories ==
+
== Purpose ==
A new tracker has been created in the SourceForge site of the Rodin project to share theories:
 
  
[http://sourceforge.net/tracker/?group_id=108850&atid=1558661 http://sourceforge.net/tracker/?group_id=108850&atid=1558661]
+
Rodin 2.0 with theory feature provides support for developing theories. But sharing theories can be somewhat difficult if care is not taken for exporting and importing them. This is related to the fact that theories are always in a particular project called "MathExtensions".
 +
To understand the problem, let's say we have developed an Event-B project P and a theory T and want to make an archive in order to share them. The workspace looks like this:
  
== Sharing a Theory ==
+
+ MathExtensions
 +
  - T.tuf
 +
  - T.dtf
 +
  ...
 +
+ P
 +
  - C0.buc
 +
  - m0.bum
 +
  ...
  
Sharing a theory can be achieved in the same way as adding an item in any other SourceForge tracker: by clicking the "Add new" link, then filling the form.
+
If we make a standard archive export of these projects (File > Export > Archive File), we will get a zip file containing the project P and the project MathExtensions.
  
As much as possible, non related theories should be provided in different artifacts (tracker items).
+
But then, the person who will import the archive into his workspace with the theory feature installed (File > Import > Existing Projects into Workspace > Select archive file), will already have a project named "MathExtensions" in the workspace. Thus, the import wizard will warn that "Some projects cannot be imported because they already exist in the workspace", and theories of "MathExtensions" in the archive will not be imported. This page is dedicated to proposing workarounds for this problem.
Before posting a new theory, it is recommended to check if the same or a similar one already exists. In this case, if your theory has something slightly different that you think worth sharing, please do so in the same tracker item, in order to keep related works together. The specificity of your theory can be briefly described in the field called "Description", below the "File" upload form; more accurate descriptions will better fit in comments.
 
  
A theory item is basically made of:
+
== Solution 1: theories at archive root ==
* a relevant title, clearly stating what kind of mathematical extensions are provided;
 
* a brief description of the contents (in the initial comment);
 
* a category indicating the area of the theory; if no existing category fits your contribution, leave the field at "None" and indicate in the comment the name of the new category you would like
 
* a group, indicating which version of Rodin the theory has been developed with
 
* one or more archives (see [[Exporting and importing archives containing theories]] for generating these archives)
 
  
== Updating a new version ==
+
When exporting, select option "Create only selected directories", then select project P, but not project MathExtensions, only the T.* files in it, as shown below:
  
New versions of a given theory shall be uploaded to the same tracker item as the original one, using the upload description field to describe evolutions.
+
[[Image:Export_P_Troot.png|500px]]
  
== Using a shared Theory ==
+
Then clean P and MathExtensions (Project > Clean).
  
After downloading the desired archive(s) from the list of attached files, import them into your Rodin workspace using one the techniques described in [[Exporting and importing archives containing theories]].
+
Then, import is done in two steps:
 +
# import T: File > Import > Archive File select the archive, untick the P project, only select T.* files at the root, select to import into the MathExtensions as shown on the image below
 +
# import P the standard way: File > Import > Existing Projects into Workspace > Select archive file
  
The technique to use depends on how the archive has been generated. In any case, the goal is always the same: to put theory files (.tuf, .dtf, ...) from the archive into the <tt>MathExtensions</tt> project of your workspace.
+
[[Image:Import_P_Troot.png|500px]]
 +
 
 +
Note: in this case we chose to only put the .tuf (theory unchecked file) and .bpr (proof file) into the archive, because other files (.tcf, .bpo, .bps) are generated upon build, and .dtf (deployed theory file) is generated when deploying T. It is also possible to put every T.* files in the archive, or only T.dtf. In any case, it is generally preferable to clean imported projects and the MathExtensions project.
 +
 
 +
This solution is the most conservative one, as other theories that might exist in the importing workspace are conserved.
 +
 
 +
== Solution 2: remove MathExtensions at import ==
 +
 
 +
This second solution is the most simple but can be used only when the importer has not developed any theories.
 +
It consists in exporting P and T the standard way, so that the archive contains P and MathExtensions projects. Then the importer simply deletes his empty MathExtensions project from the workspace before importing the standard way (File > Import > Existing Projects into Workspace > Select archive file).
 +
 
 +
== Solution 3: temporary project ==
 +
 
 +
This solution consists in creating a temporary project, for instance TempMathExtensions, then copying theory files to export in it. The exporter then makes a standard project archive with P and TempMathExtensions (and NOT MathExtensions).
 +
 
 +
The importer can then import this archive the standard way (File > Import > Existing Projects into Workspace > Select archive file), then copy theory files from TempMathExtensions to MathExtensions, and finally delete TempMathExtensions. A clean of P and MathExtensions is then highly recommended.
  
 
[[Category:Theory Plug-in]]
 
[[Category:Theory Plug-in]]

Latest revision as of 14:57, 14 June 2021

Purpose

Rodin 2.0 with theory feature provides support for developing theories. But sharing theories can be somewhat difficult if care is not taken for exporting and importing them. This is related to the fact that theories are always in a particular project called "MathExtensions". To understand the problem, let's say we have developed an Event-B project P and a theory T and want to make an archive in order to share them. The workspace looks like this:

+ MathExtensions
  - T.tuf
  - T.dtf
  ...
+ P
  - C0.buc
  - m0.bum
  ...

If we make a standard archive export of these projects (File > Export > Archive File), we will get a zip file containing the project P and the project MathExtensions.

But then, the person who will import the archive into his workspace with the theory feature installed (File > Import > Existing Projects into Workspace > Select archive file), will already have a project named "MathExtensions" in the workspace. Thus, the import wizard will warn that "Some projects cannot be imported because they already exist in the workspace", and theories of "MathExtensions" in the archive will not be imported. This page is dedicated to proposing workarounds for this problem.

Solution 1: theories at archive root

When exporting, select option "Create only selected directories", then select project P, but not project MathExtensions, only the T.* files in it, as shown below:

Export P Troot.png

Then clean P and MathExtensions (Project > Clean).

Then, import is done in two steps:

  1. import T: File > Import > Archive File select the archive, untick the P project, only select T.* files at the root, select to import into the MathExtensions as shown on the image below
  2. import P the standard way: File > Import > Existing Projects into Workspace > Select archive file

Import P Troot.png

Note: in this case we chose to only put the .tuf (theory unchecked file) and .bpr (proof file) into the archive, because other files (.tcf, .bpo, .bps) are generated upon build, and .dtf (deployed theory file) is generated when deploying T. It is also possible to put every T.* files in the archive, or only T.dtf. In any case, it is generally preferable to clean imported projects and the MathExtensions project.

This solution is the most conservative one, as other theories that might exist in the importing workspace are conserved.

Solution 2: remove MathExtensions at import

This second solution is the most simple but can be used only when the importer has not developed any theories. It consists in exporting P and T the standard way, so that the archive contains P and MathExtensions projects. Then the importer simply deletes his empty MathExtensions project from the workspace before importing the standard way (File > Import > Existing Projects into Workspace > Select archive file).

Solution 3: temporary project

This solution consists in creating a temporary project, for instance TempMathExtensions, then copying theory files to export in it. The exporter then makes a standard project archive with P and TempMathExtensions (and NOT MathExtensions).

The importer can then import this archive the standard way (File > Import > Existing Projects into Workspace > Select archive file), then copy theory files from TempMathExtensions to MathExtensions, and finally delete TempMathExtensions. A clean of P and MathExtensions is then highly recommended.