(*turn lights on and off, but at least every K seconds*)
EXTENDS Naturals
CONSTANTS
MAX_TIME, K
Time == 0 .. (MAX_TIME+1)
VARIABLE lights,clock, lightsTrigT
vars == <<lights, clock, lightsTrigT>>
isTyped == lights \in BOOLEAN /\ clock \in Time /\ lightsTrigT \in Time
Init == lights=TRUE /\ clock=0 /\ lightsTrigT=0
LNext == (IF lights THEN lights'=FALSE ELSE lights'=TRUE) /\ lightsTrigT' = clock
DoNothing == UNCHANGED <<lights,lightsTrigT>>
clockNext == clock' = clock+1
TBound(actionTriggerT, maxWait) == clock <= actionTriggerT + maxWait
Next == (LNext \/ DoNothing) /\ clockNext /\ TBound(lightsTrigT, K)
Spec == Init /\ [][Next]_vars
TimingOK == (clock <= lightsTrigT + K)
THEOREM Spec => [] TimingOK