Difference between pages "The Proving Perspective (Rodin User Manual)" and "Theory Plug-in"

From Event-B
(Difference between pages)
Jump to navigationJump to search
imported>Frederic
 
(Add to Theory Plug-in category)
 
Line 1: Line 1:
{{Navigation|Previous= [[The_Proof_Obligation_Explorer_(Rodin_User_Manual)|The Proof Obligation Explorer]]|Next= [[The_Mathematical_Language_(Rodin_User_Manual)|The Mathematical Language]]|Up= [[index_(Rodin_User_Manual)|User_Manual_index]]}}
+
Return to [[Rodin Plug-ins]]
{{TOCright}}
 
  
The Proving Perspective is made of a number of windows: the proof tree, the goal, the selected hypotheses, the proof control, the proof information, and the searched hypotheses. In subsequent sections, we study these windows, but before that let us see how one can load a proof.
+
See also [[Theory Release History]]
  
== Loading a Proof ==
+
The Theory plug-in provides capabilities to extend the Event-B language and the proving infrastructure in a familiar fashion to Rodin users. This page provides useful information about the plug-in and its capabilities.
  
In order to load a proof, enter the Proof Obligation window, select the project, select and expand the component, finally select the proof obligation: the corresponding proof will be loaded. As a consequence:
+
===Motivation===
 +
Up to Rodin v2.0, the mathematical language used in Event-B has been fixed. As such, it was not possible to define reusable polymorphic operators. A workaround was to define any required operators as set constructs in contexts. Originally, contexts were supposed to provide a parametrization of machines. The aforementioned limitations of the Event-B language lead to users to use contexts for purposes for which they were not intentionally devised. Examples of operators that can be useful to users include the sequence operator (which was present in classical B mathematical language) and the bag operator.
  
