[英]Simple State Machine in Alloy
i'm new to alloy and its function as well. 我是合金及其功能的新手。 Recently, i have an assignment about a simple state machine : begin_state->normal_state->end_state.
最近,我有一个关于简单状态机的作业:begin_state-> normal_state-> end_state。 There is only one begin_state, but some normal_state and some end_state.
只有一个begin_state,但有一个normal_state和一些end_state。 Then I can't make the instance view go right with these below alloy code:
然后我无法使实例视图与以下合金代码一起正确运行:
abstract sig state
{
prev : some state,
next : some state
}
one sig begin extends state{}
some sig end extends state{}
sig mid extends state{}
//There is no state after end state, and there is no state before begin state
pred dosomething
{
no s : state | s in begin.prev and s in end.next
}
run{dosomething}
So basically i just want no state before begin state, no state after the end state and the instance examples can something like this : 所以基本上我只希望开始状态之前没有状态,结束状态之后没有状态,实例示例可以是这样的:
begin->normal->end 开始->正常->结束
or 要么
begin-> normal ->end 开始->正常->结束
| |
normal->normal->end 正常->正常->结束
| |
normal---normal 正常-正常
| | |
|
end <-------- 结束<--------
... something like that. ...类似的东西。 Thank you
谢谢
Consider the following propositions: 考虑以下命题:
If (as I hope) you believe that these three propositions contradict each other, then ask yourself (a) do these propositions resemble the rules given in your Alloy model? 如果(我希望)您认为这三个命题相互矛盾,那么请问自己(a)这些命题是否类似于您的Alloy模型中给出的规则? (b) how might you rephrase them to make sense and not contradict each other?
(b)您如何将它们重新表述为有意义,而不互相矛盾? (c) how might your rephrasing of them be translated into Alloy?
(c)您如何将其改写为Alloy?
I hope this helps. 我希望这有帮助。
Watch your quantifiers! 注意量词! The formula
公式
no s : state | s in begin.prev and s in end.next
says there is no state s that is BOTH a predecessor of begin AND a successor of end. 说没有国家既是begin的前任,又是end的后继。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.