1 / 184

“B is a method for specifying, designing, and coding software systems.”

Define an abstract machine to control cars entering/leaving a 640-space car park, tracking current cars and enabling operations.

pearsonj
Download Presentation

“B is a method for specifying, designing, and coding software systems.”

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. “B is a method for specifying, designing, and coding software systems.” J.R. Abrial, The B-Book, Cambridge University Press

  2. B4free

  3. Exercise 1.7 A car park has 640 parking spaces. Give an abstract machine which specifies a system to control cars entering the car park. It should keep track of the cars currently in the car park, and should provide 3 operations: • Enter, which recorders the entry of a new car. This should occur only when the car park is not full; • Leave, which records the exit of a car from the car park; • Query, which outputs the number of cars currently in the car park.

  4. MACHINE CarPark VARIABLES contents INVARIANT contents : NAT & contents <= 640 INITIALIZATION contents := 0 OPERATIONS enter = PRE contents < 640 THEN contents := contents + 1 END; leave = PRE contents > 0 THEN contents := contents – 1 END; nn <-- query = PRE true THEN nn := contents END END

  5. houseset, magazine := {}, {}

More Related