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/dafny1/ListContents.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,650
c958d688207428cdf9676cb2bb963c68d503dddb0fa27e6bf9541c548d4c86e8
// RUN: %testDafnyForEachResolver "%s" class Node<T> { ghost var List: seq<T> ghost var Repr: set<Node<T>> var data: T var next: Node?<T> ghost predicate Valid() reads this, Repr { this in Repr && (next == null ==> List == [data]) && (next != null ==> next in Repr &...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/ListCopy.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
1,529
775dff169d52898d27c4c7bbd20f8ca4dabaa3e4eacd87c66d45994d45a39f6a
// RUN: %verify --allow-deprecation --relax-definite-assignment --allow-axioms "%s" > "%t" // RUN: %diff "%s.expect" "%t" class Node { var nxt: Node? method Init() modifies this ensures nxt == null { nxt := null; } method Copy(root: Node?) returns (result: Node?) decreases * ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/ListReverse.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
926
2d01f35a43f3107efdc216a1c989c39df0209195e3fc32b6a79da39ba5627c76
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation class Node { var nxt: Node? method ReverseInPlace(x: Node?, r: set<Node>) returns (reverse: Node?) requires x == null || x in r; requires (forall y :: y in r ==> y.nxt == null || y.nxt in r); // region closure modifies r; en...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/MatrixFun.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,832
c71aa7d02b4a1c4306ad27ab4df5362a676e3f6ac839cf859769ec0d0bfadbef
// RUN: %testDafnyForEachResolver "%s" method MirrorImage<T>(m: array2<T>) modifies m ensures forall i,j :: 0 <= i < m.Length0 && 0 <= j < m.Length1 ==> m[i,j] == old(m[i, m.Length1-1-j]) { var a := 0; while a < m.Length0 invariant a <= m.Length0 invariant forall i,j :: 0 <= i &...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/MoreInduction.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,497
dc2f19e34474d372ec273337fbde099e8cdf3ec2f575a07368242eaef88659bd
// RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" datatype List<X> = Nil | Cons(Node<X>, List<X>) datatype Node<X> = Element(X) | Nary(List<X>) ghost function FlattenMain<M>(list: List<M>): List<M> ensures IsFlat(FlattenMain(list)) { Flatten(list, Nil) } ghost function Flatten<X>(list: Lis...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/pow2.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
968
fd81f4106d67c29ce4ac3fb17dc1d4636d8efab3abe2a01a19bf1c87559b0792
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation // This is a Dafny adaptation of a Coq program by David Pichardie. ghost function IsEven(n: int): bool requires 0 <= n; ensures IsEven(n) ==> n == (n/2)+(n/2); { (n/2)*2 == n } ghost function Square(n: int): int { n * n } ghost funct...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/PriorityQueue.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
5,534
38f64a3d057fbaefd6d1b2f1352a7a5291d59fae432401d03a1158c5ac36b2e1
// RUN: %testDafnyForEachResolver "%s" class PriorityQueue { var N: nat // capacity var n: nat // current size ghost var Repr: set<object> // set of objects that make up the representation of a PriorityQueue var a: array<int> // private implementation of PriorityQueue ghost predicate Valid()...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/Queue.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
4,505
2fdaf0ee0662e100a4c625028aca3700446516852c364e47e290774ea28d7563
// RUN: %testDafnyForEachResolver "%s" // Queue.dfy // Dafny version of Queue.bpl // Rustan Leino, 2008 class Queue<T(0)> { var head: Node<T> var tail: Node<T> ghost var contents: seq<T> ghost var footprint: set<object> ghost var spine: set<Node<T>> ghost predicate Valid() reads thi...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/Rippling.legacy.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
12,791
70403eec04b1dbba5237f208792729150f1c8975a4522f73a25ece8e7bf92ae1
// RUN: %dafny /compile:0 /deprecation:0 /induction:3 /dprint:"%t.dprint" "%s" > "%t" // RUN: %diff "%s.expect" "%t" // Datatypes datatype Bool = False | True datatype Nat = Zero | Suc(Nat) datatype List = Nil | Cons(Nat, List) datatype Pair = Pair(Nat, Nat) datatype PList = PNil | PCons(Pair, PList)...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/SchorrWaite-stages.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
13,777
80890ceae3af2f763085c54a540e05467531f82ed4b13d8cc3adedfb4208b5e2
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation --verification-time-limit=90 --cores:1 // Schorr-Waite algorithms, written and verified in Dafny. // Rustan Leino // Original version: 7 November 2008 // Version with proof divided into stages: June 2012. abstract module M0 { // In this modul...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/SchorrWaite.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
12,927
157d0ea662c92a35b8c737aeef4b1c8aee707badcbc2c90f787a74f721095ef6
// RUN: %testDafnyForEachResolver "%s" -- --performance-stats=1 --bprint=%t.bpl // Rustan Leino // 7 November 2008 // Schorr-Waite and other marking algorithms, written and verified in Dafny. class Node { var children: seq<Node?> var marked: bool var childrenVisited: nat ghost var pathFromRoot: Pa...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/SeparationLogicList.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
5,352
87ff795942a537c00cf1b38a74b29813481887acd2ef9eae48d5c1829dc98689
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation // This file contains three variations of the separation-logic lseg linked-list example. // In this first variation, the auxiliary information about the contents represented by a linked list // and the subpart of the heap that the list occupies is p...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/Substitution.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,885
2fc087e0b4e3991349847971dda377fa4b62fc16796f6f6715e8b23f61a07adf
// RUN: %verify --allow-deprecation --manual-triggers "%s" > "%t" // RUN: %diff "%s.expect" "%t" datatype List = Nil | Cons(Expr, List) datatype Expr = Const(int) | Var(int) | Nary(int, List) ghost function Subst(e: Expr, v: int, val: int): Expr { match e case Const(c) => e case Var(x) => i...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/SumOfCubes.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,355
22e0b76ad98622ab21af02a270d29c320a34ea9cd8bfc8e72b5af4f91561378f
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation class SumOfCubes { static ghost function SumEmUp(n: int, m: int): int requires 0 <= n && n <= m; decreases m - n; { if m == n then 0 else n*n*n + SumEmUp(n+1, m) } static method Socu(n: int, m: int) returns (r: int) req...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/TerminationDemos.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,195
8866fddb6746f04d89d249fb985615ff32215abe8fed44467401342e241e2d11
// RUN: %testDafnyForEachResolver "%s" class Example { method M(n: int) { var i := 0; while i < n { i := i + 1; } } } // ----------------------------------- class Fibonacci { ghost function Fib(n: int): int { if n < 2 then n else Fib(n-2) + Fib(n-1) } } ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/TreeDatatype.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,124
08fd2892263feca5e32bab554daa354af29df930ed9bb91a71148ed7f27592d0
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation // ------------------ generic list, non-generic tree datatype List<T> = Nil | Cons(T, List<T>) datatype Tree = Node(int, List<Tree>) ghost function Inc(t: Tree): Tree { match t case Node(n, children) => Tree.Node(n+1, ForestInc(children)...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/UltraFilter.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,334
6a99adc7b6850a7db9f71ca320ad8cb30f8c11b5e6be1a5840b3cb29d745744c
// RUN: %testDafnyForEachResolver "%s" // ultra filter type G(==) ghost predicate IsFilter(f: set<set<G>>, S: set<G>) { (forall A, B :: A in f && A <= B ==> B in f) && (forall C, D :: C in f && D in f ==> C * D in f) && S in f && {} !in f } ghost predicate IsUltraFilter(f: set<set<G>>, S: se...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny1/UnboundedStack.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,469
7cadc6add4ab9fdc00e480b98cf2f32a65090b6c8f56991af17eb71b50ea1fab
// RUN: %testDafnyForEachResolver "%s" class UnboundedStack<T> { ghost var representation: set<object> ghost var content: seq<T> var top: Node?<T> ghost predicate IsUnboundedStack() reads this, representation { this in representation && (top == null ==> content == []) && ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/CalcDefaultMainOperator.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,891
bb887da703c1d2d37219f5883e07ca8f4060c5370f8db690113004e7d00ce09a
// RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" -- --rprint:- lemma TestBool(F: bool, T: bool) requires F==false && T==true { calc { // <== false; T; // error: this step does not hold F; // note: this step holds with main operator ==> } calc { // ==> ((true)); ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/Calculations.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
7,265
1befbfb4a9eb0698d64bc5a4b488b5022fb26181e3ecf68f9369479e998de021
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation /* Lists */ // Here are some standard definitions of List and functions on Lists datatype List<T> = Nil | Cons(T, List) ghost function length(l: List): nat { match l case Nil => 0 case Cons(x, xs) => 1 + length(xs) } ghost function ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/Classics.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
3,662
1cd918aae18a13ba4a42c6b0c00111c0cade31173e3c06a5042faeabbf9192ca
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation // A version of Turing's additive factorial program [Dr. A. Turing, "Checking a large routine", // In "Report of a Conference of High Speed Automatic Calculating Machines", pp. 67-69, 1949]. ghost function Factorial(n: nat): nat { if n == 0 then...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/COST-verif-comp-2011-1-MaxArray.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
3,153
632abe5251d13c8d72aabac7a226531953e7d91d28d44733fac58144724690cb
// RUN: %testDafnyForEachResolver "%s" /* Rustan Leino, 5 Oct 2011 COST Verification Competition, Challenge 1: Maximum in an array http://foveoos2011.cost-ic0701.org/verification-competition Given: A non-empty integer array a. Verify that the index returned by the method max() given below points to an ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/COST-verif-comp-2011-2-MaxTree-class.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
5,470
71a3bd74b393311548e12c619b0d3cdc1b23a4e6f16822564cb1c20824a931f5
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation /* Rustan Leino, 5 Oct 2011 COST Verification Competition, Challenge 2: Maximum in a tree http://foveoos2011.cost-ic0701.org/verification-competition Given: A non-empty binary tree, where every node carries an integer. Implement and verify a ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/COST-verif-comp-2011-2-MaxTree-datatype.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
3,013
4aa2da549aae3bcbe424701f6369bed992c29f99a56bff6d170116bac0396134
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation // This Dafny program was inspired by Claude Marche's Why3ML program that solves // Challenge 2 of the COST Verification Competition. It particular, it uses an // inductive datatype for the Tree data structure, and it uses a Contains function // def...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/COST-verif-comp-2011-3-TwoDuplicates.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
5,395
b6143203da688446322922a11d10cd694184c4269aa9b100a3a6f965858ebdf4
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation /* Rustan Leino, 5 Oct 2011 COST Verification Competition, Challenge 3: Two equal elements http://foveoos2011.cost-ic0701.org/verification-competition Given: An integer array a of length n+2 with n>=2. It is known that at least two values store...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/COST-verif-comp-2011-4-FloydCycleDetect.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
19,536
b8a489aa2e5bcef215fc2cf50be4e3def236876198be1343a061838021060f6a
// RUN: %verify "%s" > "%t" // RUN: %diff "%s.expect" "%t" /* Rustan Leino, 6 Oct 2011 COST Verification Competition, Challenge 4: Cyclic list http://foveoos2011.cost-ic0701.org/verification-competition Given: A Java linked data structure with the signature: public class Node { Node next; pub...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/Intervals.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
1,873
d9ddd5c2f05d2baf21961a7866e3df610cf86ca25794705ece4bc21d35e2f159
// RUN: %testDafnyForEachResolver "%s" // The RoundDown and RoundUp methods in this file are the ones in the Boogie // implementation Source/AbsInt/IntervalDomain.cs. class Rounding { var thresholds: array<int> ghost function Valid(): bool reads this, thresholds { forall m,n :: 0 <= m < n ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/MajorityVote.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
16,772
2e320d4badad7781c547bc41c6740fc27fe8d1aa48e6d9cb4399e3574d89f412
// RUN: %testDafnyForEachResolver "%s" // Rustan Leino, June 2012. // This file verifies an algorithm, due to Boyer and Moore, that finds the majority choice // among a sequence of votes, see http://www.cs.utexas.edu/~moore/best-ideas/mjrty/. // Actually, this algorithm is a slight variation on theirs, but the ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/MinWindowMax.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
6,690
a372111221112795fc032e3aa05c4a930e764018d0a1a5c87bd8124b7732c47e
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment // Minimum window-max problem. // Rustan Leino // 1 March 2018 // The problem is to find the minimum window-max in a given array. // A window-max is the maximum value in a contiguous subsequence of W // array elements....
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/MonotonicHeapstate.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
4,322
2b6ee3b3b817cda391535e8d68d6aae41cfce5f39503f2da41dd15515085e89a
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation module M0 { datatype Kind = Constant | Ident | Binary class Expr { var kind: Kind var value: int // value if kind==Constant; id if kind==VarDecl; operator if kind==Binary var left: Expr? // if kind==Binary var right: Expr? ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/pq-intrinsic-extrinsic.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
8,269
d6e30b21d48d34335245817eb1848987c67baa20579a817ac603a33da568e407
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment // This file contains several versions of a priority queue implemented by Braun trees: // // PriorityQueue_extrinsic // +--PriorityQueue_layered // +--PriorityQueue_intrinsic // +--PriorityQueue_on_intrinsic ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/SegmentSum.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
897
411b024a364726b48cbe9854921a80b0ec1600ae6e0212c6d7e9a54668fda659
// RUN: %testDafnyForEachResolver "%s" ghost function Sum(a: seq<int>, s: int, t: int): int requires 0 <= s <= t <= |a| { if s == t then 0 else Sum(a, s, t-1) + a[t-1] } method MaxSegSum(a: seq<int>) returns (k: int, m: int) ensures 0 <= k <= m <= |a| ensures forall p,q :: 0 <= p <= q <= |a| ==> S...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/SmallestMissingNumber-functional.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
7,658
ba60c108cabdf4f67fbbafb83a3474be1f719bb0d96abc25f049cde238f0109d
// RUN: %testDafnyForEachCompiler "%s" -- --allow-warnings --relax-definite-assignment // Smallest missing number problem, functional version without duplicates. // A purely functional solution to the programming problem in Richard Bird's // "Pearls of Functional Algorithm Design". // Rustan Leino, 22 Feb 2018 ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/SmallestMissingNumber-imperative.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
3,564
234d8d14a90ab74fae58ea50d78cdfaae738338335b5b37771fd4b1c08a85ac9
// RUN: %testDafnyForEachCompiler "%s" -- --relax-definite-assignment // Smallest missing number. // An imperative solution to the programming problem in Richard Bird's // "Pearls of Functional Algorithm Design". // Rustan Leino, 19 Feb 2018 method Main() { var a := new nat[][3, 6, 23, 9]; var s := Small...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/SnapshotableTrees.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
22,190
a7865be214622f89886e50a453d8dfdb55e0e66f5ead4e58eb10842fae4691bc
// RUN: %exits-with 4 %run --solver-option="O:smt.qi.eager_threshold=80" "%s" > "%t" // re-enable the following before long // %diff "%s.expect" "%t" // Rustan Leino, September 2011. // This file contains a version of the C5 library's snapshotable trees. A different verification // of a version like this has be...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/StoreAndRetrieve.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,856
0b8a97c962ec23231370f39686e7e08d391d6a4e0acb44996d342339e5ab7cf0
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --allow-deprecation --relax-definite-assignment // This file shows an example program that uses both refinement and :autocontracts // specify a class that stores a set of things that can be retrieved using a query. // // (For another example that use...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/TreeBarrier.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
4,160
a626f3ce643459113392a5bcbb80daa3fc05e083a19698134e8635c183b1ea8a
// RUN: %testDafnyForEachResolver "%s" class Node { var left: Node? var right: Node? var parent: Node? var anc: set<Node> var desc: set<Node> var sense: bool var pc: int ghost predicate validDown() reads this, desc { this !in desc && left != right && // not needed, bu...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/TreeFill.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
752
e0294ce9dc619919df7f145f6ba31424deb6c03cc84bffb78ed7a08300406d25
// RUN: %testDafnyForEachResolver "%s" datatype Tree<T> = Leaf | Node(Tree, T, Tree) ghost function Contains<T>(t: Tree, v: T): bool { match t case Leaf => false case Node(left, x, right) => x == v || Contains(left, v) || Contains(right, v) } method Fill<T>(t: Tree, a: array<T>, start: int) return...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/TuringFactorial.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
579
a030f3f6580e71b26b068aad4c94c5aa6b1199764512d1eaacfdf4a5eb59eece
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation ghost function Factorial(n: nat): nat { if n == 0 then 1 else n * Factorial(n-1) } method ComputeFactorial(n: int) returns (u: int) requires 1 <= n; ensures u == Factorial(n); { var r := 1; u := 1; while (r < n) invariant r ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny2/Z-BirthdayBook.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
8,896
c13b75aa9cc1666576b6aad3a098c24142fd6041ef61800090abbb6cf3fe8a16
// NONUNIFORM: https://github.com/dafny-lang/dafny/issues/4108 // RUN: %run "%s" > "%t" // RUN: %diff "%s.expect" "%t" // The birthday book example from the Z Reference Manual // Rustan Leino, 22 Feb 2018 // This file contains the BirthdayBook example from the Z Reference // manual. The comments in the code r...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/Abstemious.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
5,096
7faae51b33c907d0f8200e82b30a11619d03a55433cd106376588a3cf2fa670d
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment --type-system-refresh=false --general-newtypes=false // Examples from https://www.haskell.org/tutorial/functions.html method Main() { var n := 7; Print(n, "ones()", ones()); Print(n, "from(3)", from(3)); Print...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/AbstemiousErrors.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
1,590
c365d3034e05417e0c86b752574788aa8ac1cb43fa57650b1262b85881971dc1
// RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" codatatype Stream<T> = Cons(head: T, tail: Stream<T>) // ----- ghost function {:abstemious} TrivallyGood(): Stream<int> { Cons(0, TrivallyGood()) } ghost function {:abstemious} Inc(s: Stream<int>): Stream<int> { Cons(s.head + 1, Inc(s.ta...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/CachedContainer.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
6,157
2ac36b256ffe2143e89c440113d9113fdf1d7f24a99237e6e6fc95d635466b6d
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --allow-deprecation --relax-definite-assignment // This file contains an example chain of module refinements, starting from a // simple interface M0 to an implementation M3. Module Client.Test() is // verified against the original M0 module. Module Ca...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/CalcExample.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
5,971
d8e02fe8b0b6adbc29d139ee558eed51f5be9cf44c6502a05904a73210ce3f31
// RUN: %testDafnyForEachResolver "%s" // Here is a function "f" and three axioms (that is, unproved lemmas) about "f": ghost function f(x: int, y: int): int lemma Associativity(x: int, y: int, z: int) ensures f(x, f(y, z)) == f(f(x, y), z) lemma Monotonicity(y: int, z: int) requires y <= z ensur...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/Dijkstra.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,222
8aead001a567737fe1ec502c4c29fe010d33af4d960a9d7eab1af6092b5e2b27
// RUN: %testDafnyForEachResolver "%s" // Example taken from: // Edsger W. Dijkstra: Heuristics for a Calculational Proof. Inf. Process. Lett. (IPL) 53(3):141-143 (1995) // Transcribed into Dafny by Valentin Wüstholz and Nadia Polikarpova. // f is an arbitrary function on the natural numbers ghost function f...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/EWD-1062.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
3,773
540d4879c88491b51a2999e2fe5f85020ae7ca4f27d8e183a644c230b8cad6dd
// RUN: %testDafnyForEachResolver "%s" // Rustan Leino, 17 Jan 2018. // A transcription of a little proof calculation by E.W. Dijkstra, see: // http://www.cs.utexas.edu/users/EWD/ewd10xx/EWD1062.PDF // Let "Below" be a reflexive, transitive relation over some type T. // These properties are introduced as axi...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/Filter.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
7,499
63bcbd2ce6faf5de5e993b302b4c368c261afeaa9a7f64eaaf9fc542d8120e9c
// RUN: %verify "%s" > "%t" // RUN: %diff "%s.expect" "%t" codatatype Stream<T> = Cons(head: T, tail: Stream) ghost function Tail(s: Stream, n: nat): Stream { if n == 0 then s else Tail(s.tail, n-1) } ghost predicate In<T>(x: T, s: Stream<T>) { exists n :: 0 <= n && Tail(s, n).head == x } greatest pr...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/GenericSort.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
6,437
63f1e52ee22bdb12eb78a0373f347a615f23f82b13c3f2bd01dc230650b78929
// RUN: %testDafnyForEachResolver "%s" abstract module TotalOrder { type T // the type to be compared predicate Leq(a: T, b: T) // Leq(a,b) iff a <= b // Three properties of total orders. Here, they are given as unproved // lemmas, that is, as axioms. lemma Antisymmetry(a: T, b: T) requires Le...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/Inc.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
8,236
6f7f7b362bf2b23610d5e133181ddd8f7b68a22e13d6da4ec94c78d1d35de11b
// RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" datatype cmd = Inc | Seq(cmd, cmd) | Repeat(cmd) type state = int // ---------- ORDINAL ---------- least predicate BigStep(c: cmd, s: state, t: state) { match c case Inc => t == s + 1 case Seq(c0, c1) => exists s' :: BigStep(c0,...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/InductionVsCoinduction.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
4,286
a1aaf99b06a19e942d3dc52fc4b5c8310a11fd527971409486e46a0928dc207c
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation // A definition of a co-inductive datatype Stream, whose values are possibly // infinite lists. codatatype Stream<T> = SNil | SCons(head: T, tail: Stream<T>) /* A function that returns a stream consisting of all integers upwards of n. The sel...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/InfiniteTrees.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
22,467
0b7c98d8fd9010a0d839d83b0fe2bffe8f51f540c13ecdb66aa03f78a0286b43
// RUN: %verify --type-system-refresh=false --general-newtypes=false "%s" > "%t" // RUN: %diff "%s.expect" "%t" // Here is the usual definition of possibly infinite lists, along with a function Tail(s, n), which drops // n heads from s, and two lemmas that prove properties of Tail. codatatype Stream<T> = Nil | ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/Iter.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,659
d09ed92565bc1707f1233e2a203abbf4841a683aaf6c2af7eaeac04775a3fcd0
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment class List<T> { ghost var Contents: seq<T> ghost var Repr: set<object> var a: array<T> var n: nat ghost predicate Valid() reads this, Repr ensures Valid() ==> this in Repr { this in Repr &...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/OpaqueTrees.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
1,079
8b8e9bff7ae946e9ab23a5da5f055fa45012e6b4c226f00f1ac1ebe59e4b2c63
// RUN: %testDafnyForEachResolver "%s" datatype Tree<T> = Leaf(T) | Node(Tree, Tree) ghost function {:opaque} size(t: Tree): nat { match t case Leaf(_) => 1 case Node(left, right) => 1 + size(left) + size(right) } ghost function {:opaque} mirror<T>(t: Tree<T>): Tree<T> { match t case Leaf(_...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/Paulson.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
5,410
bbe5f7d2e64a666c5458021ac87af4800d45a32bc1a537270e78f7179a6650db
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation // The following are Dafny versions from Section 8 of // "Mechanizing Coinduction and Corecursion in Higher-order Logic" // by Lawrence C. Paulson, 1996. codatatype LList<T> = Nil | Cons(head: T, tail: LList) // Simulate function as arguments d...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/SetIterations.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
1,529
8401a14b5adcd609e938f900a5e9d3d81278439035ac1873ccb1d67678e0009c
// RUN: %testDafnyForEachResolver "%s" ghost function Count<T>(s: set<T>): int { if s == {} then 0 else var x :| x in s; // let x be such that "x in s" 1 + Count(s - {x}) } method Copy<T>(s: set<T>) returns (t: set<T>) ensures s == t { t := {}; var r := s; while r != {} invaria...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/SimpleCoinduction.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,459
0ed2f03b47911e238c761fa10103fe1e6b2313a668ab2dfdbb08c4404746f6b7
// RUN: %testDafnyForEachResolver "%s" codatatype Stream<T> = Cons(head: T, tail: Stream) codatatype IList<T> = Nil | ICons(head: T, tail: IList) // ----------------------------------------------------------------------- greatest predicate Pos(s: Stream<int>) { s.head > 0 && Pos(s.tail) } ghost func...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/SimpleInduction.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,425
865b2d0b942635adc13c96b8cf37ca5106decb06eee89298cfaf021505bf3bf0
// RUN: %testDafnyForEachResolver "%s" /* The well-known Fibonacci function defined in Dafny. The postcondition of method FibLemma states a property about Fib, and the body of the method is code that convinces the program verifier that the postcondition does indeed hold. Thus, effectively, the method...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/Streams.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
11,040
61e0deb72d0381cd7ad6fd51a5f553ca08aa41ac6f83e31e172d06cfb475f07b
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation // ----- Stream codatatype Stream<T> = Nil | Cons(head: T, tail: Stream) ghost function append(M: Stream, N: Stream): Stream { match M case Nil => N case Cons(t, M') => Cons(t, append(M', N)) } // ----- f, g, and maps type X gh...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/WideTrees.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
1,170
ef3bf95d4a053cb985556b71036247f4fba1d4f65ed4b06a10cdd761f9412350
// RUN: %verify "%s" > "%t" // RUN: %diff "%s.expect" "%t" codatatype Stream<T> = SNil | SCons(head: T, tail: Stream) datatype Tree = Node(children: Stream<Tree>) // return an infinite stream of trees ghost function BigTree(): Tree { Node(BigTrees()) } ghost function BigTrees(): Stream<Tree> decreases...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny3/Zip.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,518
8c23abdd4df0ca8851ca47b6e51fa0b1f0b4e230fddb55112cff17d7cb86e685
// RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation /* Here, we define infinite streams with some functions and prove a few properties, drawing from: Daniel Hausmann, Till Mossakowski and Lutz Schroder: Iterative Circular Coinduction for CoCasl in Isabelle/HOL. Some proofs are automatic (Eve...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Ackermann.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
6,842
dfe90acbf04326dd571d482df5a26f2b84179a435b14cadc872459115d45eb60
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --allow-warnings --relax-definite-assignment // Rustan Leino, 8 Sep 2015. // This file proves that the Ackermann function is monotonic in each argument method Main() { // Note, don't try much larger numbers unless you're prepared to wait! prin...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/ACL2-extractor.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
7,257
b98734d05e98f77e79d0b0849582a24c661bfe9927157e0285b4c9df9ceccfd2
// RUN: %verify --solver-option="O:smt.qi.eager_threshold=30" "%s" > "%t" // RUN: %diff "%s.expect" "%t" // This is the Extractor Problem from section 11.8 of the ACL2 book, // "Computer-Aided Reasoning: An Approach" by Kaufmann, Manolios, and // Moore (2011 edition). datatype List<T> = Nil | Cons(head: T, tai...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/BinarySearch.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,052
aca6b57044233a8d61ad0342bdb36d1a63fb4f95c0d498f90eff82e9f5bb3ca8
// RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" // Binary search using standard integers method BinarySearch(a: array<int>, key: int) returns (r: int) requires forall i,j :: 0 <= i < j < a.Length ==> a[i] <= a[j] ensures 0 <= r ==> r < a.Length && a[r] == key ensures r < 0 ==> key !in a[..]...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug100.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
514
8d3094f8eb86730dd9ebbaaa6f3a51d68498ddc0f89e439814b8c75991b8e4a1
// RUN: %verify --relax-definite-assignment --allow-axioms "%s" > "%t" // RUN: %diff "%s.expect" "%t" lemma lemma_ensures(x:int, RefineInt:int->int) requires forall y :: RefineInt.requires(y) ensures forall y :: RefineInt(y) + x == RefineInt(x) + y ghost function Identity(z:int) : int lemma test() ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug101.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
295
7440ee0c8a4d721d6d927875a040c8490f81718282bad57767b33ab619cd18ba
// RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" ghost predicate P(i:int) { true } lemma Tester() { // forall i ensures false ==> P(i) {} forall i ensures P(i) <== false {} assert forall i :: P(i) ==> false; assert P(0); assert false; }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug103.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
227
b2fb0e837930568e503bef3d8ba9ffc2e919a3b5c41bceefef9ca287a7ba93bf
// RUN: %testDafnyForEachResolver "%s" ghost predicate IsLessThanSuccesor(i:int) { i < i + 1 } lemma LemmaWithoutTriggerOnForallStatement() { forall i ensures IsLessThanSuccesor(i) { } }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug104.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
217
98256ea45f22e8dea7bbce984c559e7d89ea83a92f687aa5261b0f792b8436b3
// RUN: %testDafnyForEachResolver "%s" datatype PartRealPartGhost = PartRealPartGhost(x:int, ghost y:int) method UpdateField() { var v := PartRealPartGhost(3, 4); ghost var g := 5; v := v.(y := g); }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug107.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
198
3b2db543bff4287fb32879885f20c53988c897cf2887b2a32d6501ebb98dd09d
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment method Main() { var f := Inc; print(f(4)); } function Inc(x: int): int { x + 2 }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug108.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
231
5146a70fa25f5b5f41c2acc980dae02a327da805db030d60ae487de2c92e9b49
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment method Main() { var A := map[0 := 1]; var B := map x | x in (set y | y in A) :: A[x]; print A, "\n"; print B, "\n"; }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug110.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
572
dcc4ba384e7df084ac591dc3a4a9854949b8de9fbb91aae0622ca8b7e75200cc
// RUN: %testDafnyForEachResolver "%s" module Io { ghost predicate AdvanceTime(oldTime:int) { oldTime > 2 } class Time { static method GetTime() ensures AdvanceTime(1) } ghost function MaxPacketSize() : int { 65507 } class UdpClient { method Receive() ensures Ad...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug111.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
213
72ab1f918aa79d2001fb3ca9974751ac848fc77a6fc25a7526a20de5c5dd7352
// RUN: %testDafnyForEachResolver "%s" datatype A = A(i:int) datatype B = B1(a1:A) | B2(a2:A) ghost function f(b:B):int { match b { case B1(A(i)) => i case B2(A(j)) => j } }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug113.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
209
a5cf8cfe87baa4221f627aac3cf69af2e745687c9bde79aaefb251d5cc3c8150
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment datatype D = D(q:int, r:int, s:int, t:int) method Main() { print D(10, 20, 30, 40); print "\n"; }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug114.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
252
c0b33663a6201d07549fe7a0e525814dc13666bba4210f08e81a3d53bfe6af11
// RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" ghost function f1(d:int):map<int,int> ghost function f2(y:int, d:int):int method M(m:map<int,int>, d:int, x2:int) { assert forall d :: f1(d) == (map x | x in m :: f2(x, d)); }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug116.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
874
4d56484af06f5c0898632a3fbdada7b4a49b63bc005be54979a9fb0e2d62f003
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment // test various compiler-target keywords datatype struct = S // C# keyword datatype byte = arguments // JavaScript keyword method Main() { var s := S; var t: struct; var b := arguments; print s, " ", b, ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug117.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
802
a680b5c730b703f01e76f4209bd98999a4a35369756cc1e1fed6e96792857eb1
// RUN: %exits-with 2 %verify "%s" > "%t" // RUN: %diff "%s.expect" "%t" abstract module AbstractModule1 { type AbstractType1 } abstract module AbstractModule2 { import opened AM1 : AbstractModule1 datatype AbstractType2 = AbstractType2(x:AbstractType1) } abstract module AbstractModule3 { impor...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug118.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
253
06ee10440aefb471fc073b16488f18473a28d2238b79393bf4614ce489306297
// RUN: %testDafnyForEachResolver "%s" class Foo { ghost var Repr: set<object> } ghost function SeqRepr(s:seq<Foo>) : set<object> reads set b | b in s { set o,b | b in s && o in b.Repr :: o // Works if you say "set b,o | ..." }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug120.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
205
3c2f7b45dceaa931d253363d27a82117933e4130be75db4fd4c9337ae9e3252e
// RUN: %verify --disable-nonlinear-arithmetic "%s" > "%t" // RUN: %diff "%s.expect" "%t" ghost function G(n: nat): nat { if n == 0 then 5 else G(n-1) } method Test() { assert G(10) == 5; }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug121.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
191
c81c61a224f022592e6ccac4bad3a013432aeba2255bc75474fef8151d1a21af
// RUN: %testDafnyForEachResolver "%s" -- --allow-warnings method Try (a:int, b:int, c:int) { forall ensures a * c == a * c ensures b * c == b * c { } }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug122.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
141
6f69d8ad5d9f27741e14ab15420b68990f001535c782dcef3def6287dd5ff113
// RUN: %testDafnyForEachResolver "%s" -- --allow-warnings method Try (a:int) { forall ensures a == a { } }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug124.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
357
ea43e7f68048d71974fdda13a879a7659b12850e950921fd9e56fb598c44dda5
// RUN: %verify --disable-nonlinear-arithmetic --allow-axioms "%s" > "%t" // RUN: %diff "%s.expect" "%t" ghost function power(n:nat, e:nat) : int lemma lemma_power() ensures forall n:nat, e:nat :: 0 <= n * e && power(n, e) == 5 { forall n:nat, e:nat ensures 0 <= n * e && power(n, e) == 5 ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug125.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
2,016
dd5c3c701c407d4e9720a37b207ec6bb1bcc001fbf1f281f8c4be61773ba79ff
// RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s" // Here is the example reported in issue #125 to cause a crash in Dafny. // The crash has been fixed. However, the semantics is not what is suggested // in a comment in that bug report. The semantics suggested there said // that the opened AMA.T woul...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug125more.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
1,380
f693fc2418898f4d076282a46e3b5777e91a25f85d4eea7cb840644d15c67888
// RUN: %exits-with 4 %verify "%s" > "%t" // RUN: %diff "%s.expect" "%t" // See comments in Bug125.dfy module LibA { ghost function g(): int { 0 } } module LibB { ghost function g(): int { 1 } } module R { import opened LibA } /* module S0 refines R { // This module defines a local g(). I...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug128.legacy.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
356
4d01e76d9bd57cf20f44e8a89c0513bdaee297a4a01c3ea7aedba7759e4794fe
// RUN: %dafny /noNLarith /proverOpt:O:pi.warnings=true /proverWarnings:1 /compile:0 "%s" > "%t" // RUN: %diff "%s.expect" "%t" ghost function GetIndexInSequence<T>(s:seq<T>, x:T) : int requires x in s ensures 0 <= GetIndexInSequence(s, x) < |s| ensures s[GetIndexInSequence(s, x)] == x { var i :| 0 <= i ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug129.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
214
1ce1f7477ea1c1101ec92875a98ef17c3fd820203fed745d6ff91b9dff6dd590
// RUN: %testDafnyForEachResolver "%s" datatype Maybe<T> = Some(v:T) | None datatype B = B(b:Maybe<B>) datatype List<T> = Nil | Cons(T, List<T>) datatype Tree<T> = Nodes(children: List<Tree<T>>)
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug131.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
157
a8af6ed4bf5d5866482f0bb74963b05432c5b2f618533869e4a1fae194d4c3c8
// RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s" class Cell { method Test(c: Cell) { assert c.F(); } } ghost predicate F()
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug132.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
1,724
28e451105a4a7d669f24f80c20a15e127e5a60b7cfaf4dcd7506f727ce424089
// RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" class Cell { var data: int ghost predicate P() reads this { data < 0 } ghost predicate Q(e: Cell?) reads this, e { e != null ==> e.data == data } method Test() { ghost var b; var c := new Cell; if { ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug133.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
346
892dab809f01d81a0c42e3b1e41c27394b19c077c7bc830a2a1959ae276fc69e
// RUN: %verify --disable-nonlinear-arithmetic "%s" > "%t" // RUN: %diff "%s.expect" "%t" module Math__div_def_i { function my_div_pos(x:int, d:int) : int requires d > 0 decreases if x < 0 then (d - x) else x { if x < 0 then -1 + my_div_pos(x+d, d) else if x < d then 0 else 1 + my_di...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug134.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
387
5c1d91aa97b124e742fcb4db3fdb40ed10a5ae72c6fbd5bcd87d2d7039930cd9
// RUN: %testDafnyForEachResolver "%s" module NativeTypes { newtype{:nativeType "ushort"} uint16 = i:int | 0 <= i < 0x10000 } abstract module AbstractModuleA { import opened NativeTypes datatype T = T(i:uint16) } abstract module AbstractModuleB { import opened A : AbstractModuleA } abstract m...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug136.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
110
e5008582c94772fd86ca1d4f7b0683f067b23ec093e7ac6f21c86386d00bbcb2
// RUN: %testDafnyForEachResolver "%s" method test() { assume false; assert true; }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug138.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
495
9c4b33a1375e90612d46ed759f759cbcfb0f7e5ae861be6942a3c31ab2b53d76
// RUN: %testDafnyForEachResolver "%s" datatype List = Nil | Cons(int, List) method R(xs: List) { match xs case Nil() => // currently produces a parsing error, but shouldn't case Cons(x, Nil()) => // currently allowed case Cons(x, Cons(y, tail)) => } ghost function F(xs: List) : int { m...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug139.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
482
2417a9637c19d5a73a10e5caf8374e4cae88aeceff569e0938a5379804e54453
// RUN: %testDafnyForEachResolver "%s" datatype List = Nil | Cons(int, List) method R(xs: List) { var a: int; var b: int; match xs case Nil => case Cons(a, Nil()) => // this 'a' is allowed case Cons(x, Cons(b, tail)) => // this 'b' (which is in a nested position) generates an error } gh...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug140.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
1,408
b385d1940a492329d849d2fc886fd53d53938122b8d178aa160a4a2672a668e0
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment class Node<T> { ghost var List: seq<T> ghost var Repr: set<Node<T>> var data: T var next: Node?<T> ghost predicate Valid() reads this, Repr ensures Valid() ==> this in Repr { this in Repr ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug142.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
681
2e9cddf9277ef1ddf4dbade431722979f46474b724bc3f7914f0a053f6483bb5
// RUN: %resolve --warn-shadowing --allow-warnings "%s" > "%t" // RUN: %diff "%s.expect" "%t" ghost function P(x:int):int ghost function Q(x:int):int ghost function R(x:int):int ghost function Example0(y:int) : int { var state0 := y; var state0 := P(state0); var state0 := Q(state0); var state0 := ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug144.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
780
67c4824c83e8a3821bffdf691ad065d22172b999013e8ed3aa1850da48077c59
// RUN: %exits-with 4 %verify --allow-axioms "%s" > "%t" // RUN: %diff "%s.expect" "%t" ghost predicate p(i: int) method m1() method m2() { assume exists i :: p(i); assert exists i :: p(i); m1(); assert exists i :: p(i); // this once failed, but should succeed } class Test { var arr: arra...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug145.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
574
b19671f462634bf1bc0a1ce6f3c798e72ace6ece81a8fc1a8abbb0015503d2d2
// RUN: %exits-with 4 %verify "%s" > "%t" // RUN: %diff "%s.expect" "%t" ghost function existential(mat: array2<bool>): bool reads mat { exists i, j :: 0 <= i < mat.Length0 && 0 <= j < mat.Length1 && mat[i,j] } method foo(n: int) { var mat := new bool[n,n]; forall i,j | (0 <= i < n && 0 <= ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug146.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
1,192
1c3185fd5eafdb9cb318d843560f79a3f928245df8e49f7cd6fb87820e4e20bb
// RUN: %exits-with 4 %verify "%s" > "%t" // RUN: %diff "%s.expect" "%t" function inhabited(world: array2<bool>): bool { exists i,j :: 0 <= i < world.Length0 && 0 <= j < world.Length1 && world[i,j] // error: insufficient reads clause } method GameOfLife(size: nat, N: nat) requires 0 < size { var...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug148.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
786
9f3484f1e624f628f9990b748d02f34e4e173d0a4fe1c4ab398ff1ce8750595a
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment method Main() { var zero : real := 0.0; var three : real := 3.0; var fifteen : real := 15.0; var negone : real := -1.0; var negthree : real := -3.0; print zero <= fifteen, "\n"; // true ...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug150.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
210
96476f251de417ede36dd0e1cdd579ae44bad2efcaa90c0a2f83a757c31c8996
// RUN: %testDafnyForEachResolver "%s" ghost function foo(s:seq<int>) : (int, int) { (0, 0) } method pop_run_impl() { var a := new int[10]; var i := 0; ghost var (x,y) := foo(a[..i+1]); }
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug151.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
681
02aced42cabc840706cbc59f62d8c07a6ffcd61acf1651e19edff5568adb607f
// RUN: %testDafnyForEachResolver "%s" method foo(xs: set) { assert (set x | x in xs) == xs; } method bar(xs: iset) { assert (iset x | x in xs) == xs; } ghost function domain<U, V>(m: map<U,V>): set<U> ensures forall i :: i in domain(m) ==> i in m ensures forall i :: i in domain(m) <== i in...
dafny-lang/dafny
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug155.dfy
NOASSERTION
3,473
master
368adac6150e6a3825fe2f605dca71353badc779
2026-07-21T22:46:38Z
112
e392631cbf64195480ccb0692b1190e1663a880f16ad0613cb17e8337890863e
// RUN: %testDafnyForEachResolver "%s" ghost function foo(m: multiset<object>): int reads m { 0 }