repo stringclasses 966
values | path stringlengths 5 283 | license stringclasses 13
values | stars int64 0 3.47k | default_branch stringclasses 15
values | commit_sha stringclasses 966
values | pushed_at stringdate 2015-04-17 10:56:12 2026-07-22 05:29:38 | size_bytes int64 0 1.91M | sha256 stringlengths 64 64 | content stringlengths 0 1.91M |
|---|---|---|---|---|---|---|---|---|---|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug159.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 994 | bf1de9e8ccc5cbf99405239914e83fd6e4080cc8368e26fbadecede1d3949d17 | // RUN: %testDafnyForEachResolver "%s"
method ArrayInit(n: nat) returns (a: array<int>)
ensures a.Length == n
ensures forall i :: 0 <= i < n ==> a[i] == i
{
a := new int[n];
forall i | 0 <= i < n {
a[i] := i;
}
}
method Init(m: array2<int>)
modifies m
ensures forall i,j :: 0 <= i < m... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug160.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 720 | 65c7ae497bf9067d76cfd03071c6782e267b08cbccb1c005498a12c9c5163988 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" -- --allow-deprecation
type U(==)
ghost function ToU<T>(t:T) : U
type Ptr<T>
class HostEnvironment{
function{:axiom} heap():map<U,U> reads this;
}
method {:axiom} MakePtr<T>(v:T, ghost env:HostEnvironment) returns (ptr:Ptr<T>) // Using int o... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug161.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 302 | f3433f1f2caf25a21137b5dad9c058795fc9cb46aeec5399ec715caafa133987 | // RUN: %testDafnyForEachResolver "%s"
type t = seq<int>
ghost predicate P(x:t)
ghost function F(x:t) : int
ghost function C() : int { assume (exists x :: P(x)); var x :| P(x); F(x) }
lemma L(x:t)
{
assume P(x);
assume forall y :: P(y) ==> y == x;
assert F(x) == C(); // FAILS
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug162.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 453 | 0a58ba872e9149a556d901d3591d0d6be51409f4eac87196f778297f312d13bb | // RUN: %verify --relax-definite-assignment "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method foo<T(==)>(x:T)
datatype A = A(s:iset<int>)
datatype B = B(s:set<int>)
datatype C = C(s:imap<int,int>)
datatype D = D(s:map<int,int>)
method bar()
{
var a:A;
foo(a);
var b:B;
foo(b);
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug165.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 411 | ba37b33ce8389c917989b2cf66259f3773574ff12df54a810f84c8c43d8b0130 | // RUN: %testDafnyForEachResolver "%s"
type T
ghost function f(a: T) : bool
method Select(s1: seq<T>) returns (r: seq<T>)
ensures (forall e: T :: f(e) ==> multiset(s1)[e] == multiset(r)[e])
ensures (forall e: T :: (!f(e)) ==> 0 == multiset(r)[e])
method Main(s1: seq<T>)
{
var r1, r2: seq<T>;
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug166.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 252 | 2f011564988717034fde485b3c0f0c91060c1fd562f6f7319847c095e47207f5 | // RUN: %verify --disable-nonlinear-arithmetic --allow-axioms "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
ghost predicate P(x:int)
method test(s:seq<int>)
ensures forall x :: x > 5 ==> P(x)
ensures forall i :: 0 <= i < |s| ==> P(s[i])
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug168.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 567 | 3113f294f8a9de4408e1aa7bea15c1d134ebedb8a33de517c0ccf8d5e78206cf | // RUN: %exits-with 4 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
datatype List = Nil | Cons(head: int, tail: List)
ghost function Crash(xs: List): int
requires xs.Cons?
ensures Crash(xs) == xs.head
{
var Cons(h, Nil) := xs; h // ERROR: xs may not match Cons(_, Nil)
}
ghost function Crash2(x... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug169.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 131 | d7062bf562282ca0828656748e948893b68ca51b77e17c0b55072a5c1d81fe15 | // RUN: %testDafnyForEachResolver "%s"
ghost predicate R(x: int)
least lemma P(x: int)
{
forall x | R(x)
{
}
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug170.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,970 | b54c0eeedf43b9a2d88cd4d7db578e4fefaa74c6b6e490d87506d510c7e7be68 | // RUN: %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module InductiveThings {
ghost predicate P(x: int)
ghost predicate Q(x: int)
least predicate A(x: int)
{
P(x) || B(x+1)
}
least predicate B(x: int)
{
Q(x) || A(x+1)
}
least lemma AA(x: int) // should ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug49.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,213 | d2be03213d6523f1bfeeeaac5d40e6513fdbb893bc3dcc28e7c5772d975571a1 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
method Main()
{
print apply(i => i + 1, 5), "\n";
print mapply(map[5 := 6], 5), "\n";
var f: int -> int;
print five(f), "\n";
}
// -----
// test that the definition axiom for function "apply" is available
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug54.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 424 | 75d6c154444a713aee251e7f5442cd5627027c74b7f884acf421811183341f17 | // RUN: %testDafnyForEachResolver "%s"
ghost predicate G<X(!new)>(f:X~>bool)
reads f.reads
requires forall x :: f.requires(x) && f(x)
{
true
}
ghost predicate H()
{
G((x:int) => true)
}
ghost predicate P1<X>(m:map<X,bool>)
requires forall x :: x in m ==> m[x]
{
true
}
ghost predica... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug55.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 235 | 2a18372c168c5f946b0ebde68cf0060464e42ddb44f3663d490c2349d9f7c551 | // RUN: %testDafnyForEachResolver "%s"
ghost predicate {:opaque} G(f:int~>bool)
reads f.reads(0)
requires f.requires(0)
{
true
}
ghost predicate A<T>(s:set<T>)
predicate{:opaque} B(s:set<int>)
requires A(s)
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug56.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 516 | 3072e19bc5633bb0abcc5f969e5c29ae5364ec850922e8a8d56d3a68ec7c0016 | // RUN: %testDafnyForEachResolver "%s"
ghost function I(f:int->bool):int->bool
ensures I(f) == f
ghost predicate G<S>(s:S)
type D<X>
type E
lemma L1<S>(b:int->S)
requires forall i :: b.reads(i) == {}
requires forall i :: b.requires(i)
requires I(j => G(b(j)))(0) // PRECONDITION NOT SATISFIED ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug58.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 366 | b3fac67af0b518391482173a93bdee72e2cc0879a6ff3ef2adc8b70589d1e326 | // RUN: %testDafnyForEachResolver "%s"
ghost function M1(f:map<int, bool>, i:int):bool
ghost function M2(f:map<int, bool>, i:int):bool
{
M1(map j | j in f :: f[j], i)
}
lemma L(f:map<int, bool>, i:int)
requires i in f
requires M2(f, i)
requires forall j:int, f:map<int, bool> :: M1(f, j)... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug60.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 368 | ae3fc6e95958875c23638546e876ae7eefd36b8ab96a1269fa45e91431e9177e | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
// This method can be used to test compilation.
method Main()
{
var s := {2, 3};
var m := map[2 := 20, 3 := 30];
print (s, m), "\n";
print (|s|, |m|), "\n";
print set s | s in m, "\n";
print forall x :: x ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug62.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 546 | 432487cc3cebf9d6b769bc2326ab254754a91ce9321e3152b5baf8519623885a | // RUN: %exits-with 3 %run "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class C {
constructor C() { }
method Main() // not Main since the enclosing class has a constructor.
{
print "hello, I'm running ... in C\n";
}
}
class D {
method Main() // not Main since it has modifies clause.
mod... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug63.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 195 | afe7829773e78e4a9dff1e4c1f50e6bca5b4cd53d4e0fa2de8642b521e838748 | // RUN: %testDafnyForEachResolver "%s" -- --allow-warnings
method M()
modifies set o: object | true
{
}
method Client()
{
assume forall o: object {:nowarn} :: false;
M();
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug67.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 301 | 15ae76a9021d7aa587048ca02a42e042d381135fcb36d488d18a733b566f7879 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
datatype d = D(m:seq<int>)
method Main()
{
assert D([10, 20]) == D([10, 20]); // succeeds
print [10, 20] == [10, 20], "\n"; // prints True
print D([10, 20]) == D([10, 20]); // prints False
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug68.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,449 | 9a7c08a8bdeddb23542bdc396b03dfeda8cbab30ab0fb351f1acce1b65dbe1ee | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
method M1()
{
var m := map [{10, 20} := 33];
assert {10, 20} in m; // succeeds
print {10, 20} in m, "\n"; // prints False
}
method M1'()
{
var m := map [{10, 20} := 33];
assert {10, 20} == {20, 10};
as... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug69.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 288 | 653f06629dd704a3de339e7f28fcb3b067aa2eaccf2e56bfbbb301c0d0288dea | // RUN: %testDafnyForEachResolver "%s"
module M1
{
ghost predicate X(i:int)
}
module M2
{
import opened M1
ghost predicate P(i:int) requires X(i) { true } // ok
predicate{:opaque} O(i:int) requires X(i) { true } // resolution/type error: X does not exist
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug70.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 391 | a86438167731e0a076aeab13dad048f03ff423660145d0c1ecf8e65bdd27ad89 | // RUN: %testDafnyForEachResolver "%s"
module M1
{
datatype d = D()
}
module M2 { import opened M1 }
module M3 { import opened M1 }
module M4
{
import opened M1 // this is required to access D() unqualified below
import opened M2 // this causes no name conflict
import opened M3 // this cau... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug71.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 257 | 07f51486999266019ac1c16441ad5a3f4271de88db8e125179201702df91d6af | // RUN: %testDafnyForEachResolver "%s"
function{:opaque} MapSetToSet<X(!new), Y>(xs:set<X>, f:X~>Y):set<Y>
//function MapSetToSet<X, Y>(xs:set<X>, f:X->Y):set<Y>
reads f.reads
requires forall x :: f.requires(x)
{
set x | x in xs :: f(x)
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug72.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 486 | 173836284d4ee245cc0180b955064f04e8ba9e2b90e22b77f93bb9184c9b3ce9 | // RUN: %verify --relax-definite-assignment "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
datatype Ballot = Ballot(seqno:int)
ghost predicate BalLt(ba:Ballot, bb:Ballot)
{
ba.seqno < bb.seqno
}
lemma Cases()
{
var b1:Ballot;
var b2:Ballot;
if (b1 == b2) {
} else if (BalLt(b1,b2)) {... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug73.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 275 | b36b2566c12b63ac68267582c230cf50e1391d52338119a887ab77268d0903ff | // RUN: %exits-with 4 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
lemma L(m:map<int, int>, r:int, i:int)
requires i != r
{
assert i in m && i != r;
}
lemma L2(m:map<int, int>, r:int, i:int)
requires i != r
{
assert i !in m && i != r;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug75.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,177 | 893528fd8ae48fa0db56990512dc1e1a9346ca2425ec4d598fb39c86c0a0d04d | // RUN: %testDafnyForEachResolver "%s"
ghost predicate R1(x:int, y:int) { x > 0 ==> R2(x - 1) }
ghost predicate R2(x:int) { exists y :: R1(x, y) }
lemma L1(x:int)
{
assume R2(x);
assert exists y :: R1(x, y); // FAILS
}
lemma L2(x:int)
requires R2(x) // Oddly, adding this requires fixes the ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug79.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 165 | bf02c65a62f50c9b2561fc3ed99661e349169875ef485cc9eb85e3f2b2a347fc | // RUN: %testDafnyForEachResolver "%s"
ghost function foo(s:int) : (int, int)
ghost function bar(s:int) : bool
{
var (x, rest) := foo(s);
x > 0
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug81.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 210 | 2c6e2645001786a1f4b60b81a8a6cf37b6209b0f95cb9485a5715e61536130e7 | // RUN: %testDafnyForEachResolver "%s"
ghost function {:opaque} RefineSeqToSeq<T(!new), U>(s:seq<T>, refine_func: T ~> U) : seq<U>
{
if |s| == 0 then []
else RefineSeqToSeq(s[1..], refine_func)
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug82.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 226 | f978f022aa82c4b8b69a60c179f3c891f3542d460b621ba3afa1f91bfff083df | // RUN: %testDafnyForEachResolver "%s"
ghost opaque function Reverse(id: int): int
ghost function RefineToMap(ReverseKey: int -> int): bool
ghost function RefineToMapOfSeqNums(): bool
{
RefineToMap(Reverse)
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug88.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 252 | 5d3124e95aab4a53d0d2dc08329711e76850f3023fbae7f5118b0d0ea8321a71 | // RUN: %exits-with 4 %build "%s" --relax-definite-assignment > "%t"
// RUN: %diff "%s.expect" "%t"
lemma T(a: int) returns (b: int)
ensures a == b
{
calc {
a;
}
}
lemma A(i: int)
ensures false
{
if * {
} else {
}
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug89.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 238 | 94b7b5bce487afe177c789fb21914ceaa2cff9f59da78c3aa18cb2c066d4df2e | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
method F() returns(x:int)
ensures x == 6
{
x := 5;
x := (var y := 1; y + x);
}
method Main()
{
var x := F();
print x;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug91.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 877 | 9a85e4afcf35cc5a92e0831e42c7c545dcde624ddc0d93f8f406a702ac8e9ec1 | // RUN: %testDafnyForEachResolver "%s"
type SendState = map<int, seq<int>>
ghost function UnAckedMessages(s:SendState) : set<int>
{
set m,dst | dst in s && m in s[dst] :: m
}
ghost function UnAckedMessagesForDst(s:SendState, dst:int) : set<int>
requires dst in s
{
set m | m in s[dst] :: m
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug92.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,007 | b97893d7da0568667d77135b907960e0cbd4bd1fe4ce61012a94c791ff98c447 | // RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation
module ModOpaque {
ghost function {:opaque} Hidden(x:int) : (int, int)
{
(5, 7)
}
ghost function Visible(x:int) : (int, int)
{
Hidden(x)
}
lemma foo(x:int, y:int, z:int)
requires (y, z) == ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug93.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 651 | 909e8ab6ac13895dbf7bdbf35de121d563289dfc86b63499e66af8046fa6c401 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
module Fuel {
ghost function FunctionA(x:int) : int
{
x + 2
}
ghost function FunctionB(y:int) : int
{
FunctionA(y - 2)
}
method {:fuel FunctionA,0,0} MethodX(z:int)
{
assert FunctionB(z... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug94.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 463 | 9fae52de1da1a1de55132cb3d96caec0947e2997fac7c41ac1399b10ab1841a9 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
ghost function foo() : (int, int)
{
(5, 10)
}
ghost function bar() : int
{
var (x, y) := foo();
x + y
}
lemma test()
{
var (x, y) := foo();
}
function foo2() : (int,int)
{
(5, 10)
}
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug99.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 228 | aa3fa21dae53ffbe40ae07ed1b9ade6389e839c957ff83da463f6dbeacf12937 | // RUN: %testDafnyForEachResolver "%s"
ghost predicate P(e:int, p:int) { true }
ghost predicate Q(i:int, t:int)
lemma Tester(x:int)
{
assert forall i :: Q(i, x) ==> (forall p {:trigger P(i, p)} :: P(i, p));
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Circ.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,371 | 7c98b2da8c10f37a1bc459f50ab7791d3445532ffdd124b7ad117d91156aef16 | // RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation
// A couple of examples from Grigore Rosu and Dorel Lucanu, "Circular coinduction: A proof theoretical
// foundation", CALCO 2009.
codatatype Stream<T> = Cons(head: T, tail: Stream)
// ----- standard examples -----
ghost function zeros(): Stre... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/ClassRefinement.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,970 | 173e5a3f72faec726ffcd04178a25bb154b77d14d19ee354bdaaba4792736b19 | // RUN: %testDafnyForEachCompiler "%s" -- --relax-definite-assignment --allow-deprecation
abstract module M0 {
class Counter {
ghost var N: int
ghost var Repr: set<object>
ghost predicate Valid()
reads this, Repr
ensures Valid() ==> this in Repr
constructor Init()
ensure... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/CoqArt-InsertionSort.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,347 | 98b306afd44570a63107f960c7306ae4d3cfd778b6106c01d9edfa40d86d3d31 | // RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation
// Dafny transcription of the Coq development of insertion sort, as found in Coq'Art.
datatype List<T> = Nil | Cons(head: T, tail: List)
ghost predicate sorted(l: List<int>)
{
match l
case Nil => true
case Cons(x, rest) =>
match res... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/ExpandedGuardedness.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 5,274 | 1ec9a1b4f02575f2169b32cabd692ea05951bd7fbc9b2c0418f5c60ec4ee5e90 | // UNSUPPORTED: windows
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
method Main() // Windows not supported because of Java that does not pass the check as expected on the CI
{
PrintStream("Up", Up(19));
PrintStream("Up2", Up2(19));
PrintStream("UpIf", UpIf(19)... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/ExpandedGuardednessNeg.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 441 | 7a025f90edf87cfdeb812e0dd0c92745a5f0fd93ded564b05e8ff1d508006747 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
codatatype Stream<T> = ICons(head: T, tail: Stream<T>)
function UpFunction(n: int): Stream<int>
{
(k => ICons(k, UpFunction(k)))(n) // error: this is not a co-recursive call and thus can't be proved to terminate
}
ghost function UpFunction'(n:... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/FlyingRobots.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 7,298 | 189642d5a3e082705da512d09bda00a606e35cdbba53b0db02a7d141213a78a8 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
// The flying robots examples from an F* tutorial. It demonstrates how to specify
// mutable data structures in the heap.
class Cell {
var val:int
constructor (v:int)
ensures val == v
{
val := v;
}
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Fstar-QuickSort.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,300 | 6b8acffe5f8499ae0bdf0967779bce7f4e7053be2d75f43cf1c2270179a7ef31 | // RUN: %testDafnyForEachResolver "%s"
// A Dafny rendition of an F* version of QuickSort (included at the bottom of this file).
// Unlike the F* version, Dafny also proves termination and does not use any axioms. However,
// Dafny needs help with a couple of lemmas in places where F* does not need them.
// Co... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/gcd.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 7,413 | 38400627a188b57fb433196131f679bb17604bf0d821f3b719869a4e5601c55c | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment --spill-translation
// A text describing this file is found in a Dafny Power User note: http://leino.science/papers/krml279.html
type pos = x | 1 <= x witness 1
ghost predicate IsFactor(p: pos, x: pos) {
exists q :: ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/GHC-MergeSort.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 24,107 | dc078800d980a63857e5bbf34e620dbf1a44ac5ffada3cf210f59c4082417ca9 | // RUN: %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// Rustan Leino
// 23 Dec 2013 (completed in 5 hours, but is missing the formulation and proof that the
// sorting algorithm is stable, which the journal article below does and says is the most interesting
// part).
// 28 Dec 2013, added key function an... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue1.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 370 | 4adc8517f2378402e7fcd53560efd6737502e05799b6bfca41cf3e14c8d6e22e | // RUN: %testDafnyForEachResolver "%s" -- --allow-warnings
datatype T = T(n:int)
ghost function P(x: int) : int { x - 1}
ghost function ToInt(t:T) : int
ensures ToInt(t) == t.n as int
{
t.n as int
}
method Test(x:int)
{
assume exists p:int :: exists t:T :: ToInt(t) > 0;
assert exists ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue104.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 416 | f1a239e2e4896c4c296ee540bed2bedf47210fe1ba91be00689ae7f3edbb8c4c | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
predicate bug(a: array<int>)
reads a
{
forall i, j | 0 <= i <= j < a.Length :: a[i] <= a[j]
}
method Main() {
var a := new int[25](i => 2*i + 3);
var b := new int[25](i => var u := 2*i + 3; if i == 7 then 2 e... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue105.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 156 | 64329ff71fddc9e922074d34b6a92c9bf3f2db7d2e5912abd80864e7ccbbd18e | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
method lol() returns (c: int)
{
c := 5;
return c;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue106.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 237 | 9bd181af87afdae1aa77d110b7bb719aebf1873e6c1b4f2eaf819491b0b0fcb9 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
ghost function f(i:nat, j:nat):int {if i == 0 then 0 else f(i - 1, i * j + 1) + f(i - 1, 2 * i * j)}
lemma{:resource_limit 10000000} L()
{
assert f(10, 5) == 0;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue109.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 206 | 51e71b4b203c132f5ea7a0275b11bf160253c1bf6c5b969cb2b2772fe0f8efab | // RUN: %testDafnyForEachResolver "%s"
datatype MyTuple = MyTuple(x:int, y:int)
method M()
requires forall x :: MyTuple(x,x) != MyTuple(x,x+1)
requires forall x :: (x,x) != (x,x+1)
{
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue110.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 632 | b8839b50a77f0c4eccb97df28dcd250100c64394f53b58c56e6621be66430e69 | // RUN: %testDafnyForEachResolver "%s"
module MyModule {
export provides MyType, Empty, MyLemma
type MyType<A>
ghost function Empty<B>(): MyType<B>
lemma MyLemma<C>(m: MyType<C>)
requires m != Empty() // once upon a time, type inference didn't figure this out
}
// -----------------
module ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue120.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 197 | 144ee7c815e46974815fd3e408798b3348daf59f228d0e352b7adebaabd2eed7 | // RUN: %testDafnyForEachResolver "%s"
ghost function {:opaque} opfn(): int { 37 }
ghost function foo(): int
{
var x := opfn();
assert x == 37 by { reveal opfn(); }
x
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue129.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 638 | aea27f761b639302cf381719a389c9067ba049901188a2611604f59138e8f5ee | // RUN: %exits-with 4 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
function Foo(): (int, int)
{
(1, 2)
}
method Bar()
ensures var (x, y) := Foo(); x < y
{
var (x, y) := Foo();
}
datatype Point = Point(x: int, y: int)
function FooPoint(): Point
{
Point(1, 2)
}
method BarPo... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue133.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,008 | e3451b97450b6887f80e57479e2e5f01810462febb3ca34bbfe8a573fabd3c1f | // RUN: %testDafnyForEachResolver "%s"
datatype State = State(m:map<int, bool>)
lemma Test(s:State)
requires 42 in s.m
ensures s.(m := s.m[42 := s.m[42]]) == s
{
var s' := s.(m := s.m[42 := s.m[42]]);
assert s'.m == s.m;
}
datatype MyDt = MakeA(x: int, bool) | MakeB(s: multiset<int>, t: State)
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue134.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 383 | 62e98555d96d08c8f51f533df4c1f01d6a7339fba4e947bf34e73b12a4f62abf | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
lemma MapValues()
ensures false
{
var m := map[0 := false];
assert m.Keys == {0};
assert m.Values == {false};
var m' := m[0 := true];
assert m'.Values == m.Values + {true}; // This was once a bug in the axiomatization o... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue135.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 373 | 42d1d90237f6e4c440af8355ee776f0477f8683dd0abd02a9aa583410575cef8 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
lemma lemma_MapTest()
ensures false
{
var m := map [ 1 := 1, 2 := 1 ];
assert m.Keys == {1, 2};
assert m.Values == {1};
assert |m| == |m.Keys| == 2;
assert |m| == |m.Values| == 1; // This was once a bug in the axiomatizatio... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue141.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 403 | c7d1f97639319932e976ef86452c3d4f2edc18b661d142c816365bb6160264fe | // RUN: %testDafnyForEachResolver "%s"
class Node<T> {
var next: Node?<T>
}
class List<T> {
ghost var spine: seq<Node<T>>
ghost var repr: set<object>
ghost predicate Valid()
reads this, repr
{
&& forall i | 0 <= i < |spine| ::
&& spine[i] in repr
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue147.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 275 | 5c885aaa85292a43b1d9278e53a1d739ceebbe87b973c12f66d46fc2e3460843 | // RUN: %exits-with 4 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
lemma Foo(s: seq<int>, i: int)
requires 0 <= i < |s| - 1
ensures s[i] == s[i+1]
{}
lemma CallFoo(s: seq<int>)
{
forall i | 0 <= i < |s| - 1
{
Foo(s, i);
}
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue148.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 256 | 01bc1ac707a193af6a40764ae6d3a3e3f3ec36ae5429534a5e94460e92d2f057 | // RUN: %testDafnyForEachResolver "%s"
ghost function Foo(f: () -> (), n: nat): nat
{
if n == 0 then n
else Foo(f, n - 1)
}
lemma lemma_Foo()
ensures forall g: () -> () :: Foo(g, 0) == 0 // regression: this had crashed Dafny
{}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue149.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 276 | 16d5caf6e659209a4b6737979951c4d080b5a6a7d39bbf7a588f7cc9b35b4c6c | // RUN: %exits-with 2 %verify --allow-axioms "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
ghost function Foo<T>(m: map<int, T>): seq<T>
ensures Foo(m) != []
lemma Bar()
ensures forall m | 0 in m :: Foo(m)[0] == m[0] // error -- but should not crash Dafny
{}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue15.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 407 | b48181f981fec3825f9113b673d2d1be73b707823400a87ce253d2005b49e40d | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
datatype obj = Obj(fooBar:map<foo,int>)
datatype foo = Foo
method test_case() returns (o:obj)
{
if true {
o:= o.(fooBar := o.fooBar[Foo := 3]);
}
}
method Main() {
var o := test_case();
if Fo... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue155.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 223 | 357872fba0c94ff09493f8c5f745d01a145199878452a26d116257dfa3bc957b | // RUN: %testDafnyForEachResolver "%s"
datatype A = A0
datatype B = B0
ghost function F(a: A, b: B): int
{
match (a, b)
case (A0, B0) => 0
}
method M(a: A, b: B)
{
match (a, b)
case (A0, B0) =>
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue158.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,508 | 937f0d95c7e87338abc9cabc9e0f01a39e3a4ef5a1a7d8d0769c560bb407b88b | // NONUNIFORM: Multiple testing scenarios (could be split)
// RUN: %dafny /compile:3 "%s" > "%t"
// RUN: %dafny /compile:3 /optimize "%s" >> "%t"
// RUN: %diff "%s.expect" "%t"
// See https://github.com/dafny-lang/dafny/issues/508
class Class { }
newtype byte = x | 0 <= x < 256
datatype Record<G> = Make(0:... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue159.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,513 | d7c3f2a86a9282d62e983bd743f419b2c41b14af460b7898d33c3ae1d3f69a61 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
// map types used to slip through type checking of reads/modifies clauses
class MyClass { }
ghost function fset(M: set<MyClass>): real
reads M
ghost function fiset(M: iset<MyClass>): real
reads M
ghost function fmultiset(M: multiset<MyClas... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue16.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 132 | c048ebe0d54e79e02b4fd115428016aad54aae99be41ba09bd16988e3bb5018a | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
include "git-issue16.dfyi"
lemma UhOh()
ensures false
{
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue161.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 385 | 247c5342752360fe77e3f9f46fb33f8dddb1d31f96c177218201c881c678f774 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
datatype Expr0 = Var(val: string)
| Const(val: int)
datatype Expr1 = Var(val: seq<string>)
| Const(val: seq<int>)
datatype Expr2 = Var(val: iset<string>)
| Const(val: set<string>)
datatype Expr3 = V... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue167.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,961 | 4888b1092f525bbf3d57689124f5274934a65086d2fa88f5f212a46496e00e4d | // NONUNIFORM: https://github.com/dafny-lang/dafny/issues/4108
// RUN: %run "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method Main() {
LetTest();
var m := map[6 := 8, 7 := 3];
var n := Rewrite(m);
assert m.Keys == n.Keys;
print n.Keys, "\n";
var u := {"Alfons", "Milla"};
var v := Rewrite2(... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue176.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 397 | 010f74a19e5b828070b4859c3ddac628661ebbe48c1410d86adc856edb22b2a3 | // RUN: %testDafnyForEachResolver "%s"
ghost predicate Thing1() {
var m := map[0 := 1];
forall i :: i in m ==> i == 0
}
datatype Context = Context(foo: map<int, int>)
ghost predicate Thing2(ctx: Context) {
var ctx' := ctx.(foo := map[0 := 1]);
forall i :: i in ctx'.foo ==> i == 0
}
met... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue18.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 248 | bb6e2a7f4f3bd6618ec72dbf3be8f42a744b988fdcf561f8f6c3ead96222e373 | // RUN: %testDafnyForEachResolver "%s" -- --allow-warnings
datatype Maybe = Nothing | Just
ghost predicate bad(e:Maybe)
{
forall i :: 0 <= i < 1 ==>
0 == match e
case Nothing => 0
case Just => 0
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue182.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 155 | 59399c44c0cca50d6ea9c5fc07bf5b712414038dc834cdbfdf632e09ade44bc4 | // RUN: %exits-with 2 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
predicate prop()
ensures prop // OOPS! Forgot () after prop
{
true
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue195.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,945 | 0763f1c1fd2f29d04ee25466be9ee2f60105ad626a8550356925d13a6ba271a0 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
datatype Block<Hash,Transaction,VProof> =
Block(prevBlockHash:Hash, txs:seq<Transaction>, proof:VProof)
function GenesisBlock() : Block<int,int,int> {
Block(0, [], 0)
}
method IsGenesisBlock(b : Block<int,int,int... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue196.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,399 | e27f5622faffb3b3afb8d2a47663de99b346d9406311bd792665daff11ee948f | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
class A {
var a: array<array<int>>
constructor(b: array<array<int>>) {
var c := b;
a := b;
}
}
method sub(a: array<array<int>>)
requires a.Length > 0
requires a[0].Length > 0
{
print a[0][0], " ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue2.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,735 | 26c24255a443bf4acf227bcebff9acb2b4d4a4b203ecdb186a67901918b8d535 | // RUN: %testDafnyForEachResolver "%s"
type sp_state
type operand = int
ghost function sp_op_const(c:int) : int { c }
ghost predicate {:opaque} InBounds(s:sp_state, o:operand, v:int)
{
0 <= o < 0x1_0000_0000
}
lemma lemma_K_InBounds()
ensures forall s:sp_state ::
InBounds(s, ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue20.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 330 | 3f0ddcffe8fccdb27f4a708fa7f928e8e05644a6e6d8f6aa0c35e6dcefc31fff | // RUN: %exits-with 4 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
ghost predicate {:opaque} p(i:int)
{
i == 3
}
ghost predicate {:opaque} q(x:int)
requires p(x)
ensures p(x)
{
true
}
lemma L(x:int)
requires p(x)
{
reveal_q();
assert q(x);
assert x == 3; // succeeds; should... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue203.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 504 | bdb0330f6cd18b86baf12165f21206939d9c36b4605665f784d79a04be689d47 | // RUN: %testDafnyForEachResolver "%s"
datatype Value = Res(addr: nat) | Nil()
datatype Expr = Some(body: Expr)
| None()
function f(e: Expr, fuel: nat): Value
decreases fuel, 3
{
var ret := Eval(e, fuel);
Res(0)
}
function Eval(e: Expr, fuel: nat): Value
decreases fuel... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue206.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 149 | e875ed08ef1c67c0819510ef9bdb31b06470d2e5db1c169d55ba1ecdeb5d51dc | // RUN: %testDafnyForEachResolver "%s"
datatype Foo = Bar(x: int)
method letTest() {
assert (var (Bar(a), c) := (Bar(1), 2); a) == 1;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue209.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 185 | 516d8c3777bd879158589735933b7090f9d124e21b871591eb519218724cdc69 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
ghost function F(l: seq<bool>, x: bool, js: seq<int>): bool {
forall i, j :: js[i] < j < js[i + 1] ==> l[j] == x
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue210.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 160 | 6a5dcfc6be118920801f6f6ad08abded1f129860e415c0779469563fe88b4f53 | // RUN: %testDafnyForEachResolver "%s"
ghost function F<A>(l: seq<A>): bool {
forall i :: 0 <= i < |l|-1 ==> l[i] == l[i + 1] || l[i] == l[i + 1]
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue22.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 119 | e08a861470ecb9dd81db89ffb986c0cd3bf7039a450b6aa323eaf30c1114131e | // RUN: %testDafnyForEachResolver "%s" -- --allow-warnings
ghost predicate bad()
{
forall i :: i in {1}
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue225.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,094 | fc2e0f9d49148f5d283a317bc8d62d56bfeb08f457463ea75737e73396ddfc87 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module SiblingImport {
abstract module AbstractModule {
method Print() { print "hello\n"; }
}
module SiblingModule {
import AbstractModule // error: cannot import abstract module into a non-abstract module
method Test() {
A... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue228.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,367 | f92d317f384d0c3e3db7e865e00d4e7789af4619f2106c721e1b1f8f3590edd0 | // RUN: %exits-with 4 %build --print:- "%s" --relax-definite-assignment > "%t"
// RUN: %exits-with 4 %build --rprint:- "%s" --relax-definite-assignment >> "%t"
// RUN: %diff "%s.expect" "%t"
// Tests the pretty printing of + and *
lemma Sequences(s: seq, t: seq, u: seq)
// It's okay to drop the first set of... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue23.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 285 | 654046ce85678fec657386dea1e8602f42e28db73859f0eff8fdcdef13d248ba | // RUN: %exits-with 4 %verify --allow-axioms "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
ghost predicate {:opaque} ValidRegs()
{
forall i:int {:nowarn}:: true
}
ghost predicate mypredicate()
requires ValidRegs()
lemma mylemma()
{
assume mypredicate();
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue235.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 258 | 76a6d30bfeb73afdb92a2922bad35b5de52fd975f86df943ea1c7d08b39befeb | // RUN: %testDafnyForEachResolver "%s"
module A {
ghost predicate F(x: int) { true }
}
module B {
import I = A
lemma Test(x: int)
ensures I.F(x)
{
}
lemma TestWrapper()
{
forall x {
Test(x);
}
}
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue239.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 327 | 8b4039bb95886e8f942f1ffa90fd8ec7243dbd1aaaf78735f2d2eca9fa84507b | // RUN: %testDafnyForEachResolver "%s"
module List {
datatype list<A> = Nil | Cons(A, list<A>)
function split<A, B>(l: list<(A, B)>): (list<A>, list<B>) {
match l
case Nil => (Nil, Nil)
case Cons((x, y), xys) =>
var (xs, ys) := split(xys);
(Cons(x, xs), Cons(y, ys))
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue245.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,358 | 5eeb0be8f1adb88545be8c8adf9b6aaf9e3c293cdfd38511cc8fecd2b0f891d1 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
// Issue 245 pointed out that trait override checks ignored the optional name of function results
trait T {
// d does not name the result in either trait or class
function d(x: nat): nat
ensures d(x) < 10 + x
// f names the result in both... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue250.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 434 | 72c50c1f4b0ae4b453b1e509a2e8852d6a893644b936feb8d6cc1e9f1c52ceb3 | // RUN: %dafny /arith:1 "%s" > "%t"
// RUN: %dafny /arith:2 "%s" >> "%t"
// RUN: %dafny /arith:3 "%s" >> "%t"
// RUN: %dafny /arith:4 "%s" >> "%t"
// RUN: %dafny /arith:5 "%s" >> "%t"
// RUN: %dafny /arith:6 "%s" >> "%t"
// RUN: %dafny /arith:7 "%s" >> "%t"
// RUN: %dafny /arith:8 "%s" >> "%t"
// RUN: %dafny /a... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue254.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 511 | e03baa11edf948d0209adeaab2789e4d5154a947144bf77d12b02df097316142 | // RUN: %testDafnyForEachResolver "%s"
class Foo {}
trait InputStream extends object {
var x: int
ghost predicate Valid() reads this
method read(b: Foo)
requires Valid()
}
class ToyInputStream extends InputStream {
ghost predicate Valid() reads this {
x == 7
}
// regression test:... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue257.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 834 | d7a662351ae6da17aee702e7e0bf351410facb2970e000b16630a8afa0173671 | // RUN: %testDafnyForEachResolver "%s"
module M {
trait T {
ghost function f(): nat
}
class C extends T {
constructor () { }
ghost function f(): nat { 0 }
}
}
method Test0() {
var c := new M.C();
assert c.f() == 0;
var g: M.T := c;
assert g.f() == 0; // used to fail, bu... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue26.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 153 | 9f70c4755bd92af95b6157fab8e270e3bda84feabb7ea50f6425e26dd02ab0d6 | // RUN: %testDafnyForEachResolver "%s"
ghost function BitvectorCast(x:bv32): int
ensures x != 0 ==> BitvectorCast(x) != 0
{
x as int
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue27.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 246 | d9e4ad187a37ce0a7bf2414d0d894cbcdd2a838c93f476eeb38a1d7a298ea123 | // RUN: %testDafnyForEachResolver "%s"
type word = x | 0 <= x < 0x1_0000_0000
ghost function extract(src:map<int, word>): map<int, word>
requires forall i :: 0 <= i < 0x10 ==> i in src
{
(map i | 0 <= i < 0x10 :: src[i])
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue28.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 182 | 07731bffc3037caf126b3e45e3565c3d9c42c553a43217f8bd65217a64689443 | // RUN: %testDafnyForEachResolver "%s"
lemma mylemma()
{
var shift:int := 1;
assume (1 as bv32 << shift) as int == 2;
assert (1 as bv32 << 1) as int == 2;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue281.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 492 | 274528ee52ca77b890cc8ff226c71517bc78ca57130f42b752e053aa9ca8fa90 | // RUN: %exits-with 2 %verify --allow-axioms "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
datatype DT = ConstrA | ConstrB
datatype Either<S,T> = Left(left: S) | Right(right: T)
datatype Error = IOError
method M() returns (ret: Either<DT,Error>)
ensures
match ret
case Left(x) =>
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue29.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 840 | 21f34e40801dc3d3820b3a7eced27c6efeb95054f277c3c20f4c43a19b1bcc7c | // RUN: %verify --relax-definite-assignment "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
ghost function Identity<T>(a:T) : T
{
a
}
ghost function SeqIdentity<T>(s:seq<T>) : seq<T>
{
s
}
ghost function ArrayIdentity<T>(a:array<T>) : array<T>
{
a
}
type uint32 = i : int | 0 <= i < 0x1_0000_0... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue3.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 131 | 240662d20544088700906365611be6d85f3f5135cee07ac55b6548e174cf859b | // RUN: %exits-with 4 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
newtype Even = n: int | exists h :: h * 2 == n
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue39.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 150 | 098ce95199a12d62b0e220f68c77a5ef303ac879bcaf12d050e53b9f88fd73ae | // RUN: %testDafnyForEachResolver "%s"
ghost function BitsAsInt(b:bv32): int
ensures 0 <= BitsAsInt(b) < 0x1_0000_0000
{
b as int
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue4.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 629 | a58838669e3367ec601c94597aeef450ee28d7882f45adbabffe1c63ece2f351 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
function IntToChar(i:int):char
requires 0 <= i < 10
{
(48 + i) as char
}
function CharToInt(i:char):int
{
i as int - 48
}
method Main() {
print IntToChar(8), "\n";
print CharToInt('8'), "\n";
Reg... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue40.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 473 | 53768972ad0a00b0e82fdc87a581835452d3dbf4708c7574585f0562febe31fd | // RUN: %testDafnyForEachResolver "%s"
ghost function SeqRepeat<T>(count:nat, elt:T) : seq<T>
ensures |SeqRepeat<T>(count, elt)| == count
ensures forall i :: 0 <= i < count ==> SeqRepeat<T>(count, elt)[i] == elt
datatype Maybe<T> = Nothing | Just(v: T)
type Num = x | 0 <= x < 10
datatype D = C(seq<M... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue41.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,569 | c471e1cab92388592b7e7be2f3494ae01eb7a4ad6d8026f3b64be1f105a55d71 | // RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation
type uint32 = i:int | 0 <= i < 0x1_0000_0000
ghost function last<T>(s:seq<T>):T
requires |s| > 0;
{
s[|s|-1]
}
ghost function all_but_last<T>(s:seq<T>):seq<T>
requires |s| > 0;
ensures |all_but_last(s)| == |s| - 1;
{
s... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue42.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 201 | 0a9b4985e5087c78ddf0ed0f832bbe26de511fd2ec73849e8c3e50df4562fdf9 | // RUN: %verify --warn-shadowing --allow-warnings "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
lemma L(x:int)
{
var x := 2;
}
lemma {:warnShadowing false} L1(x:int)
{
var x := 2;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue43.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 115 | 1fe3c2eab6c15878294639a7d51ccfdccc345d39dc64ac09a68b8dcf57a43a5e | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
class System { }
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue44.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 644 | 2408108a09e47dd73879485f69cb53d2008a09fd4a6a86497d170301159212bb | // RUN: %testDafnyForEachResolver "%s"
type uint32 = i:int | 0 <= i < 0x1_0000_0000
ghost function RepeatValue<T>(n:T, count:nat) : seq<T>
ghost function RepeatMapValue<T>(n:T, count:nat) : map<T, T>
ghost function RepeatArrayValue<T>(n:T, count:nat) : array<T>
ghost function Example1(len:nat) : seq<ui... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.