简体   繁体   English

合金规格类型错误

[英]Type Error in Alloy specification

In the Requirements Engineering (2007) article, "Requirement Progression In Problem Frames", there is a worked example on a traffic lights problem that I have transcribed into the Alloy editor. 在需求工程(2007)文章“问题框架中的需求进展”中,有一个关于交通信号灯问题的有效示例,我已将其转录到Alloy编辑器中。 Unfortunately, I get the following error when testing the code. 不幸的是,在测试代码时出现以下错误。

Starting the solver... 启动求解器...

A type error has occurred: This must be a set or relation. 发生类型错误:这必须是集合或关系。 Instead, it has the following possible type(s): {PrimitiveBoolean} 而是,它具有以下可能的类型:{PrimitiveBoolean}

The error is triggered by the following predicate: 该错误由以下谓词触发:

pred LightUnitBreadcrumb [] {
    all t: Time | 
        NGObserve [t] <=> 
            odd [NGPulse [t]] and
        SGObserve [t] <=> 
            odd [SGPulse [t]] }

referencing the NGPulse predicate below: 引用下面的NGPulse谓词:

sig NGP, SGP, NRP, SRP in Time {}
pred NGPulse [t: Time] {t in NGP}
pred SGPulse [t: Time] {t in SGP}
pred NRPulse [t: Time] {t in NRP}
pred SRPulse [t: Time] {t in SRP}

My guess is that a set-valued expression is expected between the square brackets of odd instead of calls to the NGPulse or SGPulse predicates. 我的猜测是,期望在odd的方括号之间设置值表达式,而不是调用NGPulseSGPulse谓词。 Indeed, predicates are boolean-valued and not set/relation valued expressions, hence the error. 实际上,谓词是布尔值的,而不是设置/关系值的表达式,因此是错误的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM