Difference between pages "Google Summer of Code 2009" and "Pattern"

From Event-B
(Difference between pages)
Jump to navigationJump to search
imported>Son
 
imported>Afuerst
 
Line 1: Line 1:
{{TOCright}}
+
[[User:afuerst]] at [[ETH Zurich]] is in charge of the [[Pattern]] plugin.
For the last few years, Google has offered a fantastic opportunity for students to help out Open Source software projects in the summer while getting paid for it. It's called '''Google Summer of Code™''', and it provides free software projects a great way of attracting development effort while providing software developers who are still in university with some interesting and useful experiences. Find out more about the Summer of Code (SoC) from [http://code.google.com/soc/ their site].
 
  
'''Event-B''' is a formal method for system-level modelling and analysis. Key features of Event-B are the use of set theory as a modelling notation, the use of refinement to represent systems at different abstraction levels and the use of mathematical proof to verify consistency between refinement levels. You can know more of Event-B by reading materials available on [http://www.event-b.org/ http://www.event-b.org/]
 
  
The '''Rodin Platform''' is an Eclipse-based IDE for Event-B that provides effective support for refinement and mathematical proof. The platform is open source, contributes to the Eclipse framework and is further extendable with plugins.
 
  
We would like to participate in 2009's Summer of Code.
+
The tool can be found in the svn-trunk at location <tt>'''_exploratory/fuersta/ch.ethz.eventb.pattern'''</tt>.
  
See also [http://code.google.com/opensource/gsoc/2009/faqs.html GSoC 2009 FAQ].
+
An example including cheat sheet and event-b sources is available at <tt>'''_exploratory/fuersta/ch.ethz.eventb.pattern.example'''</tt>.
  
== Notes on applying ==
 
  
Here are some tips on what you might want to include in your application.
 
  
* First of all: get feedback on your proposal from the community. The devel [[Mailing lists|mailing list]] is a good channel for that. Ask around and get to know some people, see if they think your project is feasible or how you should change the scope to better fit the timeline and the project. (If you are new to Open Source development, reading [http://producingoss.com/en/communications.html#you-are-what-you-write this part of "Producing OSS"] may help you find the right tone.) Talking to people before applying dramatically increases your chances of approval: it shows us that you are genuinely able to communicate your ideas, allows us to gauge your expertise level and see who might be the right mentor for you.
+
== Introduction ==
 +
The intention of Design Patterns in Event-B is to have a methodological approach to reuse former developments (referred to as patterns) in a new development (the problem at hand). With the approach evolved during the master's thesis [http://e-collection.ethbib.ethz.ch/view/eth:41612 "Design Patterns in Event-B and Their Tool Support“], the proofs of the pattern can be reused too. It was shown that for the special case of a model that does not see any context and its events do not have any parameters, the generation of a refinement of the problem at hand is correct by construction and no proof obligation needs to be generated.
  
* Tell us about yourself. We don't know you, so it helps if you give an outline of your background and what your prior experiences are (e.g. Open Source development, using Eclipse, general software engineering experience or education). If it turns out you wouldn't be a good fit for the Rodin platform or your project idea, it's helpful for everyone involved if that can be determined before you get started. However, don't hesitate to apply just because this would be your first time working in Open Source or with Eclipse; at some point this was new for each of us.
+
The correctness of the construction relies on a correct matching of the pattern with the problem at hand. With other words, the correctness of the refinement is implied by the correctness of the matching. The correctness of the matching, on the other hand, is syntactically checked rather than proved. Syntactical checking is easier than doing proofs, especially if they have to be done manually.
  
* Make it clear that you've thought through your application. Don't use a project idea from this page verbatim. Instead, come up with your own proposal, or expand on a proposal from this page. Explore the code a little bit. Make a clear schedule to show the intermediate milestones you'll reach while progressing towards your final goal.
 
  
* Let us know why you care, what you like about formal methods in general and Event-B and the Rodin platform specifically, what things you think could be improved and how they could be improved. We like working on this project because this project makes our work more effective, and we hope you'll like it, too. Showing your motivation helps.
 
  
== Getting things done ==
+
== Construction of a refinement following the pattern approach ==
  
Some tips on how you can get to project completion within the scheduled timeline.
+
:[[Image:Pattern_overview.png]]
  
* Working on the Rodin platform in the summer should be your main activity. Having a vacation for one or two weeks is fine, of course, but we want you to take the project and the time mentors put into it seriously. If you are working two other jobs this summer, that probably won't work. Realize that collaborating on software development takes time, and not just the time used to reason about and write the code. This also means that we want you to set some intermediate milestones to be able to keep track of your progress.
 
  
* Communicate. In some ways, open source software development is more about communicating than about writing code. Some part of your time will be spent writing code, but a large part of the time spent will go towards explaining the code on mailing lists, asking and answering questions on IRC and in general reasoning about proposed software changes. If you can't do this, you take the risk of not understanding the goals of our project or not being able to explain why your patch is necessary.
+
For the construction of reusing a pattern within a development to be correct (without any proof), the pattern and the development have to be matched. This means the elements of the abstract model of a pattern (pattern specification) have to be recognized in the problem at hand (hereinafter referred to as problem).
  
* We want you to work in the open, with our community. Get on the [[Mailing lists|mailing lists]], both to ask for help and to provide it to other users, spend time on IRC (#rodin on irc.freenode.net) discussing your work with other developers.
 
  
* We're not going to just compare what you did at the end to what you stated you'd be doing in the beginning. We want you to put effort into the project, to think about the feature you're doing, to communicate with the community and integrate your code with the project. If you end up implementing some other cool feature or fixing some annoyance, that is great as well.
+
:'''Example'''
  
== Project Ideas ==
+
::On the left side is the abstract model of the pattern (pattern specification), on the right side th development where the pattern should be applied. The pattern provides a solution how to realize  a communication channel for the transfer of a message. It is going to be applied for the transfer of the question in the development.
  
Here are a bunch of project ideas you might like to apply for. Of course, if you have a different idea of something in the Rodin platform that badly needs fixing or some feature you think would make a difference, go ahead and apply with it!
 
  
=== Tool Support for Design Patterns ===
+
::[[Image:Pattern_example.png]]
  
'''Objective'''
 
Reusing formal models in order to reduce the effort of modelling is an important aspect of Event-B methods. The background theoretical work for design patterns in Event-B has been done as part of a master thesis. The objective of this project is to have a tool support for this work as a Rodin plug-in.
 
  
'''Expectations'''
 
  
* Study the concept of Event-B patterns.
+
==== Matching ====
  
* Study the architecture of the Rodin platform.
 
  
* Implement the tool as a Rodin platform plug-in (Eclipse plug-in) .
+
As a first step, all the variables of the pattern specification have to be matched with variables of the problem. Furthermore all the events of the pattern have to be matched with a event of the problem.
  
* Evaluate the tool on a set of example.
 
  
* Prepare basic documentation for users.
 
  
'''Requirements'''
+
:In the example the '''variable matching''' would be:
  
* Good communication skill.
+
::''transferred → question''
  
* Good command of Java programming.
 
  
* Interest in formal methods.
+
:And the '''event matching''':
  
'''Mentor'''
+
::''init → init''
  
Thai Son Hoang <htson at inf dot ethz dot ch>.
+
::''transfer → question''
  
'''Optional'''
 
  
* Basic step-by-step tutorial for using the plug-in.
 
  
=== Integration of External Provers ===
+
==== Checking ====
  
'''Objective'''
+
The chosen matching is valid for the construction if the following checks turn out to be true. Note that this is only formally proved for models that does not see any context or having events with parameters. The proof of the correctness of the construction with general models is pending.
  
Overall objective
 
  
'''Expectations'''
+
* Check that the guards of each event of the pattern specification are syntactically the same as the guards of the corresponding event in the problem.
  
List of expected work to be carried out.
+
* Check that the actions of each event of the pattern specification are syntactically the same as the actions of the corresponding event in the problem.
  
* Study ...
+
* Check that no event in the problem that is not matched alters a matched variable.
  
* Implement ...
 
  
'''Requirements'''
+
Syntactically the same means for example:
  
Requirements for students.
+
<math>a\bcmeq a+b</math> is the same as <math>c\bcmeq c+d</math>, if <math>a</math> is matched with <math>c</math>, and <math>b</math> is matched with <math>d</math>.
  
* Good programming skills in ...
 
  
* ...
+
:The '''checks''' for the above example would be:
  
'''Mentor'''
+
::for the matching ''init → init''
 +
:::check if <math>transferred\bcmeq 0</math> is syntactically the same as <math>question\bcmeq 0</math>
  
* Matthias Schmalz <someone at somewhere>
+
::for the matching ''transfer → question''
 +
:::check if <math>transferred\bcmeq transferred+1</math> is syntactically the same as <math>question\bcmeq question+1</math>
  
'''Optional'''
+
:Note that there is no guard in the pattern event transfer. The guard <math>question=response</math> acts therefore as an extra guard.
  
Optional goals
 
  
* Evaluate ...
+
As there are usually multiple guards and action in an event, the user has (at the current state of the tool) to declare which guards and actions go together.
  
* Document ...
 
  
== Mentors ==
 
  
A list of potential mentors.
+
==== Incorporation ====
  
* Laurent ?
+
Once all checks are done, the refinement of the problem is generated by merging the pattern refinement with the problem.
* Son ?
 
* ...
 
  
== Students Considering Application ==
 
  
 +
:Here is an overview of the refinement of the pattern example:
  
== Applications Received From ==
+
:[[Image:Pattern_refinement.png]]
  
  
== Project status ==
+
The following incorporation steps have to be done:
  
 +
:* Merge the variables from the pattern refinement with the not-matched variables from the problem.
 +
:* Copy the invariants from the pattern refinement.
 +
:* Extract the glueing invariants out of the invariants from the pattern refinement.
 +
:* Copy all not-matched events from the problem.
 +
:* Copy all new events from the pattern refinement.
 +
:* Merge all events from the pattern refinement that refine a matched event with the related extra guards and extra actions from the problem event.
  
== Other GSoc Projects related to RODIN ==
+
 
 +
The extraction of the gluing invariant is needed, if a variable from the pattern specification is refined in the pattern refinement and therefore disappears. By incorporating the pattern the variable in the problem that is matched to the disappearing variable will also disappear. References to this variable in predicates and assignments in the problem have to be replaced by the expression extracted from the gluing invariants.
 +
 
 +
 
 +
:In the example, the variable <math>question</math> is matched with <math>transferred</math>. <math>transferred</math>, on the other hand, is refined by <math>sent</math> as it can be seen in the invariants. Therefore, all appearances of <math>question</math> in the problem events (e.g. event respond) have to be replaced by <math>sent</math>.
 +
 
 +
 
 +
It might be necessary to rename some of the variables, if a variable name of the pattern refinement already exists in the problem. Renaming could also be used in general to give the variables a more meaningful name. The same applies for the event names.
 +
 
 +
 
 +
:In the example, the '''variables''' are '''renamed''' as follows:
 +
 
 +
::''sent → sent_question''
 +
 
 +
::''channel → channel_question''
 +
 
 +
::''received → received_question''
 +
 
 +
 
 +
: The '''events''' are '''renamed''' as follow:
 +
 
 +
::''send → send_question''
 +
 
 +
::''receive → receive_question''
 +
 
 +
 
 +
:The result of the incorporation in the example would the be:
 +
 
 +
:[[Image:Pattern_incorporation.png]]
 +
 
 +
 
 +
== Tool support ==
 +
 
 +
To support developers in using patterns, there exists a plug-in for Rodin. A first try-out version of the tool is available at the location <tt>'''_exploratory/fuersta/ch.ethz.eventb.pattern'''</tt> within the svn-trunk.
 +
 
 +
 
 +
There is also an example including cheat sheet and event-b sources available. At <tt>'''_exploratory/fuersta/ch.ethz.eventb.pattern.example'''</tt> you find the package. When starting Rodin
 +
including this package you can start the cheat sheet with ''Help'' → ''Cheat Sheets...'' and then selecting ''Other'' → ''Pattern plug-in''.
 +
 
 +
In the menu ''Pattern Example'' you can generate machines as an example with the one-click command ''Generate Machine''. The machines are created using the API of the pattern plugin directly without wizard support.
 +
 
 +
 
 +
For those interested in using the pattern plugin API directly rather than the wizard, the corresponding code snippets are presented at each step.
 +
 
 +
 
 +
==== Starting the plug-in ====
 +
*The pattern wizard is started with ''File'' → ''New'' → ''Other...'' (or just clicking on the ''New'' button) and then choosing in the ''New'' dialog the ''Event-B Pattern'' wizard in section ''Event-B''.
 +
 
 +
*Click ''Next'' to proceed to the '''matching page'''.
 +
 
 +
:[[Image:Pattern_startWizard.jpg]]
 +
 
 +
 
 +
<span style="color:darkgreen;">// get the Rodin Database</span>
 +
IRodinDB rodinDB = RodinCore.getRodinDB();
 +
 +
<span style="color:darkgreen;">// get a data instance</span>
 +
IData data = DataFactory.createData();
 +
 
 +
==== Matching page ====
 +
*Choose the pattern and the problem project and machine. If a file was selected before starting the wizard, the tool tries to set it as problem machine.
 +
 
 +
 
 +
:[[Image:Pattern_machineMatching.jpg]]
 +
 
 +
<span style="color:darkgreen;">// SET PROBLEM MACHINE</span>
 +
data.changeProblemMachine(problemMachine);  <span style="color:darkgreen;">// problemMachine is of type IMachineRoot</span>
 +
 +
<span style="color:darkgreen;">// SET PATTERN ABSTRACT MACHINE</span>
 +
data.changePatternAbstractMachine(patternAbstractMachine);  <span style="color:darkgreen;">// patternAbstractMachine is of type IMachineRoot</span>
 +
 
 +
 +
*In the variable section, add variable matchings by choosing a pattern and a problem variable from the drop down menu and click on the ''Add Matching'' button. All matchings are listed in the text field below. A matching can be removed by selecting it and clicking on the ''Remove'' button.
 +
 
 +
<span style="color:darkgreen;">// SET VARIABLE MATCHINGS</span>
 +
data.addMatching(patternVariable, problemVariable);  <span style="color:darkgreen;">// both inputs are of type IVariable</span>
 +
 +
 
 +
*In the event section, add event matchings by choosing a pattern and a problem event from the drop down menu and click on the ''Add Matching'' button. All matchings are listed in the text field below. A matchings can be removed by selecting it and clicking on the ''Remove'' button. The matching of the ''INITIALISATION'' events is set by default and cannot be removed.
 +
 
 +
<span style="color:darkgreen;">// SET EVENT MATCHINGS</span>
 +
data.addMatching(patternEvent, problemEvent);  <span style="color:darkgreen;">// both inputs are of type IEvent</span>
 +
 
 +
 
 +
*There is a section for setting the context matchings. For each carrier set and each constant of the context seen by the pattern specification a correspondent can be entered. If there is a context seen by the problem the possible choices are listed in a drop down menu. Alternatively an expression can be entered. This might be necessary if a carrier set has to be matched with a default carrier set such as BOOL or INT. Although the tool is capable of dealing with context, it's not part of the proved construction.
 +
 
 +
<span style="color:darkgreen;">// SET CONTEXT MATCHINGS</span>
 +
data.updateMatching(carrierSetOrConstant, "PROPOSAL");  <span style="color:darkgreen;">// the first input is of type ICarrierSet or IConstant, the second input is a String</span>
 +
 
 +
 
 +
:[[Image:Pattern_elementMatching.jpg]]
 +
 
 +
 
 +
*For the checking of the guards and actions, it is needed (in the current version of the tool) to declare which guard/action of the pattern event goes together with which guard/action of the corresponding problem event. This sub-matchings are set in a dialog that opens when double clicking on a existing event-matching in the text field of the event section.
 +
 
 +
*Enter for the guards and actions the sub-matchings in the same way as done for the variables and events. Note that there is also the possibility of matching the parameters. If you use this option, be aware of the fact that, although the generation works, parameters are not part of the proved construction.
 +
 
 +
<span style="color:darkgreen;">// SET PARAMETERS</span>
 +
data.addMatching(patternParameter, problemParameter);  <span style="color:darkgreen;">// both inputs are of type IParameter</span>
 +
 +
<span style="color:darkgreen;">// SET GUARDS</span>
 +
data.addMatching(patternGuard, problemGuard);  <span style="color:darkgreen;">// both inputs are of type IGuard</span>
 +
 +
<span style="color:darkgreen;">// SET ACTIONS</span>
 +
data.addMatching(patternAction, problemAction);  <span style="color:darkgreen;">// both inputs are of type IAction</span>
 +
 
 +
 
 +
*Click on ''OK'' to return to the wizard. The added sub-matchings are displayed in the text field of the event section.
 +
 
 +
 
 +
:[[Image:Pattern_submatchingDialog.jpg]]
 +
 
 +
 
 +
*In the option section, it can be set if all variables and events as well as all of their guards and action have to be matched. This is a condition for the correctness of the construction. If no proof obligations are generated this option should be enabled. There are situations where not all guards can be matched, e.g. if the corresponding guard in the problem event does not exist because it is implied by another guard. In this case the problem event should be adapted. But since the wizard (in the current version) has to be aborted in order to adapt the machine there is this option.
 +
 
 +
*If there are no errors in the matching the ''Next'' button is enabled to proceed to the next step.
 +
 
 +
*There is the possibility of saving and loading matchings. This is convenient if the models have to be adapted and therefore the wizard has to be closed. The matchings are stored in a file with the name of your choice and the ending ''.pat'' within the current problem project.
 +
 
 +
 
 +
 
 +
:[[Image:Pattern_loadFile.png]]
 +
 
 +
==== Checking page ====
 +
*At the moment, the checking of the sub-matchings is done by clicking the confirmation box at the bottom. The idea for a later version of the tool is to have a checker that controls the entered sub-matchings.
 +
 
 +
*If the confirmation box is ticked, the ''Next'' button is enabled to proceed to the next step.
 +
 
 +
 
 +
:[[Image:Pattern_checking.jpg]]
 +
 
 +
 
 +
==== Merging page ====
 +
 
 +
==== Renaming page ====
 +
*For every variable and every event of the pattern refinement that is copied to the generated problem refinement, a name can be chosen. For every item a name is proposed. If the pattern variable was matched with the problem, the original name within the problem machine is proposed. If the pattern event refines a matched event, the original name within the problem machine is proposed.
 +
 
 +
*Otherwise the name within the pattern refinement is proposed.
 +
 
 +
*In the case of more than one problem event being matched with the same pattern event, the pattern events can be distinguished by the name of the matched problem event in the parentheses.
 +
 
 +
*If there are no duplicate names or names that already exist in the not-matched part of the problem, the ''Next'' button is enabled to proceed to the next step.
 +
 
 +
 
 +
:[[Image:Pattern_renaming.jpg]]
 +
 
 +
==== Incorporating page ====
 +
*Enter the name for the new problem refinement machine.
 +
 
 +
*The replacement for disappearing variables have to be set. To extract this information from the gluing invariant all the invariants are listed at the top of the wizard page.
 +
 
 +
*If there is a witness in an event of the pattern refinement, this witness is used to determine the replacement of the former parameters in the extra guards and extra actions.
 +
 
 +
*It can be chosen whether the proof obligation should be generated or not.
 +
 
 +
*If all replacements are set, the ''Finish'' button is enables to start the generation of the problem refinement.
 +
 
 +
 
 +
:[[Image:Pattern_incorporation.jpg]]
 +
 
 +
 
 +
*After the generation of the problem refinement, the new machine is opened in an editor.
 +
 
 +
 
 +
:[[Image:Pattern_editor.jpg]]
 +
 
 +
[[Category:Work in progress]]
 +
[[Category:User Manual]]
 +
[[Category:plugin]]

Revision as of 15:36, 9 November 2009

User:afuerst at ETH Zurich is in charge of the Pattern plugin.


The tool can be found in the svn-trunk at location _exploratory/fuersta/ch.ethz.eventb.pattern.

An example including cheat sheet and event-b sources is available at _exploratory/fuersta/ch.ethz.eventb.pattern.example.


Introduction

The intention of Design Patterns in Event-B is to have a methodological approach to reuse former developments (referred to as patterns) in a new development (the problem at hand). With the approach evolved during the master's thesis "Design Patterns in Event-B and Their Tool Support“, the proofs of the pattern can be reused too. It was shown that for the special case of a model that does not see any context and its events do not have any parameters, the generation of a refinement of the problem at hand is correct by construction and no proof obligation needs to be generated.

The correctness of the construction relies on a correct matching of the pattern with the problem at hand. With other words, the correctness of the refinement is implied by the correctness of the matching. The correctness of the matching, on the other hand, is syntactically checked rather than proved. Syntactical checking is easier than doing proofs, especially if they have to be done manually.


Construction of a refinement following the pattern approach

Pattern overview.png


For the construction of reusing a pattern within a development to be correct (without any proof), the pattern and the development have to be matched. This means the elements of the abstract model of a pattern (pattern specification) have to be recognized in the problem at hand (hereinafter referred to as problem).


Example
On the left side is the abstract model of the pattern (pattern specification), on the right side th development where the pattern should be applied. The pattern provides a solution how to realize a communication channel for the transfer of a message. It is going to be applied for the transfer of the question in the development.


Pattern example.png


Matching

As a first step, all the variables of the pattern specification have to be matched with variables of the problem. Furthermore all the events of the pattern have to be matched with a event of the problem.


In the example the variable matching would be:
transferred → question


And the event matching:
init → init
transfer → question


Checking

The chosen matching is valid for the construction if the following checks turn out to be true. Note that this is only formally proved for models that does not see any context or having events with parameters. The proof of the correctness of the construction with general models is pending.


  • Check that the guards of each event of the pattern specification are syntactically the same as the guards of the corresponding event in the problem.
  • Check that the actions of each event of the pattern specification are syntactically the same as the actions of the corresponding event in the problem.
  • Check that no event in the problem that is not matched alters a matched variable.


Syntactically the same means for example:

a\bcmeq a+b is the same as c\bcmeq c+d, if a is matched with c, and b is matched with d.


The checks for the above example would be:
for the matching init → init
check if transferred\bcmeq 0 is syntactically the same as question\bcmeq 0
for the matching transfer → question
check if transferred\bcmeq transferred+1 is syntactically the same as question\bcmeq question+1
Note that there is no guard in the pattern event transfer. The guard question=response acts therefore as an extra guard.


As there are usually multiple guards and action in an event, the user has (at the current state of the tool) to declare which guards and actions go together.


Incorporation

Once all checks are done, the refinement of the problem is generated by merging the pattern refinement with the problem.


Here is an overview of the refinement of the pattern example:
Pattern refinement.png


The following incorporation steps have to be done:

  • Merge the variables from the pattern refinement with the not-matched variables from the problem.
  • Copy the invariants from the pattern refinement.
  • Extract the glueing invariants out of the invariants from the pattern refinement.
  • Copy all not-matched events from the problem.
  • Copy all new events from the pattern refinement.
  • Merge all events from the pattern refinement that refine a matched event with the related extra guards and extra actions from the problem event.


The extraction of the gluing invariant is needed, if a variable from the pattern specification is refined in the pattern refinement and therefore disappears. By incorporating the pattern the variable in the problem that is matched to the disappearing variable will also disappear. References to this variable in predicates and assignments in the problem have to be replaced by the expression extracted from the gluing invariants.


In the example, the variable question is matched with transferred. transferred, on the other hand, is refined by sent as it can be seen in the invariants. Therefore, all appearances of question in the problem events (e.g. event respond) have to be replaced by sent.


It might be necessary to rename some of the variables, if a variable name of the pattern refinement already exists in the problem. Renaming could also be used in general to give the variables a more meaningful name. The same applies for the event names.


In the example, the variables are renamed as follows:
sent → sent_question
channel → channel_question
received → received_question


The events are renamed as follow:
send → send_question
receive → receive_question


The result of the incorporation in the example would the be:
Pattern incorporation.png


Tool support

To support developers in using patterns, there exists a plug-in for Rodin. A first try-out version of the tool is available at the location _exploratory/fuersta/ch.ethz.eventb.pattern within the svn-trunk.


There is also an example including cheat sheet and event-b sources available. At _exploratory/fuersta/ch.ethz.eventb.pattern.example you find the package. When starting Rodin including this package you can start the cheat sheet with HelpCheat Sheets... and then selecting OtherPattern plug-in.

In the menu Pattern Example you can generate machines as an example with the one-click command Generate Machine. The machines are created using the API of the pattern plugin directly without wizard support.


For those interested in using the pattern plugin API directly rather than the wizard, the corresponding code snippets are presented at each step.


Starting the plug-in

  • The pattern wizard is started with FileNewOther... (or just clicking on the New button) and then choosing in the New dialog the Event-B Pattern wizard in section Event-B.
  • Click Next to proceed to the matching page.
Pattern startWizard.jpg


// get the Rodin Database
IRodinDB rodinDB = RodinCore.getRodinDB();

// get a data instance
IData data = DataFactory.createData();

Matching page

  • Choose the pattern and the problem project and machine. If a file was selected before starting the wizard, the tool tries to set it as problem machine.


Pattern machineMatching.jpg
// SET PROBLEM MACHINE
data.changeProblemMachine(problemMachine);  // problemMachine is of type IMachineRoot

// SET PATTERN ABSTRACT MACHINE
data.changePatternAbstractMachine(patternAbstractMachine);  // patternAbstractMachine is of type IMachineRoot


  • In the variable section, add variable matchings by choosing a pattern and a problem variable from the drop down menu and click on the Add Matching button. All matchings are listed in the text field below. A matching can be removed by selecting it and clicking on the Remove button.
// SET VARIABLE MATCHINGS
data.addMatching(patternVariable, problemVariable);  // both inputs are of type IVariable


  • In the event section, add event matchings by choosing a pattern and a problem event from the drop down menu and click on the Add Matching button. All matchings are listed in the text field below. A matchings can be removed by selecting it and clicking on the Remove button. The matching of the INITIALISATION events is set by default and cannot be removed.
// SET EVENT MATCHINGS
data.addMatching(patternEvent, problemEvent);  // both inputs are of type IEvent


  • There is a section for setting the context matchings. For each carrier set and each constant of the context seen by the pattern specification a correspondent can be entered. If there is a context seen by the problem the possible choices are listed in a drop down menu. Alternatively an expression can be entered. This might be necessary if a carrier set has to be matched with a default carrier set such as BOOL or INT. Although the tool is capable of dealing with context, it's not part of the proved construction.
// SET CONTEXT MATCHINGS
data.updateMatching(carrierSetOrConstant, "PROPOSAL");  // the first input is of type ICarrierSet or IConstant, the second input is a String


Pattern elementMatching.jpg


  • For the checking of the guards and actions, it is needed (in the current version of the tool) to declare which guard/action of the pattern event goes together with which guard/action of the corresponding problem event. This sub-matchings are set in a dialog that opens when double clicking on a existing event-matching in the text field of the event section.
  • Enter for the guards and actions the sub-matchings in the same way as done for the variables and events. Note that there is also the possibility of matching the parameters. If you use this option, be aware of the fact that, although the generation works, parameters are not part of the proved construction.
// SET PARAMETERS
data.addMatching(patternParameter, problemParameter);  // both inputs are of type IParameter

// SET GUARDS
data.addMatching(patternGuard, problemGuard);  // both inputs are of type IGuard

// SET ACTIONS
data.addMatching(patternAction, problemAction);  // both inputs are of type IAction


  • Click on OK to return to the wizard. The added sub-matchings are displayed in the text field of the event section.


Pattern submatchingDialog.jpg


  • In the option section, it can be set if all variables and events as well as all of their guards and action have to be matched. This is a condition for the correctness of the construction. If no proof obligations are generated this option should be enabled. There are situations where not all guards can be matched, e.g. if the corresponding guard in the problem event does not exist because it is implied by another guard. In this case the problem event should be adapted. But since the wizard (in the current version) has to be aborted in order to adapt the machine there is this option.
  • If there are no errors in the matching the Next button is enabled to proceed to the next step.
  • There is the possibility of saving and loading matchings. This is convenient if the models have to be adapted and therefore the wizard has to be closed. The matchings are stored in a file with the name of your choice and the ending .pat within the current problem project.


Pattern loadFile.png

Checking page

  • At the moment, the checking of the sub-matchings is done by clicking the confirmation box at the bottom. The idea for a later version of the tool is to have a checker that controls the entered sub-matchings.
  • If the confirmation box is ticked, the Next button is enabled to proceed to the next step.


Pattern checking.jpg


Merging page

Renaming page

  • For every variable and every event of the pattern refinement that is copied to the generated problem refinement, a name can be chosen. For every item a name is proposed. If the pattern variable was matched with the problem, the original name within the problem machine is proposed. If the pattern event refines a matched event, the original name within the problem machine is proposed.
  • Otherwise the name within the pattern refinement is proposed.
  • In the case of more than one problem event being matched with the same pattern event, the pattern events can be distinguished by the name of the matched problem event in the parentheses.
  • If there are no duplicate names or names that already exist in the not-matched part of the problem, the Next button is enabled to proceed to the next step.


Pattern renaming.jpg

Incorporating page

  • Enter the name for the new problem refinement machine.
  • The replacement for disappearing variables have to be set. To extract this information from the gluing invariant all the invariants are listed at the top of the wizard page.
  • If there is a witness in an event of the pattern refinement, this witness is used to determine the replacement of the former parameters in the extra guards and extra actions.
  • It can be chosen whether the proof obligation should be generated or not.
  • If all replacements are set, the Finish button is enables to start the generation of the problem refinement.


Pattern incorporation.jpg


  • After the generation of the problem refinement, the new machine is opened in an editor.


Pattern editor.jpg