被Dafny后置条件消息困惑

时间:2016-09-14 03:55:57

标签: verification dafny

一个非常简单的乘法代码:

method Product1 (m: nat, n: nat) returns (res:nat) 
ensures res == m * n;      
{  
    var m1: nat := 0; 
    var n1: nat := 0; 
    res := 0; 
    while (m1 < m)    
   { 
    n1 := 0; 
    while (n1 < n)  
    { 
        res := res + 1;
        n1 := n1 + 1; 
    } 
    m1 := m1 + 1; 
    } 
}

当我用dafny验证时,它说:

     Description                                        Line Column
1   A postcondition might not hold on this return path. 8   4
2   This is the postcondition that might not hold.      2   16

我知道在某些条件下,res!= m * n,但我无法弄明白。

0 个答案:

没有答案
相关问题