summaryrefslogtreecommitdiff
path: root/Test/dafny0/LetExpr.dfy
diff options
context:
space:
mode:
authorGravatar Unknown <leino@LEINO6.redmond.corp.microsoft.com>2012-03-02 18:18:07 -0800
committerGravatar Unknown <leino@LEINO6.redmond.corp.microsoft.com>2012-03-02 18:18:07 -0800
commita99b88779bd11f102ef69d94bc284d2a35b53888 (patch)
tree64ef21b8236a5998818d93f962a4a747784205ac /Test/dafny0/LetExpr.dfy
parent4fdb83b82eb6949fcfb7e46e0010dc4b9c95c62f (diff)
parent8bcdbb318c0c61b1148705accccb294906cdffb1 (diff)
Merge
Diffstat (limited to 'Test/dafny0/LetExpr.dfy')
-rw-r--r--Test/dafny0/LetExpr.dfy40
1 files changed, 40 insertions, 0 deletions
diff --git a/Test/dafny0/LetExpr.dfy b/Test/dafny0/LetExpr.dfy
index 48e4810b..11bf4fbe 100644
--- a/Test/dafny0/LetExpr.dfy
+++ b/Test/dafny0/LetExpr.dfy
@@ -107,3 +107,43 @@ method PMain(a: array<int>)
assert index == old(index) ==> a[index] == 21 && old(a[index]) == 19;
}
}
+
+// ---------- lemmas ----------
+
+method Theorem0(n: int)
+ requires 1 <= n;
+ ensures 1 <= Fib(n);
+{
+ if (n < 3) {
+ } else {
+ Theorem0(n-2);
+ Theorem0(n-1);
+ }
+}
+
+ghost method Theorem1(n: int)
+ requires 1 <= n;
+ ensures 1 <= Fib(n);
+{
+ // in a ghost method, the induction tactic takes care of it
+}
+
+function Theorem2(n: int): int
+ requires 1 <= n;
+ ensures 1 <= Fib(n);
+{
+ if n < 3 then 5 else
+ var x := Theorem2(n-2);
+ var y := Theorem2(n-1);
+ x + y
+}
+
+function Theorem3(n: int): int
+ requires 1 <= n;
+ ensures 1 <= Fib(n);
+{
+ if n < 3 then 5 else
+ var x := Theorem3(n-2);
+ var y := Theorem3(n-1);
+ 5
+}