Docstoc

user-manual

Document Sample
user-manual Powered By Docstoc
					Atelier B




Atelier B
User Manual
version 3.7
ATELIER B
Atelier B User Manual
version 3.7




                           Document made by CLEARSY.



  This document is the property of CLEARSY and shall not be copied, duplicated or
            distributed, partially or totally, without prior written consent.



            All products names are trademarks of their respective authors.




                                        CLEARSY
                              ATELIER B maintenance
                                 Parc de la Duranne
                               320 avenue Archim` de     e
                                      e                  ˆ
                              L es P l´ i ades I I I - B at . A
                           13857 Aix-en-Provence Cedex 3
                                           France

                                Tel 33 (0)4 42 37 12 70
                               Fax 33 (0)4 42 37 12 71

                             mail : contact@atelierb.eu
Contents

1 Introduction                                                                                  1
  1.1   Document Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . .         1
  1.2   Layout Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .        2

2 Presentation                                                                                  3
  2.1   Role of Atelier B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .     3
  2.2   Objects Handled by Atelier B . . . . . . . . . . . . . . . . . . . . . . . . . .        3
  2.3   Using modes of Atelier B . . . . . . . . . . . . . . . . . . . . . . . . . . . .        4
  2.4   Motif User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .      4
        2.4.1   Start-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    4
        2.4.2   Projects Window Layout . . . . . . . . . . . . . . . . . . . . . . . .          4
        2.4.3   Components Window Presentation . . . . . . . . . . . . . . . . . . .            5
        2.4.4   Using the Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . .     6
        2.4.5   Using the Interactive Help . . . . . . . . . . . . . . . . . . . . . . . .      7
  2.5   Command Mode User Interface . . . . . . . . . . . . . . . . . . . . . . . . .           7
        2.5.1   Start-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    7
        2.5.2   Using the Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . .     8
                Using a Command File        . . . . . . . . . . . . . . . . . . . . . . . . .   8
                Using the Interpreter . . . . . . . . . . . . . . . . . . . . . . . . . . .     8
        2.5.3   Using Interactive Help . . . . . . . . . . . . . . . . . . . . . . . . . .      9
  2.6   Atelier B customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
        2.6.1   Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
        2.6.2   Resource file description . . . . . . . . . . . . . . . . . . . . . . . . . 10
        2.6.3   Creating a resource file     . . . . . . . . . . . . . . . . . . . . . . . . . 10
                Command Mode User Interface . . . . . . . . . . . . . . . . . . . . . 11
                Motif User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
        2.6.4   Resource file loading . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
                Command Mode User Interface . . . . . . . . . . . . . . . . . . . . . 11
                Motif User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
        2.6.5   Display resource values and AtelierB version . . . . . . . . . . . . . 12

                                              1
ii                                                                                 CONTENTS


                  Command Mode User Interface . . . . . . . . . . . . . . . . . . . . . 12
                  Motif User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3 Getting Started                                                                              13

4 Project Management                                                                           15
     4.1   Presentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
     4.2   Display the List of Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 17
                  Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
     4.3   Creating a Project In Atelier B . . . . . . . . . . . . . . . . . . . . . . . . . 18
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 18
                  Motif User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
                  Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
     4.4   Deleting a Project In Atelier B . . . . . . . . . . . . . . . . . . . . . . . . . 22
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 22
                  Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
                  Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
     4.5   Adding Users to a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 24
                  Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
                  Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
     4.6   Removing Users from a Project . . . . . . . . . . . . . . . . . . . . . . . . . 26
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 26
                  Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
                  Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
     4.7   Listing the Users of a Project . . . . . . . . . . . . . . . . . . . . . . . . . . 28
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 28
                  Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
                  Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
     4.8   Adding Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 30

                                                 2
CONTENTS                                                                                   iii


               Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
  4.9   Removing Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 33
               Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  4.10 Listing the Libraries of a Project . . . . . . . . . . . . . . . . . . . . . . . . 35
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 35
               Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
  4.11 Adding definition files directories . . . . . . . . . . . . . . . . . . . . . . . . 37
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 37
               Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
  4.12 Removing definition files directories . . . . . . . . . . . . . . . . . . . . . . . 38
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 38
                Motif user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
  4.13 Archiving a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 41
               Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
  4.14 Restoring a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 45
               Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
  4.15 Reading Properties of a Project . . . . . . . . . . . . . . . . . . . . . . . . . 49
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 49
               Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
  4.16 Opening a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 51

                                             3
iv                                                                                CONTENTS


                  Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
                  Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
     4.17 Closing a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 54
                  Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
                  Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

5 Managing Project Components                                                                 55
     5.1   Adding Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 56
                  Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
                  Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
     5.2   Suppressing Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 58
                  Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
                  Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
     5.3   Displaying the List of Components . . . . . . . . . . . . . . . . . . . . . . . 60
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 60
                  Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
     5.4   Reading Information on the Components . . . . . . . . . . . . . . . . . . . . 63
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 63
                  Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
                  Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
     5.5   Editing a Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 64
                  Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
                  Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
                  Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
     5.6   Restoring a Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
                  Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
                  Command mode user interface . . . . . . . . . . . . . . . . . . . . . 65
                  Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

                                                4
CONTENTS                                                                                     v


               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

6 Applying the B Method                                                                     69
  6.1   Presentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
  6.2   Syntax and Type Check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 71
               Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
               Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
  6.3   Generating Proof Obligations . . . . . . . . . . . . . . . . . . . . . . . . . . 76
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 78
               Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
               Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
  6.4   Displaying Proof Obligations . . . . . . . . . . . . . . . . . . . . . . . . . . 80
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 80
               Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
               Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
  6.5   Automatic Demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 85
               Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
  6.6   Interactive Demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 87
               Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
               Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
  6.7   Canceling Demonstrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 90
               Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

                                              5
vi                                                                                  CONTENTS


     6.8   Checking the Translatable Language (B0) . . . . . . . . . . . . . . . . . . . 91
                   Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
                   Command mode user interface . . . . . . . . . . . . . . . . . . . . . 91
                   Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
                   Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
                   Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
     6.9   Project Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
                   Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
                   Command mode user interface . . . . . . . . . . . . . . . . . . . . . 94
                   Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
                   Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
     6.10 Translating into C, C++, ADA or HIA           . . . . . . . . . . . . . . . . . . . . 97
                   Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
                   Command mode user interface . . . . . . . . . . . . . . . . . . . . . 97
                   Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
                   Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
     6.11 Applying a Tool to all the Components of a Project . . . . . . . . . . . . . 102
                   Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
                   Command mode user interface . . . . . . . . . . . . . . . . . . . . . 102
                   Motif User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
                   Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
     6.12 Updating a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
                   Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
                   Command Mode User Interface . . . . . . . . . . . . . . . . . . . . . 104
                   Motif User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
                   Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
     6.13 Tools interruption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
                   Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
                   User Interface in Command mode . . . . . . . . . . . . . . . . . . . 106
                   Motif User interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
                   Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
     6.14 Dependencies management         . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
                   Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
                   Command mode user interface . . . . . . . . . . . . . . . . . . . . . 108
                   Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

7 Analysing B Developments                                                                    111
     7.1   Presentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

                                                 6
CONTENTS                                                                                      vii


  7.2   Project Status    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 113
               Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
  7.3   Component Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 115
               Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
  7.4   Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 116
               Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
  7.5   Dependency Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 119
               Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
               A few useful VCG commands . . . . . . . . . . . . . . . . . . . . . . 121
               Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
  7.6   Operation call graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 123
               Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
               Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
  7.7   Formula graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 127
               Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
               Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
               Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
  7.8   Homonymy graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 132
               Motif user interface    . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
               Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
  7.9   Cross References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
               Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
               Command mode user interface . . . . . . . . . . . . . . . . . . . . . 137

                                              7
viii                                                                                  CONTENTS


                     Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
                     Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
       7.10 Extracting Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
                     Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
                     Command mode user interface . . . . . . . . . . . . . . . . . . . . . 142
                     Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
                     Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
                     Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

8 B Project Documentation                                                                       147
       8.1   Presentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
       8.2   Displaying a B Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
                     Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
                     Command mode user interface . . . . . . . . . . . . . . . . . . . . . 148
                     Motif user interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
                     Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
                     Possible errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
       8.3   Creating Complete Documents . . . . . . . . . . . . . . . . . . . . . . . . . 151
                     Usable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

A Limitations of Project Documentation Tools                                                    153

B Files Created by Atelier B                                                                    155




                                                   8
Chapter 1

Introduction

1.1    Document Organization
This document contains three parts, that progressively initiate the reader to the use of
Atelier B.

   • Part 1 describes the general principles of Atelier B and its user interfaces. It also
     describes how to customize it through resources.

   • Part 2 presents the general overview of Atelier B functions.

   • Part 3 covers in full detail the description of the functions of Atelier B using the
     Man-Machine Interfaces.




                                            1
2                                                                     Atelier B - User Manual


1.2       Layout Conventions
Each function of Atelier B is presented in the following manner:

      • A Description sub-section presents the characteristics of the command.

      • A Command Mode User Interface sub-section describes how to use the command
        with the batch mode interface.

      • A Motif User Interface sub-section presents the procedure to follow when using the
        command with the graphic interface.

      • A Customization sub-section presents the resources which allow to alter the com-
        mand.

      • A Possible Errors sub-section presents the error messages generated by Atelier B if
        an error occured when using the command.

Resources are presented as follows:
    Example                                                Comment
    ATB*POG*Generate Obvious PO                            resource name
    Positionned at Atelier B installation.                 Default value
    Generate or not obvious proof obligations.             resource description

Error messages are presented as follows:
    Example                                                Comment
    Clause <clause name> has no such PO                    message text
    The clause that you requested does not contain any     description of the error
    PO of the type specified in the parameters.             made
                                                           example producing the
    For example:                                           message
    If the list contains: b_init(0 unproved,
    1 proved, 2 obvious) and display "unproved"
     PO only is requested.


In the description of the Motif user interface, the names of buttons are always in italics.
For example, the Help... button.
The messages displayed by Atelier B in the start-up screen are always shown in the fol-
lowing way:

Type checking machine B_Keyboard_code

Loading referenced_machines
Checking names clashes
...
Checking operation b_code_entered
Normalising B_Keyboard_code
Saving data of component B_Keyboard_code

End of Type checking
Chapter 2

Presentation

2.1     Role of Atelier B
Atelier B is a set of software tools that allows the development of applications using the
“B Method”.

Atelier B assists designers in formalizing their application by:

   • Applying automatically the actions described in the B method on components.

   • Proposing services to help the development of the project, such as management,
     analysis and project documentation.


2.2     Objects Handled by Atelier B
This sub-section introduces the main objects handled by the Atelier B functions.

Component A UNIX file that contains a source written in the B language. This is the
   basis of a development using the B method.
   Component is a generic term representing:

        • a B specification (abstract machine),
        • a refinement of this specification,
        • its implementation (the last level of refinement).

      Components can be written with any text editor, outside Atelier B.

Project A project is a set of files (components, related files, C, C++, HIA or ADA
    sources, makefile) used or produced during the development of an application using
    the B method, with additional information as necessary for handling these source
    files in Atelier B (refer to the PDB).

Manager The creator of a project, possessing privileged rights compared to a simple
   user.


                                              3
4                                                                    Atelier B - User Manual


User A user can be either the creator (and therefore the Manager) of a project, or the
    developer to whom the creator of a project has granted access rights to this project.

Project Data Base (PDB) Internal files produced by Atelier B tools are stored in a
    directory called the PDB. This directory also contains files produced by the Atelier B
    documentation tools.


2.3     Using modes of Atelier B
In this manual, the term tools refers to all tools that relate to the application of the B
method, as well as to the analysis, debugging and documentation of programs written in
B. The B environment presented in this manual offers two modes of usage for these tools:

    • An interactive mode, using a graphical interface based on windows and command
      buttons; in the remainder of this document, we will refer to this mode as the Motif
      User Interface.

    • A batch mode, based on a language called the command language; in the re-
      mainder of this document, we will refer to this mode as the Command Mode User
      Interface.


2.4     Motif User Interface
2.4.1    Start-up

To start-up the Motif User Interface, perform the following operations:

    1. Open a shell window with scroll bars (start-up window). This is the window where
       the Atelier B information and error messages will be displayed.

    2. Type the command startAB in the start-up window. This script shell is located in
       the <atelierb_dir>/AB/bbin directory.
       After a few moments the Atelier B projects window will be displayed in the top left
       of the screen.

If your Atelier B license is no longer valid or if there are no more license available, a
message is displayed in the start-up window and no window is displayed.

2.4.2    Projects Window Layout

The projects window grants you access to the project management functions (refer to
sub-section 4).
Figure 2.1 on page 5 shows the main fields in this window:

    1. The data part contains the name of the UNIX user who started Atelier B, in this
       case cc.
PRESENTATION                                                                               5




                                                                              Header
     information
        part




          Projects List                                                   Commands Part



                               Figure 2.1: Project window



  2. The projects list contains the names of all the projects that are accessible to the user
     who started Atelier B, in this case MyProject and DAB.

  3. The commands part gives access to the project management functions described in
     sub-section 4.

  4. The header contains three buttons: the Quit Environment button to quit Atelier B;
     the Help button to display Atelier B on-line help; the Preferences button to customize
     Atelier B.

2.4.3   Components Window Presentation

The components window gives you access to management, processing, analysis and docu-
mentation functions relating to the Atelier B components. These functions are described
in the following sections and sub-sections 5, 6, 7 and 8.
Figure 2.2 on page 6 shows the main parts of this window:

  1. The information part contains the name of the current project, as well as the access
     path for the current directory; in this example the project is called DAB and the
     current directory is /users/cc/tmp/src.

  2. The components list contains the names of the project components, for example
     B Clavier code is one of the project components.

  3. The filters for the components list are used to reduce the number of components
     displayed in the components list by selecting a sub-set of them.

  4. The commands part gives access to the component processing functions.
     The left buttons correspond to functions that are used to apply the B method.
6                                                                      Atelier B - User Manual




                                                                               Header
        information
        part



      components
      filters




                                                                           Commands Part
                           Components List



                              Figure 2.2: Components window



      The right buttons correspond to component management, analysis and documenta-
      tion functions.

    5. The header contains three buttons: the Quit Project button quits the components
       window; the Help button calls-up Atelier B on-line help; the Preferences button
       allows to customize Atelier B.

2.4.4     Using the Interface

This sub-section describes the general principles to use the Motif user interface. It defines
a number of terms that will be used in the following sections.

Click: Press the left mouse button.

Double-click: Press the left mouse button twice in quick succession.

Select from a list:

          • To select an element from the list, click on the element; it will be displayed in
            reverse video.
          • To select several successive elements, click on the first element, then click on
            the last one while holding the Shift key down; all of the elements between
            the first one and the last one will be displayed in reverse video. You can also
            click on the first element and drag the mouse cursor to the last one (”dragging”
            means moving the mouse while holding down the mouse button).
          • To select a number of non-successive elements, click on the first element, then
            click on the next elements while holding the Ctrl key down; each element
            selected will be displayed in reverse video.
PRESENTATION                                                                                  7


The interface buttons with names followed by ”...” have a second menu level. To use
a menu-button click on the button to display the menu, then, click on the required
function in the menu.
In the rest of this document, this type of action will be expressed as follows: Click on the
Analysing ... button, select Project Status.

2.4.5    Using the Interactive Help

To use this function, your machine must be equipped with a Hypertext browser (Netscape,
Arena, Mosaic, ...).
The browser used is declared during the set-up of Atelier B (refer to the Administrator’s
Manual).
It can be altered thanks to the following resource (refer to sub-section 2.6):
      ATB*OPT_TOOLS_<SYSTEM>*HTML_Viewer_Path
Clicking on the Help button, selecting Help Contents in the components window or the
projects window, gives access to the list of Manuals delivered with Atelier B and available
in-line.
The Help buttons in the data entry and error windows give access to the corresponding
section of this document.
Each time you click on a Help button, Atelier B calls-up the hypertext browser with the
requested document as a parameter.
The only document available in hypertext format is the User’s Guide, every other docu-
ments are available in “PDF” format.


2.5     Command Mode User Interface
This user interface allows Atelier B to be used on a VT100 type terminal as well as in
semi-automatic mode with a command file.
This interface is a command interpreter (like a shell), with the same features as the Atelier
B Motif interface.

2.5.1    Start-up

To start up the command mode user interface:
   1. Open a shell window with scroll bars (start-up window).
   2. Type the command startBB in the start-up window. This script shell is located in
      directory <atelierb_dir>/AB/bbin.
      After a few moments the interpreter prompt is displayed:
      Beginning interpretation ...
      bbatch 1>

To quit the command mode user interface, type quit or q.
If your Atelier B license is no longer valid or if there is no more license available, a message
is displayed in the start-up window and the prompt is not displayed.
8                                                                    Atelier B - User Manual


2.5.2     Using the Interface

You can use this interface in two different ways:

    1. interactively, or

    2. with a command file.

The syntax of all commands is described in the following sections. Each command has a
long name and an abbreviation. For example, show_projects_list (long name) and spl
(abbreviation).

Using a Command File

A command file can contain:

    • Comments: lines starting with “#”.

    • Atelier B commands: long name or abbreviation.

    • Calls to the UNIX shell: lines starting with “\”.

Example of a command file:
The file below displays the list of projects, then the list of users of the LIBRARY project
and the contents of the current directory:

#--------------------------
# This is a comment
#--------------------------
# list of projects
show_projects_list
# users of the LIBRARY project
spul LIBRARY
# contents of the current directory
\ls -l
# end of the command file


To execute a command file, type one of the following commands:
startBB -i=file_name
or
startBB < file_name
or
startBB << END
list of commands...
END

Using the Interpreter

This sub-section provides some hints on how to use the command interpreter.
To call-up the last command entered, type the command “!”. The last command is
displayed, then executed.
PRESENTATION                                                                          9


To call-up the UNIX shell without exiting the interpreter, enter this command preceeded
by the character “\” (example: \ls -l).
Some commands have default parameters. For project management commands, the inter-
preter stores the last project name entered. In the same way, the interpreter stores the
last component name entered. To use this default parameter, simply type <return>.
Example:

bbatch 3> typecheck MM_1
....
bbatch 4> pogenerate
pogenerate MM_1 ? (yes=return)
...


2.5.3   Using Interactive Help
The help command displays the list of commands available. This list is displayed in the
following format:

General commands :
(cd ) change-directory
...
(v   ) version-print

Project level commands:
(add ) add-definitions-directory
(apl ) add-project-lib
...
(spl ) show-projects-lists

Machine level commands (available after open_project):
(aa ) ada-all                (a   ) adatrans
(af ) add-file               (ani ) animator
....
....
(s   ) status                (sg ) status-global
(t   ) typecheck             (u   ) unprove

The commands are presented in the following order:

  1. General commands,

  2. Project management commands,

  3. Commands that apply to components: A project must be opened to be able to use
     these commands.

Command abbreviations are indicated within parenthesis () before the command name.
You can also obtain help on a specific command by typing the command: help command_name,
or h command_name.
For example:

bbatch 9> help help
help [command]    get help on commands
10                                                                      Atelier B - User Manual


2.6      Atelier B customization
2.6.1     Description

There are three ways for the user to customize Atelier B :

     • create a resource file $HOME/.AtelierB which customizes all Atelier B for the current
       user,
     • create an AtelierB file in the PDB directory of a project. This file customizes
       Atelier B when the user opens this project,
     • create any file that the user has to specify explicitly when its use is requested.

When the same resource is specified in several of those files, the priority order is the
following (from highest to lowest) :

     • the explicit file,
     • the file associated to the project,
     • the file associated to the user.

When two files are given explicitly, the second one takes precedence.
When a resource is described in none of those files, a default value is taken, which is present
in the Atelier B general resource file : refer to Atelier B - Administrator’s Manual.

2.6.2     Resource file description

All resource files have the same format. Lines starting with an exclamation mark ! or a
hash sign # are comments. The others contain a resource name followed by its value.
The resource names for the Atelier B tools are as follows :
ATB*<_tool>*<resource_name>.
For Atelier B foreign and optional tools (Latex, Da Vinci, ...), syntax is:
ATB*OPT_TOOLS_<system>*<resource_name>.
<system> is LINUX for Linux operating system and SUN5_6 for Solaris 6 or greater.
Examples :
ATB*POG*Generate_Obvious_PO: FALSE
When this resource is positioned to FALSE, the obvious proof obligations are not saved
by Atelier B.
ATB*OPT_TOOLS_LINUX*HTML_Viewer_Path: /usr/local/netscape/netscape
This resource describes the access path to the hypertext browser for Linux operating
system.

2.6.3     Creating a resource file

This function allows to edit the resource file. If the file does not exist, it is created and
initialized from a model. The model contains the list of all resources. Displaying a resource
can be made by uncommenting the line and updating the resource value.
PRESENTATION                                                                             11


Command Mode User Interface

The user interface has already been started up.
To edit the user resource file, type the following:
edit_users_res
or
eur
To edit a project resource file, open the project and type the following:
edit_project_res
or
epr
To edit an explicit resource file named filename, type the following:
edit_res_file filename
or
erf filename

Motif User Interface

To edit the user resource file:

   • In the header of the projects window or components window, click on the Prefer-
     ences... button and select Edit User Resource File

To edit the project resource file:

   • In the header of the components window, click on the Preferences... button and
     select Edit Project Resource File

To edit a named resource file:

   • In the header of the projects window or components window, click on the Prefer-
     ences... button and select Edit Explicit Resource File.

2.6.4   Resource file loading

The user resource file is automatically loaded when starting Atelier B or quitting a project.
A project resource file is automatically loaded when opening the corresponding project
and unloaded when quitting it.
Explicit resource files are loaded when requested by the user. They are automatically
unloaded when quitting a project.

Command Mode User Interface

To load the explicit resource file filename, type the following :
load_res_file filename
or :
lrf filename
12                                                                   Atelier B - User Manual


Motif User Interface

To load an explicit resource file :

     • Edit the resource file (refer to the previous sub-section).

     • In the header of the projects window or components window, click on the Preferences
       ... button and select Load Explicit Resources File.

2.6.5     Display resource values and AtelierB version

The version display command shows :

     • the global version of Atelier B,

     • the version of all Atelier B tools,

     • the current values of resources.

Command Mode User Interface

To display the Atelier B version, type the following :
version_print
or
v



Motif User Interface

To display the Atelier B version :

     • In the header of the projects window or components window, click on the Help ...
       button and select About Atelier B.
Chapter 3

Getting Started

The following sections of this document describe all the functions provided by Atelier B.
This section gives an overview of the functions of Atelier B.
To start a new development using Atelier B, you will need to:

  1. Create a project (refer to sub-sections 4.1 and 4.3),

  2. Open this project (refer to sub-section 4.16),

  3. Add components to this project (refer to sub-section 5.1).

You can now start to apply the B method to your components; you can:

  1. perform a syntax analysis and type check (refer to sub-section 6.2).

  2. generate proof obligations (refer to sub-section 6.3),

  3. automatically prove part of these proof obligations (refer to sub-section 6.5),

  4. display the proof obligations (refer to sub-section 6.4),

  5. use the interactive prover to prove the remaining proof obligations (refer to sub-
     section 6.6).

After creating the implementations for your project, you can:

  1. check that the implementations are correctly written in the B0 language (refer to
     sub-section 6.8),

  2. translate the project into C, C++, ADA or HIA (refer to sub-section 6.10).

During these development phases, you can use the Atelier B analysis functions, to:

   • display progress on a project or a component (refer to sub-section 7.2 and 7.3),

   • animate a specification (refer to sub-section 7.4

   • display the dependencie graph between components (refer to sub-section 7.5),


                                            13
14                                                                        Atelier B - User Manual


     • display graphs to visualise peculiarities of a B model (refer to sub-section

     • search for identifiers defined in components (refer to sub-section 7.9),

     • check that your components follow some programming rules (refer to sub-section 7.10).

You can also use the documentation functions to automatically produce documentation
in L TEXor Word formats (refer to sub-section 8.2 and 8.3).
   A

When your projects reach large sizes, you can:

     1. perform archive storage to create back-ups (refer to sub-section 4.13),

     2. split your large scale projects into several smaller projects using the libraries (refer
        to sub-section 4.8),
Chapter 4

Project Management

4.1    Presentation
A project managed by Atelier B is defined by:

   • Its name

   • A Project Data Base where all the files created by Atelier B are stored (PDB).

   • A directory where the translations of components to the C, C++, HIA or ADA
     languages are stored.

   • A set of B source files; these files can be located in different directories.

The creation of these directories and B source files is entirely up to the user. Atelier B
does not provide a tool for their creation, the user must use UNIX commands.
The projects managed by Atelier B are multi-user projects. Many users can work on the
same project simultaneously. Atelier B uses the rights of the atelierb UNIX group to solve
UNIX rights problems between users (refer to the Atelier B - Administrator’s Manual).
A B project, managed by Atelier B, can also use other projects regarded as libraries.
Libraries may be used to split industrial size projects into some smaller projects.
Atelier B also offers functions to archive projects. These functions are used to back-up or
copy projects.
For project archiving and portability reasons, we encourage Atelier B users to adopt a
project layout that obeys the following rules:

   • All users of the same project should be in the same UNIX group (the Atelierb group).

   • The project directories must have a common root. If project_dir is this directory,
     the PDB and the translation directory must be sub-directories of project_dir. For
     example: project_dir/pdb and project_dir/lang.

   • The B source files must be located in sub-directories of project_dir. You can for
     example define a sub-directory for each software element, especially if the users who
     are responsible for them are different.

                                            15
16                                                                                                Atelier B - User Manual



                                     project dir

                                                                                                   OWNER



                       PDB             TRANS                            SRC

                   files produced    C, C++ or ADA
                   by Atelier B      translations




                                                       Elem1                     Elem2

                                                    B sources of              B sources of
                                                    program element 1         program element 2




                                                     User 1                          User 2


                                    Figure 4.1: Project layout



     • The directories containing definition files (see 4.11) must also be sub-directories of
       project_dir.

If a project does not follow these rules, it cannot be archived.
Figure 4.1 on page 16 shows an example of a project that follows these rules.
PROJECT MANAGEMENT                                                                        17


4.2     Display the List of Projects
Description

This function is used to display the list of projects accessible to the Atelier B user (refer
to sub-section 4.5 for information on visibility rules).
The project names are always displayed sorted in alphabetical order.

Command mode user interface

The user interface has already been started up.
To view the list of projects, type the following command:
show_projects_list
or
spl
The list is displayed as shown below:

Printing Projects list ...

       projet1
       projet2

End of Projects list

Motif user interface

In the Atelier B projects window, the list of projects is always displayed.
Warning: This list is not always up to date. It is possible that another user has added or
deleted a project after the list was displayed. To update the list you must use the Refresh
button (refer to figure 2.1 on page 5).
18                                                                     Atelier B - User Manual


4.3      Creating a Project In Atelier B
Description

The Attach project function allows all users to declare a new project in Atelier B. The
information required to declare the project is:

     • the name of the new project and its owner,

     • the Project Database directory (PDB) used by Atelier B to store internal files,

     • the translation directory used by Atelier B to store translated files.

The user who created the project becomes its manager. He is the only one allowed to
perform certain add/delete users, libraries and archive operations.
To reference a given project, only the PDB and translation directories are required by
Atelier B (refer to the directions below). The creation of these two directories is up to
the user. The project components can be ”scattered through” the file system, their access
path and names are stored in a file located in the PDB and called project_name.db.

Command mode user interface

To create a project:

     1. Choose and create a Project Data Base directory. Sub-section 4.1 provides recom-
        mendations for the layout of B projects.
        If path_pdb is the path to this directory.
        To create the directory, type the UNIX command:
        mkdir path_pdb

     2. Choose and create a translations directory.
        If path_lang is the path to this directory.
        To create the directory, type the UNIX command:
        mkdir path_lang

     3. Start the command mode interface:
        startBB

     4. Create the project by typing the following command:
        create_project project_name path_pdb path_lang
        or
        crp project_name path_pdb path_lang

     5. Check that the project has been created by typing the command:
        show_projects_list
        or spl

Remark: You do not have to type the full path to directories, you can specify a path
relatively to the directory where Atelier B was started up.
For example, if Atelier B was started when you were in directory /home/project, you
could have type pdb and lang directories.
PROJECT MANAGEMENT                                                                  19




                           Figure 4.2: Attach Project window



Motif User Interface

To create a project, perform the following operations:

  1. Choose and create the project data base directory. Sub-section 4.1 provides recom-
     mendations on the layout of B projects.

     If path_pdb is the path to this directory.
     To create the directory, type the UNIX command:
     mkdir path_pdb

  2. Choose and create a translations directory.
     If path_lang is the path to this directory.
     To create the directory, type the UNIX command:
     mkdir path_lang

  3. Start the Motif user interface:
     startAB

  4. From the projects window click on the Attach Project button.
     The window shown in figure 4.2 on page 19 is displayed.


  5. Type the project name in the Project Name field, for example MyProject.

  6. Type the access path to the PDB directory
     in the Project Database Directory path, for example /home/project/pdb.

     You can also choose the directory by clicking on the Browse button. The window
     shown in figure 4.3 on page 20 is displayed.

     In this window choose the directory by clicking in the Directories: list.
20                                                                    Atelier B - User Manual




                           Figure 4.3: Choose directory window


     7. Type the access path to the translations directory
        in the Translations Directory field, for example /home/project/trans.

       You can also chose the directory by clicking on the Browse button.
     8. Click on the OK button to create the project.
     9. Check the projects list to ensure that your project name is displayed. This list is
        sorted by alphabetical order.

Remark: You do not have to type the full path to directories, you can specify a path
relative to the current directory.
For example, if Atelier B was started when you were in directory /home/project, you
could type pdb and lang directory.

Possible errors
 Cannot Attach project Cannot access directory <dir>
 The directory <dir> specified for the PDB or for the translations does not exist
 or cannot be accessed. Check the access path for the directory specified in the
 parameter as well as its UNIX rights. The directory must be accessible in write
 mode to the user who creates the project.


 Cannot Attach project Directory <dir> is already used
 The <dir> directory specified for the PDB or for the translations is already used
 by another project managed by Atelier B. The directory contains a ”marker” file
 named ”.project” which is used by Atelier B.
PROJECT MANAGEMENT                                                                    21


Cannot attach project, directory <dir> is used twice
You have specified the same directory for the PDB and the translations directory.
These two directories must be different.


Cannot attach project, project name <name> is already used
The project name that you gave is already used by another project. Warning, the
project may not be in the list of projects. In this case it is a project created by
another user.
22                                                                    Atelier B - User Manual


4.4       Deleting a Project In Atelier B
Description

The Detach project function deletes an existing project. Only the project manager, i.e.
the person who created the project is allowed to delete it.
The intermediate files produced by Atelier B in the project data base will then be deleted.
The following files are not deleted:

     • B source files,

     • user rules files (*.pmm),

     • the project documentation that is automatically generated,

     • the translations,

     • the project data base directory,

     • the translations directory.

To completely clear the project you should delete manually those files and directories after
deleting the project using Atelier B.

Command mode user interface

The user interface has already been started up.
To delete a project named proj, type the following command:
remove_project proj
or
rp proj

Motif user interface

The user interface is started up. To delete a project, perform the following operations in
the projects window:

     1. Click on the project to delete in the projects list,

     2. Click on the Detach Project button.
        a confirmation window is displayed


     3. Confirm the deletion by clicking on Ok or
        cancel the action by clicking on Cancel.
        The project is deleted from the projects list.
PROJECT MANAGEMENT                                                                         23


Possible errors
 Allowed only for the manager of the project <proj>
 Only the manager of the project (the UNIX user who created the project) is allowed
 to delete it.


 Cannot remove <proj1>: Project is used as a library of <proj2>
 The <proj1> project cannot be deleted since it is used by the <proj2> project
 as a library. If it were deleted, the <proj2> project would be incomplete. Before
 deleting it, the <proj1> library must be removed from the list of libraries declared
 in the <proj2> project.


 Cannot access the components list file of the project <proj>
 This warning message is generated if the project components description file is no
 longer accessible. This file named <proj>.db is normally in the project data base
 directory. The file or the directory may have been deleted by mistake. This message
 does not stop deletion of the project.


 No such project: <proj>
 There is no project with this name. In the projects list, check the name of the
 project to delete.


 Someone is currently using the project <proj>
 Before deleting a project, Atelier B checks that no user is currently working on the
 project. This is tested by checking the presence of the “.usedby_<user>_xxxx” files
 in the project data base directory. Such files may remain if Atelier B was shut-down
 incorrectly (by kill -9, or a power failure for example). In this case, these files must
 be deleted manually.
24                                                                     Atelier B - User Manual


4.5       Adding Users to a Project
Description

By default, a project is only accessible to the user who has created it. This user is
considered the project manager by Atelier B.
If necessary, the project manager can make his project accessible to other users. It is
possible to grant access:

     • In read and write modes: In this case the user can perform the same operations as
       the project manager on the project components (attach/detach components, type
       check, etc).
        The project manager remains the sole person authorized to perform operations on
        the project (deleting or adding libraries or users, etc).

     • In read mode only: In this case the user can only view project components. Only
       documentation functions will be accessible.
        The user can add this project as a library to the projects that he owns.

Warning, the user is added, even if he does not exist on the machine UNIX system.
The manager can grant access to all system users by adding a user named “*”.
Atelier B uses the rights of the atelierb group in order to solve problems with UNIX rights
between project users (refer to Atelier B - Administrator’s Manual).
Users can protect their B source files, even when some users have read and write mode
access rights to a project.

Command mode user interface

The user interface has already been started up.
To grant access in read-write mode to user user_name, for project proj, type the following
command:
add_project_user proj user_name
or
apu proj user_name
To grant access in read mode only to user user_name, for project proj, type the following
command:
add_project_reader proj user_name
or
apr proj user_name
If you put the character “*” instead of user_name, you grant access to all users.

Motif user interface

The user interface is started up you are in the projects window.
To add a user to a project, perform the following operations :

     1. Click on the project in the projects list.
PROJECT MANAGEMENT                                                                     25




                            Figure 4.4: New User window



  2. Click on the Users ... button, select Add.
     The window shown in figure 4.4 on page 25 is displayed.


  3. Type the user name in the New User field.
     You can type “*” to grant access to all users.

  4. Click on the type of access required read only or read write

  5. Confirm by clicking on Ok or cancel by clicking on Cancel.



Possible errors
 Allowed only for the manager of the project <proj>
 Only the manager of the project (the UNIX user who created the project) has the
 right to add a user to the project.


 No such project: <proj>
 There is no project with this name. Check the projects list for the name of the
 project that you want to add a user to.


 Someone is modifying the project <proj>
 Another user is simultaneously performing an action on the project (add/delete
 user, library or archiving). During these operations, the project description file
 (<proj name>.desc) is locked by a file named: <proj name>.desc.lock. Wait until
 the action is over.


 User <name> is already present in the project
 The user specified as a parameter is already present in the list of users authorized
 to use the project. If you wish to change the access type of a user grant write
 permission to a user with only read permission), delete the user then add him once
 again with the new permissions.
26                                                                       Atelier B - User Manual


4.6       Removing Users from a Project
Description

The Remove User function is used to remove a user from the users list of a project.
Only the project manager can use this function, and he cannot exclude himself from the
project.
Warning, it is not possible to delete a user who has added components to the project as in
this case it would no longer be possible to access these components. To delete this user,
the only solution is to delete the components owned by the user.

Command mode user interface

With the user interface running. To delete a user user_name, from project proj, type the
following command:
remove_project_user proj user_name
or
rpu proj user_name

Motif user interface

To delete the user of a project, perform the following operations in the projects window:

     1. Click on the project name.

     2. Click on the Users ... button, select Remove.
        A data entry window is displayed.
        This window contains the list of all the users of the project.

     3. Click on the user to remove.

     4. Confirm by clicking on Ok or
        cancel by clicking on Cancel.
        A confirm window is displayed.

     5. Confirm by clicking on Ok or
        cancel by clicking on Cancel.



Possible errors
 Allowed only for the manager of the project <proj>
 Only the manager of a project (the UNIX user who created the project) is allowed
 to delete a user from the project.


 Cannot suppress project manager <name>
 The user specified in the parameter is the project manager. He cannot be removed.
PROJECT MANAGEMENT                                                                        27


Cannot access the project components description file
This error message is generated if the project components description file is no longer
accessible. The <proj>.db file is normally in the project data base directory. The
file or the directory may have been accidentally deleted. If this file is not accessible,
Atelier B cannot check whether the user has components or not. In general, if this
file is no longer accessible, it is preferable to delete the project, as no more actions
will be possible on this project.


No such project: <proj>
There is no project with this name. Display the projects list to check the name of
the project from which you want to remove a user.


Someone is modifying the project <proj>
Another user is simultaneously performing an action on the project (adding/deleting
a user, a library or an archive storage). During these operations, the project de-
scription file (<proj name>.desc) is locked by a file called: <proj name>.desc.lock.
Wait until the operation is over.


User <name> owns a component of the project, it cannot be removed
The user specified owns components in the project. This user cannot be deleted
since his components would no longer be accessible to other users.


User <name> is not present in the project read/write users list
The user specified is not present in the list of project users. This error may only
occur in the command mode user interface.
28                                                                     Atelier B - User Manual


4.7      Listing the Users of a Project
Description

This function lists all the users of a project. The following data are displayed:

     • name of the project manager.

     • name of the users in read and write access modes.

     • names of the users in read only access mode.

Sub-section 4.5 describes the various rights that are available to project users.

Command mode user interface

The user interface has already been started up.
To display the list of users in read access mode, type the following command:
show_project_readers_list proj_name
or
sprl proj_name
The list is displayed as follows:


Printing Project proj_name readers list ...

        user1
        user2

End of Project proj_name readers list

To display the list of users in read and write access modes, type the following command:
show_project_users_list proj_name
or
spul proj_name
The list is displayed as follows:


Printing Project proj_name read-write users list ...

        user1     (manager)
        user2

End of Project proj_name read-write users list

The project manager is displayed first.

Motif user interface

The user interface is started up, you are in the projects window.
To obtain the list of users of a project, perform the following operations:
PROJECT MANAGEMENT                                                                    29




                            Figure 4.5: Users List window



  1. Click on the project name in the projects list.

  2. Click on the Users ... button, select List.
     The window shown in figure 4.5 on page 29 is displayed.

     This window displays the list of users.
     The project manager name is preceded by (manager).
     Users with read and write access are prefixed by (rw)
     Users with read only access are precededd by (r-)

  3. Click on Ok or Cancel to close the window.

Possible errors
 Cannot read file <ATB dir>/<proj name>.desc
 The project description file has been damaged. You must delete the project as it
 cannot be used anylonger.


 No such project: <proj>
 There is no project with this name. Display the projects list to check the name of
 the project.
30                                                                      Atelier B - User Manual


4.8       Adding Libraries
Description

When developing large size projects, you may:

     • use predefined component libraries,

     • structure a large project into a number of sub-projects.

The manager of the project can link his project to other projects managed by Atelier B,
by using the Add Library function.
Any project accessible in read mode to the manager (refer to sub-section 4.5) can become
a project library.
When a library is linked to a project, the project user can establish links (SEES, IM-
PORTS, ...) to the components of this library.
The Add Library function checks that the library to add is not already linked to the
project.
For example:
If project <proj1> uses project <proj2> as a library and if
project <proj> uses library <proj1> ,
then
library <proj2> cannot be added to project <proj> , because <proj2> is already used by
transitivity.
If a component is defined in several libraries, then the component that will be taken into
account is the one defined in the library that was added first. If there is any doubt on the
components taken into account, display the project dependency graph.

Command mode user interface

With the user interface running. To add the lib_name library to the proj project, type
the following command:
add_project_lib proj lib_name
or
apl proj lib_name

Motif user interface

The user interface is already started up, you are in the projects window. To add a library
to a project, in the projects window:

     1. Click in the projects list, on the name of the project you want to add libraries to.

     2. Click on the Libraries ... button, select Add.
        The window shown in figure 4.6 on page 31 is displayed.

       This window contains the list of projects that you have the right to read.
PROJECT MANAGEMENT                                                                         31




                            Figure 4.6: Add Libraries window



  3. From the list, select the libraries to add.

  4. Click on OK to complete linking.

Possible errors
 Allowed only for the manager of the project <proj>
 Only the manager of a project (the UNIX user who created the project) has the
 right to add a library to the project.


 Bad file format for <ATB dir>/<lib name>.desc
 The data present in the project description file that you want to add as a library
 is incorrect. The file might have been modified or overwritten by mistake. This
 project is no longer valid. You should delete it.


 Cannot create file <proj pdb>/.lib
 The ”.lib” file present in the project data base is used by some Atelier B tools
 to search for components in the libraries. This file contains the PDB access path
 of the project libraries. When a library is added or deleted, this file is modified.
 This message is generated if Atelier B cannot write into the PDB. Check the PDB
 directory access rights. The PDB directory must belong to the manager and to the
 atelierb group. The access rights should be:
 PDB rwxrwxr– atelierb manager


 <lib name> is a library of the project <proj name>
 The project that you want to add as a library is already present in the list of project
 libraries.


 No such project : <proj>
 There is no project with this name. Display the list of projects and check the name
 of the library you want to add or the name of the library project.
32                                                                  Atelier B - User Manual


 Cannot access project <lib name>
 You are not authorized to read the library that you want to add to the project. You
 should ask the manager of this project to give you read access to it.


 Someone is modifying the project <proj>
 Another user is simultaneously performing an action on the project ( adding/deleting
 a user or library).        During these actions, the project description file
 (<proj name>.desc) is locked by a file named: proj name>.desc.lock. You must
 wait until the other user action is over.


 The library <lib name> is already included in the project <proj name>
 The project you want to add as a library is already present in the list of project
 libraries.
PROJECT MANAGEMENT                                                                     33




                          Figure 4.7: Remove Libraries window



4.9     Removing Libraries
Description

The Remove Library function is used to remove a library from the list of libraries of a
project.
The operation is only performed if it is requested by the project manager.
Warning, before removing a library you should check that no component of the project
depends on a component of this library. Otherwise, the project will be in an incoherent
state after the library is removed. To check this, use the dependencies graph described in
sub-section 7.5.

Command mode user interface

The user interface is already started up.
To remove the lib_name library from the proj_name project, type the following command:
remove_project_lib proj_name lib_name
or
rpl proj_name lib_name

Motif user interface

The user interface is already started up, you are in the projects window.
To remove a library from a project, perform the following operations :

  1. Click on the project name.

  2. Click on the Libraries ... button, select Remove.
     The window shown in figure 4.7 on page 33 is displayed.

      This window contains the list of all project libraries.

  3. Click on the library to remove from the list.
34                                                                    Atelier B - User Manual


     4. Confirm by clicking on Ok.

Possible errors
 Allowed only for the manager of the project <proj>
 Only the manager of a project (the UNIX user who created the project) is allowed
 to delete a project library.


 Cannot create file <proj pdb>/.lib
 The ”.lib” file present in the project data base is used by some Atelier B tools to
 search for components in the libraries. This file contains the PDB access paths for
 the project libraries. When a library is added or deleted, this file is modified. This
 message is generated if Atelier B cannot write into the PDB. Check the access rights
 of the PDB. The PDB directory must belong to the manager and to the atelierb
 group. The access rights should be:
 PDB rwxrwxr– manager atelierb


 No such project: <proj>
 There is no project with this name. Display the projects list to check the name of
 the project.


 Project <lib name> is not present in the project libraries list
 The library given as a parameter does not belong to the list of libraries.


 Someone is modifying the project <proj>
 Another user is simultaneously performing an action on the project
 (adding/removing a user, library or archiving). During these actions, the project de-
 scription file (<proj name>.desc) is locked by a file named: <proj name>.desc.lock.
 You will have to wait for the action to be over.
PROJECT MANAGEMENT                                                                           35


4.10      Listing the Libraries of a Project
Description

This function lists all the libraries of a project. The library names are sorted in alphabetical
order.

Command mode user interface

The user interface is already started up.
To display the list of libraries of project proj_name, type the following command:
show_project_libs_list proj_name
or
spll proj_name
The list is displayed as shown below:


Printing Project proj_name libs list ...

         lib1
         lib2

End of Project proj_name libraries list


Motif user interface

The user interface is already started up, you are in the projects window.
To access the list of libraries for a project, perform the following operations :

   1. Click on the project name in the list of projects.

   2. Click on the Libraries ... button, select Display List.
      The window shown in figure 4.8 on page 36 is displayed.

      This window shows the list of libraries sorted in alphabetical order.

   3. Click on Ok or Cancel to close this window.

Possible errors
 Bad file format for <ATB dir>/<lib name>.desc
 The data present in the project description file is incorrect. The file might have
 been modified or overwritten by mistake. This project is no longer valid. You
 should delete it.


 No such project: <proj>
 There is no project with this name. Check the list of projects, for the project that
 you want the list of libraries for.
36                                                                  Atelier B - User Manual




                           Figure 4.8: Libraries List window



 Cannot access project <lib name>
 You are not authorized for read mode access to the project that you want the list
 of libraries for. You will have to ask the manager of this project to grant you read
 access.
PROJECT MANAGEMENT                                                                         37


4.11     Adding definition files directories
Description

Definition files are a means to share common definitions for several components.
Their description are given in chapter 2.3 The DEFINITIONS clause of the document
Reference Manual for B language .
This section describes the procedures to follow so as to add a new directory to a B project,
which can contain definition files used by the components of this project.
The operation only takes place if it is requested by the manager of the project.

Command mode user interface

The user interface has already been started up.

To add the dir directory to the proj project, you must type the following command :
add_definitions_directory proj dir
or
add proj dir
Beware, you must indicate the absolute path of the directory.

Motif user interface

The user interface has already been started up, you are in the projects window.

To add a directory to a project, you must :

  1. In the list of projects, click on the name of the project you wish to add to a directory.

  2. Click on the Libraries ... button, select Add definitions directory.
     The window shown in figure 4.9 on page 38 is displayed.


  3. Select in the Directories: list, the directory you wish to add.

  4. Click on OK to complete the operation.
38                                                                     Atelier B - User Manual




                      Figure 4.9: Add definition directories Window



4.12     Removing definition files directories
Description

The function Remove definition directories permits the exclusion of several directories
from the list of definition directories of a project.
The operation only takes place if it is requested by the manager of the project.
Beware, before deleting a directory, it is advised to verify that no component of the project
depends on a definition file present in this directory.

Command mode user interface

The user interface has already been started up.
To delete the dir directory from the project name proj_name, you must type the following
command :
remove_definitions_directory proj_name dir
or
rdd proj_name dir.

Beware, you must indicate the absolute path of the directory.

Motif user interface

The user interface has already been started up, you are in the projects window.
To delete a definition directory from a project, you must perform the following operations
:
PROJECT MANAGEMENT                                                                    39




                  Figure 4.10: Remove definitions directories window



  1. Click on the name of the project.

  2. Click on the Libraries ... button, select Remove definition directories.
     The window shown in figure 4.10 on page 39 is displayed.

     This window contains the list of all the definition directories of the project.

  3. Click on the directories to be deleted from the list.

  4. Confirm by clicking on Ok.
40                                                                      Atelier B - User Manual


4.13       Archiving a Project
Description

This function is used to archive all the files of a project managed by Atelier B.
The archive created is a file in tar format with a .arc extension and a tar prefix, for
example tarLIBRARY.arc.
This function can be used to:

     • back-up a project,

     • make a copy of a project (e.g., to transfer it to another machine).

There are three options for archiving:

     • Save all the B source files (.mch, .ref and .imp and definition files).

     • Save all the B source files and the proof files.
       With this option, Atelier B also saves the files in the project data base used by the
       proof tools:

          – .po files: proof obligations,
          – .pmi files: demonstrations,
          – .pmm files: user rules,
          – PatchProver file: user tactics,
          – AtelierB file: project resource file.

     • Save the entire project:

          – B source files,
          – files present in the project data base directory,
          – files present in the translation directory.

When “all” the project is archived, all data is stored. As a result, when the project is
restored (refer to sub-section 4.14) the user will retrieve it in the same state; and will not
have for instance to type check again what was already type checked.
Warning, only projects with a layout like that described in sub-section 4.1 can be
archived. All the project directories must have a common root.
Examples:

     1. The following project cannot be archived as its PDB directory and its translation
        directory are not in the same directory:

                 Project : proj_name
                 PDB    : /home/projects/proj_name/pdb
                 TRAD   : /home/projects/trad

     2. The following project cannot be archived as the components are in directories above
        the PDB and TRAD directories:
PROJECT MANAGEMENT                                                                      41


              Project : proj_name
              PDB    : /home/projects/proj_name/pdb
              TRAD   : /home/projects/proj_name/trad
              M1.mch : /home/projects/spec/M1.mch
              M2.mch : /home/projects/spec/M2.mch

  3. The following project cannot be archived as a definition file is in a directory above
     the PDB and TRAD directories:

              Project : proj_name
              PDB    : /home/projects/proj_name/pdb
              TRAD   : /home/projects/proj_name/trad
              MM.defs : /home/projects/defs/MM.defs
              M1.mch : /home/projects/proj_name/spec/M1.mch
              M2.mch : /home/projects/proj_name/spec/M2.mch

  4. The following project can be archived as the source files are all in sub-directories of
     the common root.

              Project : proj_name
              PDB    : /home/projects/proj_name/pdb
              TRAD   : /home/projects/proj_name/trad
              M1.mch : /home/projects/proj_name/spec/M1.mch
              M2.mch : /home/projects/proj_name/spec/M2.mch
              M3.mch : /home/projects/proj_name/spec_bis/M3.mch
              M4.mch : /home/projects/proj_name/spec_bis/spec/M4.mch

Command mode user interface

The user interface is already started up.
To archive a project, use the archive or arc command.

This command has three parameters:

   • The project name,

   • The path to the archive file,

   • The type of archival:

     0 B source files archive,
     1 entire project archive,
     2 B source and proof files archive.

Example:
To archive the entire project proj_name, type the following command:
archive proj_name /home/project/tarPROJ.arc 1
The archive created is named /home/project/tarPROJ.arc.
42                                                                          Atelier B - User Manual




                                 Figure 4.11: Archive window



Motif user interface

The user interface is already started up, you are in the projects window.
To archive a project, perform the following operations:

     1. Click on the name of the project to archive in the list of projects.

     2. Click on the Archive Project button.
        The window shown in figure 4.11 on page 42 is displayed.

        This window contains two parts:

         (a) The upper part permits you to choose the file and the directory where to create
             the archive.
        (b) The lower part permits you to choose the type of archive.

     3. Choose the directory where the archive file will be created. To make the selection
        you can:

          • “double-click” on the directories in the Directories list, or
          • directly type the directory path into the Archive Directory field.

        Each time the directory changes, the Archive list displays the list of the “.arc” files
        of the directory.

     4. Choose the archive file name. To do this you can:

          • click on one of the file names in the Archives list, or
PROJECT MANAGEMENT                                                                            43


        • directly type the file name into the Archive Name field without the“.arc”
          extension. By default the archive name is tar<project_name>
  5. In the lower field, click on the button that corresponds to the type of archive.
  6. Click on OK to archive the project.
     A confirm window is displayed.
  7. Click on OK to confirm.
     The list of archived files will be displayed in the Atelier B start-up window.


     a /tmp/atelierb.tar 1K
     a spec/BASIC_STATUS.mch 1K
     ....
     a pdb/ 0K
     a pdb/.project 0K
     a pdb/.lib 0K
     a pdb/INNER_INTERFACE.bpp 1K
     a pdb/TOTAL_OBJECT.bpp 1K
     ....
     a lang/ 0K
     a lang/BASIC_COMMAND.c 2K
     ....



Possible errors
 A project is being archived/restored
 Every archive contains a /tmp/atelierb file that describes the project archived. At
 the start of the archive or restore procedure, this file is copied to a temporary file.
 If two users archive or restore at the same time, this message is generated as Atelier
 B cannot copy the file. Try again later and check that there is no file called atelierb
 in the /tmp directory.


 Cannot access directory <dir name>
 One of the directories to archive is no longer accessible. Check that this directory
 has not been removed.


 Cannot create the file /tmp/xxx (check for directory permissions)
 Atelier B uses temporary files during archiving. The /tmp directory must be acces-
 sible in write mode for all users.


 Cannot access the project description file of <proj>
 This error message is generated if the project components description file is no longer
 accessible. This file called <proj>.db is normally in the project data base directory.
 <proj>.db. The file or the directory has perhaps been removed by mistake. If this
 file is no longer accessible, Atelier B cannot read the information on the components.
 In general, if this file is no longer accessible, it is better to delete the project, as no
 more actions will be possible on this project.
44                                                                 Atelier B - User Manual


 No such project <proj>
 There is no project with this name. Display the projects list to check the name of
 the project to archive.


 tar error
 The message is displayed when a tar command performed by Atelier B has sent
 back an error message. In the Atelier B start-up window, check the tar command
 messages.


 Invalid directories structure of the project <proj>
 The project that you wish to archive has a layout that makes archiving impossible.
 To be archived, a project must comply with the following conditions:
 - the PDB and TRAD directories be in the same directory.
 - the B source files must be in the sub-directories of the previous directory.
PROJECT MANAGEMENT                                                                      45


4.14     Restoring a Project
Description

This function is used to restore a project managed by Atelier B from the data stored in
an archive created using the function described in the previous sub-section.
Three restore options are available:

   • restore B source files,
   • restore B source files and proof files,
   • restore the entire project.

A restoring always creates a new project. When a project is restored the following data
from the archived project are lost:

   • the list of project libraries,
   • the name of the project manager; the user who is restoring the project automatically
     becomes the manager of the created project,
   • the list of users authorized to access the project.

Remark: You can restore the B source files and the proof files of a project archived with
a previous version of Atelier B.

Command mode user interface

The user interface is already started up.
To restore a project, use the restore or res command.
This command requires four parameters:

   • the archive file access path,
   • the type of restore:

     0 restore B source files,
     1 restore the entire project,
     2 restore B source files and proof files.

   • the name of the restored project: you must give the name of a new project.
   • the project base path, if you do not wish the directories to be created in the current
     directory.

Example:
To restore and create the COPY project, type the following command:
restore /home/project/tarPROJ.arc 1 COPY /home/COPY
A new project called COPY is created in the /home/COPY directory.
46                                                                          Atelier B - User Manual




                                 Figure 4.12: Restore window



Motif user interface

The user interface is already started up, you are in the projects window.
To restore a project, perform the following operations:

     1. Click on the Restore Project button.
        The window shown in figure 4.12 on page 46 is displayed.



        This window contains two parts:

         (a) The left part to choose the archive file and directory as well as the type of
             restore.
        (b) The right part to choose the new project to create.

     2. Choose the archive file directory. To make this selection you can:

          • “double-click” on the directories in the Directories list, or
          • directly type the access path to the directory in the Archive Directory field.

        Each time a directory is selected, the Archives list displays the list of “.arc” files of
        the directory.

     3. Click on the archive in the Archives list field.

     4. In the lower field, click on the button that corresponds to the type of restore required.

     5. In the Project Name field, type the name of the restored project. You must type in
        a new project name.
PROJECT MANAGEMENT                                                                        47


  6. Choose the directory where the new project will be installed. To make this choice,
     you can:

        • ”double-click” on the directories in the Project Directories list, or
        • directly type the access path to the directory in the Project Directory field.

     You can specify the name of a directory that does not exist in the Project Directory
     field, it will be created by Atelier B.
  7. Click on OK to restore the project.
     A confirm window is displayed.
  8. Click on OK to confirm.
     The list of restored files will be displayed in the Atelier B start-up window.


     x /tmp/atelierb.tar 1K
     x spec/BASIC_STATUS.mch 1K.
     ....
     x pdb/OK
     x pdb/.project OK
     x pdb/.lib OK
     x pdb/INNER_INTERFACE.bpp 1K
     x pdb/TOTAL_OBJECT.bpp 1K
     ....
     x lang/OK
     x lang/BASIC_COMMAND.c 2K
     ....


     The project will then be displayed in the list of projects; the various components
     and the definitions files directories are automatically attached to the project.

Possible errors
 A project is being archived/restored
 All archives contain a /tmp/atelierb file that describes the archived project. At the
 beginning of the archive or restore action, this file is copied to a temporary file. If
 two users are performing archive or restore actions at the same time, this message
 is generated since Atelier B cannot make a copy. Try again later and ensure that
 there is no file called atelierb in the /tmp directory.


 Cannot create directory <dir path>
 You have requested a restore to a new project. Atelier B cannot create the new
 project directory. Check the directory access path and the UNIX rights of the host
 directory.


 Cannot create the file /tmp/xxx (check for directory permissions)
 Atelier B uses temporary files during the restore action. The /tmp directory must
 be accessible in read mode to all users.
48                                                                  Atelier B - User Manual


 Cannot read file <archive file>
 The archive file that you specified in the parameters does not exist or cannot be
 accessed in write mode.


 Cannot restore project. Project name <proj name> is already used
 The project name you have chosen to restore your archive into already exists. You
 must chose an unused project name.


 Only B sources and proof files have been archived in <archive file>
 The archive that you selected contains only B source files and proof files. You cannot
 therefore restore it using the entire project restore option. You can only:
 - restore B source files or
 - restore B source files and proof files.


 Only B sources have been archived in <archive file>
 The archive that you selected contains only B source files. You cannot therefore
 restore using:
 - restore B source files and proof files,
 - restore the entire project. You can only restore the B sources.


 tar error
 This message is displayed when a tar command performed by Atelier B sends back
 an error. Check the Atelier B start-up window for the tar command messages.


 the archive was built by another version of atelier B
 This message is displayed only when the archiving was done with a previous version
 of Atelier B, and when you try to restore the entire project. In this case, you can
 only restore B source files and/or proof files.
PROJECT MANAGEMENT                                                                   49




                          Figure 4.13: Project Properties window


4.15     Reading Properties of a Project
Description

This function displays the following properties of a project:

   • the access path to the project database,
   • the access path to the translations directory,
   • the name of the project manager,
   • the list of project libraries.

Command mode user interface

The user interface is already started up.
To view the properties of project proj_name, type the following command:
project_infos proj_name
or
ip proj_name

The properties are displayed as follows:
Name    : LIFT
Database path : /home/projects/pdb
Translations path : /home/projects/transl
Manager : fb
Libraries : LIBRARY


Motif user interface

The user interface is already started up, you are in the projects window: To display the
properties of a project, perform the following operations:

  1. Click on a project name in the projects list.
  2. Click on the Project Properties button,
     The window shown in figure 4.13 on page 49 is displayed.
50                                          Atelier B - User Manual


     3. Click on OK to close this window.

Possible errors
 No such project: <proj name>
 The project <proj name> does not exist.
PROJECT MANAGEMENT                                                                       51


4.16       Opening a Project
Description

This function grants access to the components of a project.

Command mode user interface

The user interface is already started up.
To open project proj_name, type the following command:
open_project proj_name
or
op proj_name

Motif user interface

The user interface is already started up, you are in the projects window.
To open a project, perform the following operations :

     1. Click on the project name in the projects list,

     2. Click on the Open Project button.

or

     1. ”double-click” on the project name in the projects list.

The projects window is replaced by the components window.
Section 5 describes how to manage components.

Possible errors
 Bad file format for <ATB dir>/AB/press/bdb/<lib name>.desc
 The data of the description file of the project you try to open have been damaged.
 The file may have been modified or overwritten. This project is no longer valid. You
 should delete it.


 Cannot access Project database directory <pdb dir>
 The project data base directory is no longer accessible. The directory has probably
 been deleted. You should detach the project.


 Cannot access Project translation directory <trad dir>
 The project translation directory is no longer accessible. The directory has probably
 been deleted. You should detach the project.
52                                                                  Atelier B - User Manual


 Cannot launch Logic Solver (check if there is enough memory)
 When a project is opened, Atelier B launches the Logic Solver. This tool requires
 a lot of memory. This message is displayed when the tool could not be started.
 Generally this is due to a memory problem. Look at the messages in the Atelier B
 start-up window. If your machine does not have enough memory, you can modify
 the tool configuration by following the instructions provided in the Administrator’s
 Manual.


 Cannot open project, Project database directory <pbd dir> is not writable
 The project data base directory can no longer be accessed in write mode. The
 directory rights have probably been modified. Normally this directory must belong
 to the project manager and the atelierb group. Only the manager and the atelierb
 group are allowed to write in this directory. These rights are automatically set-up
 when the project is created.


 Cannot open project, Project translation directory <trad dir> is not writable
 The project translations directory can no longer be accessed in write mode. The
 directory rights have probably been modified. Normally this directory must belong
 to the project manager and the atelierb group. Only the manager and the atelierb
 group are allowed to write in this directory. These rights are automatically set-up
 when the project is created.


 No such project: <proj>
 There is no project named <proj>. Display the projects list to check the name of
 the project to open.


 Cannot access project <lib name>
 You are not authorized to access the project in read mode . You must ask the
 manager of this project to grant you read access.


 Someone is modifying the project <proj>
 Another user is simultaneously performing an action on the project
 (adding/removing users, library or archiving).        During these operations,
 the project description file (<proj name>.desc) is locked by a file named:
 <proj name>.desc.lock. Wait until the action is over.


 A project is already opened <proj name>
 You are using the command mode user interface. Only one project can be open at
 one time. Close the project, before opening another project.
PROJECT MANAGEMENT                                                                             53


Cannot access the project components description file
This message is displayed if the project components description file is no longer
accessible. This file is normally present in the directory of the project database; it
is named <proj>.db. The file or the directory may have been deleted by mistake. If
this file is not accessible, the Atelier B can’t check if the user has some components
or not. In general, if this file is no longer accessible, it is better to delete the project,
because none action will be possible to perform on this project.
54                                                                  Atelier B - User Manual


4.17     Closing a Project
Description

This function closes the previously opened project.

Command mode user interface

The user interface is already started up.
To close a project, type the following command:
close_project
or
clp

Motif user interface

The user interface has already been started up, you are in the projects window.
To close a project, click on the Quit Project button in the components window.
The components window is replaced by the projects window.

Possible errors
 No current project
 There is no project previously opened. This message also occurs when you click
 many times in a row on the Quit Project button.
Chapter 5

Managing Project Components

5.1    Adding Components
Description

A B project is made up of a list of B components located in text files.
These components are either directly linked to the project, or accessible through libraries.
The B source files are text files containing one or several components.
Atelier B does not supply a specific editor. Any text editor can be used to create, modify
or visualise the B source files.
Once a source file has been attached to a project, the project manager analyses which
components are contained in the file and permit the management of these components.
For Atelier B, the owner of a component is the person who attached it to the project.
This can cause a potential problem if the B source file is not accessible by the user in the
UNIX sense, either for reading, or even for writing (see chapter 4.1).
Atelier B only accepts as B source files those whose name ends in one of the four following
suffixes : .mch, .ref, .imp, .mod. The contents of each type of file is as follows :

   • A file named Ident.mch must contain one and only one component : an abstract
     machine named Ident.

   • A file named Ident.ref must contain one and only one component : a refinement
     named Ident.

   • A file named Ident.imp must contain one and only one component : an implemen-
     tation named Ident.

   • A file named Ident.mod must contain a component named Ident. It can also contain
     the refinements of this component, as well as modules (an abstract machine and all
     its refinements) imported by the implantation of the component. Finally, for each
     module present in the file, the modules imported by this module can also be present.
     A suffix file .mod permits the storage in a single file of a B module, or a sub-part
     of the project made up of a module and the modules imported by this module.



                                            55
56                                                                      Atelier B - User Manual


If the contents of the files do not respect these rules, the file will still be attached to the
project. An error message is then displayed in the start up window. No other operation
will be possible on the component before its correction.

Command mode user interface

The user interface is started up, you already have opened a project.
To add a component to the current project, perform the following operations:

     1. Go to the directory where the B source file is located, using the command
        cd or
        change_directory

     2. Display the list of B sources present in this directory, using the command lsb or
        list_sources_b.
        This command displays the list of files with .mch, .ref, .imp or .mod extensions
        present in the current directory.

     3. Add a component using command:
        af file_name or add_file file_name
        Example:
        af AA.mch

Motif user interface

The user interface has already been started up, you are in the projects window.
To add components to a project, perform the following operations in the components
window:

     1. Click on the Components ... button, select Add. The window shown in figure 5.1 on
        page 57 is displayed:


     2. Go to the directory where the B source files are located:

          • “double-click” on the directories displayed in the list Directories List or
          • type the path to the directory of your source file in Current Directory field.

       Components List displays a list that is updated every time the directory changes. It
       contains a list of B source files present in the directory. Atelier B removes from the
       list the components which are already present in the project.

     3. Select from the list displayed by Components List the files that contains the compo-
        nents to add.

     4. Click on OK to add the components.
MANAGING PROJECT COMPONENTS                                                         57




                        Figure 5.1: Add Components window



Possible errors
 Unable to open input file <filename> (<error>)
 The file specified as a parameter cannot be accessed in read mode by the Atelier B
 user. Check the UNIX rights of the B source file.


 Someone is adding or removing a component in the project
 Another user simultaneously working on the same project is adding or removing
 a component. Wait until the action is over to ensure data coherence. During the
 operations to add/remove components, mutual exclusion between user is ensured by
 a file in the PDB directory named “project name.lock”.


 Component <comp name> can not be part of this file
 The file .mod specified as a parameter contains a component which does not respect
 the rules for this type of files.


 File <comp name> can’t be added, there is already a file with the same name in
 the project
 The project already contains a component with the same name. Check the list of
 project components.
58                                                                    Atelier B - User Manual


5.2      Suppressing Components
Description

This function permits to suppress one or several components from the current project .
B source files themselves are not deleted, they are just removed from the list of components
of the project.
The components selected are only suppressed if the user is the owner of the components
or the manager of the project.
When a component is suppressed, all the information related to this component are deleted
from the PDB, except the following ones:

     • B source files,

     • user rule files (*.pmm),

     • automatically generated project documentation,

     • translations.

Command mode user interface

The user interface is started up, you already have opened a project.
To suppress a component from a project, type the following command:
remove_component comp_name
or
rc comp_name
If comp_name corresponds to a component part of a .mod file then all the components
included in the .mod file will be deleted.

Motif user interface

The user interface has already been started up, you are in the components window.
To suppress components from a project, perform the following operations :

     1. From the list of components, select the ones to suppress.

     2. Click on the Components ... button, select Suppress.
        A confirmation window is displayed.

     3. Click on OK to confirm.
        The components are suppressed from the list of components.
       If some of the components of a .mod extension file are selected, then all the compo-
       nents included in the file will be detached.
MANAGING PROJECT COMPONENTS                                                          59


Possible errors
 Cannot find component <comp name> in the project
 Component <comp name> is not present in the project
 The component specified as a parameter is not part of the project. Check the name
 of the component by displaying the list of the project components.


 Someone is adding or removing a component in the project
 Another user working simultaneously on the same project is adding or removing a
 component. Wait until the action is over to ensure data coherence. During compo-
 nent add/remove operations, mutual exclusion between users is ensured by a file in
 the PDB directory named ”project name.lock”.


 Suppression is allowed only for the project manager or the machine manager
 You cannot suppress this component. A component can only be suppressed by:
 - the user who is the component manager (the user who added it to the project).
 - the user who is the project manager.
60                                                                    Atelier B - User Manual


5.3       Displaying the List of Components
Description

This function displays the list of components of a project, grouped by B source files names.
The components are displayed in alphabetical order, according to the names of B source
files.
If the components BB, BB_1 and AA are present in the same B source file (file .mod) then
the components will be displayed in the following way:

     BB   AA
          BB
          BB_1


On large scale projects, the number of components is often very important. This func-
tion offers several filters permitting to reduce the number of components and to search
components by their names.
The available filters are:

     • Filter according to the component manager user.

     • Filter by type of component: machine, refinement, implementation.

     • Filter by component name.

Command mode user interface

The user interface is started up, you already have opened a project.
To display the list of project components, use the following command:
show_machine_list or sml.
This function accepts five optional parameters:

own If this parameter equals 1 only the components that you are manager of are displayed.

mch If this parameter equals 0 the machines are not displayed.

ref If this parameter equals 0 the refinements are not displayed.

imp If this parameter equals 0 the implementations are not displayed.

name This parameter allows to filter the list by component names. Use the * character.
    For example, to display all components with a name starting with a S letter, specify
    the S* value.

Examples:
To obtain the list of the components that you manage:

bbatch 2> sml 1
Printing Own machines list ...

       B_Site_central
MANAGING PROJECT COMPONENTS                                                           61




              Filter by
               owner



                Filter by
             component type



               Filter by
                name



                              Figure 5.2: Filters on the components list



         Card Card
              Card_imp
         Keyboard_code
         Keyboard_code_ref

End of machines list

To list machines only:

bbatch 2> sml 0 1 0 0
Printing machines list ...

         B_Site_central
         Card Card
         Keyboard_code

End of machines list

To list only machines with a name starting with K and ending with code:

bbatch 2> sml 0 1 0 0 K*code
Printing Own machines list ...

         Keyboard_code

End of machines list


Motif user interface

The     user interface is already started up, you are in the components window.
The     list of components is permanently displayed in the window. The Refresh button the
list.   This functionality makes easier the multi-user work.
The     buttons and entry field on the left of the list allow you to apply the filters.
Figure 5.2 on page 61 shows the filters available:

    • Click on Own to see only the components that you manage, All displays all the
      project components.
62                                                                  Atelier B - User Manual


     • Click on Machine to remove the machines from the list.

     • Click on Refinement to remove the refinements from the list.

     • Click on Implementation to remove the implementations from the list.

     • Type the first letters of the component name, the list is modified at each new typed
       letter.
       For example, type C, and all components beginning with a C will be displayed.
       Add an a, and the components with a name starting with Ca will be displayed.
MANAGING PROJECT COMPONENTS                                                         63


5.4    Reading Information on the Components
Description

This function displays the following properties of components:

   • the name of the component manager,

   • the entire access path of the B source file,

   • the type of the component: machine, refinement or implementation.

Command mode user interface

To get information on a component called comp_name, a project should be opened, then
type the following command:
infos_component comp_name
or
ic comp_name
The properties are displayed as follows:

MACHINE         --> Main
LOCATION        --> /home/project/spec
OWNER           --> user1


Motif user interface

To obtain properties on components, the following operations must be performed in the
components window:

  1. Select components from the components list.

  2. Click on the Components Properties button.
     A window containing the properties of the selected components will be displayed.

  3. Click on OK to close the window.

Possible errors
 Cannot find component <comp name> in the project
 The component specified as a parameter is not part of the project. Check the name
 of the component by displaying the list of project components.
64                                                                    Atelier B - User Manual


5.5    Editing a Component
Description

This function allows you to edit the source file corresponding to a component.
The editor used is set up during Atelier B installation. Sub-section 7.2 in the Atelier B -
Administrator’s Manual explain you how to modify it.

Command mode user interface

The user interface is started up, you already have opened a project.
To edit the comp_name component, a project should be opened, then type the following
command:
edit comp_name
or
e comp_name

Motif user interface

The user interface is already started up, you are in the components window.
To edit a component, ”double-click” on the component name in the components list.

Usable parameters

 ATB*OPT TOOLS <SYSTEM>*Editor Path
 Positioned at the Atelier B set up
 Access path to the text editor.



Possible errors
 Cannot find component <comp name> in the project
 The component given as a parameter is not part of the project. Check the name of
 the component by displaying the list of project components.
MANAGING PROJECT COMPONENTS                                                               65


5.6     Restoring a Component
Description

This function is used to restore B source files or definitions files from an archive created
using the function described in sub-section 4.13.
Restore is performed in the current project.
If the restored component is not in the current project, the function add it automatically.
If the component is already present in the project, it is replaced by the restored component.

Command mode user interface

The user interface is started up, you already have opened a project.
To restore a component, use the get_list_from_archive command, followed by the
restore_source command.
The get_list_from_archive command displays the list of files in a project archive:

bbatch 2> get_list_from_archive /home/project/tarPROJ.arc
x /tmp/atelierb.tar, 486 bytes, 1 tape blocks

Printing Components in archive file
        tarPROJ ...

      Acq_1.mch
      Arithmetic_1.mch
      Arithmetic_2.imp

End of List

The restore_source command performs the restore. For example, to restore the Acq_1.mch
component in the MyProj project, you must type:

bbatch 3> restore_source /home/projet/tarPROJ.arc Acq_1.mch
x /tmp/atelierb.tar, 486 bytes, 1 tape blocks
x spec/Acq_1.mch, 342 bytes, 1 tape blocks


Motif user interface

The user interface is already started up, you are in the components window.
To restore a component, perform the following operations:

  1. Click on the Components ... button, select Restore.
     The window shown in figure 5.3 on page 66 is displayed.

      This window contains two parts:

      (a) The left part lets you choose the archive file and directory.
      (b) The right part lets you choose the file to restore.

  2. Choose the directory where the archive file is located. To do this selection you can:
66                                                                      Atelier B - User Manual




                                Figure 5.3: Restore window



          • “double-click” on the directories in the Directories List, or
          • directly type the directory access path in the Archive Directory field.

       When the directory changes, the Archives List displays the list of “.arc” files present
       in the directory.

     3. Choose the archive file name by clicking on one of the files of the Archives List.
        The Components List displays the list of components present in the archive.

     4. Click on the file to restore in the Components List.

     5. Click on OK to restore the component.

Possible errors
 Allowed only for the manager of the project <proj>
 Only the manager of this project (the user who created it) is allowed to restore
 components in this project.


 A project is being archived/restored
 The archives contain a /tmp/atelierb file that describes the archived project. When
 archive or restore begins, this file is copied in a temporary file. If two users archive
 or restore at the same time, this message is generated as Atelier B cannot copy the
 /tmp/atelierb file. Try again later and check that there is no file called atelierb in
 the /tmp directory.
MANAGING PROJECT COMPONENTS                                                             67


 Cannot create the file /tmp/xxx (check for directory permissions)
 Atelier B uses temporary files while restoring. The /tmp directory must be accessible
 in write mode for all users.


 Cannot read file <archive file>
 The archive file that you entered as a parameter does not exist or cannot be accessed
 in read mode.


 Cannot restore source to project <name1>:project <name2> is opened
 You want to restore a component in the <name1> project, but you already have
 opened the <name2> project. Close the <name2> project, then redo the restoring.


 Component <comp name> is not present in the archive file <archive name>
 The component that you entered as a parameter is not in the archive file list of
 components. Check the name of the component.


 tar error
 This message is displayed when a tar command performed by Atelier B sent back
 an error. Check the Atelier B start-up window for tar command messages.


 Someone is modifying component <comp name>
 Another user is simultaneously performing an action on the component you try to
 restore. Wait until the action is over to avoid interfering with the processing. The
 components are locked by a file named “comp name.lock” in the PDB.
68   Atelier B - User Manual
Chapter 6

Applying the B Method

6.1    Presentation
To develop programs using the B method, Atelier B proposes a set of commands allowing:

   • syntax and type checking of components,

   • automatic generation of proof obligations (PO),

   • analysis of proof obligations,

   • automatic demonstration of POs,

   • interactive demonstration of POs that are not automatically demonstrated,

   • translatable language checking,

   • translating implementation into one of the following programming language (C,
     C++, ADA or HIA).

The presentation of these commands assumes that the reader is familiar with the B
method.
This manual therefore only covers the implementation conditions for the functions listed
previously and not their aims in relation to the method.
In the basic version of Atelier B, translation to standard computer languages (C, C++,
ADA or HIA) is not included. The C, C++, ADA or HIA translators must be installed
separately.




                                          69
70                                                                   Atelier B - User Manual


6.2      Syntax and Type Check
Description

This function combines the syntax analysis and the type checking of B components.
The syntax checking ensures that the sources for the selected machines comply with the
B language syntax. On this subject, the reader can refer to the B language - Reference
Manuel.
Type checking controls:

     • identifier conflicts,

     • typing rules,

     • missing declarations,

     • language restrictions,

     • visibility rules,

     • etc ...

This type check is necessary for the PO generation.
The type check of a component is automatically applied to all the components “required“
by the current component, through the following links SEES, USES, INCLDES, IMPORT,
EXTENDS, REFINES.
This type check on the required components is only applied when necessary, i.e. if a
component change was made since the last type check.
Modifications of “form” (comments, spaces, ...) are not taken in account.
Syntax errors are displayed in an error window and in the start-up window.
They are displayed as following:

<file>:<line number>:<column number> <error description>
Example:
AA.mch:6:17 Sequential (’;’) substitution is not allowed in a specification

Line and column numbers show exactly the location in the source file where the error
occurs.
Semantic errors are displayed in the Atelier B start-up window.
They are displayed as following:

Type checking machine AA

Loading referenced_machines
Checking name_conflicts
Checking constraints clause
...
    Checking INVARIANT clause
Error: 1+2 in ( aa: 1+2 ) should be a set
Error: Variable aa has not been typed
  Checking operation b_ask_code
APPLYING THE B METHOD                                                                 71


Checking operation b_code_typed
    No information saved for AA

End of Type checking

The type checker displays an information message for each processed clause.
The Type checker - Error messages manual       describes in detail all the error messages
generated during this phase.

Command mode user interface

The user interface is started up, you already have opened a project.
To perform a syntax analysis and a type check on component comp_name, type the following
command:
typecheck comp_name
or
t comp_name
The information and error messages from the type checker are displayed in the start-up
window.

Motif user interface

The user interface is already started up, you are in the projects window.
To perform a syntax analysis and type check some components, perform the following
operations:

  1. Select components from the list of components.

  2. Click on the Type Check button.
     Each component is type checked, one by one.

     If there is a syntax error, an error window will be displayed. This window contains
     the description of the detected errors.
     If there is a semantic error on one of the components, a warning window will be
     displayed. In this case, check the type of error according to the messages displayed
     in the start-up window.

Remark : You can interrupt the treatment by using the function described in chapter
6.13 on page 106.

Usable parameters

 ATB*BCOMP*Allow ANY
 FALSE
 Allow or not the ANY substitution in implementation.
72                                                                Atelier B - User Manual


 ATB*BCOMP*Allow Becomes Member Of
 FALSE
 Allow or not the “becomes member of ” substitution in implementation.


 ATB*BCOMP*Allow Becomes Such That
 FALSE
 Allow or not the “becomes as” substitution in implementation.


 ATB*BCOMP*Allow CHOICE
 FALSE
 Allow or not the CHOICE substitution in implementation.


 ATB*BCOMP*Allow LET
 FALSE
 Allow or not the LET substitution in implementation.


 ATB*BCOMP*Allow Parallel
 FALSE
 Allow or not the Parallel substitution in implementation.


 ATB*BCOMP*Allow Pre
 FALSE
 Allow or not the PRE substitution in implementation.


 ATB*BCOMP*Allow Read In Values
 FALSE
 Allow or not using previously valued constants in the VALUES clause.


 ATB*BCOMP*Allow SELECT
 FALSE
 Allow or not the SELECT substitution in implementation.


 ATB*BCOMP*Tab Width
 8
 Number of character needed to obtain a tabulation.
APPLYING THE B METHOD                                                                  73


Possible errors

This section does not describe type checker error messages as these messages are described
in the Type checker - Error message manual

 <comp name> is already Type Checked
 This warning message is displayed if the component specified as a parameter has
 already been successfully checked.
 You can force checking by using the function described in chapter 6.14 page 108.



 Cannot update component <comp name>, it belongs to library project <lib name>.
 The component that you tried to type check belongs to a library. This library is
 not updated, the components that it contains have not been type checked. Ask the
 library manager to update it.


 Component <comp name>: someone is modifying component <depend comp>
 You required the type check of the first component but the type check of a component
 which the first one depends on, is impossible to perform since an action is being
 performed on it by another user. Wait until the action is over and try again.


 Component <comp 1> is referenced several times by <comp>
 A component cannot be seen (SEES) and imported (IMPORT) by the same imple-
 mentation. This message is displayed when this rule is violated.

 IMPLEMENTATION
     M_1
 REFINES
     MM
 SEES
     NN
 IMPORTS
     NN
 END



 Component <comp 1> is seen by <comp> but is not seen by its refinement
 <comp ref>
 If a MM component sees (SEES) a NN machine , then all the refinements of MM
 must also see (SEES) this machine. This message is displayed when this rule is
 violated.


 Component <comp name>: Type Check error in <depend comp>
 You required the type check of the first component, and an an error occured on one
 component which this component depends on. Refer to the messages displayed by
 the tool in the start-up window.
74                                                                  Atelier B - User Manual


 Infinite loop between <comp 1> and <comp 2>
 Atelier B detected a loop in the dependencies of the component that you requested
 a check on. Loops between components are not allowed. There are two possible
 types of loops:
 1 - loop between components: M1 —> M2 —> M1
 2 - loops between modules: M1 refined by M1 1 –> M2 —> M1

 Examples of loops:
 M1 --> M2 ---> M1
 M1 --> M2 ---> M3 ---> M1
        sees
 M1 <------------ M2
 ^                ^
 |       sees     |
 M1_1 ------------+




 Infinite loop in components dependencies
 Atelier B has detected a loop in the dependencies of the component that you required
 a type check on. Loops between components are not allowed.

 Examples of loops in dependencies:
 M1 --> M2 ---> M1
 M1 --> M2 ---> M3 ---> M1
 etc ...




 Someone is modifying component <comp name>
 Another user is performing at the same time, an action on the component that you
 wish to check. Wait until the action is over to avoid disrupting its processing. The
 components are locked by a file named “comp name.lock” present in the PDB.


 The following components are not present in the project : <MachineList>
 Machine <MachineName> is not present in the project
 Components “required” by the component that you have requested a type check on,
 are not present in the project. You must attach these components before performing
 the type check.


 Type Check error in <comp name>
 A syntax or type check error was detected on the component specified as a parameter.
 Refer to the messages displayed by the tool in the start-up window.
APPLYING THE B METHOD                                                                  75


 WARNING: Name clash between <comp 1> and <comp 2>
 If in a project two machines have the same name regardless of lower and upper case,
 then Atelier B will not be able to translate them into the ADA language. This
 message is displayed if such a conflict does exist.

 Project containing:
 M1 and m1
 DaB and daB
 etc ...
76                                                                    Atelier B - User Manual


6.3      Generating Proof Obligations
Description

This function produces the proof obligations of a component. The component must be
type checked (refer to the previous sub-section).
The proof obligations are defined by the B method. They depend on the level of the
software development:

     • In machines, the selected mathematical model must be consistent.

     • In the following steps, you must prove that refinements keep the properties of the
       previous step model.

The document Proof Obligations Reference Manual describes the PO in a theoric way.
In theory there is a proof obligation for initialization and a proof obligation for each of
the operations.
In practice, these obligations can be ”large” and complex formulas. The Proof Obligations
Generator function split the theoretical PO into many simpler PO. Some PO are so easy
to prove that the PO Generator can prove them by itself. In return, the initially foreseen
number of formula increases. Some PO defined as obvious are automatically eliminated
by the tool.
Before generating the proof obligations for a component, Atelier B ensures that the com-
ponent is type checked. Otherwise, the type check is automatically performed.
Generating proof obligations creates four files in the PDB:

     • the comp_name.po file contains the PO of the comp_name component.

     • the comp_name.opo file contains the obvious PO of the comp_name component.

     • the comp_name.pmi file contains the status of the proof obligations (proved/not
       proved) as well as the interactive demonstrations.

     • the comp_name.stc file contains a description of the component.

If the Differential option is used, and if the PO of the component have already been gen-
erated at least once, Atelier B compares the component with the description saved in the
comp_name.stc file.
For each operation, and for the initialization, it generates the PO only if one of the in-
formation occuring in their construction has been modified. Otherwise, it copies the PO
from the ancient files.
If the full option is used, the Atelier B generates all the PO again, even if they haven’t
been modified.

After the new PO generation, and if they have already been modified before, they are au-
tomatically compared to the ancient ones, in order to keep the associated demonstrations.
The comparison rule is the following one:
APPLYING THE B METHOD                                                                  77


A P.O.B deducts itself from a P.O.A if they have the same goal, and if the assumption of
B contains the assumption of A.
If a PO can deduct itself from one or several ancient PO, it receives by preference order:


   • the demonstration of the ancient PO with the same number if this PO would end,


   • the first one of the ancient PO demonstrations proved of the same clause,


   • the first one of the ancient PO demonstrations proved of a different clause,


   • the demonstrations of the ancient PO with the same number wich was not ending.


If a new PO can’t deduct itself from an ancient one, but if its number and pertenancy
clause do exist, it receives the demonstration of the ancient PO with the same number
and clause. In this way, the user retrieves his demonstation even if he renamed some
identificators.
Thanks to this mecanism, the user can keep the interactives demonstrations (and auto-
matics) if the PO are the same.
The messages of PO generator are displayed in the start up window as following:

Generating proof obligations of Machine B_Keyboard_code

    Initialisation :
......
proof obligations:            3
obvious proof obligations:    3

    b_input_code :
..
proof obligations:            0
obvious proof obligations:    2

   3 proof obligations generated

   11 obvious proof obligations generated

Generation complete

Normalising...
    b_check_code: unchanged

Merging...
Done


For each clause present in the component, Atelier B displays the number of proof obliga-
tions to be proved (proof obligations:) and the number of obvious proof obligations
deleted (obvious proof obligations:).
78                                                                    Atelier B - User Manual


Atelier B displays a character “.” each time a new PO is generated.
The PO clauses that have been copied are listed at the end of generation.



Command mode user interface

The user interface is started up, you already have opened a project.
To generate the proof obligations for component comp_name, with the Differential option,
type the following command:
pogenerate comp_name 1
or
po comp_name 1
To generate the PO for component comp_name, with the full option, type the following
command:
pogenerate comp_name 0
or
po comp_name 0

The option by default proposed by Atelier B is the Differential mode.

Motif user interface

The user interface is already started up, you are in the components window.
To generate proof obligations for components, perform the following operations:

     1. Select the components from the components list.
     2. Click on the PO Generate button.
        The proof obligations are generated for each component.
        The results are displayed component by component, clause by clause, in the start-up
        window.
       If there is an error on one of the components, a warning window is displayed. Then
       look at the error messages displayed in the start-up window.

Remark : You can interrupt the treatment by using the function described in chapter
6.13 page 106.

Usable parameters

 ATB*POG*Generate Obvious PO
 Positioned at Atelier B installation.
 The maximum number of PO generated for one component is 10,000.

Possible errors

Generating proof obligations does not cause errors.
The only possible error is an exceeding of the tool ability. If the number of PO on a com-
ponent is greater than 10000, the tool exits as an error. The only solution is to modify the
APPLYING THE B METHOD                                                                   79


project, to generate less POs. Warning, if the ressource ATB*POG*Generate Obvious PO
is modified, even though the PO have already been generated at least once, Atelier B dis-
plays a message such as “Missing Atomic...”. In this case, don’t take this message into
account.
  PO Generate error in <comp name>
  An error occurred when generating the proof obligations.
  Refer to the messages displayed in the start-up window.
  This error is caused by exceeding the tool capacity.


 Proof obligations already generated for <comp name>
 This warning message is displayed if the proof obligations have already been gener-
 ated for this component.
 You can force the generation of proof obligations by using the function described in
 chapter 6.14 page 108.



 Someone is modifying component <comp name>
 Another user is simultaneously performing an action on the <comp name> compo-
 nent you want to generate the PO.
 Wait until the action is over to avoid affecting
 processing.
 The components are locked by a ”comp name.lock” file
 in the PDB.
80                                                                     Atelier B - User Manual


6.4      Displaying Proof Obligations
Description

Atelier B provides two methods for displaying proof obligations:

     • Using the PO Viewer
     • Using the interactive prover

Using the interactive prover is recommended in the following cases:

     • complex assumptions: in this case the search functions of the interactive prover are
       required to analyse these proof obligations.
     • the number of proof obligations is high. The PO would rather be displayed one by
       one which is impossible using the POViewer.

The Interactive Prover - User’s Manual sub-section 5.4 describes the different methods
available for viewing proof obligations.
This sub-section describes the use of the POViewer.
This tool enables:

     • displaying the proof obligations of a component clause by clause,
     • displaying obvious proof obligations, i.e. those that were eliminated by the proof
       obligations generator,
     • displaying and printing proof obligations using mathematical fonts via a word pro-
       cessing program (L TEXor Word).
                         A


The proof obligations include comments that specify:

     • the origin of the assumptions (for example: Component invariant),
     • the theoretical justification of the proof obligation.
       In this case the comment refers to a sub-section in the Proof obligations - Reference
       manual.

Command mode user interface

This function is mainly used via the Motif user interface.
Using the command mode is much more difficult.
To display the proof obligations of component comp_name, type the following command:
po_view comp_name
or
pov comp_name
The PO Viewer prompt is displayed: POV>.
You should then request the list of clauses and the number of proof obligations per clause,
using the command:
APPLYING THE B METHOD                                                                     81


POV> get_clauses
B_Delais clauses list
Initialisation (0 unproved, 0 proved, 4 obvious)
b_init_delai (0 unproved, 1 proved, 4 obvious)
b_stopper_delai (0 unproved, 0 proved, 5 obvious)
b_delai_ecoule (0 unproved, 3 proved, 2 obvious)
End of list

To display the proof obligations for the Initialisation clause, type the following com-
mand:

POV> view(true, true, true, Initialisation)
Clause Initialization
Obvious PO1 :
        "‘Check that the invariant (delai: NATURAL) is established ...
        =>
        0: NATURAL
PO end
....
....
Obvious PO2 :
....
....
PO end
End of PO list

The first parameter must be set to true otherwise, use false if you want the unproved
PO to be displayed.
The second parameter must be set to true otherwise, use false if you want the proved
PO to be displayed.
The third parameter must equals true otherwise, use false if you want the obvious PO
to be displayed.
The last parameter is the name of the clause.
To exit the POViewer type the command: Quit.

Motif user interface

The user interface has already been started up, you are in the component window.
To display the proof obligations of a component, perform the following operations:

  1. Click on the component in the list of components.

  2. Click on Analysing ..., select Show/Print PO.
     The window shown in figure 6.1 on page 82 is displayed.

     This window contains two fields:

      (a) The left field displays the list of clauses that contain proof obligations.
      (b) The right field allows you to choose the type of proof obligations to display.

  3. Select a clause from the Clauses list.

  4. Click on the buttons in the PO status field to choose the types of PO to display.
82                                                                     Atelier B - User Manual




                            Figure 6.1: Show/Print PO window



     5. Click on the Display button to display the selected PO.
        The window shown in figure 6.2 on page 83 is displayed.

       This window contains the selected PO.
       Use the scroll bars to display all the text.
       Warning: If the number of PO to display is very high or if the PO contain complex
       assumptions, it may require a long time to display this window.

     6. Click on the PrettyPrint button to display the PO using a word processor program.
        The window shown in figure 6.3 on page 83 is displayed.

     7. Select the output format in the Output Format field.

     8. Select the output type in the Output field.

     9. Click on OK to confirm the selection.
        Proof obligations are saved in a file of the PDB directory, named comp_name.pov.
        This file is then translated into the selected word processor format, the name of the
        file generated is displayed in the start-up window.
        If the L TEX output format is used, the file is sent to latex, then to xdvi or to
               A
        dvips.

Usable parameters

 ATB*OPT TOOLS <SYSTEM>*Latex Binary Directory
 Positioned at Atelier B installation.
 Directory where it is possible to find the Latex binaries.
APPLYING THE B METHOD                                    83




                        Figure 6.2: Display PO window




                        Figure 6.3: PrettyPrint window
84                                                                  Atelier B - User Manual


 ATB*OPT TOOLS <SYSTEM>*Latex Postscript Translator
 Positioned at Atelier B installation.
 Name of the Latex Postscript translator.


 ATB*OPT TOOLS <SYSTEM>*Latex Viewer
 Positioned at Atelier B installation.
 Name of the Latex viewer.

Possible errors
 B Pretty Printer error while translating into LATEX format file <filename>
 You requested a display or print-out of the proof obligations using LaTeX. B Pretty
 Printer is the tool used to convert B formulae into various word processor formats.
 This message is displayed if this tool fails.
 It is a malfunction.


 B Pretty Printer error while translating into RTF format file <filename>
 You requested a display or print-out of the proof obligations using Word (RTF). B
 Pretty Printer is the tool used to convert B formulae into various word processor
 formats. This message is displayed if this tool fails.
 It is a malfunction.


 Clause <clause name> has no such PO
 The clause that you requested does not contain any PO of the type specified in the
 parameters.

 For example:
 If the list contains: b_init(0 unproved, 1 proved, 2 obvious)
 and display "unproved" PO only is requested.



 latex error in file <comp name>.pov.tex
 You requested a display or print-out of the proof obligations using LaTeX. This
 message is displayed if LaTeX sends back an error. Check your installation of LaTeX,
 and try to run the command outside of Atelier B, directly in the PDB:
 cd PDB
 latex <comp name>.pov.tex


 Problem with LATEX PostScript translator for <comp name>
 You requested a display or print-out of the proof obligations using LaTeX. This mes-
 sage is displayed if the dvips program sends back an error. Check your installation
 of LaTeX, and try to run the command outside of Atelier B, directly in the PDB:
 cd PDB
 dvips <comp name>.pov.dvi -o <comp name>.pov.ps
APPLYING THE B METHOD                                                                    85


6.5    Automatic Demonstration
Description

This function automates, in the limit of its ability, the demonstration of the proof obliga-
tions for each B component.
The proof activity is essential to the B method. This is the reason why two manuals are
dedicated to this subject:

   • Interactive Prover - User’s Manual

   • Interactive Prover - Reference Manual

The Atelier B automatic prover has different levels of force. These forces are described in
sub-section 3.1.1 of the Interactive Prover - User’s Manual
The messages of the automatic prover are displayed in the start-up window as shown
below:

Proving B_Delays

  Proof pass 0, still 3 unproved PO

    clause b_init_delas

        -+

End of Proof
  Initialisation Proved 0 Unproved 0
  b_init_delay Proved 1 Unproved 0
  b_stop_delay Proved 0 Unproved 0
  b_delay_is_up Proved 3 Unproved 0
TOTAL for B_Delays Proved 4 Unproved 0

For each clause of the component, Atelier B displays a + each time a proof obligation is
proved and a - each time the prover fails.

Command mode user interface

The user interface is started up, you already have opened a project.
To run the automatic prover on component comp_name, type the following command:
prove comp_name <force>
or
pr comp_name <force>
the <force> value could be:

0,1,2,3 for the different prover force levels,

-1 for “Fast” prover level.

-2 for the “Replay” option.

-3 for the “User Pass” option.
86                                                                    Atelier B - User Manual


Motif user interface

The user interface has already been started up, you are in the components window. To
run the automatic prover on components, perform the following operations:

     1. Select the components from the list of components.

     2. Click on the Prove ... button and select Automatic(force), the force level of the
        automatic prover to apply.
        The automatic prover will be run on each component.
        The results are displayed component by component, clause by clause, in the start-up
        window.
       If an error occurs on one of the components, a warning window is displayed. In this
       case, look up the error type in the messages displayed in the start-up window.

Remark : You can interrupt the treatment by using the function described in chapter
6.13 on page 106.

Possible errors
 Nothing to Prove in <comp name>
 This warning message is displayed if there is no, or no more, proof obligation to
 prove for a component.


 Proof error in <comp name>
 An error occurred during the component automatic proof procedure. Look at the
 messages displayed in the start-up window. Errors may occur when using higher
 force levels.


 Someone is modifying component <comp name>
 Another user is simultaneously performing an action on the component. Wait until
 the action is over. The components are locked by the ”comp name.lock” file in the
 PDB.
APPLYING THE B METHOD                                                                  87


6.6    Interactive Demonstration
Description

The primary goal of this function is to allow the user to prove manually the proof obliga-
tions that were not proved automatically.
The proof activity is essential in the B method, and for this reason two manuals are
dedicated to this subject:

   • Interactive Prover - User’s Manual

   • Interactive Prover - Reference Manual

Command mode user interface

The user interface is started up, you already have opened a project.
To run the interactive prover on component comp_name, type the following command:
browse comp_name
or
b comp_name
After typing this command the interactive prover prompt is displayed: PRI >.
You can then type the various interactive prover commands.
Type qu to quit.

Motif user interface

The user interface has already been started up, you are in the components window.
To run the interactive prover on a component, perform the following operations:

  1. Click on the component in the list of components.

  2. Click on the Prove ... button, select Interactive.
     The Atelier B main window is automatically reduced to an icon.
     The window shown in figure 6.4 on page 88 is displayed.

      Refer to Interactive Prover - User’s Manual to use this interface.

Usable parameters

 ATB*OPT TOOLS <SYSTEM>*Da Vinci Path
 Positioned at Atelier B installation.
 Entire path to the da Vinci executable.


 ATB*OPT TOOLS <SYSTEM>*Editor Path
 Positioned at Atelier B installation.
 Access path to the text editor.
88                                          Atelier B - User Manual




     Figure 6.4: Interactive Proof window
APPLYING THE B METHOD                                                                 89


 ATB*OPT TOOLS <SYSTEM>*HTML Viewer Path
 Positioned at Atelier B installation.
 Entire path of the HTML viewer.

Possible errors
 All PO of component <comp name> were discharged by the PO Generator
 This warning message is displayed if there is no P.O to prove on a component.All
 the P.O were automatically discharged by the P.O generator. It is not necessary to
 call-up the interactive prover.


 Someone is modifying component <comp name>
 Another user is simultaneously performing an action on the component. Wait until
 the action is over. The components are locked by a ”comp name.lock” file in the
 PDB.
90                                                                   Atelier B - User Manual


6.7      Canceling Demonstrations
Description

This function is used to cancel the demonstrations performed on a component in order to
repeat interactive proofs.
The interactive demonstrations are not lost. Only the status of the proof obligations is
changed.

Command mode user interface

The user interface is started up, you already have opened a project.
To cancel demonstrations of the component comp_name, type the following command:
unprove comp_name
or
u comp_name
The following message is displayed in the start-up window:
Unproving successful

Motif user interface

The user interface has already been started up, you are in the components window.
To cancel the component demonstrations, perform the following operations:

     1. Select the components from the list of components.

     2. Click on the Prove ... button, selectUnprove.
        A confirmation window is displayed.

     3. Confirm by clicking on OK.
        The following message is displayed in the start-up window:
        Unproving successful

Possible errors
 Someone is modifying component <comp name>
 Another user is simultaneously performing an action on the component. Wait until
 the action is over. The components are locked by the ”comp name.lock” file present
 in the PDB.
APPLYING THE B METHOD                                                                   91


6.8    Checking the Translatable Language (B0)
Description

Before using the translators for exporting to standard computer programming languages
(C, C++, ADA or HIA), check that the language used in the implementations can be
translated.
The constructions authorized in the implementations are described in the B Language -
Reference Manual.
The error messages from the B0 checker are displayed in an error window and in the start-
up window as following:


<file>:<line number>:<column number>(BO check)<error description>

Exemple:
BO Checking Machine B_Keyboard_code_1

B_Keyboard_code_1.imp:5:11 (BO Check) binary expression is not a simple term
B_Keyboard_code_1.imp:5:19 (BO Check) binary expression is not a simple term
B0 Check error in B_Keyboard_code_1

Column and line numbers allow an exact location of the place where the error was detected.
When the component is correct, the following message is displayed in the start up window:


B0 Checking B_Keyboard_code_1
B0 Checking B_Keyboard_code_1 successful


remark: To use the HIA translator, it is necessary to type the array with concrete con-
stants. By default, the B0 checker indicates that the concrete constant is not imple-
mentable. In that case, to pass over the B0 checker, the following resource has to be
positioned:

ATB*BCOMP*Enable Typing Identifiers: TRUE
It is easier to save this resource in the project resource file of the projects wich will be
translated into the HIA language.

Command mode user interface

The user interface is started up, you already have opened a project.
To B0 check component comp_name, type the following command:
b0check comp_name
or
b0c comp_name

Motif user interface

The user interface has already been started up, you are in the components window.
To check the translatable language on the components, perform the following operations:
92                                                                  Atelier B - User Manual


     1. Select the components from the list of components.

     2. Click on the B0 Check button.
        Components are checked one by one.
        The result of all checks is displayed, component by component, in the start-up
        window.
       If there is an error on one of the components, a warning window is displayed. In
       this case you should check the type of error in messages displayed in the start-up
       window.

Usable parameters

 ATB*COMP*Disable Array Compatibility Check
 FALSE
 Perform or not compatibility checks of array indexes.


 ATB*COMP*Disable Concrete Constants Type Check
 FALSE
 Perform or not type checks of concrete constants.


 ATB*COMP*Disable Expression Syntax Check
 FALSE
 Perform or not expression syntax checks .


 ATB*COMP*Disable Formal Params Type Check
 FALSE.
 Perform or not type checks of formal parameters .


 ATB*COMP*Disable Variables Initialisation Checker
 FALSE
 Perform or not variables initialisation checks.


 ATB*COMP*Disable Locale Variables Type Check
 FALSE
 Perform or not variables type checks.


 ATB*COMP*Disable Operation Input Parameters Type Check
 FALSE
 Perform or not operation input parameters type checks.


 ATB*COMP*Disable Operation Output Parameters Type Check
 FALSE
 Perform or not operation output parameters type checks.
APPLYING THE B METHOD                                                                  93


 ATB*COMP*Disable Parameters Instanciation Check
 FALSE
 Perform or not machine parameters instanciation checks.


 ATB*COMP*Disable Predicate Syntax Check
 FALSE
 Perform or not predicate syntax checks.


 ATB*COMP*Disable Valuation Check
 FALSE
 Perform or not VALUES clause checks.


 ATB*COMP*Enable Typing Identifiers
 FALSE.
 Variables of array, record or interval type must be typed with an identifier if this
 resource is TRUE (special case for HIA translations) .

Possible errors
 <comp name> already B0 Checked
 This warning message is displayed if the translatable language check has already
 been performed for this component.
 You can force the B0-check by using the function described in chapter 6.14 page
 108.



 B0 Check Error in <comp name>
 An error occurred during B0 checking. Look at the messages displayed in the start-
 up window.


 Someone is modifying component <comp name>
 Another user is simultaneously performing an action on the component to B0
 check. Wait until the action is over. The components are locked by a file named
 ”comp name.lock” in the PDB.
94                                                                     Atelier B - User Manual


6.9      Project Checking
Description

This function performs checks on all the project components.
The rules checked by this function are:

     • a machine can only be imported once in a project,

     • a seen machine must be imported by a project component,

     • the SEES clause must be transversal to a component,

     • a component cannot be seen and imported at the same time,

     • the SEES clause is not allowed to an ancestor,

     • the dependency graph must not contain cycles,

     • the names of project components must be differents (an upper/lower case difference
       is not enough).

These checks are described in the B language - Reference Manual.
These checks are required to translate the project. They are run automatically by Atelier
B before project translation.
Some of these checks are performed automatically before the syntax analysis and the type
check of components in order to warn the user as soon as possible.
The user can also perform these checks on demand by following the procedures described
below.

Command mode user interface

The user interface is started up, you already have opened a project.
To perform the checks on this project, type the following command:
project_check comp_name
or
pchk comp_name
The parameter of this command is the name of the implementation that is the project
entry point.

Motif user interface

The user interface is already started up, you are in the components window.
To start checks on the project, perform the following operations:

     1. Select from the list of components, the implementation that is the project entry
        point.

     2. Click on the Project ... button in the Project Check menu.
        Possible error messages will be displayed in the start-up window.
APPLYING THE B METHOD                                                                   95


Possible errors
 Component <comp name> is imported several times by : <comp>
 A machine can only be imported once in a project. This error message indicates a
 violation of this rule.


 Component <comp 1> is referenced several times by <comp>
 A component cannot be seen (SEES) and imported (IMPORT) in the same imple-
 mentation. This error message indicates a violation of this rule.

 IMPLEMENTATION
     M_1
 REFINES
     MM
 SEES
     NN
 IMPORTS
     NN
 END



 Component <comp name> is seen by <comp> so it should be imported in the project
 A machine that is seen must be imported by a component in the project. This error
 message indicates a violation of this rule.


 Component <comp 1> is seen by <comp> so its refinement <comp ref> should see
 it too
 If a component MM sees (SEES) a machine NN, then every refinement of MM must
 also see (SEES) this machine. This error message indicates a violation of this rule.


 The dependence graph contains a loop
 Atelier B has detected a loop in the dependencies of the component that you have
 requested a check on. Loops between components are not allowed. There are two
 kinds of possible loops:
 1 - loops between components: M1 —> M2 —> M1
 2 - loops between modules: M1 refined by M1 1 –> M2 —> M1
 These types of loops are not allowed by translators.

 Examples of loops:
 M1 --> M2 ---> M1
 M1 --> M2 ---> M3 ---> M1
        sees
 M1 <------------ M2
 ^                ^
 |       sees     |
 M1_1 ------------+
96                                                                  Atelier B - User Manual


 <comp1> is imported by <comp2> and is seen by its ancestor <comp3>
 A machine imported into the project must not be seen by any of the ancestors of
 the machine that imports it. This error message indicates a violation of this rule.


 WARNING: Name clash between <comp 1> and <comp 2>
 If in a project, there are components with names that differ only in upper or lower
 case letters, then the translation into the ADA language of these components is
 impossible. This error message is generated if such a conflict exists.

 Project containing:
 M1 and m1
 DaB and daB
 etc ...
APPLYING THE B METHOD                                                                      97


6.10     Translating into C, C++, ADA or HIA
Description

In the basic version of Atelier B, translators are not included. Translators must be installed
separately. Their installation is described in the Atelier B - Administrator’s Manual
This function translates project implementations into C, C++, ADA or HIA language.
For further information, refer to the translators user’s manual.

Command mode user interface

The user interface is started up, you already have opened a project.
To translate the implementation named imp_name, type the following command:
For translation into C:
ctrans imp_name
or
ct imp_name
For translation into C++:
c++trans imp_name
or
c++t imp_name
For translation into ADA:
adatrans imp_name
or
a imp_name
For translation into HIA:
hiatrans imp_name
or
hia imp_name

The following messages are displayed in the start-up window:

Translating into ADA the file imp_name
Translation into ADA successful

If the implementation specified as a parameter is not fully proved, a warning message is
displayed in the start up window, and also written in generated files.

Translating into ADA the file imp_name
Warning : this implementation has not been fully proved
Ada code will be generated but it might not be secure
Translation into ADA successful

To translate all the project implementations and perform link editing, first indicate if the
project is autonomous or heteregeneous: :
For an autonomous project:
set_native 0
or
98                                                                      Atelier B - User Manual


sn 0
For an heterogeneous project:
set_native 1
or
sn 1

If it is not indicated, the project is considered as autonomous.
Then, type the following command:
For the translation into C:
cc imp_name
For translation into C++:
c++all imp_name
or
c++a imp_name
For translation into ADA:
ada_all imp_name
or
aa imp_name
For translation into HIA:
hia_all imp_name
or
hiaa imp_name
The parameter must be the name of the implementation that is the project entry point.

Motif user interface

The user interface is already started up, you are in the components window.
To translate the project implementations, perform the following operations:

     1. Select the implementations to translate from the list of components.

     2. Click on the Translator button.
       The window shown in figure 6.5 on page 99 is displayed. This window contains three
       fields:

     3. The upper field allows you to choose the translation language C,C++,ADA or HIA.

     4. The lower field allows you to choose between a global project translation or the
        translation of the selected implementations.

     5. The field allows you to indicate if your project is autonomous or heterogeneous.

     6. Click on C, C++, Ada or HIA in the upper field.

     7. Click on Selected Only to translate the selected implementations only.

     8. Click on OK to perform the translation.
        The translation results are displayed in the start-up window.

To translate the entire project and perform links editing, perform the following operations:
APPLYING THE B METHOD                                                                   99




                             Figure 6.5: Translator window



  1. From the list of components, select the project entry point implementation.

  2. Click on the Translator button.
     The window shown in figure 6.5 on page 99 is displayed.


  3. Click on C, C++, ADA or HIA in the upper field.

  4. Click on All to translate the entire project.


  5. Click on Native to indicate that your project is autonomous.


  6. Click on OK to perform the translation.
     The result of the translation and link editing actions are displayed in the start-up
     window.

To translate the entire project in order to make it a library which will be used by another
project developed independently of Atelier B, you must perform the following operations:

  1. From the components list, select the implementation that is the project entry point.


  2. Click on the Translator button.
     The window shown in figure 6.5 on page 99 is displayed.


  3. Click on C, C++, ADA or HIA in the upper field.


  4. Click on All to translate the entire project.
100                                                                 Atelier B - User Manual


  5. Click on Heterogeneous to indicate that your project is heterogeneous.


  6. Click on OK to perform the translation.
     The result of the translation and link editing actions are displayed in the start-up
     window.

Possible errors
 ADA translator error in <comp name>
 HIA translator error in <comp name>
 C translator error in <comp name>
 C++ translator error in <comp name>
 An error occurred while translating the implementation. Refer to the messages
 displayed in the start-up window.


 Component <comp name> is already translated
 This warning message is displayed if the selected implementation has already been
 translated. You can force the translation by using the function described in chapter
 6.14 on page 108.



 Component <comp name> is imported several times by <comp>
 A machine can only be imported into a project once. This error message indicates
 a violation of this rule.


 Component <comp 1> is seen by <comp> so its refinement <comp ref> should see
 it too
 A machine that is seen must be imported by a project component. This error
 message indicates a violation of this rule.


 Component <comp name> is not an implementation
 The component that you selected is not an implementation. Select another compo-
 nent.


 <comp1> is imported by <comp2> and is seen by its ancestor <comp3>
 A machine imported into the project must not be seen by one of the ancestors of
 the machine that imports it. This error message indicates a violation of this rule.


 Someone is modifying component <comp name>
 Another user is simultaneously performing an action on the component. Wait until
 the action is over. The components are locked by the ”comp name.lock” file in the
 PDB.
APPLYING THE B METHOD                                                                   101


 TOOL not installed (cf. resource file Atelier B)
 The translator has not been installed within Atelier B. Refer to the Administrator’s
 Manual for its installation procedure.
102                                                                 Atelier B - User Manual


6.11       Applying a Tool to all the Components of a Project
Description

The Make project function is used to perform, on all the components of a project, the
following operations:

      • syntax analysis and types check,

      • generating proof obligations,

      • proof,

      • checking the translatable language (B0),

This function takes into account the links between project components; its operation is
similar to the UNIX ”make” function.
This function proposes two options:

forced mode The requested operations will be performed regardless of the state of the
     components. For example, if a component is already in TypeChecked state and the
     user requests Forced Make on the project, then the type check will be repeated on
     this component.

normal mode The requested operations are only performed if necessary.

Warning: When a Forced Make is requested on the project, only the requested operation
will be systematically repeated on all the project components.
For example: If you request a Forced Make for the POgenerate operation, then the gener-
ation of proof obligations will be repeated on all the project components. The type check
will not be repeated.

Command mode user interface

The user interface is started up, you already have opened a project.
To perform an operation on all the project components, type the following command:
make_all operation force
or
m operation force
The operation parameter can take one of the following values: typecheck, pogenerate,
b0check, prove.

The force parameter must equal 0 in normal mode and 1 in forced mode.

If the requested operation is prove, you must give a third parameter which is the prover
force level to apply (-3,-2,-1,0,1,2 or 3. Refer to sub-section 6.5).
APPLYING THE B METHOD                                                                  103




                           Figure 6.6: Make Project window



Motif User Interface

The user interface is already started up, you are in thecomponents window.
To start an operation on all of the components of a project, perform the following opera-
tions:

  1. Click on the Project ... button, select Make Project.
     The window shown by figure 6.6 on page 103 is displayed.


  2. Click on the type of operation to perform in the Operations field.

  3. Click on Yes in the Forced field if you wish to use the ”forced” mode.

  4. Click on OK to validate the selection.
     The messages from the various tools are displayed in the Atelier B start-up window.

Possible errors

Except for the error message shown below, the error messages displayed by this function
correspond to the error messages displayed for the requested operations.

 Project already up to date
 You requested ”Make Project” in normal mode. This warning message indicates
 that it is not necessary to perform this operation on the project, since all of its
 components are updated.
104                                                                    Atelier B - User Manual


6.12     Updating a Project
Description

When several users are simultaneously working on a large scale project, modifying a com-
ponent can have effects on several other project components (on all the components linked
to this component).
The Remake project function is used to update all the components of a project.
It takes into account the dependencies between the project components and the status of
each component.
This function “redoes” for each component, all the actions that have already been per-
formed at least once.
This function offers two options:

forced mode Operations that have already been performed at least once will be repeated,
     regardless of the status of the components. For example, if a component is already
     in the Type Checked state and the user requests a Forced remake on the project, then
     the type check will be redone on this component.
normal mode The operations that have been performed at least once in the past will be
    repeated only if necessary.

Command Mode User Interface

The user interface is started up, you already have opened a project.
To update all the project components, type the following command:
remake force
or
r force
The force parameter must equal 0 in normal mode and 1 in forced mode.

Motif User Interface

The user interface is already started up, you are in the components window.
To update all the components of a project, perform the following operations:

  1. Click on the Project ... button, select Remake Project.
     The window shown in figure 6.7 on page 105 is displayed.


  2. Click on Yes in the Forced field, to use the ”forced” mode.
  3. Click on OK to validate the selection.
     The messages from the various tools are displayed in the Atelier B start-up window.

Possible errors

Except for the error message below, the error messages displayed by this function corre-
spond to error messages displayed for the requested operations.
APPLYING THE B METHOD                                                                     105




                          Figure 6.7: Remake Project window



 Project already up to date
 You requested a “Remake Project” in normal mode. This warning message indi-
 cates that it is not necessary to perform this operation on the project, since all the
 components are updated.
106                                                                      Atelier B - User Manual


6.13       Tools interruption
Description

This function permits the interruption of some actions.
According to the executed action, this interruption is either automatic or manual.

      • The manual interrupt works with the following actions :
          – Syntax analysis and type checking,
          – Generation of proof obligations,
          – Automatic demonstration,
        It offers different possibilities according to the action that is executing.
      • The automatic interrupt is used with the automatic demonstration.
        A timeout can be defined for the automatic demonstartion in order to try some prove
        tactics which can loop or take too much time.

User Interface in Command mode

The user interface has already been started up.
To set the timeout for the automatic demonstration, type the following command :
timeout[value]
or
to[value]
The value 0 is used to disable this functionality. Warning the timer is based on a ”cpu
time”, therefore the result will be function of the cpu charge.

The manual interrupt is not available in the command mode interface.

Motif User interface

The user interface has already been started up, you are in the components window.
For the automatic interrupt, there is an area Proof Timeout where you can

      • set the timeout
      • turn on the functionality
      • turn off the functionality


For the manual interrupt, perform the following operations:
After selecting one or several components, click on the button corresponding to the action
of your choice : TypeCheck, PO Generate, Prove Automatic, Make Project, Remake Project.
When the action starts up, four buttons are displayed next to the Quit Project button.
The figure 6.8 on page 107 describes this zone.
These buttons stay grey until you move the mouse over them. These buttons permit :
APPLYING THE B METHOD                                                                107




                           Figure 6.8: Interruption buttons



   • Stop button : This button stops right away all treatments asked for.

   • Next Component button : This button stops the current treatment on the current
     component. If several components were selected, Atelier B continues on the following
     component.

   • Next Operation button : This button is only available during a phase of automatic
     demonstration. It permits the stopping of demonstrations on the current operation;
     Atelier B continues on the following operations.

   • Next PO button : This button is only available during an automatic demonstration
     phase. It permits the stopping of the current demonstration, Atelier B continues on
     the following proof obligation.

After the end of treatment, the following messages are shown in an alert window :
Type Check interrupted in xxx or
PO generate interrupted in xxx or
Prover interrupted in xxx.

Usable parameters

 ATB*PR*Time Out Auto
 0 (fonctionality disabled)
 Timeout for the automatic prove.
108                                                                   Atelier B - User Manual


6.14     Dependencies management
Description

For each of the actions described in this chapter, Atelier B checks that this action has not
already been performed on this component.
The action is only carried out if the component, or the components it depends on, have
been modified.

If this is not the case, the following messages are displayed :
Component <comp name> is already Type Checked
or
Proof obligations already generated for <comp name>

The functions described below permit you to ”force” the accomplishment of the action.

Command mode user interface

The user interface has already been started up.
To stop the management of dependencies and therefore be able to force an action, you
must type the following command :
disable_dependence_mode
or
ddm
You can then type your command.
For example : typecheck AA.
To bring the management of dependencies back into function, you must type the following
command :
enable_dependence_mode
or
edm



Motif user interface

The user interface has already been started up, you are in the components window.
Under the list of components, there are two buttons which permit to enable or disable the
management of dependencies (see figure 6.9 on page 109).
To disable the management of dependencies, click on the Inactive button.
To enable the management of dependencies, click on the Active button.
APPLYING THE B METHOD                                         109




                        Figure 6.9: Dependencies management
110   Atelier B - User Manual
Chapter 7

Analysing B Developments

7.1    Presentation
“Analysing a B development” is a set of six commands used to obtain information on the
components of a project.
The analysis commands are used to:

   • determine the status of a project (syntax checked, proven, etc.),

   • determine the proof status of a component (number of proof obligations per opera-
     tion, etc.),

   • animate a specification

   • create a dependency graph between the components,

   • create a homonymy graph between the identifiers of a project,

   • create a call graph between different operations of a project,

   • create a formula graph of one of the clauses of a component,

   • search among the components of a project, declarations and common uses of consti-
     tuants such as variables, functions,...

   • calculate metrics on project implementations (number of seen machine, operations,
     instructions, etc).




                                          111
112                                                                  Atelier B - User Manual


7.2    Project Status
Description

This function is used to create a summary table that provides information on all the
components of a project.
It is used to determine project progress.
This function takes into account the dependencies between project components. If some
components are not yet present in the project, a warning message is displayed.
The results table is displayed in the Atelier B start-up window. This table can also be
used by the Atelier B documentation tools (refer to sub-section 8.1).
Example:


+-------------------+----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| COMPONENT         | TC | POG | Obv | nPO | nUn | %Pr | B0C | C | Ada | C++ | HIA |
+-------------------+----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| BASIC_COMMAND     | OK | OK |    6 |   0 |   0 | 100 | - |       |     |     |     |
| BASIC_STATUS      | OK | OK |    6 |   0 |   0 | 100 | - |       |     |     |     |
| DATA_BASE         | OK | OK | 142 | 28 |     5 | 82 | - |        |     |     |     |
| DATA_BASE_1       | OK | OK | 136 | 112 | 23 | 79 | - | - | - | - | - |
| DFILE             | OK | OK |    8 |   6 |   1 | 83 | - |        |     |     |     |
| DFILE_1           | OK | OK | 42 | 16 |      6 | 62 | - | - | - | - | - |
| FILE_ACCESS       | OK | OK | 40 | 13 |      2 | 84 | - |        |     |     |     |
| FILE_ACCESS_1     | OK | OK | 57 | 19 |      8 | 57 | - |        |     |     |     |
| FILE_ACCESS_2     | OK | OK | 68 | 19 |      1 | 94 | - | - | - | - | - |
| FILE_BUFFER       | OK | OK | 13 |     7 |   2 | 71 | - |        |     |     |     |
| FILE_BUFFER_1     | OK | OK | 53 |     4 |   1 | 75 | - | - | - | - | - |
| INNER_INTERFACE   | OK | OK | 11 |     0 |   0 | 100 | - |       |     |     |     |
| INNER_INTERFACE_1 | OK | OK | 52 |     0 |   0 | 100 | - | - | - | - | - |
| MAIN_INTERFACE    | OK | OK |    3 |   0 |   0 | 100 | - |       |     |     |     |
| MAIN_INTERFACE_1 | OK | OK | 32 | 18 |       0 | 100 | - | - | - | - | - |
| PARTIAL_OBJECT    | OK | OK | 18 |     9 |   1 | 88 | - |        |     |     |     |
| PARTIAL_OBJECT_1 | OK | OK | 42 | 27 |       8 | 70 | - | - | - | - | - |
| QUERY             | OK | OK | 41 |     0 |   0 | 100 | - |       |     |     |     |
| QUERY_1           | OK | OK | 137 | 75 |     9 | 88 | - | - | - | - | - |
| TOTAL_OBJECT      | OK | OK | 11 |     8 |   2 | 75 | - |        |     |     |     |
| TOTAL_OBJECT_1    | OK | OK | 17 | 13 |      3 | 76 | - | - | - | - | - |
+-------------------+----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| TOTAL             | OK | OK | 941 | 374 | 72 | 80 | - | - | - | - | - |
+-------------------+----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+

The columns in this table indicate:

TC An OK value means that the syntax analysis and type check of the component and
   all the components it depends on were successfully performed.

POG An OK value means that the proof obligations were generated for the component.

Obv This column contains the number of obvious proof obligations of the component. It
    concerns the P.O simple enough to be discharged automatically by the P.O generator.

nPO This column contains the number of non obvious proof obligations of the component.
ANALYSING B DEVELOPMENTS                                                             113


nUn This column contains the number of proof obligations for the component that have
    not yet been proved.

%Pr This column contains the percentage of proof obligations already proven. This
    percentage does not take into account the obvious POs.

B0c An OK value means that the B0 check was performed successfully on this component.

Ada An OK value means that the implementation was translated into ADA. If the ADA
    translator has not been installed, this column is not displayed.

C An OK value means that the implementation was translated into C. If the C translator
    has not been installed, this column is not displayed.

C++ An OK value means that the implementation was translated into C++. If the
   C++ translator has not been installed, this column is not displayed.

HIA An OK value means that the implementation was translated into HIA. If the HIA
    translator has not been installed, this column is not displayed.

The last line in the table, named (TOTAL), sums up the information for the whole project.

Command mode user interface

The user interface is started up, you already have opened a project.

To obtain the project status, type the following command:
status_global
or
sg

Motif user interface

The user interface has already been started up, you are in the components window.
To obtain the project status, perform the following operations:

  1. Click on the Analysing ... button, select Project Status.
     The project status table is displayed in the Atelier B start-up window.

To obtain the unproved project status (i.e. show only the unproved components), perform
the following operations:

  1. Click on the Analysing ... button, select Project Status Unproved.
     The project status table is displayed in the Atelier B start-up window.
114                                                                    Atelier B - User Manual


7.3      Component Status
Description

A component with the B method applied on pass through several states:

Modified after modification of the component source,

Parsed after a syntax analysis of the component,

TypeChecked after type checking of the component,

POGenerated after generating of component proof obligations,

AutoProved after an automatic or interactive demonstration of all the proof obligations
    of the component.

These states are exclusive. A component loses its Modified state as soon as it is successfully
type checked.
This function displays the component state as shown below:

Printing the status of QUERY

      QUERY TypeChecked /home/project/spec/QUERY.mch

End of Printing the status

If the component is the POGenerated status, the function displays a table showing more
precise information on the component proof obligations.
Example:

Printing the status of FILE_BUFFER_1

    FILE_BUFFER_1 POGenerated /home/projet/spec/FILE_BUFFER_1.mxh
+-----------------------+-------+------+-------+-------+-----+
|                       | NbObv | NbPO | NbPRi | NbPRa | %Pr |
+-----------------------+-------+------+-------+-------+-----+
|   Initialisation      |    3 |    0 |        |       |     |
|   load_buffer         |   12 |    3 |    0   |   3   | 100 |
|   create_record       |    4 |    1 |    0   |   0   |   0 |
|   not_in_buffer       |    7 |    0 |        |       |     |
|   mod_buffer          |    8 |    0 |        |       |     |
|   val_buffer          |    8 |    0 |        |       |     |
|   size_file           |    5 |    0 |        |       |     |
+-----------------------+-------+------+-------+-------+-----+
|   FILE_BUFFER_1       |   47 |    4 |    0   |   3   | 75 |
+-----------------------+-------+------+-------+-------+-----+

End of Printing the status


The columns in this table show, for each operation on the component:

NbObv This column contains the number obvious proof obligations of the operation.
   These proof obligations are eliminated automatically by the generator of proof obli-
   gations.
ANALYSING B DEVELOPMENTS                                                            115


NbPO This column contains the number of not obvious proof obligations of the operation.

NbPRi This column contains the number of proof obligations proved by the interactive
   prover.

NbPRa This column contains the number of proof obligations proved by the automatic
   prover.

%Pr This column contains the percentage of proof obligations on the operation already
    proved. This percentage does not take in account POs eliminated by the proof
    obligation generator.

The last line in the table, (TOTAL) sums up each information for all operation of the
component.
This information can be included in the documents automatically generated by Atelier B
(refer to sub-section 8.1).

Command mode user interface

The user interface is started up, you already have opened a project.
To obtain the status of the comp_name component, type the following command:
status comp_name
or
s comp_name

Motif user interface

The user interface has To obtain the status of a component, perform the following opera-
tions, in the components window:

  1. Select the component from the list of project components.

  2. Click on the Analysing ... button, select Component Status.
     The component status is displayed in the Atelier B start-up window.

To obtain the unproved component status (i.e. show only the unproved operations),
perform the following operations:

  1. Click on the Analysing ... button, select Component Status Unproved.
     The project status table is displayed in the Atelier B start-up window.
116                                                                        Atelier B - User Manual


7.4     Animation
Description

This function is used to animate a B specification.
This animation allows you to validate a specification by viewing the evolution of variables
and properties through operation calls. For further information, the reader, is refered to
the Animator - User’s Manual document.

Command mode user interface

The user interface is started up, you already have opened a project.

To perform the animation of a specification comp_name, type the following command:
animator comp_name
or
ani comp_name
After typing this command, the prompt of the animator is displayed: ANI>.
Then, you can type the various commands of the animator.
Type qu to quit.

Motif user interface

This function is not available with the Motif user interface.

Possible errors
 No current project
 You requested the animation of a component without first opening a project. You
 must open a project before launching an animation.


 Cannot access the project components description file <proj name>
 This error message is sent if the description file of the project components is no
 longer accessible.This file is normally present in the project PDB; it is named
 <proj>.db.The file or the directory may have been deleted by mistake. If this
 file is not accessible, Atelier B cannot check if the user has or not some components.
 In general, if this file is no longer accessible, it is better to delete the project, because
 none action will be possible to perform on this project.


 Cannot find component <comp name> in the project
 The component specified as a parameter is not attached to the project. Check the
 name of the component by displaying the project components list.
ANALYSING B DEVELOPMENTS                                                          117


 Component <comp name> is not a machine
 The component specified as a parameter is a refinement or an implementation. As
 only abstract machines can be animated, start the animator with the name of an
 abstract machine.
118                                                                Atelier B - User Manual



                          INCLUDES

                          USES

                          SEES

                          EXTENDS

                          IMPORTS

                 Figure 7.1: Line styles for links between components



7.5    Dependency Graphs
Description

This command is only available if the workstation has the VCG freeware tool installed
(refer to the Atelier B - Administrator’s Manual).
A dependencies graph is provided for the selected component or for the whole project.
The search for dependencies is recursive. Therefore if component X depends on component
Y (for example via an ”IMPORTS” link), and component Y depends on component Z (for
example via a ”SEES” link), then components X, Y and Z will be present in the graph.
The components are grouped by module. A module contains a machine, its refinements
and its implementation.
When a component is linked to another component with a renaming (for example IMPORT nn.machine),
the link between the two components gives the renaming prefix (nn in this case).
Each type of link is shown with a different line style. Figure 7.1 on page 118 shows the
different line styles.
Given the complexity of the projects, a number of options are available for filtering the
links and the modules displayed:

Components filtering: The user can choose between several options for the components.
   The available options are:

All: All the project components are present.

Selected only: Only the selected component is displayed.

Selected and transitively linked: Only the selected component and all its refinements
     and abstractions are displayed.

Link filtering: The user can choose the types of links (SEES, IMPORTS, ...) displayed.

Graph direction: The user may choose to do a graph:
ANALYSING B DEVELOPMENTS                                                             119


ascending: In this case, the components that are dependent on the selected component
     are displayed. This shows the impact of a modification to this component on the
     other project components. All the component incoming links are displayed.

descending: In this case the component linked to the selected component are displayed.
     All the components outgoing links are displayed.

Library components filtering: The user may choose between several options for the
     components linked to the project and that are in a library. The options available
     are:

Show All: In this case the components present in libraries are handled in the same way
    as the other components. If these components depend on other components, they
    will also be included in the graph.

Show: In this case only components directly linked to project components will be dis-
    played. If these components depend on other components, they will not be displayed.

Group: In this case all the components in the same library are combined in the same
    node of the graph.

Hide: In this case the components present in libraries will not be displayed.

For all components present in libraries, the library name is given in brackets.

Components not linked filtering: The user can choose to not see the isolated compo-
   nents, in other words, the components that are not linked to other components.

Instanciation graph: The user can choose to visualise only the instanciation graph, in
     other words, only the IMPORTS links between the different modules.

Figure 7.2 on page 120 shows an example of a project graph.
Dependency graphs can be included in the documentation automatically generated by
Atelier B (refer to section 8.1).

Command mode user interface

The user interface is started up, you already have opened a project.
To obtain a dependency graph, use the following command: project_status.
This command uses seven parameters:

  1. The name of the component or the “*” value to obtain a graph for the entire project.

  2. The option on components: A for All, S for Selected only, G for Selected and tran-
     sitively linked. The library option: A for Show All, S for Show, G for Group N for
     Hide.

  3. The direction of the graph: U for up, D for down.
120                                                                  Atelier B - User Manual




                     Figure 7.2: Example of a dependency graph



  4. The types of links to display. The links are in the following order: EXTENDS,
     IMPORTS, INCLUDES, SEES, USES. The value 0 deletes the displaying of the
     link.
     Example: To display only IMPORTS and SEES: 01010.

  5. The option on the components not linked: 1 to hide the isolated components, 0 to
     show them.

  6. 1 to see only the instanciation graph, otherwise, 0.

Example: To display the project graph with all the links, type the command:
project_status * A D 11111 0 0

Motif user interface

The user interface is already started up, you are in the components window.
To obtain a dependency graph, perform the following operations:

  1. To obtain a graph from a specific component, select it from the list of components.

  2. Click on the Analysing ... button in the Dependence Graph menu.
     The window shown in figure 7.3 on page 121 is displayed.


  3. Click on All in the Components field to display a graph on the entire project.

  4. Click on the type of links you wish to display in the Links field.

  5. Click on the Instanciation graph field, or, if you want only the instanciation graph
     to be displayed.
ANALYSING B DEVELOPMENTS                                                               121




                        Figure 7.3: Dependence Graph window



  6. Click on the type of graph you wish to display in the Browse field.

  7. Click on the Options field if you want to hide the isolated components.

  8. Click on one of the displaying options for the components present in the libraries, in
     the Library Components field.

  9. Click on OK to display the graph.
     The VCG tool window is displayed.

A few useful VCG commands

To quit the tool, you can type q.
To move around in the graph you can use the up or down scroll bars or the cursor keys
on the keyboard.
To enlarge/reduce the graph you can use the scroll bar to the left or the + and - keys on
the keyboard.
You can also click on the small box in the lower left corner and VCG will ensure that the
entire graph will fit in the screen.
To print the graph, select the Export Graph ... option from the screen background menu,
then choose the output format, PostScript for example; you can then modify the orienta-
tion of the graph and its position on the paper.
For more information, refer to the VCG user’s manual.
122                                      Atelier B - User Manual


Usable parameters

 ATB*OPT TOOLS <SYSTEM>*VCG Path
 Positioned at Atelier B installation.
 Entire path to the vcg executable.
ANALYSING B DEVELOPMENTS                                                                123




                     Figure 7.4: Example of an operation call graph



7.6    Operation call graph
Description

This command is available only if the workstation has the DaVinci tool installed (refer to
Atelier B - Administrator’s manual).

The operation call graph permits to visualise the cascades of operation calls in the OP-
ERATIONS, LOCAL OPERATIONS and INITIALISATION clauses of a B component.
This type of graph is useful during the proof phase, as it allows to better understand where
the elements of an operation PO come from.

To distinguish the specifications and implementations of local operations, the name of the
implementation of a local operation is preceded by refinement_of_ in this graph.

The operation call graph is provided for some selected components, for these components
and all those they depend on or for all the components of a project.
The figure 7.4 on page 123 gives an example of an operation call graph.
The operation call graph can be included in the documentation automatically produced
by Atelier B (refer to chapter 8.1).

Command mode user interface

The user interface is started up, you already have opened a project.
To obtain an operation call graph, type the following command:
124                                                                  Atelier B - User Manual


op_call_graph.
or :
ocg.

This command include three parameters:


  1. the name of a component or the “*” value to have a graph on all the project.


  2. the name of an operation, the INITIALISATION key word, or the “*” value to have
     the graphs of all the operations.


  3. 1 if you wish to extend the graph to the refinements and to the operation abstrac-
     tions, otherwise, 0.


Example : To display the operation call graph of operation op_name of component comp_name
and all its refinements and abstraction, type the following command :
op_call_graph comp_name op_name 1
or :
ocg comp_name op_name 1

Motif user interface

The user interface has already been started up, you are in the components window.
To obtain an operation call graph, perform the following operations:

  1. If you want to obtain a graph for only some components, select them in the compo-
     nents list.

  2. Click on the Analysing ...button, select Operations Call Graph.
     The window shown in figure 7.5 on page 125 is displayed.

  3. Click in the Component field:

        • on All to obtain the operation graph for the whole project,
        • on Selected Only to obtain the operation call graph derived from the selected
          components only,
        • on Selected and transitively linked to obtain the operation graph in the selected
          components and in all their refinements and abstractions.

  4. Type in the Operation Name field the name of the operation you want to see the
     graph of. If you don’t indicate anything the graphs of all operations will be gen-
     erated. If you want to obtain the graph of the INITIALISATION clause, type
     INITIALISATION.

  5. Click on OK to display the graph.
     The window of the DaVinci tool is displayed.
ANALYSING B DEVELOPMENTS                                                     125




                      Figure 7.5: Operations Call Graph window



Usable parameters

 ATB*OPT TOOLS <SYSTEM>*DaVinci Path
 Positioned at Atelier B installation
 Entire path to the daVinci executable.
 ATB*GRAPH*BackGroundColor
 white
 Color of the window background.
 ATB*GRAPH*ComponentNodeColor
 white
 Color of the nodes of the graph representing a component.
 ATB*GRAPH*IdentNodeColor
 white
 Color of the nodes of the graph representing an identifier.
 ATB*GRAPH*NodeColor
 white
 Color of the graph nodes.
 ATB*GRAPH*Font

 Font used in the graph.
 ATB*GRAPH*daVinci*Orientation
 top down
 Orientation of the graph : top down, bottom up, left right or right left.
 ATB*GRAPH*CutBelowDepth

 Minimum depth of the graph (Integer ≥ 1).
 ATB*GRAPH*CutAfterDepth

 Maximum depth of the graph (Integer ≥ 1).
126                                                                   Atelier B - User Manual


 ATB*GRAPH*AddIdentificater

 Add the data corresponding to the given identifier list.
 ATB*GRAPH*ExcludeIdentifier

 Exclude the data corresponding to the given identifier list.
 ATB*GRAPH*AddComponentData

 Add the data corresponding to the given component list.
 ATB*GRAPH*ExcludeComponentData

 Exclude the data corresponding to the given component list.
 ATB*GRAPH*ExcludeLibraryData

 Exclude the data corresponding to the given library list.
 ATB*GRAPH*ExcludeAllLibrariesData

 Exclude the data corresponding to all the libraries.
 ATB*GRAPH*CALL*PrintMachineName
 TRUE
 Write the name of the components in nodes.
 ATB*GRAPH*CALL*daVinci*OpShape
 box
 Representation of an operation : box, circle, ellipse, rhombus, triangle or text.
ANALYSING B DEVELOPMENTS                                                                 127


7.7     Formula graph
Description

This command is available only if the workstation has the DaVinci tool installed (refer to
Atelier B - Administrator’s Manual).
A formula graph represents a predicate, an expression or a substitution of a B component
clause. This graph is a binary tree. It permits to visualise immediatly the priorities
between operators. Such a graph is useful during the syntax and semantic checks (to help
understanding an error message), or during the proof phase ( is the written predicate the
one you really wanted?).
In order to avoid having a too much complex graph, the user can indicate the depth or
the graph level he wants to have:

   • If the user indicates a n (n ≥ 2)level, all the nodes of the graph that have almost
     n-1 descendants level are represented in a textual form rather than a graphical one.

   • If the user indicates a n (n ≥ 1) depth, all the grah nodes that have n-1 ancestors
     are represented in a textual form rather than a graphical one.

These two options are exclusive: it is not possible to indicate a level and a depth at the
same time.
If the user requires the formula with the name of a local operation, it is the implementation
graph of this operation that is generated.
The figure 7.6 on page 128 gives an example of a formula graph.
The figure 7.7 on page 129 gives an example of a formula graph with a level equal to 3.
The figure 7.8 on page 129 gives an example of a formula graph with a depth equal to 3.
The formula graphs can be included in the documentations automatically produced by
Atelier B (refer to chapter 8.1).

Command mode user interface

The user interface is started up, you already have opened a project.
To obtain a formula graph, type the following command: formula_graph or fg.
This command includes four parameters:

  1. the name of a component,

  2. the name of a clause or of an operation,

  3. the level, or 0.

  4. the depth, or 0,

Warning: as the level and the depth are exclusive, one of these two parameters must be 0.
Example : To display the graph of the INVARIANT clause of the op_name component
with a depth of 3, you must type :
formula_graph comp_name INVARIANT 0 3
128                                            Atelier B - User Manual




      Figure 7.6: Example of a formula graph
ANALYSING B DEVELOPMENTS                                            129




               Figure 7.7: Example of a formula graph (level = 3)




              Figure 7.8: Example of a formula graph (depth = 3)
130                                                                 Atelier B - User Manual




                          Figure 7.9: Formula Graph window


or :
fg comp_name INVARIANT 0 3

Motif user interface

The user interface is already started up, you are in the components window.
To obtain a formula graph, perform the following operations:

  1. Select the component you want to see the graph of in the components list.
  2. Click on the Analysing ... button, select Formula Graph.
     The window shown in figure 7.9 on page 130 is displayed.
  3. Type in the Clause Name field the name of the clause you want to see the graph of.
  4. If you want to indicate a level, update the Fold Level field using the arrows.
  5. If you want to indicate a depth, update the Fold Depth field using the arrows.
     Warning: as the level and the depth are exclusive, the modification of either one
     resets the other to 0.
  6. Click on OK to display the graph.
     The window of the DaVinci tool is displayed.

Usable parameters

 ATB*OPT TOOLS <SYSTEM>*DaVinci Path
 Positioned at Atelier B installation.
 Entire path to the daVinci executable.
 ATB*GRAPH*BackGroundColor
 white
 Color of the window background.
 ATB*GRAPH*ComponentNodeColor
 white
 Color of the nodes of the graph representing a component.
 ATB*GRAPH*IdentNodeColor
 white
 Color of the nodes of the graph representing an identifier.
ANALYSING B DEVELOPMENTS                                                                 131


 ATB*GRAPH*NodeColor
 white
 Color of the graph nodes.
 ATB*GRAPH*Font

 Font used in the graph.
 FonteATB*GRAPH*daVinci*Orientation
 top down
 Orientation of the graph : top down, bottom up, left right or right left.
 ATB*GRAPH*CutBelowDepth

 Minimum depth of the graph (Entire ≥ 1).
 ATB*GRAPH*CutAfterDepth

 Maximum depth of the graph (Entire ≥ 1).
 ATB*GRAPH*FORMULA*daVinci*LeafShape
 box
 Representation of a graph leaf: box, circle, ellipse, rhombus, triangle or text.
 ATB*GRAPH*FORMULA*daVinci*OperatorShape
 circle
 Representation of an operator : box, circle, ellipse, rhombus, triangle or text.
 ATB*GRAPH*FORMULA*daVinci*FoldedShape
 ellipse
 Representation of a folded formula : box, circle, ellipse, rhombus, triangle or text.
 ATB*GRAPH*FORMULA*daVinci*RootShape
 rhombus
 Representation of the graph root : box, circle, ellipse, rhombus, triangle or text.

Possible errors
 Cannot give fold level and fold depth together
 You specified a level and a depth at the same time. But these two options are
 exclusive.

 Unexpected fold level value: <n> (expected 0 or >= 2)
 If you want to indicate a level, the value you choose must be greater than or equal
 to 2. Otherwise, you must give the 0 value.

 Unexpected fold depth value: <n> (expected positive value)
 If you want to indicate a depth, the value you choose must be a non negative integer
 whole number. Otherwise, you must give the 0 value.

 One and Only One Component Must be Selected
 You selected several components. You must select only one component.
132                                                                    Atelier B - User Manual




                     Figure 7.10: Example of an homonymy graph



7.8    Homonymy graph
Description

This command is available only if the workstation has the DaVinci tool installed (refer to
Atelier B - Administrator’s Manual).

The homonymy graph permits to visualise homonymy links between data of a B project.
It underlines the way they are refined, then implemented.
The homonymy graph of an identifier is provided for a list of selected components, for
these components and all those they depend on or for all the components of a project.
The figure 7.10 on page 132 gives an example of an homonymy graph.
The homonymy graphs can be included in the documentation automatically produced by
Atelier B (refer to chapter 8.1).

Command mode user interface

The user interface is started up, you already have opened a project.
To obtain a homonymy graph, type the following command:
homonymy_graph
or :
hg.
This command takes three parameters:

  1. The name of a component or the “*” value to obtain a graph on all the project,
ANALYSING B DEVELOPMENTS                                                               133




                        Figure 7.11: Homonymy Graph window



  2. the name of an identifier or the “*”to have the graphs of all identifiers,

  3. 0 if you don’t want to extend the graph to the components transitively linked, 1
     otherwise.

Example : To display the homonymy graph of identifier ident_name in component comp_name
and all the components that are transitively linked to it, type the following command:
homonymy_graph comp_name ident_name 1
ou :
hg comp_name ident_name 1

Motif user interface

The user interface is already started up, you are in the components window.
To obtain a homonymy graph, you must perform the following operations:

  1. If you want to obtain a graph from some components, select them in the components
     list.

  2. Click on the Analysing ... button, select Homonymy Graph.
     The window shown in the figure 7.11 on page 133 is displayed.


  3. Click in Component field :

        • on All to obtain a graph on the entire project,
        • on Selected Only to obtain a graph that for the selected components only,
        • on Selected and transitively linked to obtain a graph for the selected components
          and all the components that are linked to them.

  4. Type in the Ident Name field the name of the identifier you want the graph of. If
     you don’t indicate anything, the graphs of all the identifiers will be generated.

  5. Click on OK to display the graph.
     The window of the DaVinci tool is displayed.
134                                                                  Atelier B - User Manual


Usable parameters

 ATB*OPT TOOLS <SYSTEM>*DaVinci Path
 Positioned at Atelier B installation
 Entire path to the daVinci executable.
 ATB*GRAPH*BackGroundColor
 white
 Color of the window background.
 ATB*GRAPH*ComponentNodeColor
 white
 Color of the nodes of the graph representing a component.
 ATB*GRAPH*IdentNodeColor
 white
 Color of the nodes of the graph representing an identifier.
 ATB*GRAPH*NodeColor
 white
 Color of the graph nodes.
 ATB*GRAPH*Font

 Font used in the graph.
 ATB*GRAPH*daVinci*Orientation
 top down
 Orientation of the graph : top down, bottom up, left right or right left.
 ATB*GRAPH*CutBelowDepth

 Minimum depth of the graph (Entire ≥ 1).
 ATB*GRAPH*CutAfterDepth

 Maximum depth of the graph (Entire ≥ 1).
 ATB*GRAPH*AddIdentifier

 Add the data corresponding to the given identifier list.
 ATB*GRAPH*ExcludeIdentifier

 Exclude the data corresponding to the given identifier list.
 ATB*GRAPH*AddComponentData

 Add the data corresponding to the given component list.
 ATB*GRAPH*ExcludeComponentData

 Exclude the data corresponding to the given component list.
ANALYSING B DEVELOPMENTS                                                                    135


 ATB*GRAPH*ExcludeLibraryData

 Exclude the data corresponding to the given librariy list.
 ATB*GRAPH*ExcludeAllLibrariesData

 Exclude the data corresponding to all libraries.
 ATB*GRAPH*HOMO*daVinci*ConcreteVariableShape
 box
 Representation of a concrete variable: box, circle, ellipse, rhombus, triangle or text.
 ATB*GRAPH*HOMO*daVinci*AbstractVariableShape
 rhombus
 Representation of an abstract variable : box, circle, ellipse, rhombus, triangle or
 text.
 ATB*GRAPH*HOMO*daVinci*ConcreteConstantShape
 circle
 Representation of a concrete constant : box, circle, ellipse, rhombus, triangle or text.
 ATB*GRAPH*HOMO*daVinci*AbstractConstantShape
 ellipse
 Representation an abstract constant : box, circle, ellipse, rhombus, triangle or text.
 ATB*GRAPH*HOMO*daVinci*AbstractSetShape
 triangle
 Representation an abstract set: box, circle, ellipse, rhombus, triangle or text.
136                                                                     Atelier B - User Manual


7.9       Cross References
Description

This function performs searches on the identifiers defined in the project components.
For each identifiers, the function displays:

      • its type: variable, set, ...

      • the place where it is typed,

      • the names of the components and the clauses where it is defined.

      • the names of the components and the clauses where it is used.

      • the names of the components and the clauses where it is modified (for variables
        only).

Identifiers are sorted by type.
The user can request this information:

      • for a specific identifier,

      • for all of the identifiers defined in a component,

      • for all of the identifiers defined in the project: the user will obtain a dictionary of
        the terms used in the project.
        To distinguish the specifications and implemantaions of local operations, the names
        of the implemantations of local operations are preceded by refinement_of_.

Example:

_____________________________________________________________________
VARIABLES
end_delay
        concrete variable
          Definition of "end_delay" in B_Delais.mch (CONCRETE_VARIABLES)
          Use of "end_delay" in B_Delay.mch (INVARIANT)
          Use of "end_delay" in B_Delay.mch (INVARIANT)
          Modification of "end_delay" in B_Delay.mch (INITIALISATION)
          Modification of "end_delay" in B_Delay.mch (b_init_delay)
          Modification of "end_delay" in B_Delay.mch (b_stopper_delay)
          Modification of "end_delay" in B_Delay.mch (b_delay_elapsed)

.....
_____________________________________________________________________
OPERATIONS
b_delay_elapsed
        operation name
          Definition of "b_delay_elapsed" in B_Delay.mch
.....
_____________________________________________________________________
OPERATION PARAMETERS
end_del
        operation output parameter
ANALYSING B DEVELOPMENTS                                                                 137


          Definition of "end_del" in B_Delay.mch (b_delay_elapsed)
          Modification of "end_del" in B_Delay.mch (b_delay_elapsed)



This information can be included in the project documentation automatically generated
by Atelier B (refer to sub-section 8.3).
Warning: Calling this function generates a semantic analysis of the concerned compo-
nents.

Command mode user interface

The user interface is started up, you already have opened a project.
To obtain cross references, type the following command:
get_project_xref
or
gpx
This command includes one or two parameters:

  1. The filter on identifiers:

        • 0 for all identifiers of the component specified as second parameter,
        • 1 for on identifier of the current project specified as second parameter,
        • 2 for all identifiers of the project,

  2. The component for filter 0 or identifier for filter 1.

Examples:
To obtain cross references for all of the identifiers defined in the component comp, type
the following command:
get_project_xref 0 comp
To obtain cross references on an identifier ident, type the following command:
get_project_xref 1 ident
To obtain cross references for all the identifiers defined in the project, type the following
command:
get_project_xref 2

Motif user interface

The user interface has already been started up, you are in the components window.
To obtain cross references on all the identifiers defined in the project, perform the following
operations:

  1. Click on the Tracking ... button, select Cross Reference menu.
     The window shown in figure 7.12 on page 138 is displayed.


  2. Click on Project.
138                                                                  Atelier B - User Manual




                         Figure 7.12: Cross Reference window



  3. Click on OK to perform the search.
     The results are displayed in the Atelier B start-up window.
     They are also decribed in a PDB window named project_name.dico_ascii.

To obtain cross references on all the identifiers defined in a project component, perform
the following operations:

  1. Select the component in the list of components.

  2. Click on the Analysing ... button, select Cross Reference.
     The window shown in figure 7.12 on page 138 is displayed.

  3. Click on Component.

  4. Click on OK to perform the search.
     The results are displayed in the Atelier B start-up window.

To obtain cross references on a specific identifier, perform the following operations:

  1. Click on the Analysing ... button, select Cross Reference.
     The window shown in figure 7.12 on page 138 is displayed.

  2. Click on Identifier.
     An additional field is displayed in the window.

  3. Type the name of the identifier in the Identifier Name field.

  4. Click on OK to perform the search.
     The results are displayed in the Atelier B start-up window.

Possible errors
 Cannot update component <comp name>, it belongs to library project <lib name>
 The component that you tried to get cross references depends on a component
 present in a library. This library is not updated, the components that it contains
 have not been syntaxically checked. Ask the library manager to update it.


 No current project
 You use the command mode interface and you requested cross references on compo-
 nents without opening a project before. You must open the project first.
ANALYSING B DEVELOPMENTS                                                                 139


 Cannot find component <comp name> in the project
 The component specified as a parameter is not part of the project. Check the name
 of the component by displaying the list of project components.


 Xref error in <project name>
 The Cross reference tool has detected an error in the analysis of the B source data
 specified as parameters. These error messages present below of this one, specify the
 type of error. The format of these messages is :
 file name:line number:column number: Text message. In general, these messages
 refers to syntax or semantic errors. To check if your components are correct, call up
 the Atelier B type check function.
140                                                                       Atelier B - User Manual


7.10        Extracting Metrics
Description

This function extracts metrics from an implementation or from all the implementations of
the project.
These metrics are used to:

      • measure the complexity of an implementation or of the analysed project,

      • check that the implementation or the analysed project complies with programming
        rules.

      • measure the minimum memory size required for implementing the data layouts used
        in the B sources.

The metrics extracted are exctracted accoeding to the data present in a configuration file.
This configuration file contains the following information:

      • The reference value for each metric.

      • The list of metrics to display in the project report; the project report is a table that
        contains metrics for all the project implementations.

      • The list of metrics to display in the implementation report; the implementation
        report is a table that contains metrics for a specified implementation.

      • The list of metrics to display in the operation report; the operation report is a table
        that contains metrics for an operation in a specified implementation.

The user can use the configuration files provided by Atelier B or create his own configu-
ration files.
The configuration files supplied with Atelier B are located in the AB/press/lib/LC direc-
tory. The files have a .cvl extension.
Example of a project report:

+--------------------+---------+---------+---------+---------+---------+---------+
| Name               |     (1) |     (2) |     (3) |     (4) |     (5) |     (6) |
+--------------------+---------+---------+---------+---------+---------+---------+
| Reference Values   |     500 |     100 |      10 |       3 |       2 |     100 |
+--------------------+---------+---------+---------+---------+---------+---------+
| Distributor_imp    |      14 |      12 |       1 |       2 |       1 |       5 |
+--------------------+---------+---------+---------+---------+---------+---------+
| Screen_imp         |      13 |       6 |       1 |     !4! |       1 |       1 |
+--------------------+---------+---------+---------+---------+---------+---------+

(1)=NB_INST_OPER
(2)=NB_INST_SEQ
(3)=NB_CTRL_SEQ
(4)=NB_CTRL_IMB
(5)=NB_WHILE_IMB
(6)=LG_CONDITION
ANALYSING B DEVELOPMENTS                                                             141


The first line shows the names of the metrics that are repeated after the table.
The second line remains the reference value for each metric.
The next lines show the values of the metrics for each project implementation.
If a metric value exceeds the reference, it is enclosed between !<value>! (example !4!).
Example of an implementation report:

METRICS FOR IMPLEMENTATION : Ecran_imp

+----------------------+------------+------------+------------+------------+
| Title                |   Value    |    Ref     |   % > ref |     CR      |
+----------------------+------------+------------+------------+------------+
| NB_INST_OPER         |         13 |        500 |    --      |    OK      |
+----------------------+------------+------------+------------+------------+
| NB_INST_SEQ          |          6 |        100 |    --      |    OK      |
+----------------------+------------+------------+------------+------------+
| NB_CTRL_SEQ          |          1 |         10 |    --      |    OK      |
+----------------------+------------+------------+------------+------------+
| NB_CTRL_IMB          |          4 |          3 |    25      |    KO      |
+----------------------+------------+------------+------------+------------+
| NB_WHILE_IMB         |          1 |          2 |    --      |    OK      |
+----------------------+------------+------------+------------+------------+
| LG_CONDITION         |          1 |        100 |          0 |    OK      |
+----------------------+------------+------------+------------+------------+


The first column shows the names of the metrics.
The second column shows the maximum value of each metric for all implementation op-
erations.
The third column shows the reference value for each metric.
The fourth column shows the excess percentage according to the reference value.
The last column shows OK if the value is below the reference value, KO if not.
Example of an operation report:

METRICS FOR OPERATION : message_controler_code

+----------------------+------------+------------+------------+------------+
| Title                 |  Value     |   Ref      |  % > ref |     CR       |
+----------------------+------------+------------+------------+------------+
| NB_INST_OPER          |         6 |        500 |    --       |   OK       |
+----------------------+------------+------------+------------+------------+
| NB_INST_SEQ           |         4 |        100 |    --       |   OK       |
+----------------------+------------+------------+------------+------------+
| NB_CTRL_IMB           |         4 |          3 |    25       |   KO       |
+----------------------+------------+------------+------------+------------+
| NB_CTRL_SEQ           |         1 |         10 |    --       |   OK       |
+----------------------+------------+------------+------------+------------+
| NB_WHILE_IMB        |          0 |          2 |    --      |    OK      |
+----------------------+------------+------------+------------+------------+
| LG_CONDITION          |         1 |        100 |          0 |    OK       |
+----------------------+------------+------------+------------+------------+


The second column shows the value of each metric for the analised operation. The meaning
of the other table columns is the same as in the implementation report.
The following table shows the list of the available metrics:
142                                                                         Atelier B - User Manual


 Metric Code      Calculation performed
 NB_SEE_MACH      number of seen machines
 NB_IMPORT_MACH   number of imported machines
 NB_MACH_EXTEND   number of extended machines
 NB_ENUM_SET      number of enumerated sets
 NB_ABSTR_SET     number of abstract sets
 NB_ENUM_ITEM     maximum number of elements in a enumerated set
 NB_MACH_PAR      number of machine formal parameters
 TOT_NB_ENUM      total number of enumerated elements
 NB_CONC_VAR      number of concrete variables
 NB_OPER          number of operations
 NB_CONST         number of concrete constants
 NB_LOC_VAR       maximum number of local variables per operation
 NB_INPUT_PAR     number of input parameters per operation
 NB_OUTPUT_PAR    number of output parameters per operation
 NB_INST_OPER     total number of instructions in an operation
 NB_NEST_CTRL     maximum number of control statements nested in an operation
 NB_SEQ_CTRL      maximum number of control statements in sequence in an oper-
                  ation
 NB_NEST_WHILE    number of nested whiles
 NB_SEQ_INST      number of instructions in sequence in an operation
 NB_VAR_IN        number of VAR IN in an operation
 LG_PREFIX        maximum size of rename prefixes
 LG_PAR_MACH      maximum size of a machine parameter
 LG_IMP           implementation name size
 LG_INPUT_PAR     maximum size of an operation input parameter
 LG_OUTPUT_PAR    maximum size of an operation output parameter
 LG_SET           maximum size of a set identifier
 LG_ITEM_SET      maximum size of a set element identifier
 LG_CST           maximum size of a visible constant identifier
 LG_CONC_VAR      maximum size of a visible variable identifier
 LG_LITERAL       maximum size of a literal character string in an operation
 LG_LOC_VAR       maximum size of a local variable identifier
 LG_OPER          maximum size of an operation identifier
 LG_OPER_MACH     maximum size of an operation identifier + machine identifier
 LG_CONDITION     maximum size of a condition expression for an operation (num-
                  ber of operators)
 SZ_ARRAY         memory space taken by the arrays
 NB_OP_PROMUE     number of operations promoted and extended
 SZ_CONC_VAR      memory space taken by the visible variables other than arrays
 SZ_CST           memory space taken by visible constants other than arrays


Command mode user interface

The user interface is started up, you already have opened a project.
To calculate the metrics on all the implementations of a project, type the following com-
mand:
lchecker_project config_path output
or
lcp path_config output
The first parameter is the complete path of the configuration file to use, for example
<rep_Atelierb>AB/press/lib/LC/CONFIG_clause.cvl.
The second parameter is the output format; the values 0,1,4,6 and 8 correspond respec-
tively to a L TEX, Interleaf, ASCII, FrameMaker or Word displaying.
            A
The values 2,3,5 and 7 correspond respectively to a L TEX, Interleaf, ASCII, FrameMaker
                                                    A
ANALYSING B DEVELOPMENTS                                                                 143




                          Figure 7.13: Limit Checker window



or Word print out.
To calculate metrics on a project implementation, type the following command:
lchecker_mach name_imp config_path output
or
lcm imp_name config_path output

The first parameter is the implementation name. The two other one have the same mean-
ing that for lcp .



Motif user interface

The user interface is already started up, you are in the components window.
To calculate metrics, perform the following operations:

  1. Click on the Limit Checker button.
     The window shown in figure 7.13 on page 143 is displayed.

     This window contains two fields:

      (a) the upper field is used to choose the metric configuration files,
      (b) the lower field that only appears when you click on Limit Checker, is used to
          choose the output format produced by the tool.

  2. Select the configuration file directory in the upper field.
     You can move around in the directories by ”double-clicking” on the Directories list
     field or by directly typing the access path in the Directory name field.
     Each time the directory changes the Files list contains the list of the directory’s files
144                                                                  Atelier B - User Manual


      with a “.cvl” extension.
      The configuration files are by default located in the <rep_atelierb>AB/press/lib/LC
      directory.

  3. Select, from the Files list , the configuration file.
     The name of the configuration file is displayed in the File Name field.

  4. To edit the selected configuration file, click on Edit Config File, then OK.
     The file is edited with the standard editor.

  5. To calculate the metrics, click on Limit Checker.
     The lower field in the data entry window is displayed.

  6. To perform a calculation on all of the project implementations, click on All. If you
     click on Selected Only, the calculation will only be performed on the implementations
     selected from the list of components.

  7. Select the output formats in the Output Format field.
     Warning, a display on screen is only possible in ASCII and L TEXformats.
                                                                A


  8. Select the type of output from the Output format. If you select Print you must also
     specify the printer name.

  9. Click on OK to perform the extraction.
     The results are displayed in the Atelier B start-up window.
     If the output format is ASCII the results are displayed with the standard editor.
     If the output format is L TEX, the results are displayed with xdvi.
                             A



Usable parameters

 ATB*OPT TOOLS <SYSTEM>*Latex Binary Directory
 Positioned at Atelier B installation.
 Directory where to find the Latex binaries.


 ATB*OPT TOOLS <SYSTEM>*Latex Postscript Translator
 Positioned at Atelier B installation.
 Name of the Latex translator to PostScript.


 ATB*OPT TOOLS <SYSTEM>*Latex Viewer
 Positioned at Atelier B installation.
 Name of the Latex viewer.


 ATB*OPT TOOLS <SYSTEM>*Editor Path
 Positioned at Atelier B installation.
 Access path to the text editor.
ANALYSING B DEVELOPMENTS                                                                  145


Possible errors
 B Pretty Printer error while translating into LATEX format file <filename>
 You requested the displaying or the printing-out of the metrics using L TEX. The B
                                                                       A
 Pretty Printer is the tool that converts B formulae to the formats of the different
 word processors. This message is displayed if the tool fails.


 B Pretty Printer error while translating into RTF format file <filename>
 You requested the displaying or the printing-out of the metrics using Word (RTF).
 The B Pretty Printer is the tool that converts B formulae to the formats of the
 different word processors. This message is displayed if the tool fails.


 Cannot read file <filename>.cvl
 The configuration file specified as a parameter is not accessible in read mode. Check
 the rights of this file.


 Error editing file <filename>.cvl
 The configuration file specified as a parameter is not accessible in read mode or the
 editor is not accessible. Atelier B cannot edit the configuration file. Check the rights
 of this file.


 <comp name> is not an implementation
 The component specified as a parameter is not an implementation. The Limit
 Checker only works on implementations.


 Latex error in file <comp name>.avl.tex
 You requested the displaying or printing-out of the metrics using LaTeX. This mes-
 sage is displayed if LaTeX sent back an error. Check your LaTeX installation and
 try to run the command outside of Atelier B, directly in the PDB:
 cd PDB
 latex <comp name>.avl.tex


 Limit Checker error in <comp name>
 The Limit Checker detected an error in one of the implementations specified as a
 parameter. Refer to the messages displayed in the start-up window.


 Problem with LATEX PostScript traductor of <comp name>
 You requested a print-out of the metrics using LaTeX. This message is displayed if
 the dvips program sent back an error. Check your LaTeX installation and try to
 run the command outside of Atelier B, directly in the PDB:
 cd PDB
 dvips <comp name>.avl.dvi -o <comp name>.avl.ps
146   Atelier B - User Manual
Chapter 8

B Project Documentation

8.1    Presentation
These commands are only available if the workstation has one of the following word pro-
cessors installed: L TEXor Word.
                   A

Atelier B provides a number of commands used to generate automatically complete doc-
uments containing the following pieces of information:

   • B source files,

   • user rule files (.pmm),

   • status tables for the project and each component,

   • different graphs,

   • cross references.

In these documents:

   • the B language symbols are displayed using math fonts.

   • the B language key words are displayed in bold face characters.

The two commands offered by Atelier B are:

   • Displaying a B source only.

   • Create a complete document that may contain all the above information in the order
     chosen by the user.




                                         147
148                                                                  Atelier B - User Manual


8.2       Displaying a B Source
Description

This function applies itself on any component of a B project. The B source file (specifica-
tion or refinement) is converted in an understable format of the selected word processor.
If the output format is L TEX the document is displayed on the screen using the xdvi tool
                        A
or converted into a file in PostScript format by the dvips tool and sent to the printer.
For other output formats, the file is generated but the user must edit it directly from his
word processor.

When converting the B source file, the user can choose two types of presentations, he can:

      • keep his original presentation,

      • use the presentation supplied by Atelier B.

Normal comments are deleted from the B source file, only the comments enclosed between
”/*?” and ”?*/” character sequences are retained.

Command mode user interface

The user interface is started up, you already have opened a project.
To display-convert a B source into a word processor format, use one of the following
commands:

      • show_doc_latex or sdl: This function converts the B source into L TEX format,
                                                                               A
        then calls up the latex tool and the xdvi tool to display it on the screen.

      • print_doc_latex or pdl: This function converts the B source into L TEX format,
                                                                              A
        then calls-up the latex tool and the dvips tool to produce a file in PostScript
        format. This file is then automatically sent to the selected printer. To change the
        selected printer, use the set_print_params command.

      • create_doc_rtf or cdr: This function converts the B source into Word format. The
        name of the file produced is displayed in the start-up window. You should then edit
        the file using Word.

The first parameter for these functions is the component name.
The second parameter is the type of required presentation. To retain the original presen-
tation, specify the value PLAIN. Use the NORM value for a standardised presentation.

Motif user interface

The user interface is already started up, you are in the components window.
To convert a B source to word processor format, perform the following operations:

  1. Select the component from the list of components.
B PROJECT DOCUMENTATION                                                              149




                         Figure 8.1: Documentation window



  2. Click on the Document ... button, select Component.
     The window shown by figure 8.1 on page 149 is displayed.


  3. In the Output Format field, click on the selected word processor.

  4. Click on Yes in the Normalization field, if you don’t want to keep the original pre-
     sentation.

  5. Click on the output type in the Output field.
     If you select Print you must specify the printer name and the pages to print.
     The Print format is only available for L TEX.
                                            A


  6. Click on OK to confirm the selection.
     The B source file is converted to the word processor format.
     If the output format is L TEX, Atelier B calls up the latex tool, then the xdvi or
                             A
     dvips tool.
     For the Word format, the name of the file produced is displayed in the start-up
     window. You should then open this file directly from your word processor.

Usable parameters

 ATB*OPT TOOLS <SYSTEM>*Latex Binary Directory
 Positioned at Atelier B installation.
 Directory where to find the Latex binaries.


 ATB*OPT TOOLS <SYSTEM>*Latex Postscript Translator
 Positioned at Atelier B installation.
 Name of the Latex translator to PostScript.


 ATB*OPT TOOLS <SYSTEM>*Latex Viewer
 Positioned at Atelier B installation.
 Name of the Latex viewer.
150                                                                    Atelier B - User Manual


Possible errors
 LATEX error for <comp name>
 This message indicates an error sent back by the L TEXtool.
                                                        A           Check your
 L TEXinstallation. You can try starting L TEX directly on the file generated by
  A                                         A
 Atelier B:
 cd <pdb dir>
 latex <comp name>.tex
 Errors can come from your Latex configuration.                Latex file gen-
 erated by Atelier B contain the same heading defined in the file
 <rep\_atelierb>AB/press/lib/BBeautifuler/ENTETE_LATEX. You can mod-
 ify this file to be conform to your Latex configuration.


 LATEX DVI error viewing <comp name>
 This message indicates an error sent back by the xdvi tool. This tool is the L TEX dis-
                                                                              A
 playing module. Check your L TEX installation. You can try to start xdvi directly
                               A
 on the file generated by Atelier B:
 cd <pdb dir>
 xdvi <comp name>.dvi


 LATEX PostScript error translating <comp name>
 This message indicates an error sent back by the dvips tool. This tool converts
 L TEX format to PostScript format. Check your L TEX installation. You can try to
  A                                                A
 start xdvi directly on the file generated by Atelier B:
 cd <pdb dir>
 dvips <comp name>.dvi -o <comp name>.ps


 Error while generating the documentation of <comp name>
 This message indicates an error in the tool that converts the B source into the word
 processor format. Refer to the messages displayed in the start-up window.
B PROJECT DOCUMENTATION                                                               151


8.3    Creating Complete Documents
This function permits the automatic creation of the documents of the projects managed
by Atelier B.
The created documents can contain the following information:

   • a cover page,

   • a table of contents (only in L TEX),
                                  A


   • sections (5 levels),

   • free text provided by the user,

   • B source files,

   • user rule files (.pmm),

   • status tables for the project and each component,

   • dependency graphs (files in PostScript format),

   • a dictionary of the terms used in the project.

The user can organise this information as he wants to.
Atelier B provides documentation models. These models define a specific documentation
layout, they are a working base to assist the user in creating his own models.
Documentation creation includes three steps:

  1. Creating a model for the project, from a predefined model: during this step, Atelier
     B creates sections for each project component.
     This step is performed by the Create Model function.

  2. Modifying the project model: the user can add, delete or move sections, information,
     ...

  3. Automatic document creation: The user chooses the target word processor and
     Atelier B automatically creates the document.

For more information on this function, read the Model Editor - User’s Manual
This document contains using examples of this function, as well as an absolute description
of the Motif user interface.
This function is not available from the command mode user interface.

Usable parameters

 ATB*OPT TOOLS <SYSTEM>*Latex Binary Directory
 Positioned at Atelier B installation.
 Directory where to find the Latex binaries.
152                                                   Atelier B - User Manual


 ATB*OPT TOOLS <SYSTEM>*Latex Postscript Translator
 Positioned at Atelier B installation.
 Name of the Latex translator to PostScript.


 ATB*OPT TOOLS <SYSTEM>*Latex Viewer
 Positioned at Atelier B installation.
 Name of the Latex viewer.
Appendix A

Limitations of Project
Documentation Tools

The outputs in Word (.rtf) formats are limited. This is due to the abilities of the pro-
grams and their formats. This functionality should be used with care.

For the Word output format, the limitations are the following :

  1. The logo is not included in the generated document.

  2. The table of contents is not generated.

  3. Be careful when including Postscript files:

        • no check is performed to ensure that the file is present on generation;
        • the file must be present on the disk;
        • Word must recognize Postscript files;
        • The printer must be able to interpret the Postscript.

  4. The files are intended for PCs and cannot be used directly on Macintosh computers.




                                          153
154   Atelier B - User Manual
Appendix B

Files Created by Atelier B

The table below describes all the files created by Atelier B:


 File                  Location                      Contents
 project_name.desc     Atelier data base             Project descriptor (directories, manager, users,
                                                     libraries)
 project_name.db       Project data base             Project components (name, localization,
                                                     owner)
 .usedby_*             Project data base             Marker indicating that the project is opened by
                                                     a user
 .project              Project data base, transla-   Marker indicating that the directory is occupied
                       tion directory                by a project
 .lib                  Project data base             Directory of library project PDBs
 *.lock                Project data base             Markers used to ensure mutual exclusion be-
                                                     tween users of the same project
 deB*,versB*           Project data base             FIFOs for communication between the user in-
                                                     terface and the Logic Solver
 src/*.*               Project data base             B source files with expanded definitions. There
                                                     is one file per component even if
 expand_src/*.*        Project data base             B source files, one per component
 *.nf                  Project data base             normalized form of component
 *.tse                 Project data base             Extended table of symbols generated by
                                                     B0Checker
 *.po                  Project   data   base         Component proof obligations
 *.opo                 Project   data   base         component obvious proof obligations
 *.pmi                 Project   data   base         Saved component interactive proof
 *.pmm                 Project   data   base         Rules defined by the user for each component
 project_name.gdl      Project   data   base         Dependency graph
 project_name.stg      Project   data   base         ”Project Status” table in SGML format.
 *.stg                 Project   data   base         ”Component Status” table in SGML format.
 *.tex                 Project   data   base         Files generated by the documentation tools for
                                                     translation into LaTeX.
 *.rtf                 Project data base             Files generated by the documentation tools for
                                                     translation into Word.
 *.dvi                 Project data base             Files generated by LaTeX for display or print-
                                                     out.
                                                                              continued on next page



                                               155
156                                                                           Atelier B - User Manual


 continued from previous page
 File                    Location                          Contents
 *.ps                    Project data base                 LaTeX files converted into PostScript format
                                                           for printing-out.
 *.bod, *.str,           Translation           directory   Object files generated by the ADA translator.
 *.blf                   sub-directory   ada
 *.ads,*.adb             Translation           directory   Files generated by the ADA translator after link
                         sub-directory   ada               edition.
 makefile                Translation           directory   Directives for ADA compiler.
                         sub-directory   ada
 *.bod, *.str            Translation           directory   Object files generated by the HIA translator.
 *.blf                   sub-directory   hia
 *.hia,*.h               Translation           directory   Files generated by the HIA translator after link
                         sub-directory   hia               edition.
 makefile                Translation           directory   Directives for HIA compiler.
                         sub-directory   hia
 *.bdy, *.spe            Translation           directory   Object files generated by the C++ translator.
 *.blf                   sub-directory   cpp
 *.cpp,*.h               Translation           directory   Files generated by the C++ translator after
                         sub-directory   cpp               link edition.
 makefile                Translation           directory   Directives for C++ compiler.
                         sub-directory   cpp
 *.bdy, *.spe            Translation           directory   Object files generated by the C translator.
 *.blf                   sub-directory   c
 *.cpp,*.h               Translation           directory   Files generated by the C translator after link
                         sub-directory   c                 edition.
 makefile                Translation           directory   Directives for C compiler.
                         sub-directory   c

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:15
posted:12/21/2011
language:
pages:166