summaryrefslogtreecommitdiff
path: root/Test/dafny2
diff options
context:
space:
mode:
authorGravatar Clément Pit--Claudel <clement.pitclaudel@live.com>2015-07-13 11:55:06 -0700
committerGravatar Clément Pit--Claudel <clement.pitclaudel@live.com>2015-07-13 11:55:06 -0700
commit6dfa82655aa7cb35bae6904e05887cdf960c6319 (patch)
treefcc960db0cce120eccce3fb4be52edf9ff9325c3 /Test/dafny2
parent64495ae998749da057b3a717aba6ef53a3e8006e (diff)
Fix multiple tests that relied on z3 triggering on $Box
Found by enabling auto-generated triggers and looking for failing tests
Diffstat (limited to 'Test/dafny2')
-rw-r--r--Test/dafny2/COST-verif-comp-2011-2-MaxTree-class.dfy9
1 files changed, 9 insertions, 0 deletions
diff --git a/Test/dafny2/COST-verif-comp-2011-2-MaxTree-class.dfy b/Test/dafny2/COST-verif-comp-2011-2-MaxTree-class.dfy
index c752bd38..f691384c 100644
--- a/Test/dafny2/COST-verif-comp-2011-2-MaxTree-class.dfy
+++ b/Test/dafny2/COST-verif-comp-2011-2-MaxTree-class.dfy
@@ -117,6 +117,11 @@ class Tree {
Repr := lft.Repr + {this} + rgt.Repr;
}
+ lemma exists_intro<T>(P: T -> bool, x: T)
+ requires P.requires(x)
+ requires P(x)
+ ensures exists y :: P.requires(y) && P(y) { }
+
method ComputeMax() returns (mx: int)
requires Valid() && !IsEmpty();
ensures forall x :: x in Contents ==> x <= mx;
@@ -124,13 +129,17 @@ class Tree {
decreases Repr;
{
mx := value;
+
if (!left.IsEmpty()) {
var m := left.ComputeMax();
mx := if mx < m then m else mx;
}
+
if (!right.IsEmpty()) {
var m := right.ComputeMax();
mx := if mx < m then m else mx;
}
+
+ exists_intro(x reads this => x in Contents && x == mx, mx);
}
}