簡體   English   中英

合金分析儀不提供實例

[英]Alloy Analyzer not providing an instance

我正在嘗試用Alloy制作交通燈模型。 問題是我並不是很了解它。 我一直在閱讀分析儀發現的紅綠燈示例,但出於某種原因它並沒有給我任何實例。 這是示例代碼。

`module chapter4/lights ----- The model from page 127

abstract sig Color {}

one sig Red, Yellow, Green extends Color {}

sig Light {}
sig LightState {color: Light -> one Color}
sig Junction {lights: set Light}

fun redLights [s: LightState]: set Light { s.color.Red }
fun colorSequence: Color -> Color {
Color <: iden + Red->Green + Green->Yellow + Yellow->Red
}

pred mostlyRed [s: LightState, j: Junction] {
lone j.lights - redLights[s]
}

pred trans [s, s': LightState, j: Junction] {
lone x: j.lights | s.color[x] != s'.color[x]
all x: j.lights |
    let step = s.color[x] -> s'.color[x] {
        step in colorSequence
        step in Red->(Color-Red) => j.lights in redLights[s]
    }
}

assert Safe {
all s, s': LightState, j: Junction |
    mostlyRed [s, j] and trans [s, s', j] => mostlyRed [s', j]
}

check Safe for 3 but 1 Junction`

如果有人可以解釋一下,我會非常感激。

要查看實例,您需要包含運行命令。 這里唯一的命令是check命令,如果檢查的屬性為true,則不會找到反例。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM