[英]How to interpret an Alloy fact
我正在閱讀一篇文章,該文章使用Alloy來模擬飛機航空電子設備的一些安全和安全要求 。 我正在努力理解文章中顯示的“事實限制”之一。
數據流入系統。 數據由系統使用。 該模型聲明了一組Data,一組System和一個consumeBy關系(System使用Data):
sig Data {
consumedBy: some System
}
sig System {}
然后,該模型聲明了一組“臨界值”。 關系將關鍵性映射到數據。 另一個關系將關鍵性映射到系統:
sig Criticality {
concernedData: one Data,
concernedSystem: one System
}
接下來,該模型表達了兩個事實。 這是我正在努力的第二個事實。
第一個事實說每個系統至少消耗一個數據:
all s: System | some consumedBy.s
文章對第二個事實有這樣的評論:
// for any system which consumes a given datum,
// the said datum and system should belong to
// a same unique criticality
我認為評論是這樣說的:如果系統消耗了一個數據,那么數據和系統必須具有相同的關鍵性。 例如,如果數據D1由系統S1消耗,而數據D1具有臨界值C1,則系統S1也必須具有臨界值C1。 你同意對評論的解釋嗎?
現在,這是合金中表達的事實:
all d: Data | all s: System | one c: Criticality |
c.concernedData = d and c.concernedSystem = s
我對如何閱讀這個事實的理解是這樣的:
The following constraint holds for exactly one c in Criticality:
For every d in Data and every s in System:
c.concernedData = d and c.concernedSystem = s
這是對這個事實的正確理解嗎? 如果是這樣,我認為事實並不像評論中的描述那樣表達。
所以我的問題是:
一:評論說:
// for any system which consumes a given datum,
// the said datum and system should belong to
// a same unique criticality
以下Alloy事實是否表達與評論相同的內容?
all d: Data | all s: System | one c: Criticality |
c.concernedData = d and c.concernedSystem = s
二:如果評論和Alloy事實不一樣,那么在Alloy中表達評論的正確方法是什么?
這是一個Alloy模型,它將紙張的事實版本與我認為可以捕捉您想要表達的內容進行比較:
sig Data {consumedBy: some System}
sig Criticality {
concernedData: one Data,
concernedSystem: one System
}
sig System {}
// the paper's statement:
// for any system which consumes a given datum,
// there is one criticality that has that data and system
// as its concernedData and concernedSystem
pred Paper {
all d: Data | all s: d.consumedBy | one c: Criticality |
c.concernedData = d and c.concernedSystem = s
}
// your interpretation:
// If a system consumes a datum, then the datum and the system
// must have the same (single) criticality
pred You {
all d: Data | all s: d.consumedBy |
concernedData.d = concernedSystem.s and one concernedSystem.s
}
check {Paper implies You} for 2
如果執行此操作,您將得到以下反例,顯示兩者之間的差異:
簡而言之,紙質版本說兩者都只有一個共同點; 你的版本說基准和系統都與一個關鍵性相關聯,並且它是相同的(更強)。
我不知道在這種情況下哪個是對的。
“一個”量詞,雖然具有非常簡單的語義(“一個x:S | P”意味着P對於集合S中的一個x是真的)可能會令人困惑,因為我們很想讀自然語言中的量詞。 在第73頁的軟件抽象第3章的常見問題解答中有一個半頁討論。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.