428
2007-10-03 02:21:40 +0200
inconsistency: Expression of type (constraint) cannot be used as a guard
2008-09-12 13:46:53 +0200
1
1
1
Unclassified
UPPAAL
GUI
4.0.6
PC
Linux
RESOLVED
FIXED
P2
trivial
---
1
tbourke
adavid
marius
oldest_to_newest
1510
0
tbourke
2007-10-03 02:21:40 +0200
1) Declare two local variables:
clock c;
int b;
2) Add a self-loop transition to the initial state, with the guard:
b>3 || c<2
3) Run a syntax check: passes.
4) Change the guard to:
c<2 || b>3
5) Run a syntax check: fails with: Expression of type (constraint) cannot be used as a guard, even though the two guards are logically equivalent and syntactically similar.
1559
1
marius
2008-04-25 11:26:16 +0200
The code is quite scattered but formally the typechecker seems to implement the following rules:
invariant ::= integral | (clock "<" clock) | (clock ">" clock)
| (clock "<" integer) | (integer ">" clock)
| (difference "<" integer) | (integer "<" difference)
| (difference ">" integer) | (integer ">" difference)
| (invariant "&&" invariant) | (integral "||" invariant)
;
guard ::= invariant | (integer "<" clock) | (clock ">" integer)
| (guard "&&" guard) | (integral "||" guard)
;
constraint ::= guard | (clock "!=" clock) | (clock "!=" integer)
| (integer "!=" clock) | (difference "!=" clock)
| (difference "!=" clock) | "!" constraint | "forall" constraint
| "exists" constraint | (constraint "&&" constraint)
| (constraint "||" constraint)
;
Typechecker will try to interpret the expression in simplest possible way (i.e. expression will be invariant if it matches invariant rule, and expression will get promoted to guard only if it cannot match invariant anymore and so on).
Eventually some expressions might end up as constraints in general, which means that they are unsupported, they are easily recognized (type CONSTRAINT) and raise "cannot be used as" errors.
As you can see from the rules, the reported problem persists also for invariants.
Having said that, the following additional rules enable typechecker to accept the above expressions:
invariant ::= | (invariant "||" integral)
guard ::= | (guard "||" integral)
This fix has been applied in rev. 3546.
Behold the rest of the code :-)
1563
2
tbourke
2008-04-28 03:15:34 +0200
Thanks Marius. I also appreciate your inclusion of the rules.