100 likes | 201 Views
CSC 4504 : Langages formels et applications (La méthode Event-B) J Paul Gibson, A207 paul.gibson@it-sudparis.eu http://www-public. it-sudparis.eu /~gibson/Teaching/Event-B/. DataStructures http://www-public.it-sudparis.eu/~gibson/Teaching/Event-B/DataStructures.pdf.
E N D
CSC 4504 : Langages formels et applications (La méthode Event-B) J Paul Gibson, A207 paul.gibson@it-sudparis.eu http://www-public.it-sudparis.eu/~gibson/Teaching/Event-B/ DataStructures http://www-public.it-sudparis.eu/~gibson/Teaching/Event-B/DataStructures.pdf T&MSP-CSC 4504 : Langages formels et applications
TO DO : Answer the Questions As Best You Can • Stacks • Queues • Work in groups of 1, 2 or 3 people T&MSP-CSC 4504 : Langages formels et applications
Question 1: A Stack – typical behaviour of a machine Add(5) Add(2) 2 5 Add(3) 3 2 5 empty 5 Add has no result to return : it just changes the stack state by pushing the element onto the head of the stack T&MSP-CSC 4504 : Langages formels et applications
Question 1: A Stack – typical behaviour of a machine Add(5) Add(2) 2 5 Add(3) 3 2 5 empty 5 Remove = 5 Remove = 2 Remove = 3 Remove returns the head of the stack as the result and changes the state of the stack by popping this head from the top of the stack T&MSP-CSC 4504 : Langages formels et applications
Question 1: A Stack Abstract Context (a) TO DO: Add this context to a RODIN project DataStructures All proof obligations should be automatically discharged T&MSP-CSC 4504 : Langages formels et applications
Question 1: A Stack Abstract Machine (a) TO DO: Add this machine to the project DataStructures Use the interactive prover to prove any Proof Obligation that RODIN has not done automatically T&MSP-CSC 4504 : Langages formels et applications
Question 1: A Stack – add a Length operator Length = 3 Length = 1 Length = 2 Length = 0 Add(5) Add(2) 2 5 Add(3) 3 2 5 empty 5 Remove = 5 Remove = 2 Remove = 3 Length returns the number of elements on the stack but does not change its state (we write this as a skip action in Event-B). TO DO: Update the Stack context and Machine to include Length T&MSP-CSC 4504 : Langages formels et applications
Question 1: A Stack – add a Length operator To validate your specification 1) Add and prove the following theorems in the context: T&MSP-CSC 4504 : Langages formels et applications
Question 2: A Queue Abstract Machine Add(5) Add(2) 2 5 Add(3) 3 2 5 empty 5 Remove = 3 3 2 Remove = 5 Remove = 2 3 T&MSP-CSC 4504 : Langages formels et applications
Question 2: A Queue Abstract Machine • TO DO: • Specify a Queue Context in the DataStructures Project • Specify a Queue Machine in the DataStructures Project • Structure/Notation: push, pop and head - in the Context • add and remove - in the Machine T&MSP-CSC 4504 : Langages formels et applications