0
byte x;

if
::(x == 0) -> ...
::(x > 0) -> ...
fi

Is there a default value of a global variable? Or the model checker checks for all possible interleavings, that is, in this case, use all possible states with both (x==0) and (x>0).

MetallicPriest
  • 29,191
  • 52
  • 200
  • 356

2 Answers2

1

According to Promela doc variables are initialized to zero by default.

Checking for all possible initial values of variables would increase the state space exponentially.

Erbureth
  • 3,378
  • 22
  • 39
  • But how can I make the model checker to check for all possible states, that is, in this case for both (x==0) and (x>0)? – MetallicPriest Jan 14 '14 at 11:58
  • Can you elaborate how? – MetallicPriest Jan 14 '14 at 11:59
  • SPIN is (IIRC) `explicit-state` model checker (maybe they added some symbolic verification, but I am not sure as it would be recent), so the models are executed as they are defined. You are probably looking for some parametrization and verifying those two options in two different launches of the model checker. – Erbureth Jan 14 '14 at 12:01
  • 1
    Read this, http://spinroot.com/spin/Man/rand.html. According to that, If the variable is declared inside a process, all its values are tested by the model checker in verification mode. Precisely, what I am looking for. – MetallicPriest Jan 14 '14 at 12:10
0

Do it like this;

if
:: x = 0
:: x = 1
:: x = 2
// if you need more, add more
fi

or if you really want all values, 0 to 255

byte x = 0;

do
:: x <= 254 -> x++
:: break
od

which will break or increment on each iteration, thus generating all possible values. Or, as you (and I) now know, use:

select (i : 0 .. 255)
GoZoner
  • 67,920
  • 20
  • 95
  • 145