From 60208673a25423e378cc7e9672d5acf9fd6f58bc Mon Sep 17 00:00:00 2001 From: Dan Rosén Date: Mon, 7 Jul 2014 15:09:33 -0700 Subject: New logical encoding of types with Is and IsAlloc --- Test/dafny1/Celebrity.dfy | 10 +++++----- Test/dafny1/MoreInduction.dfy | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'Test/dafny1') diff --git a/Test/dafny1/Celebrity.dfy b/Test/dafny1/Celebrity.dfy index 7e5ab205..360c5aba 100644 --- a/Test/dafny1/Celebrity.dfy +++ b/Test/dafny1/Celebrity.dfy @@ -3,16 +3,16 @@ // Celebrity example, inspired by the Rodin tutorial -static function method Knows(a: Person, b: Person): bool +static function method Knows(a: X, b: X): bool requires a != b; // forbid asking about the reflexive case -static function IsCelebrity(c: Person, people: set): bool +static function IsCelebrity(c: Y, people: set): bool { c in people && (forall p :: p in people && p != c ==> Knows(p, c) && !Knows(c, p)) } -method FindCelebrity0(people: set, ghost c: Person) returns (r: Person) +method FindCelebrity0(people: set, ghost c: Z) returns (r: Z) requires exists c :: IsCelebrity(c, people); ensures r == c; { @@ -20,7 +20,7 @@ method FindCelebrity0(people: set, ghost c: Person) returns (r: r := cc; } -method FindCelebrity1(people: set, ghost c: Person) returns (r: Person) +method FindCelebrity1(people: set, ghost c: W) returns (r: W) requires IsCelebrity(c, people); ensures r == c; { @@ -43,7 +43,7 @@ method FindCelebrity1(people: set, ghost c: Person) returns (r: r := x; } -method FindCelebrity2(people: set, ghost c: Person) returns (r: Person) +method FindCelebrity2(people: set, ghost c: V) returns (r: V) requires IsCelebrity(c, people); ensures r == c; { diff --git a/Test/dafny1/MoreInduction.dfy b/Test/dafny1/MoreInduction.dfy index d71c735f..a52f994b 100644 --- a/Test/dafny1/MoreInduction.dfy +++ b/Test/dafny1/MoreInduction.dfy @@ -4,7 +4,7 @@ datatype List = Nil | Cons(Node, List); datatype Node = Element(X) | Nary(List); -function FlattenMain(list: List): List +function FlattenMain(list: List): List ensures IsFlat(FlattenMain(list)); { Flatten(list, Nil) @@ -22,7 +22,7 @@ function Flatten(list: List, ext: List): List case Nary(nn) => Flatten(nn, Flatten(rest, ext)) } -function IsFlat(list: List): bool +function IsFlat(list: List): bool { match list case Nil => true -- cgit v1.2.3