# Difference between revisions of "Event-B Qualitative Probability User Guide"

imported>Son |
imported>Son |
||

(25 intermediate revisions by the same user not shown) | |||

Line 1: | Line 1: | ||

− | [[User:Son]] | + | [[User:Son]] is in charge of the plug-in. |

{{TOCright}} | {{TOCright}} | ||

== Introduction == | == Introduction == | ||

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

− | + | For more details about the principles on Event-B Qualitative Probability, see the [[Qualitative Probability | Qualitative Probability page]]. | |

== Installing and Updating == | == Installing and Updating == | ||

Line 11: | Line 11: | ||

== News == | == News == | ||

* 23.11.2011: Version 0.2.1 released for Rodin 2.3.* | * 23.11.2011: Version 0.2.1 released for Rodin 2.3.* | ||

+ | * 10.04.2012: Version 0.2.1 is compatible with Rodin 2.4.* | ||

+ | * 14.05.2012: Version 0.2.1 is compatible with Rodin 2.5.* | ||

+ | * 09.03.2015: Version 0.2.2 is released with Rodin 3.x.x | ||

+ | * 09.10.2015: Version 0.2.3 is released | ||

+ | * 23.07.2017: Version 0.2.4 is released | ||

== Technical References == | == Technical References == | ||

+ | * Thai Son Hoang. '''Reasoning about almost-certain convergence properties using Event-B'''. Science of Computer Programming, 81:108–121, February 2014 © Elsevier. [https://doi.org/10.1016/j.scico.2013.08.006 SCP website] (''Please use this article as the reference for the plug-in). | ||

+ | ** Extended version of the EASST paper (below). | ||

+ | ** Probablistic convergence event with refinement | ||

+ | ** Constraints on how (not-) to refine probabilistic events. | ||

+ | ** Example: Duelling cowboys | ||

+ | ** Example: Rabin's choice coordination. | ||

+ | ** Example: Herman's probabilistic self-stabilization. | ||

+ | * 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] | ||

+ | ** Probablistic convergence event with refinement | ||

+ | ** Constraints on how (not-) to refine probabilistic events. | ||

+ | ** Example: Rabin's Choice Coordination. | ||

* 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] | * 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. | ** Initial idea about probabilistic convergence event. | ||

Line 18: | Line 34: | ||

** New proof obligations: '''PRV''', '''BND''', '''FINACT'''. | ** New proof obligations: '''PRV''', '''BND''', '''FINACT'''. | ||

** Example: Resolve contention in IEEE 1395 (Firewire protocol). | ** Example: Resolve contention in IEEE 1395 (Firewire protocol). | ||

− | |||

− | |||

− | |||

− | |||

− | |||

== Usage == | == Usage == | ||

Line 33: | Line 44: | ||

* 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). | * 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). | ||

− | [[Image:contention-nondet.jpg]] | + | [[Image:contention-nondet.jpg|480px|alt=Alt|Nondeterminsitc modelling of Contention problem]] |

=== Probabilistic Modelling === | === Probabilistic Modelling === | ||

− | * | + | * Set event '''resolve''' to be probabilistic convergence by setting its convergence attribute to be ''convergent'' and the probabilistic attribute of '''resolve''' from ''standard'' to ''probabilistic''. |

− | + | [[Image:contention-prob.jpg|400px|alt=Alt|Probabilistic modelling of contention]] | |

− | |||

− | |||

− | |||

− | [[Image:contention-prob.jpg]] | ||

* Set <math>\Bool \setminus \{x, y\}</math> as the variant of the model | * Set <math>\Bool \setminus \{x, y\}</math> as the variant of the model | ||

− | [[Image:contention-variant.jpg]] | + | [[Image:contention-variant.jpg|150px|alt=Alt|Variant for the probabilistic convergent event]] |

+ | |||

+ | * Create a new bound element (right-click on the machine name and choose ''Add Child''/Event-B Bound Element). | ||

+ | [[Image:contention-bound-create.jpg|500px|alt=Alt|Create the bound element]] | ||

* Set <math>\Bool</math> as the bound of the model | * Set <math>\Bool</math> as the bound of the model | ||

− | [[Image:contention-bound.jpg]] | + | [[Image:contention-bound.jpg|100px|alt=Alt|Bound for the probabilistic convergent event]] |

* Save the model | * Save the model | ||

Line 62: | Line 72: | ||

* '''Missing variant''' warning | * '''Missing variant''' warning | ||

− | ** Problem | + | ** Problem: [[Image:contention-novariant.jpg|500px|alt=Alt|Missing variant]] |

− | [[Image:contention-novariant.jpg]] | + | ** Explanation: User needs to provide a variant for probabilistic convergence events. |

− | ** Explanation: User | ||

** Solution: Add a variant to the model | ** Solution: Add a variant to the model | ||

− | + | ||

− | * | + | * '''Missing bound''' error |

+ | ** Problem: [[Image:contention-nobound.jpg|400px|alt=Alt|Missing bound]] | ||

+ | ** 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 == | == 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. |

## Latest revision as of 17:54, 21 March 2018

User:Son 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). For more details about the principles on Event-B Qualitative Probability, see the Qualitative Probability page.

## 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.*
- 10.04.2012: Version 0.2.1 is compatible with Rodin 2.4.*
- 14.05.2012: Version 0.2.1 is compatible with Rodin 2.5.*
- 09.03.2015: Version 0.2.2 is released with Rodin 3.x.x
- 09.10.2015: Version 0.2.3 is released
- 23.07.2017: Version 0.2.4 is released

## Technical References

- Thai Son Hoang.
**Reasoning about almost-certain convergence properties using Event-B**. Science of Computer Programming, 81:108–121, February 2014 © Elsevier. SCP website (*Please use this article as the reference for the plug-in).*- Extended version of the EASST paper (below).
- Probablistic convergence event with refinement
- Constraints on how (not-) to refine probabilistic events.
- Example: Duelling cowboys
- Example: Rabin's choice coordination.
- Example: Herman's probabilistic self-stabilization.

- 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.

- 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).

## 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 and represent the choice for each process: for short delay for long delay.

- Resolving contention is model as an event of the model with guard (i.e. keep trying when the choices are identical).

### Probabilistic Modelling

- Set event
**resolve**to be probabilistic convergence by setting its convergence attribute to be*convergent*and the probabilistic attribute of**resolve**from*standard*to*probabilistic*.

- Set as the variant of the model

- Create a new bound element (right-click on the machine name and choose
*Add Child*/Event-B Bound Element).

- Set as the bound of the model

- Save the model

### Proof Obligations

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

- The goal of proof obligation
**resolve/PRV**is . With hypothesis (from the guard of the event), the proof obligation can be discharged by instantiating different values for and (e.g. for and for ). Alternatively, the obligation can be interactively discharge using**p1**(AterlierB Predicate Prover on lasso'd hypotheses) directly as shown below

## Explanations for some warning and error messages

**Missing variant**warning

**Missing bound**error

## 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.