0
當編譯如下代碼:編譯與模塊細化
module Interface {
function addSome(n: nat): nat
ensures addSome(n) > n
}
module Mod {
import A : Interface
method m() {
assert 6 <= A.addSome(5);
print "Test\n";
}
}
module Implementation refines Interface {
function addSome(n: nat): nat
ensures addSome(n) == n + 1
{
n + 1
}
}
module Mod2 refines Mod {
import A = Implementation
}
method Main() {
Mod2.m();
}
我得到的輸出
Dafny program verifier finished with 5 verified, 0 errors
Compilation error: Function _0_Interface_Compile._default.addSome has no body
鑑於Implementation
提煉Interface
,爲什麼編譯器還需要Interface.addSome
有一個組織,特別是當addSome
反正是鬼,所以不應該參與編譯?