我正在尝试检查以下模型中的 verifyingUndefinedFields 断言:
module Tests
open law6_withStaticSemantic
assert verifyingUndefinedFields {
some fa:FieldAccess | fa.pExp in newCreator && fa.id_fieldInvoked !in fa.pExp.((id_cf.(*extend)).fields)
}
check verifyingUndefinedFields
所呈现的模型又使用了另一个模型:law6_withStaticSemantic。下面是这个模型的一个非常简化的版本:
module TestWithStaticSemantic
open javametamodel_withStaticSemantic
sig Left,Right extends Class{}
one sig ARight, BRight, CRight extends Right{}
one sig ALeft, BLeft, CLeft extends Left{}
pred law6RightToLeft[] {
twoClassesDeclarationInHierarchy[]
mirroringOfTwoClassesDeclarationsExceptForTheFieldMoved[]
law6[]
}
pred twoClassesDeclarationInHierarchy[] {...}
pred mirroringOfTwoClassesDeclarationsExceptForTheFieldMoved[] {...}
...
run law6RightToLeft for 10 but 10 Id, exactly 2 FieldAccess, exactly 11 Type, 4 Method, exactly 1 Field, 4 SequentialComposition, 8 Expression, 4 Block, exactly 1 LiteralValue
第二个模型(law6_withStaticSemantic)根据定义的谓词生成实例。但是,当我在第一个模型中运行断言时,生成的反例不遵循第二个模型的谓词中定义的条件。考虑到先前模型的谓词,我如何构建/运行将检查反例的断言?
之前在以下问题中更详细地解释了这些模型: