我目前正在进行LTL(线性时间时间逻辑)和CTL(计算树逻辑)的理论研究。我是NuSMV的新手,我很难创建一个简单的Kripke结构。
我的结构是M =(S,R,L)其中S = {s0,s1,s2}是可能状态的集合,R是过渡关系,使得:s0 - > s1,s0 - > s2,s1 - > s0,s1 - > s2和s2 - > s2和L是由下式定义的每个状态的标记函数:L(s0)= {p,q},L(s1)= {q,r},并且L(s2)= {r}。我正在使用Huth和Ryan在Logic in Computer Science教科书中描述的符号。我尝试了以下两个代码:
第一个代码:
MODULE main
VAR
p : boolean;
q : boolean;
r : boolean;
state : {s0, s1, s2};
ASSIGN
init(state) := s0;
next(state) :=
case
state = s0 : {s1, s2};
state = s1 : {s2};
state = s2 : {s2};
esac;
init(p) := TRUE;
init(q) := TRUE;
init(r) := FALSE;
next(p) :=
case
state = s1 | state = s2 : FALSE;
esac;
next(q) :=
case
state = s1 : TRUE;
state = s2 : FALSE;
esac;
next(r) :=
case
state = s1 : FALSE;
state = s2 : TRUE;
esac;
SPEC
p & q
第二个代码:
MODULE main
VAR
p : boolean;
q : boolean;
r : boolean;
state : {s0, s1, s2};
ASSIGN
init(state) := s0;
next(state) :=
case
state = s0 : {s1, s2};
state = s1 : {s2};
state = s2 : {s2};
esac;
init(p) := TRUE;
init(q) := TRUE;
init(r) := FALSE;
next(p) := !p;
next(q) :=
case
state = s0 & next(state) = s1 : q;
state = s0 & next(state) = s2 : !q;
state = s1 & next(state) = s0 : q;
state = s1 & next(state) = s2 : !q;
esac;
next(r) :=
case
state = s0 & next(state) = s1 : r;
state = s0 & next(state) = s2 : r;
state = s1 & next(state) = s0 : !r;
state = s1 & next(state) = s2 : r;
esac;
LTLSPEC
p & q
出了点问题,我得到了这样的信息:“案件条件并非详尽无遗”。这是什么意思?我如何解决我的问题?
答案 0 :(得分:3)
因为您必须为每个案例输入其“默认”。 第一个代码:
MODULE main
VAR
p : boolean;
q : boolean;
r : boolean;
state : {s0, s1, s2};
ASSIGN
init(state) := s0;
next(state) :=
case
state = s0 : {s1, s2};
state = s1 : {s2};
state = s2 : {s2};
TRUE : state;
esac;
init(p) := TRUE;
init(q) := TRUE;
init(r) := FALSE;
next(p) :=
case
state = s1 | state = s2 : FALSE;
esac;
next(q) :=
case
state = s1 : TRUE;
state = s2 : FALSE;
TRUE : q;
esac;
next(r) :=
case
state = s1 : FALSE;
state = s2 : TRUE;
TRUE : r;
esac;
SPEC
p & q
和第二个代码:
MODULE main
VAR
p : boolean;
q : boolean;
r : boolean;
state : {s0, s1, s2};
ASSIGN
init(state) := s0;
next(state) :=
case
state = s0 : {s1, s2};
state = s1 : {s2};
state = s2 : {s2};
TRUE : state;
esac;
init(p) := TRUE;
init(q) := TRUE;
init(r) := FALSE;
next(p) := !p;
next(q) :=
case
state = s0 & next(state) = s1 : q;
state = s0 & next(state) = s2 : !q;
state = s1 & next(state) = s0 : q;
state = s1 & next(state) = s2 : !q;
TRUE : q;
esac;
next(r) :=
case
state = s0 & next(state) = s1 : r;
state = s0 & next(state) = s2 : r;
state = s1 & next(state) = s0 : !r;
state = s1 & next(state) = s2 : r;
TRUE : r;
esac;
LTLSPEC
p & q