event-bfreek/courses/pa-2014/presentatie.pdf · 2014-08-05 · gebruikt voor de the paris metro...
TRANSCRIPT
Event-BHet Rodin Platform
Myrthe van Delft
http://web.archive.org/web/20071202063524/http://www.jpbowen.com/publications/thes-b.html
review B-Book
Event-B is a formal method for system-level modelling and analysis. Key features of Event-B are the use of set theory as a modelling notation, the use of refinement to represent systems at different abstraction levels and the use of mathematical proof to verify consistency between refinement levels.The Rodin Platform is an Eclipse-based IDE for Event-B that provides effective support for refinement and mathematical proof. The platform is open source, contributes to the Eclipse framework and is further extendable with plugins.Development of Rodin is currently supported by the European Union ICT Project ADVANCE (2011 to 2014). Originally Rodin development was funded by the European Union Projects DEPLOY (2008 to 2012). and RODIN (2004 to 2007).Use the menu on the left to install the Rodin platform and plug-ins. The documentation wiki contains support for tool users and developers. The DEPLOY Repository contains resources including papers, Event-B examples and training material.Event-B is an evolution of B-Method developed by Jean-Raymond Abrial. Wikipedia contains useful information and links on the B-Method.
OverviewHistoryEvent-BRodinExamplesFuture?
HistoryFormal Specifications
Event-B: formele methode, op een formele manier code verkrijgen uit requirements.
=> geschiedenis formele methodes
HistoryFormal Specifications:
TuringFloyd, Hoare & NaurDijkstra
http://www.info.ucl.ac.be/Research/Publication/2000/FormalSpec-avl.pdf
Turing: reasoning on sequential programs simpler by annotating with properties on program states at specific pointsFloyd, Hoare Naur: Late sixties: Propose axiomatic techniques for proving consistency between sequential programs and properties, called ‘specifications’Dijkstra: how formal calculus over specifications can be used to constructively derive non-det. programs that meet them (seventies) (Guarded Command Language (GCL), Hoare logic, used by promela programming language, which is used by SPIN model checker, which verifies correct operation of concurrrent software applications)
Par72, Lis75 (datastructured programs)Pnu77 (concurrent programs)
Z NotatieB-MethodEvent-B
HistoryAbrial
Z Notation
Abrial:70s: considering specification of data structures and programs.Z during his time at the programming research group within the oxford
computing laboratory (now: oxfor university department of computer science)
Z Notatieoxford house style for the use of predicate logic and set theory in specification
of discrete digital software (and sometime hardware) systemspopulair in industrie ivt andere formele methodes
ISO standaardformal specification of software
dus niet: developmentkan een beetje gerefined worden richting implementatie, maar tool
support is slecht, and sprong naar echte code moeilijk
dus: in safety critical willen we ook in latere stappen iets hebben, dat formeel en exact is, en bewezen kan worden: Abrial (en anderen) ontwikkelden de B-Method
B-Methodsoftware development
B-Bookspecificatie notatie: Abstract Machine Notation: AMN, lijkt op Z, maar
ontworpen met het oog op tool-supported development of a sepcification in AMN all the way down to executables. The schema structuur van Z, waarin wiskundige fragmenten van sepcificatie wordenn weergegeven in boxed schema’s, is vervangen met het concept van abstracte machines, met pseudo-programma specificatie’s, die niet direct te executeren zijn, maar wel makkelijker te vertalen zijn naar code.
gebruikt voor de the paris metro braking system software.
Event-BRODIN project (2004-2007): Jean Raymond Abrial, Michael Butler maakten
voorstel, Abrial en Laurent Voisin leidden dev. (toen at ETH Zurich). gevolgd door het DEPLOY project, which addressed further development of
the Rodin core and associated plug-ins in parallel with industrial-scale deployment of the Rodin tools. Exposing the tools to serious industrial users in DEPLOY drove the developers to implement significant improvements in performance, usability and stability of Rodin and key plug-ins such as ProB, the Theory plug-in, Camille and UML-B
HistoryAbrial
Z NotationB Method
dus: in safety critical willen we ook in latere stappen iets hebben, dat formeel en exact is, en bewezen kan worden: Abrial (en anderen) ontwikkelden de B-Method
B-Methodsoftware developmentB-Bookspecificatie notatie: Abstract Machine Notation: AMN, lijkt op Z, maar
ontworpen met het oog op tool-supported development of a sepcification in AMN all the way down to executables. The schema structuur van Z, waarin wiskundige fragmenten van sepcificatie wordenn weergegeven in boxed schema’s, is vervangen met het concept van abstracte machines, met pseudo-programma specificatie’s, die niet direct te executeren zijn, maar wel makkelijker te vertalen zijn naar code.
gebruikt voor de the paris metro braking system software.
Action systems...
Event-BRODIN project (2004-2007): Jean Raymond Abrial, Michael Butler maakten
voorstel, Abrial en Laurent Voisin leidden dev. (toen at ETH Zurich).
gevolgd door het DEPLOY project, which addressed further development of the Rodin core and associated plug-ins in parallel with industrial-scale deployment of the Rodin tools. Exposing the tools to serious industrial users in DEPLOY drove the developers to implement significant improvements in performance, usability and stability of Rodin and key plug-ins such as ProB, the Theory plug-in, Camille and UML-B
HistoryAbrial
Z NotationB Method
ButlerAction systems (Back)
/*Program development in action systemsAction systemsBack & Kurki-Suonio*/
Niet enkel Abrial heeft meegewerkt aan het Rodin project, Michael Butler heeft veel invloeden van de Action Systems van Back ingebracht.
‘80: Temporal logic approach of Manna and Pnueli (early 80's)een systeem van regels en symbolen om proposities die over tijd gaan
voor te stellen, en over ze te redenerenAction systems (Back, Suonio): An action system is a sequential
program or collection ofprocessess which communicate by means of shared variables;
it therefore provides a flexible way in which to develop programs on a variety of architectures
- refinement
Event-BRODIN project (2004-2007): Jean Raymond Abrial, Michael Butler maakten
voorstel, Abrial en Laurent Voisin leidden dev. (toen at ETH Zurich). gevolgd door het DEPLOY project, which addressed further development of
the Rodin core and associated plug-ins in parallel with industrial-scale deployment of
the Rodin tools. Exposing the tools to serious industrial users in DEPLOY drove the developers to implement significant improvements in performance, usability and stability of Rodin and key plug-ins such as ProB, the Theory plug-in, Camille and UML-B
HistoryB-Method (+action systems)Event-B
RODINDEPLOYADVANCE
http://deploy-eprints.ecs.soton.ac.uk/130/1/main.pdf
Event-BAction system approach: system behavior in Event-B is modelled by a
collection of state variables and a collection of guarded actions that act on the state variables.
B-Method: wiskundige taal for defining state structures and events is typed set theory.
where B-method is aimed at software development, event-B is aimed at system development. To achieve this, a notion of ‘context’ was introduced to the ‘machines’ of the B-Method
RODIN project (2004-2007): Abrial, Butler, Hallerstede, Hoang, Mehta, Voisin
Jean Raymond Abrial, Michael Butler maakten voorstel, Abrial en Laurent Voisin leidden dev. (toen at ETH Zurich).
gevolgd door het DEPLOY project, which addressed further development of the Rodin core and associated plug-ins in parallel with industrial-scale deployment of the Rodin tools. Exposing the tools to serious industrial users in DEPLOY drove the developers to implement significant improvements in performance, usability and stability of Rodin and key plug-ins such as ProB, the Theory plug-in, Camille and UML-B
Event-BThe ‘language’
http://deploy-eprints.ecs.soton.ac.uk/130/1/main.pdf Sectie 3: language
Event-B is een notatie, ontworpen for het ontwikkelen van wiskundige modelen van discrete transitie systemen
Een event-B model bestaat uit context en machines, en de machines.
http://deploy-eprints.ecs.soton.ac.uk/130/1/main.pdf Sectie 3: languageSectie 7+8: provers
Event-BThe ‘language’
Machinevariablesinvariantstheoremseventsvariant
Contextcarrier setsconstantsaxiomstheorems
http://deploy-eprints.ecs.soton.ac.uk/130/1/main.pdf Sectie 3: language
Event-B is een notatie, ontworpen for het ontwikkelen van wiskundige modelen van discrete transitie systemen
Een event-B model bestaat uit context en machines, en de machines.Machines en contexts hebben namen, die uniek moeten zijn (binnen een
model)Machines: dynamische structuur van een discreet systeem (variables,
invariants, events)Contexts: statische structuur (constanten, axiomas)
Machines ‘zien’ contexts, contexts kunnen worden uitgebreid, en machines kunnen worden verfijnd
(meer info over zien: slide 11 evtb)
Event-B
Contextcarrier setsconstantsaxiomstheorems
sets lists various sets, which define pairwise disjoint types.only property to be assumed: a set is not empty
constants: de verschillende constanten die we tegenkomen in een contextaxiomas: definieren de eigenschappen van de constantentheorems: eigenschappen die afgeleid moeten worden uit de axiomas
Event-BContext
naam: ctx_0definieerd een set Der zijn 3 constanten in de context:
n, een natuurlik getal (axioma1)f, een totale functie uit interval 1..n naar D (axioma2)en v zit in het bereik van f (axioma3)
de context stelt een theorem voor: n is positief (thm1)
Event-B
huidige context
Event-B
Machinevariablesinvariantstheoremseventsvariant
variables: state variables of the machineinvariants: properties of the variables
defined in terms of the seen sets and constants (from contexts)theorems: provable from invariants, seen axioms, seen theoremsevents: dynamics of the transistion systemvariant: voor de temporal logic, gaan we verder niet op in
//natural number expression or finite set expression//present in any machine with convergent events//numeric variant must be decreased by all convergent events//set variant must be made structly indluced in its previous value by all
convergent events
Event-BContext + machine
zelfde context als netmachine m_0aziet context ctx_0machine definieerd een variabele i
die in interval 1..n zitevents: altijd een initialisatie
uitleg next slide
Event-BEvents
een event is een staat transitie in het discrete systeemeen event kan een ander event refinenen (ook meerdere, als het een merging refining event is, merged events moeten dezelfde acties doen)status: ordinary (nothing special), convergent (decreases variant, later) anticipated (convergent in later refinement)any: event parameterswhere (when in RODIN): guards van de event, necessary conditions for event to be enabledwith: laterthen: actions:een actie omschrijft hoe een of meer state variables veranderen door het optreden van een event, ze kunnen zowel deterministisch als non-deterministisch zijn (next)end: einde event
Event-BDeterministic event
x:=x+yy:=y-x-z
then: actions:deterministisch:
end: einde event
Event-BNon-deterministic event
x,y:|x’>x /\ y’<x’
then: actions:LHS: distinct variablesRHS: before-after predicate
x and y: before valuesx’, y’: after values
result: x krijgt een waarde groter dan zijn vorigey krijgt een waarde kleiner dan de nieuwe waarde van x
kan ook in de vorm x:(in) {x+1, y-2, z+3}, waarbij x een (any) waarde krijgt uit de set
end: einde event
Event-BExample
event search assigns to i any value k such that f(k)=v, gegeven k in het interval 1..nsearching program
Event-B
de machine gebruikt de context om aan i een waarde toe te kennen zdd f(i)=v
Event-BWitnesses
a -> a:P(a)det: a = E
with: de witnesses van een refining eventhas to be provided for each disappearing parameterthe witness of param. a is een predicaat involving a
deterministische witness: P(a) := a = Emet E zonder a
Event-Brefining
Event-B
In plaats van in een keer de waarde van i te updaten zodat f(i)=v, doen we in stapjesvia een nieuwe variabele j, die bijhoud waar we al gekeken hebben (zie inv1, inv2)er is een nieuw convergent event genaamd progress, die door het programma heen ‘stapt’als de variant op 0 zit, zijn we klaar (j: 1..n)
Event-B
nieuwe situatie
Event-B
hieruit kan een sequentieel programma worden afgeleid:i,j:=1,0;while (f(j+1)!=v) do
j:=j+1;end;i:=j+1
RodinExtension of Eclipse IDEProof managerPlugins
rodin is een exetensie van de Eclipse IDE (maar kan standalone gebruikt worden)De proof manager managed de bewijzen (later)rodin heeft veel plugins (later)
RodinProof manager
managesproof obligationsproof treereasoners
dischargesplit
automatic + interactivetactics
eerst: bewijzen
rodin is een exetensie van de Eclipse IDE (maar kan standalone gebruikt worden)de proof manager managed de proofs.het genereert/update de proof obligations, en bij update checkt het oude bewijshet genereert/update de proof tree
door middel van het aanroepen van reasoners, die nodes in een proof treedischargen of opsplitsen in subgoals
de reasoners zijn (o.a.) een simplifier, rule-based, decision proceduresstelt een basic tactic language beschikbaar voor gebruiker om proofs (proof trees) te bewerken
RodinProvers
New PPAtelier B provers:
PPML
Reasoners can be applied to a sequent of a given proof tree node, and provide a way to contribute to the provers, it takes a given sequent and produce a proof rule that will (if possible) apply to this sequent. A tactic may use several reasoners, by applying them in loops
newPP: NewPP is unsound! bug reports, may be usable, but not recommendedinput: similair to PPoperation: all function and predicate sumbols different from /element of/ and not related to arithmetic are translated away.
then new PP translates to CNF, and applies a combination of unit resolution and the Davis Putnam algorithmstrengths: outputs set of used hypothesis
limited support equational reasoningweaknesses: UNSOUND
no arithmetic support (discharge |- 1=1, not discharge |- 1+1=2)unaware of some set theoretical axioms: in particular: union
axiom! |- exists A . forall x . x in A ⇔ (x in B \/ x in C)
unnecessary hyp. prevent new PP from finding proofno well-definedness is taken into account:
|- b in (inv(f))[{(f(b))}]tends to run out of memory with large input
PP: recommended, P0: only current context, P1: one lasso operation, PP: all available hyp. passed
operation: The input sequent is translated to classical B and fed to the PP prover of atelier B. PP works similairly to newPP, but with support for equational and arithmetic reasoning
strengthts: limited support for equational and arithmetic reasoningweaknesses: no output used hyp.
unaware of some set theoretical axiomssimilar problems to New PP with regard to well-
definednessif unnecessary hyp. present, then PP may not find a
proof even in the obvious case
ML (Model Lemma): helpful with proofs around arithmeticinput: all visible hyp. are passed to MLoperation: applies a mix of forward, backward and rewriting rules to discharge,
or detect contradiction in hyp.strengths: support equational and arithmetic reasoning
resilience to unnecessary hypotheses compared to newPP, PPweaknesses: no output used hyp.
not all set theoretical axioms
RodinPlugins
Issabelle for RodinCode generation
Rodin heeft veel plugins, notables zijn: Issabele for Rodin (export proof obligations to isabelle/hol)meerder code generation plugins available, zoals JAVA, JML, Dafny, Ada, C,
en meer...
Event-BBN’er example:
nobody knows themselfBN’er knows nobodyeverybody knows BN’er
find BN’er
celbrity kent ook zichzelf niet
Future?IndustryRodin
Auto refinementProbability support
de industrie gaat het meer en meer gebruikenRodin zouden ze graag uitgebreid zien met:
auto refinementprobability supportmeer/betere auto provers/SMT for set theory:
common contextoutput used hypothesis!extensible operators
reasoned modelling supportflexible document management
Questions?
This is where the presentation ends. Following are some remaining subjects which were not incorporated into the presentation
Rodinsucces stories:
aerospaceautomotivebusiness informationchip design/smart cardoperating systemsspacetransportation
RodinProvers
proof obligation managerwell-definedness
Proof obligation manager: maintains proof status and proofs associated with proof obligationsso, works automatically and interactively intern: extensible en static deel. extensible: generating indiv. proof rules, used for proving obligations static: responsible for putting proof rules togetherbuilds a (possibly partial) proof obligation by constructing proof treesfor the user: provides tactics, and can be extended with new tactics and reasoners
well-definedness in modelling and proof (later)
RodinProvers
Hu: the set of used hyp.Hv: the set of unused hyp.Gu: the set of used goals (may be absent)Hai: the set of added hyp. corresponding to the ith antecedentGai: het nieuwe goalH: H==Hv union Hu is de set van alle hyp. of the consequent
Hv is een meta variabele, die door instantieren verschillende bewijsregels genereerd
the required hyp. are treated as the used hyp. Hu, the proof obligation manager instantiates Hv met de hypotheses van het input sequent dat niet in Hu zit.
RodinProvers
Reasoners
De reasoners generate the proof rules. The input is een sequent, en mogelijk wat extra, en de reasoner is succesvol als het een proof rule kan genererende proof obligation manager assumes:
logical validity: generated proof rules are valid in math. logicre-playable: reasoner must work deterministically, i.e. generate the same proof
rule given the same input
voorbeeld:a = a => b = c |- b+0 = c
a = a => b = c |- b = c----------------------------------- (simplifier)a = a => b = c |- b+0 = c
RodinProvers
Proof treesnode: sequent (proof rule)* (children)*
proof tree komt overeen met een proof obligation van het sequent als de wortel van de boom hetzelfde is als de obligation.een node is pending als ie nog geen rule heeft, i.e. onbewezen, non-pending als wel bewezen.proof tree is valid als alle nodes validnode is valid: pending => children null
non-pending => children not be null, proof rule applicable to the sequent of the node, children correspond to the result of the appl. of the rule to the sequent (and ofc. all children valid)
POM on proof trees:constructie, create initial proof tree corresponding to input sequentrule appl, proof tree groeit when rule applies to one of pending nodespruning, proof tree can be pruned at any of its nodesget pending nodescheck completeness
tactics:constructing and manipulating proofs
Rodintactics
tactics:constructing and manipulating proofs
Rodin paper: gebleven start paragraaf
Formele Methodesrequirementsdesigncodingtestingmaintenance
Formele MethodesSoftware requirements
Executable code
Feasibility StudyRequirements AnalysisTechnical SpecificationDesignCodingTestingDocumentation (manuals)Maintenance
Formele MethodesSoftware requirements
Executable code
Formele Methodes
Feasibility StudyRequirements AnalysisTechnical SpecificationDesignCodingTestingDocumentation (manuals)Maintenance
Formele Methodescontroleert systematisch
programma eigenschappen
● type checking● static analysis● model checking● theorem proving
een formele methode is een systematische benadering van software development, die gebruikt word om te bepalen of een programma bepaalde gewenste eigenschappen heeft
Formele Methodestheorem proving:
model construction
Event-B:Model refinement
constructie van modelen via successive refinements, de eigenschappen die bewezen worden zijn onderdeel van het model, via invarianten en verfijning. Uiteindelijk word automatisch correcte code gegenereerd.
Dit is het principe waarop Event-B gebaseerd is: van requirements naar code via een steeds verfijnder model
Event-BB-Method
Systemen > SoftwareMachines
with context
Event-B is bedoeld om systemen te modelleren
Van software naar systemen: in plaats van enkel software componenten te modelleren, is event-B bedoeld om systemen te modelleren en beredeneren die kunnen bestaan uit zowel software, als physieke componenten en electronica. een ander belangrijk verschil is dat event-b een sterkere refinement toestaat, waarbij nieuwe variabelen geintroduceerd kunnen worden bij elke refinement stap, waardoor van complexe interacties tussen subcomponenten geabstraheerd kan worden, die geintroduceerd worden via refinement in latere stadia
Formele MethodesSoftware requirements
Executable code
Formele MethodesSoftware Development Cycle:
requirementsdesigncodingtestingmaintenance
Feasibility StudyRequirements AnalysisTechnical SpecificationDesignCodingTestingDocumentation (manuals)Maintenance
Formele MethodesSoftware Development Cycle:
requirementsdesigncodingtestingmaintenance
Feasibility StudyRequirements AnalysisTechnical SpecificationDesignCodingTestingDocumentation (manuals)Maintenance