Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Logic 未能对合金表达式进行类型检查_Logic_Modeling_Specifications_First Order Logic_Alloy - Fatal编程技术网

Logic 未能对合金表达式进行类型检查

Logic 未能对合金表达式进行类型检查,logic,modeling,specifications,first-order-logic,alloy,Logic,Modeling,Specifications,First Order Logic,Alloy,我是Alloy(规范语言)的初学者,需要在案例研究的基础上做一些进一步的工作,可以找到(代码在第5页)。相关代码: open util/ordering[Time] as T0 pred Eavesdropping() { some pro:Process | some m:Protected_Msg | some t: (Time - T0/last) - T0/prev[T0/last] | let t' = T0/t.next | let t'' = T0/t'

我是Alloy(规范语言)的初学者,需要在案例研究的基础上做一些进一步的工作,可以找到(代码在第5页)。相关代码:

open util/ordering[Time] as T0

pred Eavesdropping() {   
  some pro:Process | some m:Protected_Msg |  
  some t: (Time - T0/last) - T0/prev[T0/last] |   let t' = T0/t.next |
  let t'' = T0/t'.next |   !HasReadAccess[pro,m] && (m->t in pro.knows)
  &&   (m.contents->t not in pro.knows) &&   (m.contents->t'' in
  pro.knows) && IsUnique(m.contents) }

在更正了一些语法之后,我得到了这个错误消息:“这个表达式没有被类型检查”,它在
let t'=T0/t.next
中突出显示
t'
。如何打字检查
t'

这里的错误是next是别名
T0
引用的模块中的一个函数,因此let绑定的RHS上的表达式应该是
t.T0/next
,而不是
T0/t.next
。但实际上,无论如何,您都不需要
T0
,因为Alloy可以确定引用的是哪个模块。因此,只要删除对
T0
的所有引用,它就可以很好地编译

另一个注释:您可以删除所有这些连接符号,并使用隐式连接、书写

{ A B C }

这里的错误不是
A&&B&&C
,而是next是别名
T0
引用的模块中的函数,因此let绑定的RHS上的表达式应该是
t.T0/next
,而不是
T0/t.next
。但实际上,无论如何,您都不需要
T0
,因为Alloy可以确定引用的是哪个模块。因此,只要删除对
T0
的所有引用,它就可以很好地编译

另一个注释:您可以删除所有这些连接符号,并使用隐式连接、书写

{ A B C }
而不是
A&&B&&C