达夫尼。布尔值对不相等

Dafny. Pairs with bools do not equal

为什么这两个在 Dafny 失败了?

lemma test(x : (int, bool)) {
  assert x == (x.0, true) || x == (x.0, false);
}

lemma test''(v : int, x : (int, bool))
  requires x.0 == v; 
{
  assert x == (v, true) || x == (v, false);
}

https://rise4fun.com/Dafny/DtDMdm

我猜这与元组可以包含的通用类型的布尔值内部装箱有关。无论如何,这里有一个简单的解决方法:

lemma test(x : (int, bool)) {
  var (i, b) := x;
  assert x == (x.0, true) || x == (x.0, false);
}

鲁斯坦