From 8e25cc2331e4f90d7674f3b3bb218f65f7e93797 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Tue, 21 Jul 2015 18:55:28 -0700 Subject: Improved rank axioms for containers --- Test/dafny0/ContainerRanks.dfy | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Test/dafny0/ContainerRanks.dfy (limited to 'Test/dafny0/ContainerRanks.dfy') diff --git a/Test/dafny0/ContainerRanks.dfy b/Test/dafny0/ContainerRanks.dfy new file mode 100644 index 00000000..df35e214 --- /dev/null +++ b/Test/dafny0/ContainerRanks.dfy @@ -0,0 +1,33 @@ +// RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t" +// RUN: %diff "%s.expect" "%t" + +datatype Abc = End | Wrapper(seq) + +lemma SeqRank0(a: Abc) + ensures a != Wrapper([a]) +{ + assert [a][0] == a; // TODO: one could consider strengthening axioms to eliminate the need for this assert + // The reason we need the assert is to match the trigger in the rank axioms produced + // for datatypes containing sequences. + // See "is SeqType" case of AddDatatype in Translator.cs +} + +lemma SeqRank1(s: seq) + requires s != [] + ensures s[0] != Wrapper(s) +{ +} + +datatype Def = End | MultiWrapper(multiset) + +lemma MultisetRank(a: Def) + ensures a != MultiWrapper(multiset{a}) +{ +} + +datatype Ghi = End | SetWrapper(set) + +lemma SetRank(a: Ghi) + ensures a != SetWrapper({a}) +{ +} -- cgit v1.2.3