Tutorial Debugging Well-Definedness and Transition Errors: Difference between revisions

(Created page with 'Category:Tutorial Category:User Manual We assume that you have grasped the way that ProB setups up the initial states of a B machine as outlined in [[Tutorial Setup Phas…')
 
No edit summary
Line 37: Line 37:
Sometimes you can also have the possibility to click on a "Visualise" button, which in this case will give you a graphical visualisation of the invariant violation:
Sometimes you can also have the possibility to click on a "Visualise" button, which in this case will give you a graphical visualisation of the invariant violation:


[[file:ProB_While_INV_Violation.png|600px|center]]
[[file:ProB_While_INV_Violation.png|200px|center]]

Revision as of 15:33, 25 July 2011


We assume that you have grasped the way that ProB setups up the initial states of a B machine as outlined in Tutorial Setup Phases, and have understood why animation is difficult as outlined in Tutorial Understanding the Complexity of B Animation.

A simple example

Let us use the following B machine as starting point:

MACHINE WhileLoopInvariantError
VARIABLES xx
INVARIANT
 xx:NATURAL
INITIALISATION xx:=1
OPERATIONS
  Set(c) = PRE c:1..10 & xx<=c THEN
    WHILE xx < c DO xx := xx+1
    INVARIANT
      xx <= c & xx:NATURAL &
      xx<10 /* this is wrong */
    VARIANT c-xx
    END
  END;
  r <-- Get = BEGIN r:= xx END
END

After loading and initialising the machine you see that ProB has found a so-called "transition error", i.e., an error that occured while computing enabled operations (which correspond to a transition from one state to the B machine to another). These errors are displayed in red in the State Properties pane:


ProB WhileAfterLoad.png

When you click on the red transition error you get presented with more details about the error:

ProB WhileAfterErrClick.png

Sometimes you can also have the possibility to click on a "Visualise" button, which in this case will give you a graphical visualisation of the invariant violation:

ProB While INV Violation.png