Difference between pages "Help:Tables" and "Theory Plug-in"

From Event-B
(Difference between pages)
Jump to navigationJump to search
imported>Mathieu
m (Importing help from mediawiki)
 
(Add to Theory Plug-in category)
 
Line 1: Line 1:
 +
Return to [[Rodin Plug-ins]]
  
Tables may be authored in wiki pages using either HTML table elements directly, or using wikicode formatting to define the table. HTML table elements and their use are well described on various web pages and will not be discussed here. The benefit of wikicode is that the table is constructed of character symbols which tend to make it easier to perceive the table structure in the article editing view compared to HTML table elements.
+
See also [[Theory Release History]]
  
A good general rule of thumb is to avoid using a table unless you need to. Table markup often complicates page editing.
+
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.
  
== Wiki table markup summary ==
+
===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.
  
{|cellpadding="5" cellspacing="0" border="1" width="600"
+
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.
|<nowiki>{|</nowiki> || start '''table'''
 
|-
 
|<nowiki>|+</nowiki> || table '''caption,''' ''optional;'' only one per table and between table start and first row
 
|-
 
|<nowiki>|-</nowiki> || '''table row,''' ''optional on first row'' -- wiki engine assumes the first row
 
|-
 
|<nowiki>!</nowiki>  || '''table header''' cell, ''optional.'' Consecutive table headers may be added on same line separated by double marks (!!) or start on new lines, each with its own single mark (!).
 
|-  
 
|<nowiki>|</nowiki>  || '''table data''' cell, ''required!'' Consecutive table data cells may be added on same line separated by double marks (<nowiki>||</nowiki>) or start on new lines, each with its own single mark (<nowiki>|</nowiki>).
 
|-
 
|<nowiki>|}</nowiki> || end '''table'''
 
|}
 
*The above marks must '''start on a new line''' except the double || and !! for optionally adding consecutive cells to a line.
 
*'''XHTML attributes.''' Each mark, except table end, optionally accepts one or more XHTML attributes. Attributes must be on the same line as the mark. Separate attributes from each other with a single space.
 
**Cells and caption (<nowiki>| or ||, ! or !!, and |+</nowiki>) hold content. So separate any attributes from content with a single pipe (|). Cell content may follow on same line or on following lines.
 