* the proof tree is loaded in the Proof Tree window. As we shall see in section [[The_Proving_Perspective_(Rodin_User_Manual)#The_Proof_Tree|6.2]], each node of the proof tree is associated with a sequent.
+
In Rodin v2.0, support for customised syntactic symbols was introduced. The Theory plug-in, as a result, evolved from being just a component to define rewrite rules to a versatile platform to define and validate proof and language extensions.
* In case the proof tree has some "pending" nodes (whose sequents are not discharged yet) then the sequent corresponding to the first pending node is decomposed: its goal is loaded in the Goal window (section [[The_Proving_Perspective_(Rodin_User_Manual)#Goal and Selected Hypotheses|6.3]]), whereas parts of its hypotheses (the "selected" ones) are loaded in the Selected Hypotheses window (section [[The_Proving_Perspective_(Rodin_User_Manual)#Goal and Selected Hypotheses|6.3]]).
 
* In case the proof tree has no pending node, then the sequent of the root node is loaded as explained previously.
 
  
== The Proof Tree ==
+
The latest Theory plug-in is released for Rodin v2.8.
  
=== Description of the Proof Tree ===
+
===Overview===
 +
The Theory plug-in is a Rodin extension that provides the facility to define '''''mathematical extensions''''' as well as '''''prover extensions'''''.
 +
Mathematical extensions are new operator definitions and new datatype definitions and axiomatic definitions. Operator definitions can be expression operators (e.g., ''card'') and predicate operators (e.g., ''finite''). Datatypes extensions can be used to define enumerated datatypes (e.g., ''DIRECTION'') as well as inductive datatypes (e.g., ''Tree''). Axiomatic definitions can be used to define new data types like "REAL".
  
The proof tree can be seen in the corresponding window as shown in the following screen shot:
+
The placeholder for mathematical and prover extensions is a Theory construct which looks similar to contexts and machines. A theory can include datatypes definitions, operator definitions, axiomatic definitions, inference and rewrite rules as well as polymorphic theorems. The [http://wiki.event-b.org/images/Theory_Plugin.pdf user manual] provides a guide to developing and using theories.
  
[[Image:um-0095.png|center]]
+
=== Installation & Update ===
  
Each line in the proof tree corresponds to a node which is a sequent. A line is right shifted when the corresponding node is a direct descendant of the node of the previous line. Here is an illustration of the previous tree:
+
The installation or update for the Theory plug-in is available under the main Rodin Update site (http://rodin-b-sharp.sourceforge.net/updates) under the category "Modelling Extensions". Like always, after the installation, restarting Rodin is recommended.
  
[[Image:Tree.png|center]]
+
===User Manual===
 +
The user manual is available here: [http://wiki.event-b.org/images/Theory_Plugin.pdf Theory User Manual]. Below is the presentation of the sequence theory which its description can be found in the user manual:
  
Each node is labelled with a comment explaining how it can be discharged. By selecting a node in the proof tree, the corresponding sequent is decomposed and loaded in the Goal and Selected Hypotheses windows as explained in section [[The_Proving_Perspective_(Rodin_User_Manual)#Loading a Proof|6.1]].
+
[[image:SeqTheory.png|center|thumb|1500px|'''Theory of Sequence''']]
  
=== Decoration ===
+
===Standard Library===
 +
In this section, you find a set of standard theories and some models using some of these theories.
  
The leaves of the tree are decorated with three kinds of logos:
+
The standard library of the theories is available to download:
 +
[https://sourceforge.net/projects/rodin-b-sharp/files/Theory_StdLib/StandardTheory0.1.zip/download here] for Rodin2.8 and
 +
[https://sourceforge.net/projects/rodin-b-sharp/files/Theory_StdLib/StandardTheory0.2.zip/download here] for Rodin3.1.
 +
This library includes:
 +
* BasicTheory project: including theories of BinaryTree, BoolOps, List, PEANO, SUMandPRODUCT and Seq.
 +
* RelationOrderTheory project: including theories of Connectivity, FixPoint, Relation, Well_Fondation, closure, complement and galois.
 +
* RealTheory project: including theory of Real.
  
* a green logo with a "<math>\surd </math>" in it means that this leaf is discharged,
+
Also it includes three simple Event-B models that use some of the theories:
* a red logo with a "?" in it means that this leaf is not discharged,
+
* Data project: using SUMandPRODUCT theory
* a blue logo with a "R" in it means that this leaf has been reviewed.
+
* Queue project: using Seq theory
 +
* SimpleNetwork project: using closure theory
  
Internal nodes in the proof tree are decorated in the same (but lighter) way. Note that a "reviewed" leaf is one that is not discharged yet by the prover. Instead, it has been "seen" by the user who decided to have it discharged later. Marking nodes as "reviewed" is very convenient in order to perform an interactive proof in a gradual fashion. In order to discharge a "reviewed" node, select it and prune the tree at that node (section [[The_Proving_Perspective_(Rodin_User_Manual)#Pruning|6.2.5]]): the node will become "red" again (undischarged) and you can now try to discharge it.
+
In order to keep the POs discharged, you need to install "Atelier B provers" as well.
  
=== Navigation within the Proof Tree ===
+
===Capabilities===
 +
The Theory plug-in has the following capabilities:
  
On top of the proof tree window one can see three buttons:
+
* Theory Definition:
 +
** Definition of datatypes: datatypes are defined by supplying the types on which they are polymorphic, a set of constructors one of which has to be a base constructor. Each constructor may or may not have destructors.
 +
** Definition of operators: operators can be defined as predicate or expression operators. An expression operator is an operator that "returns" an expression, an example existing operator is ''card''. A predicate operator is one that "returns" a predicate, an example existing predicate operator is ''finite''.
 +
** Definition of axiomatic definitions: axiomatic definitions are defined by supplying the types, a set of operators, and a set of axioms.
 +
** Definition of rewrite rules: rewrite rules are one-directional equalities that can be applied from left to right. The Theory plug-in can be used to define rewrite rules.
 +
** Definition of inference rules: inference rules can be used to infer new hypotheses, split a goal into sub-goals or discharge sequents.
 +
** Definition of polymorphic theorems: theorems can be defined and validated once, and can then be imported into sequents of proof obligations if a suitable type instantiation is available.
 +
** Validation of extensions: where appropriate, proof obligations are generated to ensure soundness of extensions. This includes, proof obligations for validity of inference and rewrite rules, as well as proof obligations to validate operator properties such as associativity and commutativity.
 +
*Theory Deployment: this step signifies that a theory is ready for use. Theories can be deployed after they have been optionally validated by the user. It is strongly advisable to discharge all proof obligations before deployment.
 +
Once a theory has been deployed to its designated project, all its extensions (mathematical and prover extensions) can be used in models.
  
* the "G" buttons allows you to see the goal of the sequent corresponding to the node
+
===Insider Look===
* the "+" button allows you to fully expand the proof tree
+
The Theory plug-in partially satisfies the requirements outlined in the following document:
* the "-" allows you to fully collapse the tree: only the root stays visible.
+
* [http://deploy-eprints.ecs.soton.ac.uk/80/ Abrial, Jean-Raymond and Butler, Michael and Schmalz, Matthias and Hallerstede, Stefan and Voisin, Laurent. Mathematical Extensions Proposal]
  
=== Hiding ===
+
A more accurate description of the implemented functionalities of the plug-in can be found in the following document:
 +
* [http://deploy-eprints.ecs.soton.ac.uk/251/ Michael Butler, Issam Maamria. Mathematical Extensions Summary]
  
The little triangle next to each node in the proof tree allows you to expand or collapse the subtree starting at that node.
+
The following two papers describe rewriting and well-definedness issues that has to be accounted for:
  
=== Pruning ===
+
* [http://eprints.ecs.soton.ac.uk/18269/ Issam Maamria, Michael Butler, Andrew Edmunds, and Abdolbaghi Rezazadeh. On an Extensible Rule-based Prover for Event-B, ABZ'2010.]
 +
* [http://eprints.ecs.soton.ac.uk/21221/ Issam Maamria, Michael Butler. Rewriting and Well-Definedness within a Proof System.]
  
The proof tree can be pruned from a node: it means that the subtree starting at that node is eliminated. The node in question becomes a leaf and is red decorated. This allows you to resume the proof from that node. After selecting a sequent in the proof tree, pruning can be performed in two ways:
 
  
* by right-clicking and then selecting "Prune",
+
[[Category:Plugin]]
* by pressing the "Scissors" button in the proof control window (section [[The_Proving_Perspective_(Rodin_User_Manual)#The Proof Control Window|6.4]]).
+
[[Category:User documentation]]
 
+
[[Category:Proof]]
Note that after pruning, the post-tactic (section [[The_Proving_Perspective_(Rodin_User_Manual)#The Automatic Post-tactic|6.8]]) is not applied to the new current sequent: if needed you have to press the "post-tactic" button in the Proof Control window (section [[The_Proving_Perspective_(Rodin_User_Manual)#The Proof Control Window|6.4]]). This happens in particular when you want to redo a proof from the beginning: you prune the proof tree from the root node and then you have to press the "post-tactic" button in order to be in exactly the same situation as the one delivered automatically initially.
+
[[Category:Theory Plug-in]]
 
 
When you want to redo a proof from a certain node, it might be advisable to do it after copying the tree so that in case your new proof fails you can still resume the previous situation by pasting the copied version (see next section).
 
 
 
=== Copy/Paste ===
 
 
 
By selecting a node in the proof tree and then clicking on the right key of the mouse, you can copy the part of the proof tree starting at that sequent: it can later be pasted in the same way. This allows you to reuse part of a proof tree in the same (or even another) proof.
 
 
 
== Goal and Selected Hypotheses ==
 
 
 
The "Goal" and "Selected Hypotheses" windows display the current sequent you have to prove at a given moment in the proof. Here is an example:
 
 
 
[[Image:um-0098.png|center]]
 
 
 
A selected hypothesis can be deselected by first clicking in the box situated next to it (you can click on several boxes) and then by pressing the red (-) button at the top of the selected hypothesis window:
 
 
 
[[Image:um-0099.png|center]]
 
 
 
Here is the result:
 
 
 
[[Image:um-0100.png|center]]
 
 
 
Notice that the deselected hypotheses are not lost: you can get them back by means of the Searched Hypotheses window (section [[The_Proving_Perspective_(Rodin_User_Manual)#srchhyp|6.7]]).
 
 
 
The three other buttons next to the red (-) button allow you to do the reverse operation, namely keeping some hypotheses. The (ct) button next to the goal allows you to do a proof by contradiction: pressing it makes the negation of the goal being a selected hypothesis whereas the goal becomes "false". The (ct) button next to a selected hypothesis allows you to do another kind of proof by contradiction: pressing it makes the negation of the hypothesis the goal whereas the negated goal becomes an hypothesis.
 
 
 
== Rewrite rules ==
 
 
 
Rewrite rules are applied either automatically (A) or manually (M).
 
 
 
A rule may be applied:
 
* Automatically (A), when post tactics are enabled. These rules are equivalence simplification laws.
 
* Manually (M), through an interactive command. These rules gathers non equivalence laws, definition laws, distributivity laws and derived laws.
 
 
 
Rewrite rules are applied from left to right either in the goal or in the selected hypotheses, when their ''side condition'' hold.
 
 
 
Each rule is named after the following elements:
 
 
 
* The law category: simplification law (SIMP), definition law (DEF), distributivity law (DISTRI), or else derived law (DERIV).
 
* Particularity on terminal elements of the left part of the rule (optional): special element (SPECIAL) such as the empty-set, type expression (TYPE), same element occurring more then once (MULTI), literal (LIT). A type expression is either a basic type (<math>\intg, \Bool</math>, any carrier set), or <math>\pow</math>(type expression), or type expression<math>\cprod</math>type expression.
 
* One or more elements describing from top to down the left part of the rule, eg. predicate AND, expression BUNION.
 
* Detail to localize those elements (optional): left (L), right (R).
 
 
 
Rewrite rules having an equivalence operator in their left part may also describe other rules. eg: the rule:
 
 
 
<math>  \True  = \False  \;\;\defi\;\;  \bfalse </math>
 
 
 
should also produce the rule:
 
 
 
<math>  \False  = \True  \;\;\defi\;\;  \bfalse </math>
 
 
 
 
 
For associative operators in connection with distributive laws as in:
 
 
 
<center><math> P \land (Q \lor \ldots \lor R) </math></center>
 
 
 
it has been decided to put the "button" on the first associative/commutative operator (here <math>\lor </math>). Pressing that button will generate a menu: the first option of this menu will be to distribute all associative/commutative operators, the second option will be to distribute only the first associative/commutative operator. In the following presentation, to simplify matters, we write associative/commutative operators with two parameters only, but it must always be understood implicitly that we have a sequence of them. For instance, we shall never write <math> Q \lor \ldots \lor R </math> but <math> Q \lor R </math> instead. Rules are sorted according to their purpose.
 
 
 
 
 
Rewrite rules are split into:
 
 
 
* [[Set Rewrite Rules]]
 
* [[Relation Rewrite Rules]]
 
* [[Arithmetic Rewrite Rules]]
 
 
 
They are also available in a single large page [[All Rewrite Rules]].
 
 
 
== The Proof Control Window ==
 
 
 
The Proof Control window contains the buttons which you can use to perform an interactive proof. Next is a screen shot where you can see successively from top to bottom:
 
 
 
* some selected hypotheses,
 
* the goal,
 
* the "Proof Control" window,
 
* a small editing area within which you can enter parameters used by some buttons of the Proof Control window
 
* the smiley (section [[The_Proving_Perspective_(Rodin_User_Manual)#The Simley|6.5]])
 
 
 
[[Image:um-0101.png|center]]
 
 
 
The Proof Control window offers a number of buttons which we succinctly describe from left to right:
 
 
 
* (p0): the prover PP attempts to prove the goal (other cases in the list)
 
* (R) review: the user forces the current sequent to be discharged, it is marked as being reviewed (it’s logo is blue-colored)
 
* (dc) proof by cases: the goal is proved first under the predicate written in the editing area and then under its negation,
 
* (ah) lemma: the predicate in the editing area is proved and then added as a new selected hypothesis,
 
* (ae) abstract expression: the expression in the editing area is given a fresh name,
 
* the auto-prover attempts to discharge the goal. The auto-prover is the one which is applied automatically on all proof obligations (as generated automatically by the proof obligation generator after a "save") without any intervention of the user. With this button, you can call yourself the auto-prover within an interactive proof.
 
* the post-tactic is executed (see section [[The_Proving_Perspective_(Rodin_User_Manual)#The Automatic Post-tactic|6.8]]),
 
* lasso: load in the Selected Hypotheses window those unseen hypotheses containing identifiers which are common with identifiers in the goal and selected hypotheses,
 
* backtrack form the current node (i.e., prune its parent),
 
* scissors: prune the proof tree from the node selected in the proof tree,
 
* show (in the Search Hypotheses window) hypotheses containing the character string as in the editing area,
 
* show the Cache Hypotheses window,
 
* load the previous non-discharged proof obligation,
 
* load the next undischarged proof obligation,
 
* (i) show information corresponding to the current proof obligation in the corresponding window. This information correspond to the elements that took directly part in the proof obligation generation (events, invariant, etc.),
 
* goto the next pending node of the current proof tree,
 
* load the next reviewed node of the current proof tree.
 
 
 
== The Smiley ==
 
 
 
The smiley can take three different colors: (1) red, meaning that the proof tree contains one or more non-discharged sequents, (2) blue, meaning that all non-discharged sequents of the proof tree have been reviewed, (3) green, meaning that all sequents of the proof tree are discharged.
 
 
 
== The Operator "Buttons" ==
 
 
 
In the goal and in the selected, searched, or cache hypotheses some operators are colored in red. It means that they are "buttons" you can press. When doing so, the meaning (sometimes several) is shown in a menu where you can select various options. The operation performed by these options is described in sections [[The_Proving_Perspective_(Rodin_User_Manual)#Interactive Rewrite Rules|6.9.1]] and [[The_Proving_Perspective_(Rodin_User_Manual)#Interactive Inference Rules|6.9.2]].
 
 
 
== The Search Hypotheses Window ==
 
 
 
A window is provided which contains the hypotheses having a character string in common with the one in the editing area. For example, if we search for hypotheses involving the character string "cr", then after pressing the "search hypothesis" button in the proof control window, we obtain the following:
 
 
 
[[Image:um-0102.png|center]]
 
 
 
Such hypotheses can be moved to the "Selected Hypotheses" window (button (+)) or removed from the "Search Hypotheses" window (button (-)). As for the selected hypotheses, other buttons situated next to the previous ones, allow you to move or remove all hypotheses. By pressing the (ct) button the negation of the corresponding hypothesis becomes the new goal.
 
 
 
== The Automatic Post-tactic ==
 
 
 
In this section, we present the various rewrite or inference rules which are applied automatically as a systematic post-tactic after each proof step. Note that the post-tactic can be disabled by using the "'''P'''<math>\! \! \! \! /</math>" button situated on the right of the proof control window.
 
 
 
The post-tactic is made of two different rules: rewrite rules, which are applied on any sub-formula of the goal or selected hypotheses (section [[The_Proving_Perspective_(Rodin_User_Manual)#Rewrite Rules|6.8.1]]) and inference rules which are applied on the current sequent (section [[The_Proving_Perspective_(Rodin_User_Manual)#Automatic Inference Rules|6.8.2]]).
 
 
 
 
 
 
 
=== Automatic Inference Rules ===
 
 
 
The following inference rules are ''applied automatically'' in a systematic fashion at the end of each proof step. They have the following possible effects:
 
 
 
* they discharge the goal,
 
* they simplify the goal and add a selected hypothesis,
 
* they simplify the goal by decomposing it into several simpler goals,
 
* they simplify a selected hypothesis,
 
* they simplify a selected hypothesis by decomposing it into several simpler selected hypotheses.
 
 
 
<br />
 
 
 
'''Axioms'''
 
 
 
<center>
 
{{InfRule|HYP|<math>\frac{}{\textbf{H},\textbf{P} \;\;\vdash \;\; \textbf{P}}</math>}}
 
{{InfRule|HYP_OR|<math>\frac{}{\textbf{H},\textbf{Q} \;\;\vdash \;\;
 
\textbf{P} \lor \ldots \lor  \textbf{Q} \lor \ldots \lor \textbf{R}}</math>}}
 
{{InfRule|CNTR|<math>\frac{}{\textbf{H},\;\textbf{P},\;\neg\,\textbf{P} 
 
\;\;\vdash \;\; \textbf{Q}}</math>}}
 
{{InfRule|FALSE_HYP|<math>\frac{}{\textbf{H},\bfalse \;\;\vdash \;\; \textbf{P}}</math>}}
 
{{InfRule|TRUE_GOAL|<math>\frac{}{\textbf{H} \;\;\vdash \;\; \btrue}</math>}}
 
</center>
 
 
 
 
 
'''Simplification'''
 
 
 
<center>
 
 
 
{{InfRule|DBL_HYP|<math>\frac{\textbf{H},\;\textbf{P} \;\;\vdash \;\;
 
\textbf{Q}}{\textbf{H},\;\textbf{P},\;\textbf{P}  \;\;\vdash \;\;
 
\textbf{Q}}</math>}}
 
</center>
 
 
 
'''Conjunction'''
 
<center>
 
{{InfRule|AND_L|<math>\frac{\textbf{H},\textbf{P},\textbf{Q} \; \; \vdash \;
 
\;  \textbf{R}}{\textbf{H},\; \textbf{P} \land \textbf{Q} \; \; \vdash \; \; 
 
\textbf{R}}</math>}}
 
{{InfRule|AND_R|<math>\frac{\textbf{H} \; \;
 
\vdash \; \;  \textbf{P} \qquad \textbf{H} \; \; \vdash \; \; 
 
\textbf{Q}}{\textbf{H} \; \; \vdash \; \;  \textbf{P} \; \land \; 
 
\textbf{Q}}</math>}}
 
</center>
 
 
 
'''Implication'''
 
<center>
 
{{InfRule|IMP_L1|<math>\frac{\textbf{H},\; \textbf{Q},\; \textbf{P} \land \ldots \land \textbf{R} \limp \textbf{S} \;\;\vdash \;\; \textbf{T}}{\textbf{H},\; \textbf{Q},\; \textbf{P} \land \ldots \land \textbf{Q} \land \ldots \land \textbf{R} \limp \textbf{S} \;\;\vdash \;\; \textbf{T} }</math>}}
 
{{InfRule|IMP_R|<math>\frac{\textbf{H}, \textbf{P} \;\;\vdash \;\; \textbf{Q}}{\textbf{H} \;\;\vdash \;\; \textbf{P} \limp \textbf{Q}}</math>}}
 
</center>
 
 
 
 
 
<center>
 
{{InfRule|IMP_AND_L|<math>\frac{\textbf{H},\textbf{P} \limp \textbf{Q},  \textbf{P} \limp \textbf{R}\;\;\vdash \;\; \textbf{S}}{\textbf{H},\;\textbf{P} \limp  \textbf{Q} \land \textbf{R}  \;\;\vdash \;\; \textbf{S}}</math>}}
 
{{InfRule|IMP_OR_L|<math>\frac{
 
\textbf{H},\textbf{P} \limp \textbf{R},  \textbf{Q} \limp \textbf{R}\;\;\vdash \;\; \textbf{S}
 
}{
 
\textbf{H},\;\textbf{P} \lor  \textbf{Q} \limp \textbf{R}  \;\;\vdash \;\; \textbf{S}
 
}</math>}}
 
</center>
 
 
 
'''Negation'''
 
 
 
<center>
 
{{InfRule| |<math>\frac{\textbf{H},\; E \in \{ a,\ldots , c\}  \; \; \vdash \; \;  \; \;  \textbf{P} }{\textbf{H},\; E \in \{ a,\ldots , b, \ldots , c\} , \neg \, (E=b) \; \; \vdash \; \;  \textbf{P} }</math>}}
 
{{InfRule| |<math>\frac{\textbf{H},\; E \in \{ a,\ldots , c\}  \; \; \vdash \; \;  \; \;  \textbf{P} }{\textbf{H},\; E \in \{ a,\ldots , b, \ldots , c\} , \neg \, (b=E) \; \; \vdash \; \;  \textbf{P} }</math>}}
 
</center>
 
 
 
'''Quantification'''
 
 
 
<!-- template
 
{{InfRule||<math>\frac{}{}</math>}}
 
-->
 
 
 
<center>
 
{{InfRule|XST_L|<math>\frac{\textbf{H},\;  \textbf{P(x)} \; \; \vdash \; \;  \textbf{Q}
 
}{
 
\textbf{H},\;  \exists \, \textbf{x}\, \qdot\, \textbf{P(x)} \; \; \vdash \; \;  \textbf{Q}
 
}</math>}}
 
'''x''' not free in '''H''' and  '''Q'''
 
 
 
{{InfRule|ALL_R|<math>\frac{\textbf{H}\; \; \vdash \; \;  \textbf{P(x)}
 
}{
 
\textbf{H} \; \; \vdash \; \;  \forall \textbf{x}\, \qdot\, \textbf{P(x)}
 
}</math>}}
 
'''x''' not free in '''H''' and '''Q'''
 
</center>
 
 
 
'''Equality'''
 
 
 
<center>
 
{{InfRule| EQL\_ LR|<math>\frac{\textbf{H(E)} \; \; \vdash \; \;  \; \;  \textbf{P(E)} }{\textbf{H(x)},\; x=E \; \; \vdash \; \;  \textbf{P(x)} }</math>}}
 
{{InfRule| EQL\_ RL|<math>\frac{\textbf{H(E)} \; \; \vdash \; \;  \; \;  \textbf{P(E)} }{\textbf{H(x)},\; E=x \; \; \vdash \; \;  \textbf{P(x)} }</math>}}
 
</center>
 
 
 
In these two rules <math>x</math> is a variable which is not free in <math>E</math>
 
 
 
=== Preferences for the Post-tactic ===
 
 
 
The post-tactic can be configured by means of a preference page which can be obtained as follows: press the "Window" button on the top tooolbar. On the coming menu, press the "Preferences" button. On the coming menu, press the "Event-B" menue, then the "Sequent Prover’, and finally the "Post-Tactic" button. This yilds the following window:
 
 
 
[[Image:um-0147.png|center]]
 
 
 
In the left part you can see the ordered sequence of individual tactics composing the post-tactic, whereas the right part contains further tactics you can incorporate in the left part. By selecting a tactic you can move it from on part to the other or change the order in the left part.
 
 
 
== Interactive Tactics ==
 
 
 
In this section, the rewrite rules and inference rules, which you can use to perform an interactive proof, are presented. Each of these rules can be invoked by pressing "buttons" which corresponds to emphasized (red) operators in the goal or the hypotheses. A menu is proposed when there are several options.
 
 
 
=== Interactive Rewrite Rules ===
 
 
 
Most of the rewrite rules correspond to distributive laws. For associative operators in connection with such laws as in:
 
 
 
<center><math>
 
P \land (Q \lor \ldots \lor R)
 
</math></center>
 
 
 
it has been decided to put the "button" on the first associative/commutative operator (here <math>\lor </math>). Pressing that button will generate a menu: the first option of this menu will be to distribute all associative/commutative operators, the second option will be to distribute only the first associative/commutative operator. In the following presentation, to simplify matters, we write associative/commutative operators with two parameters only, but it must always be understood implicitly that we have a sequence of them. For instance, we shall never write <math> Q \lor \ldots \lor R </math> but <math> Q \lor R </math> instead. Rules are sorted according to their purpose.
 
 
 
<br />
 
 
 
'''Conjunction'''
 
 
 
<center><math>
 
\begin{array}{l} P \land (Q \lor R) \; \; ==\; \;  (P \land Q) \lor (P \land R) \end{array}
 
</math></center>
 
 
 
'''Disjunction'''
 
 
 
 
 
<!--
 
%\hbox{\bf canceled} \ \ \ \ \ \ P \lor \ldots \lor  Q \lor \ldots \land
 
\fbox{R} \lor \ldots \lor S \;\;==\;\; %P \lor \ldots \lor  Q \lor R \land
 
\ldots \lor S \\ \\
 
%\hbox{\bf canceled} \ \ \ \ \ \ P \lor \ldots \lor \fbox{Q}  \lor \ldots \lor R \;\;==\;\;
 
%\neg\, Q \;\limp\; P \lor \ldots \lor  R  \\ \\
 
-->
 
<center><math>
 
\begin{array}{l}
 
P \lor (Q \land R) \;\;==\;\; (P \lor Q) \land (P \lor R) \\ \\
 
P \lor Q \lor \ldots \lor R \;\;==\;\; \neg\, P \limp (Q \lor \ldots \lor R)
 
\end{array}
 
</math></center>
 
 
 
'''Implication'''
 
 
 
<center><math>
 
\begin{array}{l}
 
P \limp Q \;\;==\;\; \neg\,Q \limp \neg P \\ \\
 
P \limp (Q \limp R) \;\;==\;\; P \land Q \limp R \\ \\
 
P \limp (Q \land R) \;\;==\;\; (P \limp Q) \;\land\;  (P \limp R) \\ \\
 
P \lor Q \;\limp\; R\;\;==\;\; (P \limp R)  \;\land\;  (Q \limp R)
 
\end{array}
 
</math></center>
 
<!--
 
%\hbox{\bf canceled} \ \ \ \ \ \ P \limp (Q \lor \ldots \lor \fbox{R} \lor
 
\ldots \lor S) \;\;==\;\; P \land \neg\,R \;\limp\; (Q \lor \ldots \lor S) \\
 
\\
 
-->
 
 
 
'''Equivalence'''
 
 
 
<center><math>
 
\begin{array}{l}
 
P \leqv Q \;\;==\;\; (P \limp Q) \;\land\; (Q \limp P)
 
\end{array}
 
</math></center>
 
 
 
'''Negation'''
 
 
 
<center><math>
 
\begin{array}{l}
 
\neg\,(P \land Q) \;\;==\;\; \neg\,P \lor \neg\,Q \\ \\
 
\neg\,(P \lor Q) \;\;==\;\; \neg\,P \land \neg\,Q \\ \\
 
\neg\,(P \limp Q)\;\;==\;\; P \land \neg\,Q \\ \\
 
\neg\,\forall x \,\qdot\, P \;\;==\;\; \exists x \,\qdot\, \neg\,P \\ \\
 
\neg\,\exists x \,\qdot\, P \;\;==\;\; \forall x \,\qdot\, \neg\,P \\ \\
 
\neg \,(S = \emptyset) \;\;==\;\; \exists x \,\qdot\, x \in S
 
\end{array}
 
</math></center>
 
 
 
'''Set Theory'''
 
 
 
Most of the rules are concerned with simplifying set membership predicates.
 
 
 
<center><math>
 
\begin{array}{l}
 
E \mapsto F \;\in\; S \cprod T \;\;==\;\; E \in S \;\land\; F \in T \\ \\
 
E \in \pow(S) \;\;==\;\; E \subseteq S \\ \\
 
S \subseteq T \;\;==\;\; \forall x\,\qdot\,(\, x\in S \;\limp\; x \in T\,)
 
\end{array}
 
</math></center>
 
 
 
In the previous rule, <math>x</math> denotes several variables when the type of <math>S</math> and <math>T</math> is a Cartesian product.
 
 
 
<center><math>
 
\begin{array}{l}
 
E \in S \bunion T \;\;==\;\; E \in S \;\lor\; E \in T \\ \\
 
E \in S \binter T \;\;==\;\; E \in S \;\land\; E \in T \\ \\
 
E \in S \setminus T \;\;==\;\; E \in S \;\land\; \neg\, (E \in T) \\ \\
 
E \in \{A, \ldots, B\} \;\;\;==\;\;\; E=A \;\lor\;  \ldots \;\lor\; E=B \\ \\
 
E \in \union\,(S)\;\;==\;\; \exists s \,\qdot\, s \in S \;\land\; E \in s \\ \\
 
\;E \in (\Union\; x \,\qdot\,x \in S \;\land\; P\;|\; T\,) \;\;==\;\; \exists x \,\qdot\,x \in S \;\land\; P \;\land\; E \in T \\ \\
 
\;E \;\in\;  \inter\,(S) \;\;==\;\;  \forall s \,\qdot\, s \in S \;\limp\; E \in s \\ \\
 
\;E \;\in\;  (\Inter\; x \,\qdot \,x \in S \;\land\; P\;|\; T\,)\;\;==\;\;    \forall x \,\qdot\,x \in S \;\land\; P \;\limp\; E \in T \\ \\
 
E \in \dom(r)\;\;==\;\; \exists y \,\qdot \, E \mapsto y \;\in\; r \\ \\
 
F \in \ran(r) \;\;==\;\;\exists x \,\qdot \, x \mapsto F \;\in\; r \\ \\
 
E \mapsto F \in r^{-1}\;\;==\;\;  F \mapsto E \in r
 
\\ \\
 
E \mapsto F \;\in\; S \domres r \;\;==\;\; E \in S \;\;\land\;\;  E \mapsto F \in r  \\ \\
 
E \mapsto F \;\in\; r \ranres T \;\;==\;\;  E \mapsto F \in r \;\;\land\;\; F \in T  \\ \\
 
E \mapsto F \;\in\; S \domsub r \;\;==\;\; E \notin S \;\;\land\;\;  E \mapsto F \in r \\ \\
 
E \mapsto F \;\in\; r \ransub T\;\;==\;\;  E \mapsto F \in r \;\;\land\;\; F \notin T \\ \\
 
F \in r[w]\;\;==\;\; \exists x \,\qdot\,  x \in w \;\;\land\;\;  x \mapsto F \in r \\ \\
 
E \mapsto F \in (p \fcomp q)\;\;==\;\; \exists x \,\qdot \, E \mapsto x \in p \;\;\land\;\;  x \mapsto F \in q \\ \\
 
p \ovl q\;\;==\;\; (\dom\,(q) \domsub p) \;\bunion\; q \\ \\
 
E \mapsto F \in \id(S)\;\;==\;\; E \in S  \;\;\land\;\; F=E \\ \\
 
E \mapsto (F \mapsto G)  \in p \dprod q\;\;==\;\; E \mapsto F \in p \;\;\land\;\; E \mapsto G \in q \\ \\
 
(E \mapsto G) \mapsto (F \mapsto H)  \in p \pprod q\;\;==\;\; E \mapsto F \in p \;\;\land\;\; G \mapsto H \in q \\ \\
 
r \in S \trel T \;\;==\;\; r \in S \rel T \;\land\; \dom(r) = S \\ \\
 
r \in S \srel T \;\;==\;\; r \in S \rel T \;\land\; \ran(r) = T \\ \\
 
r \in S \strel T \;\;==\;\; r \in S \rel T \;\land\;  \dom(r) = S \;\land\; \ran(r) = T
 
\\ \\
 
f \in S \pfun T \;\;==\;\; f \in S \rel T \;\land\; \forall x,y,z \qdot x\mapsto y \in f \;\land\; x \mapsto z  \in f \;\limp\; y=z \\ \\
 
f \in S \tfun T \;\;==\;\; f \in S \pfun T \;\land\; \dom(f)=S \\ \\
 
f \in S \pinj T \;\;==\;\; f \in S \pfun T \;\land\; f^{-1} \in T \pfun S
 
\end{array}
 
</math></center><center><math>
 
\begin{array}{l}
 
f \in S \tinj T \;\;==\;\; f \in S \pinj T \;\land\; \dom(f) = S \\ \\
 
f \in S \psur T \;\;==\;\; f \in S \pfun T \;\land\; \ran(f) = T  \\ \\
 
f \in S \tsur T \;\;==\;\; f \in S \psur T \;\land\; \dom(f) = S\\ \\
 
f \in S \tbij T \;\;==\;\; f \in S \tinj T \;\land\; \ran(f)=T \\ \\
 
(p \bunion q)^{-1} \;\;==\;\; p^{-1} \bunion q^{-1} \\ \\
 
(p \binter q)^{-1} \;\;==\;\; p^{-1} \binter q^{-1} \\ \\
 
(s \domres r)^{-1} \;\;==\;\; r^{-1} \ranres s \\ \\
 
(s \domsub r)^{-1} \;\;==\;\; r^{-1} \ransub s \\ \\
 
(r \ranres s)^{-1} \;\;==\;\; s \domres r^{-1} \\ \\
 
(r \ransub s)^{-1} \;\;==\;\; s \domres r^{-1} \\ \\
 
(p \fcomp q)^{-1} \;\;==\;\; q^{-1} \fcomp p^{-1} \\ \\
 
(s \bunion t) \domres r \;\;==\;\; (s \domres r) \bunion (t \domres r) \\ \\
 
(s \binter t) \domres r \;\;==\;\; (s \domres r) \binter (t \domres r) \\ \\
 
(s \bunion t) \domsub r \;\;==\;\; (s \domsub r) \binter (t \domsub r) \\ \\
 
(s \binter t) \domsub r \;\;==\;\; (s \domsub r) \bunion (t \domsub r) \\ \\
 
s \domres (p \bunion q) \;\;==\;\; (s \domres p) \bunion (s \domres q) \\ \\
 
s \domres (p \binter q) \;\;==\;\; (s \domres p) \binter (s \domres q) \\ \\
 
s \domsub (p \bunion q) \;\;==\;\; (s \domsub p) \bunion (s \domsub q) \\ \\
 
s \domsub (p \binter q) \;\;==\;\; (s \domsub p) \binter (s \domsub q) \\ \\
 
r \ranres (s \bunion t) \;\;==\;\; (r \ranres s) \bunion (r \ranres t) \\ \\
 
r \ranres (s \binter t) \;\;==\;\; (r \ranres s) \binter (r \ranres t) \\ \\
 
r \ransub (s \bunion t) \;\;==\;\; (r \ransub s) \binter (r \ransub t) \\ \\
 
r \ransub (s \binter t) \;\;==\;\; (r \ransub s) \bunion (r \ransub t) \\ \\
 
(p \bunion q) \ranres s \;\;==\;\; (p \ranres s) \bunion (q \ranres s) \\ \\
 
(p \binter q) \ranres s \;\;==\;\; (p \ranres s) \binter (q \ranres s) \\ \\
 
(p \bunion q) \ransub s \;\;==\;\; (p \ransub s) \bunion (q \ransub s) \\ \\
 
(p \binter q) \ransub s \;\;==\;\; (p \ransub s) \binter (q \ransub s) \\ \\
 
r[S \bunion T] \;\;==\;\; r[S] \bunion r[T]
 
\end{array}
 
</math></center><center><math>
 
\begin{array}{l}
 
(p \bunion q)[S] \;\;==\;\; p[S] \bunion q[S] \\ \\
 
\dom(p \bunion q) \;\;==\;\; \dom(p) \bunion \dom(q) \\ \\
 
\ran(p \bunion q) \;\;==\;\; \ran(p) \bunion \ran(q) \\ \\
 
S \subseteq T \;\;==\;\; (U \setminus T) \subseteq (U \setminus S)
 
\end{array}
 
</math></center>
 
 
 
In the previous rule, the type of <math>S</math> and <math>T</math> is
 
<math>\pow(U)</math>.
 
 
 
<center><math>
 
\begin{array}{l} S = T \; \; ==\; \;  S \subseteq T \; \land \;  T \subseteq S \end{array}
 
</math></center>
 
 
 
In the previous rule, <math>S</math> and <math>T</math> are sets
 
 
 
<center><math>
 
\begin{array}{l}
 
S \;\subseteq\; A \setminus B \;\;==\;\; S \subseteq A \;\,\land\;\, S \binter B = \emptyset  \\ \\
 
p \fcomp (q \bunion r) \;\;==\;\; (p \fcomp q) \bunion (p \fcomp r) \\ \\
 
(q \bunion r) \fcomp p \;\;==\;\; (q \fcomp p) \bunion (r \fcomp p) \\ \\
 
(p \fcomp q)[s] \;\;==\;\; q[p[s]] \\ \\
 
(s \domres p) \fcomp q \;\;==\;\; s \domres (p \fcomp q)  \\ \\
 
(s \domsub p) \fcomp q \;\;==\;\; s \domsub (p \fcomp q)  \\ \\
 
p \fcomp (q \ranres s) \;\;==\;\; (p \fcomp q) \ranres s  \\ \\
 
p \fcomp (q \ransub s) \;\;==\;\; (p \fcomp q) \ransub s \\ \\
 
U \setminus (S \binter T) \;\;==\;\; (U\setminus S) \bunion (U \setminus T) \\ \\
 
U \setminus (S \bunion T) \;\;==\;\; (U\setminus S) \binter (U \setminus T) \\ \\
 
U \setminus (S \setminus T) \;\;==\;\; (U\setminus S) \bunion T \\ \\
 
\end{array}
 
</math></center>
 
 
 
In the three previous rules, <math>S</math> and <math>T</math> are supposed to
 
be of type <math>\pow(U)</math>.
 
 
 
'''Cardinality'''
 
 
 
<center><math>
 
\begin{array}{l}
 
\card\,(S) \leq \card(T) \;\;==\;\; S \subseteq T \\ \\
 
\card\,(S) \geq \card(T) \;\;==\;\; T \subseteq S \\ \\
 
\card\,(S) < \card(T) \;\;==\;\; S \subset T \\ \\
 
\card\,(S) > \card(T) \;\;==\;\; T \subset S \\ \\
 
\card\,(S) = \card(T) \;\;==\;\; S = T
 
\end{array}
 
</math></center>
 
 
 
In the five previous rules, <math>S</math> and <math>T</math> must be of the same type.
 
 
 
=== Interactive Inference Rules ===
 
 
 
'''Disjunction'''
 
 
 
<center>
 
{{InfRule| CASE|<math>\frac{\textbf{H}, \; \textbf{P} \; \; \vdash \; \;  \textbf{R} \  \  \  \  \ldots \  \  \  \  \textbf{H}, \; \textbf{Q} \; \; \vdash \; \;  \textbf{R} }{\textbf{H},\; \textbf{P} \lor \ldots \lor \textbf{Q} \; \; \vdash \; \;  \textbf{R} }</math>}}
 
</center>
 
 
 
'''Implication'''
 
 
 
<center>
 
{{InfRule| MH|<math>\frac{\textbf{H} \;\;\vdash\;\;\textbf{P} \qquad \textbf{H},\;\textbf{P},\; \textbf{Q} \;\;\vdash \;\; \textbf{R} }{\textbf{H},\;\textbf{P} \limp \textbf{Q} \;\;\vdash \;\; \textbf{R} \ \ \ \ \ }</math>}}
 
{{InfRule| HM|<math>\frac{\textbf{H} \;\;\vdash\;\;\neg\,\textbf{Q} \qquad \textbf{H},\;\neg\,\textbf{Q},\; \neg\,\textbf{P} \;\;\vdash \;\; \textbf{R} }{\textbf{H},\;\textbf{P} \limp \textbf{Q} \;\;\vdash \;\; \textbf{R} \ \ \ \ \ }</math>}}
 
</center>
 
 
 
'''Equivalence'''
 
 
 
<center>
 
{{InfRule| EQV}|<math>\frac{\textbf{H(Q)}, \textbf{P} \leqv \textbf{Q}
 
\;\;\vdash\;\; \textbf{G(Q)}}{\textbf{H(P)},\;\textbf{P} \leqv \textbf{Q}
 
\;\;\vdash \;\; \textbf{G(P)} \ \ \ \ \ }</math>}} '''postponed'''
 
</center>
 
 
 
'''Set Theory'''
 
 
 
<center>
 
{{InfRule|OV_L|<math>\frac{\textbf{H},\; G=E 
 
,\;\textbf{P}(F)\;\;\vdash\;\;\textbf{Q} \qquad \textbf{H},\; \neg\,(G=E) 
 
,\;\textbf{P}(f(G))\;\;\vdash\;\;\textbf{Q}}{\textbf{H},\;\textbf{P}((f\ovl\{E
 
\mapsto F\})(G)) \;\;\vdash \;\; \textbf{Q}}</math>}}
 
{{InfRule| OV_R|<math>\frac{\textbf{H},\; G=E \;\;\vdash\;\;\textbf{Q}(F)
 
\qquad \textbf{H},\; \neg\,(G=E)  \;\;\vdash\;\;\textbf{Q}(f(G))}{\textbf{H}
 
\;\;\vdash \;\; \textbf{Q}((f\ovl\{E \mapsto F\})(G)) \ \ \ \ \ }</math>}}
 
{{InfRule| OV_L|<math>\frac{\textbf{H},\; G \in \dom(g)  ,\;\textbf{P}(g(G))\;\;\vdash\;\;\textbf{Q} \qquad \textbf{H},\; \neg\,G \in \dom(g)  ,\;\textbf{P}(f(G))\;\;\vdash\;\;\textbf{Q}}{\textbf{H},\;\textbf{P}((f\ovl g)(G)) \;\;\vdash \;\; \textbf{Q} \ \ \ \ \ }</math>}}
 
{{InfRule| OV_R|<math>\frac{\textbf{H},\; G \in \dom(g) \;\;\vdash\;\;\textbf{Q}(g(G)) \qquad \textbf{H},\; \neg\, G \in \dom(g) \;\;\vdash\;\;\textbf{Q}(f(G))}{\textbf{H} \;\;\vdash \;\; \textbf{Q}((f\ovl g)(G)) \ \ \ \ \ }</math>}}
 
</center>
 
 
 
In the four previous rules the <math>\ovl</math> operator must appear at the
 
"top level"
 
 
 
<center>
 
{{InfRule| <math>\binter</math>DIS_R|<math>\frac{\textbf{H} \;\;\vdash\;\; f^{-1} \in A \pfun B    \qquad\textbf{H} \;\;\vdash\;\;\textbf{Q}(f[S] \binter f[T]) }{\textbf{H} \;\;\vdash \;\; \textbf{Q}(f[S \binter T]) \ \ \ \ \ }</math>}}
 
</center>
 
<center>
 
{{InfRule| <math>\setminus</math>DIS_R|<math>\frac{\textbf{H} \;\;\vdash\;\; f \in A \pfun B    \qquad\textbf{H} \;\;\vdash\;\;\textbf{Q}(f^{-1}[S] \setminus f^{-1}[T]) }{\textbf{H} \;\;\vdash \;\; \textbf{Q}(f^{-1}[S \setminus T]) \ \ \ \ \ }</math>}}
 
</center>
 
 
 
In the two previous rules, the occurrence of <math>f^{-1}</math> must appear at the "top level". Moreover <math>A</math> and <math>B</math> denote some type. Similar left distribution rules exist
 
 
 
<center>
 
{{InfRule| SIM_R|<math>\frac{\textbf{H} \; \; \vdash \; \; {WD}(\textbf{Q}(\{
 
    f(E)\} )) \qquad\textbf{H} \; \; \vdash \; \; \textbf{Q}(\{ f(E)\} )
 
    }{\textbf{H} \; \; \vdash \; \;  \textbf{Q}(f[\{ E\} ])} </math>}}
 
</center>
 
 
 
In the previous rule, the occurrence of <math>f</math> must appear at the "top level". A similar left simplification rule exists.
 
 
 
<center>
 
{{InfRule| SIM_R|<math>\frac{\textbf{H} \;\;\vdash\;\;{WD}(\textbf{Q}(g(f(x))))    \qquad\textbf{H} \;\;\vdash\;\;\textbf{Q}(g(f(x))) }{\textbf{H} \;\;\vdash \;\; \textbf{Q}((f \fcomp g)(x)) \ \ \ \ \ }</math>}}
 
</center>
 
 
 
In the previous rule, the occurrence of <math>f \fcomp g</math> must appear at
 
the "top level". A similar left simplification rule exists.
 
 
 
'''Finiteness'''
 
 
 
<center>
 
{{InfRule| fin<math>\subseteq</math>_R|<math>\frac{\textbf{H} \;\;\vdash \;\; S \subseteq T \qquad; \textbf{H} \;\;\vdash \;\; \finite\,(T)}{\textbf{H} \;\;\vdash \;\; \finite\,(S) \ \ \ \ \ \ \ }</math>}}
 
</center>
 
 
 
For applying the previous rule, the user has to write the set corresponding to <math>T</math> in the editing area of the Proof Control Window.
 
 
 
<center>
 
{{InfRule|fin<math>\binter</math>_R|<math>\frac{\textbf{H} \;\;\vdash
 
\;\;\finite\,(S) \;\lor\;\ldots \;\lor\; \finite\,(T)}{\textbf{H} \;\;\vdash
 
\;\; \finite\,(S \;\binter\;\ldots \;\binter\; T)}</math>}}
 
</center>
 
<center>
 
{{InfRule| fin<math>\setminus</math>_R|<math>\frac{\textbf{H} \;\;\vdash
 
\;\;\finite\,(S)}{\textbf{H} \;\;\vdash \;\; \finite\,(S \;\setminus\; T) \ \
 
\ \ \ \ \ }</math>}}
 
{{InfRule|fin_rel_R|<math>\frac{\textbf{H} \;\;\vdash \;\; r \;\in\; S \rel T
 
\qquad \textbf{H} \;\;\vdash \;\; \finite\,(S) \qquad \textbf{H} \;\;\vdash
 
\;\; \finite\,(T)}{\textbf{H} \;\;\vdash \;\; \finite\,(r)}</math>}}
 
</center>
 
 
 
For applying the previous rule, the user has to write the set corresponding to
 
<math>S \rel T</math> in the editing area of the Proof Control Window.
 
 
 
<center>
 
{{InfRule| fin_rel_img_R|<math>\frac{\textbf{H} \;\;\vdash \;\; \finite\,(r) }{\textbf{H} \;\;\vdash \;\; \finite\,(r[s]) \ \ \ \ \ \ \ }</math>}}
 
{{InfRule| fin_rel_ran_R|<math>\frac{\textbf{H} \;\;\vdash \;\; \finite\,(r) }{\textbf{H} \;\;\vdash \;\; \finite\,(\ran(r)) \ \ \ \ \ \ \ }</math>}}
 
{{InfRule| fin_rel_dom_R|<math>\frac{\textbf{H} \;\;\vdash \;\; \finite\,(r) }{\textbf{H} \;\;\vdash \;\; \finite\,(\dom(r)) \ \ \ \ \ \ \ }</math>}}
 
{{InfRule| fin_fun1_R|<math>\frac{\textbf{H} \;\;\vdash \;\; f \;\in\; S \pfun T \qquad \textbf{H} \;\;\vdash \;\; \finite\,(S) }{\textbf{H} \;\;\vdash \;\; \finite\,(f) \ \ \ \ \ \ \ }</math>}}
 
</center>
 
 
 
For applying the previous rule, the user has to write the set corresponding to
 
<math>S  \pfun T</math> in the editing area of the Proof Control Window.
 
 
 
<center>
 
{{InfRule| fin_fun2_R|<math>\frac{\textbf{H} \;\;\vdash \;\; f^{-1} \;\in\; S \pfun T \qquad \textbf{H} \;\;\vdash \;\; \finite\,(S) }{\textbf{H} \;\;\vdash \;\; \finite\,(f) \ \ \ \ \ \ \ }</math>}}
 
</center>
 
 
 
For applying the previous rule, the user has to write the set corresponding to
 
<math>S  \pfun T</math> in the editing area of the Proof Control Window.
 
 
 
<center>
 
{{InfRule| fin_fun_img_R|<math>\frac{\textbf{H} \;\;\vdash \;\; f \;\in\; S \pfun T \qquad \textbf{H} \;\;\vdash \;\; \finite\,(s) }{\textbf{H} \;\;\vdash \;\; \finite\,(f[s]) \ \ \ \ \ \ \ }</math>}}
 
{{InfRule| fin_fun_ran_R|<math>\frac{\textbf{H} \;\;\vdash \;\; f \;\in\; S \pfun T \qquad \textbf{H} \;\;\vdash \;\; \finite\,(S) }{\textbf{H} \;\;\vdash \;\; \finite\,(\ran(f)) \ \ \ \ \ \ \ }</math>}}
 
</center>
 
 
 
For applying the previous rule, the user has to write the set corresponding to
 
<math>S  \pfun T</math> in the editing area of the Proof Control Window.
 
 
 
<center>
 
{{InfRule| fin_fun_dom_R|<math>\frac{\textbf{H} \;\;\vdash \;\; f^{-1} \;\in\; S \pfun T \qquad \textbf{H} \;\;\vdash \;\; \finite\,(S) }{\textbf{H} \;\;\vdash \;\; \finite\,(\dom(f)) \ \ \ \ \ \ \ }</math>}}
 
</center>
 
 
 
For applying the previous rule, the user has to write the set corresponding to
 
<math>S  \pfun T</math> in the editing area of the Proof Control Window.
 
 
 
<center>
 
{{InfRule||<math>\frac{\textbf{H} \;\;\vdash \;\; \finite(S)  }{\textbf{H} \;\;\vdash \;\; \exists n\,\qdot\, (\forall x \,\qdot\, x \in S \;\limp\; n \leq x)}</math>}}
 
{{InfRule||<math>\frac{\textbf{H} \;\;\vdash \;\; \finite(S)  }{\textbf{H} \;\;\vdash \;\; \exists n\,\qdot\, (\forall x \,\qdot\, x \in S \;\limp\; x \geq n)}</math>}}
 
{{InfRule||<math>\frac{\textbf{H} \;\;\vdash \;\; \finite(S)  }{\textbf{H} \;\;\vdash \;\; \exists n\,\qdot\, (\forall x \,\qdot\, x \in S \;\limp\; n \geq x)}</math>}}
 
{{InfRule||<math>\frac{\textbf{H} \;\;\vdash \;\; \finite(S)  }{\textbf{H} \;\;\vdash \;\; \exists n\,\qdot\, (\forall x \,\qdot\, x \in S \;\limp\; x \leq n)}</math>}}
 
</center>
 
 
 
In the four previous rules, <math>S</math> must not contain any bound variable.
 
 
 
<center>
 
{{InfRule||<math>\frac{\textbf{H} \;\;\vdash \;\; \exists n\,\qdot\, (\forall x \,\qdot\, x \in S \;\limp\; n \leq x)  \qquad \textbf{H} \;\;\vdash \;\; S \subseteq \intg \setminus \natn }{\textbf{H} \;\;\vdash \;\; \finite(S)}</math>}}
 
{{InfRule||<math>\frac{\textbf{H} \;\;\vdash \;\; \exists n\,\qdot\, (\forall x \,\qdot\, x \in S \;\limp\; x \leq n)  \qquad \textbf{H} \;\;\vdash \;\; S \subseteq \nat }{\textbf{H} \;\;\vdash \;\; \finite(S)}</math>}}
 
</center>
 
 
 
'''Cardinality'''
 
 
 
<center>
 
{{InfRule||<math>\frac{\textbf{H},\, a \leq b \;\;\vdash \;\; \textbf{Q}(b-a+1) \qquad \textbf{H},\, b < a \;\;\vdash \;\; \textbf{Q}(0) }{\textbf{H} \;\;\vdash\;\; \textbf{Q}(\card\,(a\upto b))}</math>}}
 
{{InfRule||<math>\frac{\textbf{H},\, a \leq b,\,\textbf{P}(a-b+1)  \;\;\vdash \;\; \textbf{Q} \qquad \textbf{H},\, b < a ,\, \textbf{P}(0)\;\;\vdash \;\; \textbf{Q} }{\textbf{H},\,\textbf{P}(\card\,(a\upto b))  \;\;\vdash\;\; \textbf{Q}}</math>}}
 
</center>
 
 
 
In the two previous rules, <math>\card (a \upto b)</math> must appear at
 
"top-level".
 
 
 
<center>
 
{{InfRule||<math>\frac{\textbf{H}  \;\;\vdash \;\; \textbf{P}(S \subseteq T)  }{\textbf{H} \;\;\vdash\;\; \textbf{P}(\card\,(S) \leq \card(T))}</math>}}
 
</center>
 
 
 
There are similar rules for other cases
 
 
 
{{Navigation|Previous= [[The_Proof_Obligation_Explorer_(Rodin_User_Manual)|The Proof Obligation Explorer]]|Next= [[The_Mathematical_Language_(Rodin_User_Manual)|The Mathematical Language]]|Up= [[index_(Rodin_User_Manual)|User_Manual_index]]}}
 
 
 
[[Category:User documentation|The Proving Perspective]]
 
[[Category:Rodin Platform|The Proving Perspective]]
 
[[Category:User manual|The Proving Perspective]]
 

Latest revision as of 14:53, 14 June 2021

Return to Rodin Plug-ins

See also Theory Release History

The Theory plug-in provides capabilities to extend the Event-B language and the proving infrastructure in a familiar fashion to Rodin users. This page provides useful information about the plug-in and its capabilities.

Motivation

Up to Rodin v2.0, the mathematical language used in Event-B has been fixed. As such, it was not possible to define reusable polymorphic operators. A workaround was to define any required operators as set constructs in contexts. Originally, contexts were supposed to provide a parametrization of machines. The aforementioned limitations of the Event-B language lead to users to use contexts for purposes for which they were not intentionally devised. Examples of operators that can be useful to users include the sequence operator (which was present in classical B mathematical language) and the bag operator.

In Rodin v2.0, support for customised syntactic symbols was introduced. The Theory plug-in, as a result, evolved from being just a component to define rewrite rules to a versatile platform to define and validate proof and language extensions.

The latest Theory plug-in is released for Rodin v2.8.

Overview

The Theory plug-in is a Rodin extension that provides the facility to define mathematical extensions as well as prover extensions. Mathematical extensions are new operator definitions and new datatype definitions and axiomatic definitions. Operator definitions can be expression operators (e.g., card) and predicate operators (e.g., finite). Datatypes extensions can be used to define enumerated datatypes (e.g., DIRECTION) as well as inductive datatypes (e.g., Tree). Axiomatic definitions can be used to define new data types like "REAL".

The placeholder for mathematical and prover extensions is a Theory construct which looks similar to contexts and machines. A theory can include datatypes definitions, operator definitions, axiomatic definitions, inference and rewrite rules as well as polymorphic theorems. The user manual provides a guide to developing and using theories.

Installation & Update

The installation or update for the Theory plug-in is available under the main Rodin Update site (http://rodin-b-sharp.sourceforge.net/updates) under the category "Modelling Extensions". Like always, after the installation, restarting Rodin is recommended.

User Manual

The user manual is available here: Theory User Manual. Below is the presentation of the sequence theory which its description can be found in the user manual:

Theory of Sequence

Standard Library

In this section, you find a set of standard theories and some models using some of these theories.

The standard library of the theories is available to download:

here for Rodin2.8 and
here for Rodin3.1. 

This library includes:

  • BasicTheory project: including theories of BinaryTree, BoolOps, List, PEANO, SUMandPRODUCT and Seq.
  • RelationOrderTheory project: including theories of Connectivity, FixPoint, Relation, Well_Fondation, closure, complement and galois.
  • RealTheory project: including theory of Real.

Also it includes three simple Event-B models that use some of the theories:

  • Data project: using SUMandPRODUCT theory
  • Queue project: using Seq theory
  • SimpleNetwork project: using closure theory

In order to keep the POs discharged, you need to install "Atelier B provers" as well.

Capabilities

The Theory plug-in has the following capabilities:

  • Theory Definition:
    • Definition of datatypes: datatypes are defined by supplying the types on which they are polymorphic, a set of constructors one of which has to be a base constructor. Each constructor may or may not have destructors.
    • Definition of operators: operators can be defined as predicate or expression operators. An expression operator is an operator that "returns" an expression, an example existing operator is card. A predicate operator is one that "returns" a predicate, an example existing predicate operator is finite.
    • Definition of axiomatic definitions: axiomatic definitions are defined by supplying the types, a set of operators, and a set of axioms.
    • Definition of rewrite rules: rewrite rules are one-directional equalities that can be applied from left to right. The Theory plug-in can be used to define rewrite rules.
    • Definition of inference rules: inference rules can be used to infer new hypotheses, split a goal into sub-goals or discharge sequents.
    • Definition of polymorphic theorems: theorems can be defined and validated once, and can then be imported into sequents of proof obligations if a suitable type instantiation is available.
    • Validation of extensions: where appropriate, proof obligations are generated to ensure soundness of extensions. This includes, proof obligations for validity of inference and rewrite rules, as well as proof obligations to validate operator properties such as associativity and commutativity.
  • Theory Deployment: this step signifies that a theory is ready for use. Theories can be deployed after they have been optionally validated by the user. It is strongly advisable to discharge all proof obligations before deployment.

Once a theory has been deployed to its designated project, all its extensions (mathematical and prover extensions) can be used in models.

Insider Look

The Theory plug-in partially satisfies the requirements outlined in the following document:

A more accurate description of the implemented functionalities of the plug-in can be found in the following document:

The following two papers describe rewriting and well-definedness issues that has to be accounted for: