summaryrefslogtreecommitdiff
path: root/Test/dafny0/CoinductiveProofs.dfy
diff options
context:
space:
mode:
Diffstat (limited to 'Test/dafny0/CoinductiveProofs.dfy')
-rw-r--r--Test/dafny0/CoinductiveProofs.dfy30
1 files changed, 15 insertions, 15 deletions
diff --git a/Test/dafny0/CoinductiveProofs.dfy b/Test/dafny0/CoinductiveProofs.dfy
index b7dea89d..d3112233 100644
--- a/Test/dafny0/CoinductiveProofs.dfy
+++ b/Test/dafny0/CoinductiveProofs.dfy
@@ -10,14 +10,14 @@ copredicate Pos(s: Stream<int>)
0 < s.head && Pos(s.tail)
}
-comethod {:induction false} PosLemma0(n: int)
+colemma {:induction false} PosLemma0(n: int)
requires 1 <= n;
ensures Pos(Upward(n));
{
PosLemma0(n + 1); // this completes the proof
}
-comethod {:induction false} PosLemma1(n: int)
+colemma {:induction false} PosLemma1(n: int)
requires 1 <= n;
ensures Pos(Upward(n));
{
@@ -27,7 +27,7 @@ comethod {:induction false} PosLemma1(n: int)
}
}
-comethod {:induction false} Outside_CoMethod_Caller_PosLemma(n: int)
+colemma {:induction false} Outside_CoLemma_Caller_PosLemma(n: int)
requires 1 <= n;
ensures Pos(Upward(n));
{
@@ -51,19 +51,19 @@ copredicate X(s: Stream) // this is equivalent to always returning 'true'
X(s)
}
-comethod {:induction false} AlwaysLemma_X0(s: Stream)
+colemma {:induction false} AlwaysLemma_X0(s: Stream)
ensures X(s); // prove that X(s) really is always 'true'
{ // error: this is not the right proof
AlwaysLemma_X0(s.tail);
}
-comethod {:induction false} AlwaysLemma_X1(s: Stream)
+colemma {:induction false} AlwaysLemma_X1(s: Stream)
ensures X(s); // prove that X(s) really is always 'true'
{
AlwaysLemma_X1(s); // this is the right proof
}
-comethod {:induction false} AlwaysLemma_X2(s: Stream)
+colemma {:induction false} AlwaysLemma_X2(s: Stream)
ensures X(s);
{
AlwaysLemma_X2(s);
@@ -77,19 +77,19 @@ copredicate Y(s: Stream) // this is equivalent to always returning 'true'
Y(s.tail)
}
-comethod {:induction false} AlwaysLemma_Y0(s: Stream)
+colemma {:induction false} AlwaysLemma_Y0(s: Stream)
ensures Y(s); // prove that Y(s) really is always 'true'
{
AlwaysLemma_Y0(s.tail); // this is a correct proof
}
-comethod {:induction false} AlwaysLemma_Y1(s: Stream)
+colemma {:induction false} AlwaysLemma_Y1(s: Stream)
ensures Y(s);
{ // error: this is not the right proof
AlwaysLemma_Y1(s);
}
-comethod {:induction false} AlwaysLemma_Y2(s: Stream)
+colemma {:induction false} AlwaysLemma_Y2(s: Stream)
ensures Y(s);
{
AlwaysLemma_Y2(s.tail);
@@ -103,7 +103,7 @@ copredicate Z(s: Stream)
false
}
-comethod {:induction false} AlwaysLemma_Z(s: Stream)
+colemma {:induction false} AlwaysLemma_Z(s: Stream)
ensures Z(s); // says, perversely, that Z(s) is always 'true'
{ // error: this had better not lead to a proof
AlwaysLemma_Z(s);
@@ -119,7 +119,7 @@ copredicate Even(s: Stream<int>)
s.head % 2 == 0 && Even(s.tail)
}
-comethod {:induction false} Lemma0(n: int)
+colemma {:induction false} Lemma0(n: int)
ensures Even(Doubles(n));
{
Lemma0(n+1);
@@ -130,25 +130,25 @@ function UpwardBy2(n: int): Stream<int>
Cons(n, UpwardBy2(n + 2))
}
-comethod {:induction false} Lemma1(n: int)
+colemma {:induction false} Lemma1(n: int)
ensures Even(UpwardBy2(2*n));
{
Lemma1(n+1);
}
-comethod {:induction false} ProveEquality(n: int)
+colemma {:induction false} ProveEquality(n: int)
ensures Doubles(n) == UpwardBy2(2*n);
{
ProveEquality(n+1);
}
-comethod {:induction false} BadEquality0(n: int)
+colemma {:induction false} BadEquality0(n: int)
ensures Doubles(n) == UpwardBy2(n);
{ // error: postcondition does not hold
BadEquality0(n+1);
}
-comethod {:induction false} BadEquality1(n: int)
+colemma {:induction false} BadEquality1(n: int)
ensures Doubles(n) == UpwardBy2(n+1);
{ // error: postcondition does not hold
BadEquality1(n+1);