【问题标题】:Does the order of constraints in a pred matter?pred 中的约束顺序是否重要?
【发布时间】:2017-08-04 13:34:04
【问题描述】:

pred 中的约束顺序是否重要:

pred Example {
   A
   B
   C
}

ABC 表示约束。

那个pred和这个pred一样吗:

pred Example {
   B
   A
   C
}

if-then-else 中的约束是否有序?例如,ReadMemoryWriteMemory 是否在此 if-then-else 中排序:

pred Example {
    {
       ReadMemory
       WriteMemory
    } implies C else D
}

这是我提出问题的动机:Software Abstractions 的第 222 页有,This assertion says that if a read, write, load, and read are performed in that order, then ...

那句话中的“顺序”一词引起了我的注意。因此我的问题。

【问题讨论】:

    标签: alloy


    【解决方案1】:

    不,约束的顺序无关紧要。在你提到的例子中

     assert LoadNotObservable {
       all c, c’, c“: CacheSystem, a1, a2: Addr, d1, d2, d3: Data | 
        {read [c, a2, d2]
         write [c, c’, a1, d1]
         load [c’, c”] 
         read [c“, a2, d3] 
    } implies d3 = (a1 = a2 => d1 else d2) } 
    

    是参数 (c, c', c") 定义了转换的前后状态。

    【讨论】:

    • 啊!那讲得通。谢谢丹尼尔!
    猜你喜欢
    • 1970-01-01
    • 2012-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-02
    • 2010-11-22
    • 2017-05-21
    相关资源
    最近更新 更多