Make :exec/:init/:constants automatically move in trace as needed
%% Cell type:code id: tags: | ||
``` prob | ||
:help :browse | ||
``` | ||
%%%% Output: execute_result | ||
``` | ||
:browse | ||
``` | ||
Show information about the current state. | ||
The output shows the names of all sets, constants, and variables defined by the current machine, as well as a list of enabled operations (and possible parameter values) in the current state. | ||
:browse | ||
Show information about the current state. | ||
The output shows the names of all sets, constants, and variables defined by the current machine, as well as a list of enabled operations (and possible parameter values) in the current state. | ||
%% Cell type:code id: tags: | ||
``` prob | ||
:help :exec | ||
``` | ||
%%%% Output: execute_result | ||
``` | ||
:exec OPERATION [PREDICATE] | ||
``` | ||
Execute an operation. | ||
The predicate is used to select the operation's parameter values. The parameters can be fully specified explicitly (e. g. `:exec op param1 = 123 & param2 = {1, 2}`), or they can be partially constrained (e. g. `:exec op param1 > 100 & card(param2) >= 2`) to let ProB find a valid combination of parameters. If there are multiple valid combinations of parameters that satisfy the predicate, it is undefined which one is selected by ProB. | ||
If no predicate is specified, the parameters are not constrained, and ProB will select an arbitrary valid combination of parameters. | ||
:exec OPERATION [PREDICATE] | ||
Execute an operation. | ||
The predicate is used to select the operation's parameter values. The parameters can be fully specified explicitly (e. g. `:exec op param1 = 123 & param2 = {1, 2}`), or they can be partially constrained (e. g. `:exec op param1 > 100 & card(param2) >= 2`) to let ProB find a valid combination of parameters. If there are multiple valid combinations of parameters that satisfy the predicate, it is undefined which one is selected by ProB. | ||
If no predicate is specified, the parameters are not constrained, and ProB will select an arbitrary valid combination of parameters. | ||
%% Cell type:code id: tags: | ||
``` prob | ||
:help :constants | ||
``` | ||
%%%% Output: execute_result | ||
``` | ||
:constants [PREDICATE] | ||
``` | ||
Set up the current machine's constants. | ||
This is a shorthand for `:exec SETUP_CONSTANTS [PREDICATE]`. | ||
:constants [PREDICATE] | ||
Set up the current machine's constants. | ||
This is a shorthand for `:exec SETUP_CONSTANTS [PREDICATE]`. | ||
%% Cell type:code id: tags: | ||
``` prob | ||
:help :init | ||
``` | ||
%%%% Output: execute_result | ||
``` | ||
:init [PREDICATE] | ||
``` | ||
Initialise the current machine with the specified predicate | ||
This is a shorthand for `:exec INITIALISATION [PREDICATE]`. | ||
:init [PREDICATE] | ||
Initialise the current machine with the specified predicate | ||
This is a shorthand for `:exec INITIALISATION [PREDICATE]`. | ||
%% Cell type:code id: tags: | ||
``` prob | ||
:browse | ||
``` | ||
%%%% Output: execute_result | ||
Machine: repl | ||
Sets: (none) | ||
Constants: (none) | ||
Variables: (none) | ||
Operations: | ||
INITIALISATION() | ||
%% Cell type:code id: tags: | ||
``` prob | ||
::load | ||
MACHINE Counter | ||
CONSTANTS min_value, max_value | ||
PROPERTIES min_value : MININT..0 & max_value : 0..MAXINT & min_value <= max_value | ||
VARIABLES value | ||
INVARIANT value : min_value..max_value | ||
INITIALISATION value :: min_value..max_value | ||
OPERATIONS | ||
add(diff) = SELECT | ||
value+diff : min_value..max_value | ||
THEN | ||
value := value+diff | ||
END | ||
END | ||
``` | ||
%%%% Output: execute_result | ||
Loaded machine: Counter | ||
%% Cell type:code id: tags: | ||
``` prob | ||
:browse | ||
``` | ||
%%%% Output: execute_result | ||
Machine: Counter | ||
Sets: (none) | ||
Constants: min_value, max_value | ||
Variables: value | ||
Operations: | ||
SETUP_CONSTANTS() | ||
SETUP_CONSTANTS() | ||
SETUP_CONSTANTS() | ||
SETUP_CONSTANTS() | ||
More operations may be available (MAX_OPERATIONS/MAX_INITIALISATIONS reached) | ||
%% Cell type:code id: tags: | ||
``` prob | ||
min_value..max_value | ||
``` | ||
%%%% Output: error | ||
:eval: NOT-INITIALISED | ||
%% Cell type:code id: tags: | ||
``` prob | ||
value | ||
``` | ||
%%%% Output: error | ||
:eval: NOT-INITIALISED | ||
%% Cell type:code id: tags: | ||
``` prob | ||
:constants min_value=5 & max_value=-5 | ||
``` | ||
%%%% Output: error | ||
java.lang.IllegalArgumentException: Executing operation $setup_constants with predicate min_value=5 & max_value=-5 produced errors: Could not execute operation SETUP_CONSTANTS in state root with additional predicate | ||
%% Cell type:code id: tags: | ||
``` prob | ||
:constants min_value=-1 & max_value=2 | ||
``` | ||
%%%% Output: execute_result | ||
Executed operation: SETUP_CONSTANTS() | ||
%% Cell type:code id: tags: | ||
``` prob | ||
:browse | ||
``` | ||
%%%% Output: execute_result | ||
Machine: Counter | ||
Sets: (none) | ||
Constants: min_value, max_value | ||
Variables: value | ||
Operations: | ||
INITIALISATION() | ||
INITIALISATION() | ||
INITIALISATION() | ||
INITIALISATION() | ||
More operations may be available (MAX_OPERATIONS/MAX_INITIALISATIONS reached) | ||
%% Cell type:code id: tags: | ||
``` prob | ||
min_value..max_value | ||
``` | ||
%%%% Output: execute_result | ||
$\{-1,0,1,2\}$ | ||
{−1,0,1,2} | ||
%% Cell type:code id: tags: | ||
``` prob | ||
value | ||
``` | ||
%%%% Output: error | ||
:eval: NOT-INITIALISED | ||
%% Cell type:code id: tags: | ||
``` prob | ||
:init value=-100 | ||
``` | ||
%%%% Output: error | ||
Error from ProB: ProB reported Errors | ||
Error: INITIALISATION FAILS (/Users/Shared/Uni/SHK/ProB2/prob2-jupyter-kernel/notebooks/tests/(machine from Jupyter cell).mch:6:15 to 6:44) | ||
// Source code not known | ||
%% Cell type:code id: tags: | ||
``` prob | ||
:init value=2 | ||
``` | ||
%%%% Output: execute_result | ||
Executed operation: INITIALISATION() | ||
%% Cell type:code id: tags: | ||
``` prob | ||
:browse | ||
``` | ||
%%%% Output: execute_result | ||
Machine: Counter | ||
Sets: (none) | ||
Constants: min_value, max_value | ||
Variables: value | ||
Operations: | ||
add(-3) | ||
add(-2) | ||
add(-1) | ||
add(0) | ||
%% Cell type:code id: tags: | ||
``` prob | ||
value | ||
``` | ||
%%%% Output: execute_result | ||
$2$ | ||
2 | ||
%% Cell type:code id: tags: | ||
``` prob | ||
:exec add diff=-1 | ||
``` | ||
%%%% Output: execute_result | ||
Executed operation: add(-1) | ||
%% Cell type:code id: tags: | ||
``` prob | ||
:browse | ||
``` | ||
%%%% Output: execute_result | ||
Machine: Counter | ||
Sets: (none) | ||
Constants: min_value, max_value | ||
Variables: value | ||
Operations: | ||
add(-2) | ||
add(-1) | ||
add(0) | ||
add(1) | ||
%% Cell type:code id: tags: | ||
``` prob | ||
value | ||
``` | ||
%%%% Output: execute_result | ||