当前正在学习TLA +,并被困在这种简单的方法上,该方法可以将人员从寄存器中删除。从我所看到的来看,问题似乎与许可状态有关。
我的TLA +函数如下所示,并将一个人与权限一起从寄存器中删除。
DeRegister(p) ==
/\ p \in register
/\ register' = register \ {p}
/\ permission' = [x \in DOMAIN permission \ {p} |-> permission[x]]
/\ UNCHANGED <<location>>
我要检查的Typeok具有以下约束
TypeOk
/\ register \subseteq PERSON
/\ permission \in [register -> SUBSET BUILDING]
/\ location \in [register -> (BUILDING \union {OUTSIDE})]
我收到一个违反typeOK的模型错误。在堆栈跟踪中,错误看起来像这样
/\ location = [p1 |-> OUTSIDE]
/\ permission = << >>
/\ register = {}
感谢您的见识
编辑:
以前的状态可能有一定用途
/\ location = [p2 |-> OUTSIDE]
/\ permission = [p2 |-> {}]
/\ register = {"p2"}
答案 0 :(得分:2)
location \in [register -> SUBSET BUILDING]
意思是DOMAIN location = register
。不过,在DeRegister
之后,您有DOMAIN location = {"pq"} /\ register = {}
,这违反了您的不变式。