**Table and row marks (<nowiki>{| and |-</nowiki>) do not directly hold content. Do ''not'' add pipe (|) after their optional attributes. If you erroneously add a pipe after attributes for the table mark or row mark the parser will delete it ''and'' your final attribute if it was touching the erroneous pipe!
 
*'''Content''' may (a) follow its cell mark on the same line after any optional XHTML attributes or (b) on lines below the cell mark. Content that uses wiki markup that itself needs to start on a new line, such as lists, headers, or nested tables, must of course be on its own new line.
 
  
==Simple table==
+
The latest Theory plug-in is released for Rodin v2.8.
  
===Plain===
+
===Overview===
The following table lacks borders and good spacing but shows the simplest wiki markup table structure
+
The Theory plug-in is a Rodin extension that provides the facility to define '''''mathematical extensions''''' as well as '''''prover extensions'''''.
{| width="100%"
+
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".
|width="50%"|
 
{|
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
|width="50%"|
 
<pre>
 
{|
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
</pre>
 
|}
 
  
===Alternative===
+
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.
For more table-ish looking wiki markup cells can be listed on one line separated by ||. This does not scale well for longer cell content such as paragraphs. It works well for short bits of content however, such as our example table.
 
  
Extra spaces within cells in the wiki markup can be added, as I have done in the wiki markup below, to make the wiki markup itself look better but they do not affect the actual table rendering.
+
=== Installation & Update ===
  
HTML attributes can be added to tables on this page but have been left out of the following example for simplicity.
+
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.
{| width="100%"
 
|width="50%"|
 
{|
 
|  Orange    ||  Apple  ||  more
 
|-
 
|  Bread    ||  Pie    ||  more
 
|-
 
|  Butter  || Ice cream ||  and more
 
|}
 
|width="50%"|
 
<pre>
 
{|
 
|  Orange    ||  Apple  ||  more
 
|-
 
|  Bread    ||  Pie    ||  more
 
|-
 
|  Butter  || Ice cream ||  and more
 
|}
 
</pre>
 
|}
 
  
===With HTML attributes===
+
===User Manual===
You can add HTML attributes to make your table look better
+
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:
====border="1"====
 
{| width="100%"
 
|width="50%"|
 
{| border="1"
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
|width="50%"|
 
<pre>
 
{| border="1"
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
</pre>
 
|}
 
  
====align="center" border="1"====
+
[[image:SeqTheory.png|center|thumb|1500px|'''Theory of Sequence''']]
{| width="100%"
 
|width="50%"|
 
{| align="center" border="1"
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
|width="50%"|
 
<pre>
 
{| align="center" border="1"
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
</pre>
 
|}
 
  
====Attributes on cells ====
+
===Standard Library===
You can put attributes on individual '''cells.''' Numbers for example may look better aligned right
+
In this section, you find a set of standard theories and some models using some of these theories.  
{| width="100%"
 
|width="50%"|
 
{| border="1"
 
|Orange
 
|Apple
 
|align="right"|12,333.00
 
|-
 
|Bread
 
|Pie
 
|align="right"|500.00
 
|-
 
|Butter
 
|Ice cream
 
|align="right"|1.00
 
|}
 
|width="50%"|
 
<pre>
 
{| border="1"
 
|Orange
 
|Apple
 
|align="right"|12,333.00
 
|-
 
|Bread
 
|Pie
 
|align="right"|500.00
 
|-
 
|Butter
 
|Ice cream
 
|align="right"|1.00
 
|}
 
</pre>
 
|}
 
  
====Attributes on rows====
+
The standard library of the theories is available to download:
You can put attributes on individual '''rows,''' too.
+
[https://sourceforge.net/projects/rodin-b-sharp/files/Theory_StdLib/StandardTheory0.1.zip/download here] for Rodin2.8 and
{| width="100%"
+
[https://sourceforge.net/projects/rodin-b-sharp/files/Theory_StdLib/StandardTheory0.2.zip/download here] for Rodin3.1.  
|width="50%"|
+
This library includes:
{| border="1"
+
* BasicTheory project: including theories of BinaryTree, BoolOps, List, PEANO, SUMandPRODUCT and Seq.
|Orange
+
* RelationOrderTheory project: including theories of Connectivity, FixPoint, Relation, Well_Fondation, closure, complement and galois.
|Apple
+
* RealTheory project: including theory of Real.
|align="right"|12,333.00
 
|-
 
|Bread
 
|Pie
 
|align="right"|500.00
 
|- style="font-style:italic;color:green;"
 
|Butter
 
|Ice cream
 
|align="right"|1.00
 
|}
 
|width="50%"|
 
<pre>
 
{| border="1"
 
|Orange
 
|Apple
 
|align="right"|12,333.00
 
|-
 
|Bread
 
|Pie
 
|align="right"|500.00
 
|- style="font-style:italic;color:green;"
 
|Butter
 
|Ice cream
 
|align="right"|1.00
 
|}
 
</pre>
 
|}
 
  
====cellspacing="0" border="1"====
+
Also it includes three simple Event-B models that use some of the theories:
{| width="100%"
+
* Data project: using SUMandPRODUCT theory
|width="50%"|
+
* Queue project: using Seq theory
{| cellspacing="0" border="1"
+
* SimpleNetwork project: using closure theory
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
|width="50%"|
 
<pre>
 
{| cellspacing="0" border="1"
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
</pre>
 
|}
 
  
====cellpadding="20" cellspacing="0" border="1"====
+
In order to keep the POs discharged, you need to install "Atelier B provers" as well.
{| width="100%"
 
|width="50%"|
 
{| cellpadding="20" cellspacing="0" border="1"
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
|width="50%"|
 
<pre>
 
{| cellpadding="20" cellspacing="0" border="1"
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
</pre>
 
|}
 
  
''Note: This cellpadding example is not currently working properly on mediawiki.org  It is supposed to look like [http://test.wikipedia.org/wiki/Table_test this]''
+
===Capabilities===
 +
The Theory plug-in has the following capabilities:
  
===With HTML attributes and CSS styles===
+
* Theory Definition:
CSS style attributes can be added with or without other HTML attributes
+
** 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.
====style="color:green;background-color:#ffffcc;" cellpadding="20" cellspacing="0" border="1"====
+
** 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''.
{| width="100%"
+
** Definition of axiomatic definitions: axiomatic definitions are defined by supplying the types, a set of operators, and a set of axioms.
|width="50%"|
+
** 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.
{| style="color:green;background-color:#ffffcc;" cellpadding="20" cellspacing="0" border="1"
+
** Definition of inference rules: inference rules can be used to infer new hypotheses, split a goal into sub-goals or discharge sequents.
|Orange
+
** 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.
|Apple
+
** 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.
|Bread
+
Once a theory has been deployed to its designated project, all its extensions (mathematical and prover extensions) can be used in models.
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
|width="50%"|
 
<pre>
 
{| style="color:green;background-color:#ffffcc;" cellpadding="20" cellspacing="0" border="1"
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
</pre>
 
|}
 
  
==Table with TH headings==
+
===Insider Look===
 +
The Theory plug-in partially satisfies the requirements outlined in the following document:
 +
* [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]
  
TH (HTML table headings) can be created by using ! instead of |. Headings usually show up bold and centered by default.
+
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]
  
===Top headings===
+
The following two papers describe rewriting and well-definedness issues that has to be accounted for:
====Each column====
 
{| width="100%"
 
|width="50%"|
 
{| border="1" cellpadding="20" cellspacing="0"
 
!Yummy
 
!Yummier
 
|-
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
|width="50%"|
 
<pre>
 
{| border="1" cellpadding="20" cellspacing="0"
 
!Yummy
 
!Yummier
 
|-
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
</pre>
 
|}
 
  
====Colspan="2"====
+
* [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.]
{| width="100%"
+
* [http://eprints.ecs.soton.ac.uk/21221/ Issam Maamria, Michael Butler. Rewriting and Well-Definedness within a Proof System.]
|width="50%"|
 
{| border="1" cellpadding="20" cellspacing="0"
 
!colspan="2"|Yummies
 
|-
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
|width="50%"|
 
<pre>
 
{| border="1" cellpadding="20" cellspacing="0"
 
! colspan="2"|Yummies
 
|-
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
</pre>
 
|}
 
  
===Side headings===
 
====Default====
 
{| width="100%"
 
|width="50%"|
 
{| border="1" cellpadding="20" cellspacing="0"
 
!Fruit
 
|Orange
 
|Apple
 
|-
 
!Dish
 
|Bread
 
|Pie
 
|-
 
!Complement
 
|Butter
 
|Ice cream
 
|}
 
|width="50%"|
 
<pre>
 
{| border="1" cellpadding="20" cellspacing="0"
 
!Fruit
 
|Orange
 
|Apple
 
|-
 
!Dish
 
|Bread
 
|Pie
 
|-
 
!Complement
 
|Butter
 
|Ice cream
 
|}
 
</pre>
 
|}
 
  
====Right justify====
+
[[Category:Plugin]]
Right justified side headings can be done as follows
+
[[Category:User documentation]]
{| width="100%"
+
[[Category:Proof]]
|width="50%"|
+
[[Category:Theory Plug-in]]
{| border="1" cellpadding="20" cellspacing="0"
 
!align="right" |Fruit
 
|Orange
 
|Apple
 
|-
 
!align="right" |Dish
 
|Bread
 
|Pie
 
|-
 
!align="right" |Complement
 
|Butter
 
|Ice cream
 
|}
 
|width="50%"|
 
<pre>
 
{| border="1" cellpadding="20" cellspacing="0"
 
!align="right" |Fruit
 
|Orange
 
|Apple
 
|-
 
!align="right" |Dish
 
|Bread
 
|Pie
 
|-
 
!align="right" |Complement
 
|Butter
 
|Ice cream
 
|}
 
</pre>
 
|}
 
 
 
==Caption==
 
A '''table caption''' can be added to the top of any table as follows
 
{| width="100%"
 
|width="50%"|
 
{| border="1" cellpadding="20" cellspacing="0"
 
|+Food complements
 
|-
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
|width="50%"|
 
<pre>
 
{| border="1" cellpadding="20" cellspacing="0"
 
|+Food complements
 
|-
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
</pre>
 
|}
 
 
 
'''Attributes''' can be added to the caption as follows
 
 
 
{| width="100%"
 
|width="50%"|
 
{| border="1" cellpadding="20" cellspacing="0"
 
|+align="bottom" style="color:#e76700;"|''Food complements''
 
|-
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
|width="50%"|
 
<pre>
 
{| border="1" cellpadding="20" cellspacing="0"
 
|+align="bottom" style="color:#e76700;"|''Food complements''
 
|-
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
</pre>
 
|}
 
 
 
==Table with H1, H2, H3 etc. headings==
 
 
 
HTML H1, H2, H3, H4 etc. headings can be created the standard wiki markup way with ==equal== signs and '''must be on a line all by themselves''' to work.
 
 
 
'''Preview the whole table.''' If you click on an edit tab for a heading ''within'' a table, edit, and preview, the parent table will display erroneously broken because part of it will be missing.
 
 
 
Keep the heading hierarchy consistent with the rest of the page so that the table of contents at page top works correctly.
 
 
 
{| width="100%"
 
|width="50%"|
 
{| border="1" cellpadding="20" cellspacing="0"
 
|colspan="2"|
 
====Yummiest====
 
|-
 
|Orange
 
|Apple
 
|-
 
|Bread
 
|Pie
 
|-
 
|Butter
 
|Ice cream
 
|}
 
 
 
==Caveat==
 
===Negative numbers===
 
Negative value minus sign can break your table (it may display missing some values) if you start a cell on a new line with a negative number or a parameter that evaluates to a negative number (|-6) because that is the wiki markup for table row, not table cell. To avoid this, insert a space before the value (| -6) or use in-line cell markup (||-6).
 
 
 
{{Languages|Help:Tables}}
 
[[Category:Help|Tables]]
 

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: