Difference between pages "Event-B Indexers" and "Event-B Qualitative Probability User Guide"

From Event-B
(Difference between pages)
Jump to navigationJump to search
imported>Laurent
 
imported>Son
 
Line 1: Line 1:
==Purpose==
+
[[User:Son]] at '''ETH Zurich''' is in charge of the plug-in.
 +
{{TOCright}}
  
Event-B indexers populate the index repository. Currently, indexers are implemented for the following files :
+
== Introduction ==
* machine (.bum)
+
Event-B Qualitative Probability plug-in provides supports for reasoning about termination with probability 1 (almost-certain termination).
* context (.buc)
 
  
  
==Event-B Occurrence Kinds==
+
== Installing and Updating ==
 +
The plug-in is available through the main Rodin Update Site under '''Modelling Extension''' category.
  
So far, the following occurrence kinds have been defined :
+
== News ==
* DECLARATION : when a variable, a carrier set, ..., is declared
+
* 23.11.2011: Version 0.2.1 released for Rodin 2.3.*
* REFERENCE : when a variable, a carrier set, ..., is referenced (but not modified)
 
* MODIFICATION : when a variable is modified (e.g., occurs in the left-hand side of an event action)
 
* REDECLARATION : when a variable, parameter or event is redeclared (refined).
 
Please notice the distinction between the index repository notion of declaration ({{class|IDeclaration}}) and the Event-B occurrence kind DECLARATION.
 
  
==What Is Indexed==
+
== Technical References ==
 +
* S. Hallerstede, T.S. Hoang. '''Qualitative Probabilistic Modelling in Event-B'''. In ''IFM 2007: Integrated Formal Methods, 6th International Conference Proceedings'', Oxford, UK, July 2-5, 2007, volume 4591 of LNCS © Springer-Verlag. [http://dx.doi.org/10.1007/978-3-540-73210-5_16 Springer website]
 +
** Initial idea about probabilistic convergence event.
 +
** New modelling elements: Variant bound
 +
** New proof obligations: '''PRV''', '''BND''', '''FINACT'''.
 +
** Example: Resolve contention in IEEE 1395 (Firewire protocol).
  
Currently, indexed elements are :
+
* E. Yilmaz, T.S. Hoang. '''Development of Rabin’s Choice Coordination Algorithm in Event-B'''.  In ''Automated Verification of Critical Systems 2010'', volume 35 of ''Electronic Communications of the EASST'' © EASST. [http://journal.ub.tu-berlin.de/eceasst/article/view/548 EASST website]
* carrier sets
+
** Probablistic convergence event with refinement
* constants
+
** Constraints on how (not-) to refine probabilistic events.
* variables
+
** Example: Rabin's Choice Coordination Algorithm.
* events
 
* parameters
 
  
Formulas which cannot be parsed are ignored.
+
== Usage ==
 +
We illustrate the usage of the plug-in using the example of contention resolving (part of IEEE 1394 Firewire protocol). The description of the problem is as follows.
  
In the descriptions below, the following notation will be used to specify locations :
+
Two processes in contention use a probabilistic protocol to resolve the problem. In each step, each process probabilisitcally choose to communicate in either short or long delay. The contention is resolved when the processes choose different delays.
* [element] : internal location
 
* [element/attribute] : attribute location
 
* [element/attribute/begin..end] : attribute substring location
 
  
===Context Indexer===
+
We start with a non-deterministic model of the system
 +
* Boolean variables <math>x</math> and <math>y</math> represent the choice for each process: <math>TRUE</math> for short delay <math>FALSE</math> for long delay.
  
====Dependencies====
+
* Resolving contention is model as an event of the model with guard <math>x = y</math> (i.e. keep trying when the choices are identical).
* extended contexts
+
[[Image:contention-nondet.jpg]]
  
====Declarations====
 
* carrier sets
 
* constants
 
  
====Occurrences====
+
=== Probabilistic Modelling ===
 +
* To set event '''resolve''' is probabilistic convergence:
 +
# Go to the '''Edit''' page of the standard ''Rodin Editor''.
 +
# Open the '''EVENTS''' section
 +
# Set convergence attribute of '''resolve''' from ''ordinary'' to ''convergent''.
 +
# Set probabilistic attribute of '''resolve''' from ''standard'' to ''probabilistic''.
 +
[[Image:contention-prob.jpg]]
  
* DECLARATION of carrier sets [corresponding element/Identifier]
+
* Set <math>\Bool \setminus \{x, y\}</math> as the variant of the model
* DECLARATION of constants [corresponding element/Identifier]
+
[[Image:contention-variant.jpg]]
* REFERENCE of elements in axioms [Axiom/Predicate/b..e]
 
* REFERENCE of elements in theorems [Theorem/Predicate/b..e]
 
  
Example:
+
* Set <math>\Bool</math> as the bound of the model
 +
[[Image:contention-bound.jpg]]
  
  Ctx
+
* Save the model
  Sets
 
    S
 
  Constants
 
    C
 
  Axioms
 
    axm1 : C ∈ S
 
  
We will end up with the following occurrences :
+
=== Proof Obligations ===
 +
* The model should have 3 proof obligations including '''resolve/PRV'''.
 +
[[Image:contention-po.jpg]]
  
  S :
+
* The goal of proof obligation '''resolve/PRV''' is <math>\exists x^\prime, y^\prime \qdot \Bool \setminus \{x^\prime, y^\prime\} \subset \Bool \setminus \{x, y\}</math>. With hypothesis <math>x = y</math> (from the guard of the event), the proof obligation can be discharged by instantiating different values for <math>x^\prime</math> and <math>y^\prime</math> (e.g. <math>\True</math> for <math>x^\prime</math> and <math>\False</math> for <math>y^\prime</math>). Alternatively, the obligation can be interactively discharge using '''p1''' (AterlierB Predicate Prover on lasso'd hypotheses) directly as shown below
    DECLARATION in [Ctx.Root]
+
[[Image:resolve-prv.jpg]]
    REFERENCE in [axm1/Predicate/4..5]
 
  C :
 
    DECLARATION in [Ctx.Root]
 
    REFERENCE in [axm1/Predicate/0..1]
 
  
====Exports====
+
== Explanations for some warning and error messages ==
* imported and declared carrier sets
 
* imported and declared constants
 
  
===Machine Indexer===
+
* '''Missing variant''' warning
 +
** Problem: [[Image:contention-novariant.jpg]]
 +
** Explanation: User needs to provide a variant for probabilistic convergence events.
 +
** Solution: Add a variant to the model
  
====Dependencies====
 
* refined machines
 
* seen contexts
 
  
====Declarations====
+
* '''Missing bound''' error
* variables
+
** Problem: [[Image:contention-nobound.jpg]]
* events
+
** Explanation: The variant for probabilistic events need to be bounded above.
* parameters
+
** Solution: Add a bound to the model (using Edit page of the standard Rodin editor).
  
====Occurrences====
+
== Additional features to be investigated/implemented ==
* DECLARATION of (local) variables [Root]
+
* ''Proof hints'': Select event guards when creating proof obligations, such as PRV and BND
* DECLARATION of (local) events [Root]
 
* DECLARATION of (local) parameters [Event]
 
* REDECLARATION of abstract variables in the local variables that redeclare them [Variable/Identifier]
 
* REDECLARATION of abstract events in the local events that refine them [Event/RefinesEvent/Target]
 
* REDECLARATION of abstract parameters in the local parameters that redeclare them [Parameter/Identifier]
 
* REFERENCE of abstract parameters or variables in witnesses [Witness/Label]
 
* REFERENCE of elements in invariants [Invariant/Predicate/b..e]
 
* REFERENCE of elements in theorems [Theorem/Predicate/b..e]
 
* REFERENCE of elements in variants [Variant/Expression/b..e]
 
* REFERENCE of elements in guards [Guard/Predicate/b..e]
 
* REFERENCE of elements in witnesses [Witness/Predicate/b..e]
 
* REFERENCE of non assigned elements in actions [Action/Assignment/b..e]
 
* MODIFICATION of assigned elements in actions [Action/Assignment/b..e]
 
  
Example :
+
* ''Finer-grain for probabilisitc attribute''. The probabilistic attribute might/should be attached to individual assignment and/or parameter of the event.
 
 
  M1
 
  VARIABLES
 
    var1
 
  INVARIANTS
 
    inv1 : var1 > 0
 
  EVENTS
 
    INITIALISATION
 
      THEN
 
        act1 : var1 := 1
 
 
 
After indexing M1, we will have the following occurrences:
 
 
 
  M1.var1 :
 
    DECLARATION in [M1.Root]
 
    REFERENCE in [M1.inv1/Predicate/0..4]
 
    MODIFICATION in [M1.act1/Assignment/0..4]
 
  M1.INITIALISATION :
 
    DECLARATION in [M1.Root]
 
 
 
Then, if we add another machine
 
 
 
  M2
 
  REFINES
 
    M1
 
  VARIABLES
 
    var1
 
  EVENTS
 
    INITIALISATION
 
      THEN
 
        act1 : var1 := 1
 
 
 
we will add the following occurrences :
 
 
 
  M1.var1 :
 
    REDECLARATION in [M2.var1/Identifier]
 
  M2.var1 :
 
    DECLARATION in [M2.Root]
 
    MODIFICATION in [M2.act1/Assignment/0..4]
 
  M2.INITIALISATION :
 
    DECLARATION in [M2.Root]
 
 
 
====Exports====
 
* imported carrier sets
 
* imported constants
 
* local variables
 
* local events
 
* local parameters
 
 
 
==Propagation==
 
 
 
Propagators are defined for :
 
* events ({{class|EventPropagator}}) to propagate through refines
 
* parameters ({{class|IdentifierPropagator}}) to propagate through redeclaration
 
* variables ({{class|IdentifierPropagator}} as well) to propagate through redeclaration
 
 
 
In the above example with machines M1 and M2, after both files have been indexed, we can query occurrences of M1.var1.
 
 
 
With no propagator, the result would be :
 
 
 
  M1.var1 :
 
    DECLARATION in [M1.Root]
 
    REFERENCE in [M1.inv1/Predicate/0..4]
 
    MODIFICATION in [M1.act1/Assignment/0..4]
 
    REDECLARATION in [M2.var1/Identifier]
 
 
 
Using the {{class|IdentifierPropagator}}, the result becomes :
 
 
 
  M1.var1 (propagated) :
 
    DECLARATION in [M1.Root]
 
    REFERENCE in [M1.inv1/Predicate/0..4]
 
    MODIFICATION in [M1.act1/Assignment/0..4]
 
    REDECLARATION in [M2.var1/Identifier]
 
    DECLARATION in [M2.Root]
 
    MODIFICATION in [M2.act1/Assignment/0..4]
 
 
 
[[Category:Developer documentation]]
 

Revision as of 14:23, 23 November 2011

User:Son at ETH Zurich is in charge of the plug-in.

Introduction

Event-B Qualitative Probability plug-in provides supports for reasoning about termination with probability 1 (almost-certain termination).


Installing and Updating

The plug-in is available through the main Rodin Update Site under Modelling Extension category.

News

  • 23.11.2011: Version 0.2.1 released for Rodin 2.3.*

Technical References

  • S. Hallerstede, T.S. Hoang. Qualitative Probabilistic Modelling in Event-B. In IFM 2007: Integrated Formal Methods, 6th International Conference Proceedings, Oxford, UK, July 2-5, 2007, volume 4591 of LNCS © Springer-Verlag. Springer website
    • Initial idea about probabilistic convergence event.
    • New modelling elements: Variant bound
    • New proof obligations: PRV, BND, FINACT.
    • Example: Resolve contention in IEEE 1395 (Firewire protocol).
  • E. Yilmaz, T.S. Hoang. Development of Rabin’s Choice Coordination Algorithm in Event-B. In Automated Verification of Critical Systems 2010, volume 35 of Electronic Communications of the EASST © EASST. EASST website
    • Probablistic convergence event with refinement
    • Constraints on how (not-) to refine probabilistic events.
    • Example: Rabin's Choice Coordination Algorithm.

Usage

We illustrate the usage of the plug-in using the example of contention resolving (part of IEEE 1394 Firewire protocol). The description of the problem is as follows.

Two processes in contention use a probabilistic protocol to resolve the problem. In each step, each process probabilisitcally choose to communicate in either short or long delay. The contention is resolved when the processes choose different delays.

We start with a non-deterministic model of the system

  • Boolean variables x and y represent the choice for each process: TRUE for short delay FALSE for long delay.
  • Resolving contention is model as an event of the model with guard x = y (i.e. keep trying when the choices are identical).

Contention-nondet.jpg


Probabilistic Modelling

  • To set event resolve is probabilistic convergence:
  1. Go to the Edit page of the standard Rodin Editor.
  2. Open the EVENTS section
  3. Set convergence attribute of resolve from ordinary to convergent.
  4. Set probabilistic attribute of resolve from standard to probabilistic.

Contention-prob.jpg

  • Set \Bool \setminus \{x, y\} as the variant of the model

Contention-variant.jpg

  • Set \Bool as the bound of the model

Contention-bound.jpg

  • Save the model

Proof Obligations

  • The model should have 3 proof obligations including resolve/PRV.

Contention-po.jpg

  • The goal of proof obligation resolve/PRV is \exists x^\prime, y^\prime \qdot \Bool \setminus \{x^\prime, y^\prime\} \subset \Bool \setminus \{x, y\}. With hypothesis x = y (from the guard of the event), the proof obligation can be discharged by instantiating different values for x^\prime and y^\prime (e.g. \True for x^\prime and \False for y^\prime). Alternatively, the obligation can be interactively discharge using p1 (AterlierB Predicate Prover on lasso'd hypotheses) directly as shown below

Resolve-prv.jpg

Explanations for some warning and error messages

  • Missing variant warning
    • Problem: Contention-novariant.jpg
    • Explanation: User needs to provide a variant for probabilistic convergence events.
    • Solution: Add a variant to the model


  • Missing bound error
    • Problem: Contention-nobound.jpg
    • Explanation: The variant for probabilistic events need to be bounded above.
    • Solution: Add a bound to the model (using Edit page of the standard Rodin editor).

Additional features to be investigated/implemented

  • Proof hints: Select event guards when creating proof obligations, such as PRV and BND
  • Finer-grain for probabilisitc attribute. The probabilistic attribute might/should be attached to individual assignment and/or parameter of the event.