I specified the Die Hard problem in Runway. The problem, if you're unaware, is to get 4 gallons of water given only 5 gallon and 3 gallon jugs. It was famously featured in Die Hard 3 (
scene) and is a good introductory specification problem. You set up the rules of the system then assert as an invariant that you'll never have 4 gallons of water; when this fails, the model checker spits out the steps to solve the problem.
My spec (see source
here) apparently works just fine, but the model checker only spits out the last state transition rather than all of them:
C:\Users\ahelwer\Source\GitHub\runway-compiler>node --harmony .\bin\main.js chec
k ..\runway-tla-eval\DieHard.model
Was at {
"jugs": [
[
1,
{
"volume": 5,
"currentLevel": 5
}
],
[
2,
{
"volume": 3,
"currentLevel": 2
}
]
]
}
Applied transfer(2)
Reached {
"jugs": [
[
1,
{
"volume": 5,
"currentLevel": 4
}
],
[
2,
{
"volume": 3,
"currentLevel": 3
}
]
]
}
Failed Success
C:\Users\ahelwer\Source\GitHub\runway-compiler\lib\modelchecker.js:112
throw e;
^
ModelingAssertionError: Assertion failed: !=(jug.currentLevel, 4) at ..\runway-t
la-eval\DieHard.model: line 71, col NaN to line 71, col NaN
at Base (C:\Users\ahelwer\Source\GitHub\runway-compiler\lib\errors.js:15:10)
at Runtime (C:\Users\ahelwer\Source\GitHub\runway-compiler\lib\errors.js:57:
10)
at Assertion (C:\Users\ahelwer\Source\GitHub\runway-compiler\lib\errors.js:9
2:10)
at Assert.execute (C:\Users\ahelwer\Source\GitHub\runway-compiler\lib\statem
ents\assert.js:33:13)
at C:\Users\ahelwer\Source\GitHub\runway-compiler\lib\statements\sequence.js
:21:38
at Array.forEach (native)
at Sequence.execute (C:\Users\ahelwer\Source\GitHub\runway-compiler\lib\stat
ements\sequence.js:21:21)
at Block.execute (C:\Users\ahelwer\Source\GitHub\runway-compiler\lib\stateme
nts\block.js:28:16)
at C:\Users\ahelwer\Source\GitHub\runway-compiler\lib\statements\foreach.js:
63:21
at C:\Users\ahelwer\Source\GitHub\runway-compiler\lib\types\array.js:47:34
Is there a way to get the full state transition sequence? Thanks!