UniTO/anno3/vpc/consegne/3/3.8.smv

49 lines
1.4 KiB
Text
Raw Normal View History

2020-05-08 19:23:51 +02:00
MODULE main
VAR
wantP: boolean;
wantQ: boolean;
p: proc(wantP, wantQ);
q: proc(wantQ, wantP);
ASSIGN
init(wantP) := FALSE;
init(wantQ) := FALSE;
next(wantP) := case
p.state = setTrue: TRUE;
p.state = setFalse: FALSE;
TRUE: wantP;
esac;
next(wantQ) := case
q.state = setTrue: TRUE;
q.state = setFalse: FALSE;
TRUE: wantQ;
esac;
CTLSPEC -- no mutual exclusion
AG (p.state != critical | q.state != critical)
CTLSPEC -- no deadlock
AG ((p.state = await | q.state = await) -> AF (p.state = critical | q.state = critical))
CTLSPEC -- no individual starvation
AG (p.state = await -> AF p.state = critical)
CTLSPEC
AG (q.state = await -> AF q.state = critical)
CTLSPEC -- prova: path senza starvation
AG (q.state = await -> EF q.state = critical)
MODULE proc(mine, other)
VAR
state: {local, await, critical, setTrue, setFalse};
ASSIGN
init(state) := local;
next(state) := case
state = local: {local, setTrue};
state = await & other = FALSE: critical;
state = await: await;
state = setTrue: await;
state = critical: setFalse;
state = setFalse: local;
esac;