A forum for Spin users
You are not logged in.
Q1.
In the SPIN book page-182 line-13 reads "Not surprisingly, therefore SPIN only includes support for weak fairness, and not for strong fairness". I hope this statement does not hold good any more and the current version of the SPIN does support strong fairness, right? If the option "-f" to pan is passed, model is verified for weak-fairness and if it is not passed, then the model is verified for strong-fairness, I suppose.
Q2.
***************************
byte x = 2;
active proctype A()
{
do
:: x = 3 - x;
progress: skip;
od
}
active proctype B()
{
do
:: x = 3 - x;
//progress: skip;
od
}
***************************
In the above model, I am observing the following results for strong fairness and weak fairness for different permutations of enabling the progress label.
(1) no progress label : strong fairness : failure
(2) no progress label : weak fairness : failure
(3) progress label in only A : strong fairness : failure
(4) progress label in only A : weak fairness : success
(5) progress label in both : strong fairness : success
(6) progress label in both : weak fairness : success
I understand the result for (1), (2), (5) and (6). I do not understand why (4) is "success", when (3) is "failure". For the case (4), I added proctype (C) with the same body and without the progress label defined and SPIN reports still success. Could you please explain?
I see your point. However, sometimes, it defaults to "acceptance cycles", even if I did not have any progress label defined. Not sure whether it happens, if I have "ltl formulae" in the model. It is a bit confusing and I cannot catch the exact pattern. One can argue this way "iSpin can default to any settings when a model is opened first. However, if one switches to other tab to modify/reopen the model and switches back to verification tab, he would normally expect the same verification options to stay, since it is more likely he is modifying the model to fix the errors thrown earlier". On the other hand, one can certainly live with it with a mind-set to check all the verification configuration options before hitting "Run" after modifying the model every time.
After opening a model, if I switch to "verification" tab, "non-progress cycles" is selected by default. I think that is ok. However, if I choose "safety" and verify and then go to "Edit/View" tab and come back to "verification" tab, I see that "non-progress cycles" is selected again by default. I would expect whatever verification options I chose before (in this case, "safety") to be sticky. And, it is my expectation and I would not complain if the current behavior is by design though.
Steps to reproduce this issue:
1. Open a model in iSpin
2. In "Verification" tab, choose "non-progress cycles" and click "enforce weak fairness constraint"
3. Hit "Run"
4. Choose "safety"
5. Hit "Run"
You get the following error :
**************************
./pan -m10000 -f
Pid: 5719
saw option -f
Spin Version 6.1.0 -- 2 May 2011
-a,-l,-f -> are disabled by -DSAFETY
**************************
It looks like "enforce weak fairness constraint" is a "liveness" related option and iSpin should not pass "-f" to pan when "safety" is chosen for verification.
> progress labels inside atomics are invisible -- hence you get non-progress cycle errors: the verifier does not see the label
I understand. It would be nice, if "syntax check" throws a warning or error. It did not in this case and that is confusing.
*****************
#define MAX_SEM_VAL 2
int sem = MAX_SEM_VAL;
active [MAX_SEM_VAL+1] proctype P()
{
end:
do
:: acq_sem(sem);
//progress:
rel_sem(sem);
od;
}
*****************
It would be nice, if SPIN allows constant expression that evaluates to an integer for the number of processes in proctype as above as a syntactic sugar. This would just make the model more expressive that the author thinks "maximum of counting semaphore + 1" number of processes is sufficient to verify the model. It is a different issue whether the author's thinking is correct or not, though it looks like it is true in this case to verify a counting semaphore model.
Question below the model excerpt:
**********************************
inline acq_sem(sem)
{
atomic {
sem > 0 ->
progress:
sem--;
}
}
inline rel_sem(sem)
{
sem++;
}
#define MAX_SEM_VAL 2
int sem = MAX_SEM_VAL;
active [3] proctype P()
{
end:
do
:: acq_sem(sem);
//progress:
rel_sem(sem);
od;
}
***************************
Using the progress label inside atomic in acq_sem function did not throw any warnings as it used to in my original post with busy wait cycles. However, non-progress cycle verification (with weakness enabled or disabled) throws "non-progress cycle errors. However, deleting the "progress" label inside atomic and adding it in proctype P (as shown in the commented line above) verifies without errors. I guess both should succeed. If the first one fails, then "syntax check" should probably error out. Am I missing something?
> re Q1, Q2 and Q4: the correct way to model the counting semaphore in Promela is (and not needing labels): atomic { sem > 0 -> sem-- }
I did this correctly when I tried mutex: atomic { lock == 0 -> lock = 1}. Apparently, did not follow the idiomatic way (using blocking expression) when I wrote counting semaphore. Thanks for catching this.
Output of verification for safety with your suggestion:
depth reached 6
7 states, stored
12 states, matched
Output of verification for safety with my original implementation ("acq_sem") with the busy wait in "do...od"
depth reached 9999
7 states, stored
15 states, matched
29988 atomic steps
Also, when I kept increasing the depth limit to 100000, I still kept getting the error from pan ("error: max search depth too small"). However, I did not get any error "'Search not completed' or 'Search Truncated'. I hope the pan error about "search depth too small" can be ignored. I understand this is inefficient and I should not be writing models with the busy-wait cycles like this but I wanted to make sure this is not an incorrect model with respect to verification results.
It looks like "Edit/View" window that shows the model uses 8 spaces for tabs. I use tabs for indenting my PROMELA models. Though I use a different editor to edit the model, I tend to view the model in iSpin as I can click on file-name/line-number in the simulation output of error trails. It would be nice, if I can configure the tab size to 2 spaces so that the model will fit nicer within the window. If not through GUI dialog, a shell env variable or a command-line argument for iSpin would be very acceptable.
PS: Why is "Edit/View" window not using a mono-space font to show code? Is it an error or intentional to fit within space?
ah, sweet. I did not pay attention to those little squares. I was dragging anywhere arbitrarily on the lines. Thanks very much. I am glad I asked ![]()
When inline functions are used, the error trail information refers to the line number inside the function but it does not report the line number of the call-site (calling function or proctype body). When macros are used, it reports the line number of the call-site. I prefer to use inline functions to macros in the models (like I do very much in C/C++). I hate to implement everything in proctype body without inline functions as it lacks clarity in reading the model (especially, when the model gets bigger). So, now, for quickly interpreting and debugging my model, I implement all the abstracted functions using both inline and macros and use a conditional directive (like "#define USE_INLINE 1") and turn it on and off to interpret the error trail information in both cases to debug my model. While this is not extremely tedious, it is quite a bit of work. It would be nice, if SPIN error-trail information shows the call-stack of functions (from proctype body to function A to function B). A depth of 3 or 4 might be more than sufficient, I think. Actually as inline functions are expanded directly and don't have their own scope, even showing call-stack with a depth of 2 might be sufficient for most use-cases, IMHO.
Individual window panes cannot be resized. For example, in the "Simulate/Replay", it would be nice, if I could resize the variable and simulation output window panes horizontally or vertically.
When we use multiple monitors these days, it would be nice, if the window panes can be detached (undocked) so that an undocked simulation window can be moved to a different monitor.
Here is the portion of a simplified model to illustrate a few questions. This models acquire_semaphore and release_semaphore functions.
********************************************
inline acq_sem1(sem)
{
L0:
atomic {
if
:: sem == 0 -> goto L0
:: else -> sem--
fi
}
}
inline acq_sem(sem) // Using do to fix the errors with above inline function
{
atomic {
do
:: sem == 0;
:: else ->
//progress: // warning, progress label inside atomic is invisible
sem--; break;
od;
}
}
inline rel_sem(sem)
{
sem++;
}
#define MAX_SEM_VAL 2
int sem = MAX_SEM_VAL;
active [3] proctype P()
{
end:
do
:: acq_sem1(sem);
progress:
rel_sem(sem);
od;
}
active proctype Check()
{
end:
do
:: skip;// This is needed to use the progress label
progress:
assert(sem >=0 && sem <= MAX_SEM_VAL);
od
}
********************************************
Q-1:
In acq_sem1, no matter where I place the label L0, I always get the error "label L0 placed incorrectly. Instead of ....., always use ....". My understanding is that I need "atomic", otherwise my assertion would fail, even if I get this to compile. It looks like SPIN has stringent restrictions on using labels and expansion of inline function inside proctype P ends up violating all limitations on where I can place the label, am I right? Or, is there a way to fix the placing of labels to get this to work?
Q-2:
So, I came up with acq_sem() function where I replaced "if" with "do...od" inside "atomic" and that seems to work. Is that the only work-around/solution for problem explained in Q-1?
Q-3:
When I verify this mode for "safety", I get the error "unreached in proctype" for both processes "P" and "Check" and this seems to be a bug, since I do have the "end" labels in both processes "P" and "Check". I got the same error when I did not have the "end" label and that was ok.
Q-4:
As you see in "acq_sem" function, I get a warning for using "progress" label inside "atomic". I am curious whether it is a deficiency that can be fixed or it is a hard-to-solve/unsolvable problem in verification when "atomic" has "progress" label. I moved the "progress" label to process "P" after calling "acq_sem". Hope that is the right way to fix it.
Q-5:
Can I use ltl formulae instead of "proctype Check" to achieve the same? I see that ltl formulae can be used inline. But, I do not find documentation "how" or examples. I have the "SPIN Model Checker" book. But, I think this is a new feature. Could you please point me to some documentation and examples of using inline ltl in SPIN models? Are there any limitations doing that as opposed to using never claims separately? Also, some documentation and examples on how to use "claim name" and "use claim" in iSpin. I have used sometime back using xSpin but iSpin seems to be different and cannot find how to use this feature correctly.
Q-6:
Is there a way to attach model files (.pml) to forum post? That would help simplify explanation and I can use line-numbers,etc to refer to in the post.
Thanks a lot in advance for any help.
thanks. [Edit to previous post] copy to clipboard using "Ctrl+C" does work from all output windows.
In several window panes (syntax check, verification, simulation), it would be nice to give shortcut keys or buttons to select all the text and delete or to clear the entire window pane. Now, I need to select and scroll the entire window pane and delete. Ctrl+A does not select all text. It has been a while since I used xSpin, but I remember I was able to do these in xSpin.
> spinroot wrote:
> I found the problem, and was able to fix it.
ispin 1.0.6 fixes it. Thanks. The web-page http://spinroot.com/spin/Src/ lists the version of iSpin as 3.0.6 as opposed to 1.0.6. Though launching iSpin lists the correct version.
hmm.. No, the behavior I see is different. When it works, I can scroll up and down with the right scroll bar and release it and the text stays (which is what I expected as opposed to jumping back to the end as you see). When it does not work, I cannot scroll up at all. Even while holding the mouse button and scrolling up (not releasing at all), it does not scroll up at all.
Here are the steps to reproduce:
1. Open a simple PROMELA model with 2 processes or more with no errors and no "LTL formula/never/accept" .
2. Syntax check. OK
3. Goto verification tab
4. Select "safety" and hit "Run". Try scrolling up and down. It works.
5. Choose "non-progress cycles" and hit "Run". Try scrolling up and down. It works.
6. Choose "acceptance cycles" and hit "Run". SPIN throws error that "error: no accept labels defined in model (for option -a).. Valid options are....". Try scrolling up and down. It does NOT work and I see the error behavior.
7. Choose "non-progress cycles" and hit "Run". Try scrolling up and down. It works again. This is the work-around. I can scroll up now and see the error message for "Step-6".
It looks like when "pan" throws the error on "accept" and list the long list of "Valid options are : ", only then I see the error. Even though in step-5 (and 7), I get an error for which pan created an error trails file, the scrolling problem did not happen.
I use Ubuntu 11.04 (natty), Spin 6.1.0 and iSpin 1.0.5. If you would like more information or the versions of any other packages I have installed, please let me know.
Got it. Thanks for the quick response. The scroll-bar not moving up (as described above in my post) is a bug. Do you want me to report it as a "bug report" in this forum or the above post is just good enough?
When I try to verify a model for "acceptance cycles" without any accept label in the model, I would expect it to get an error (error: no accept labels defined in model (for option -a)). However, the scroll-bar on the right does not allow me to scroll up to actually see the error. I ran into other GUI related issues with LTL formula, etc (don't remember exactly now) with iSpin. Is xSpin strictly not supported (not expected to work) with the latest SPIN or is it just discouraged?