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
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/MIEIC_mfes_tmp_tmpq3ho7nve_TP3_binary_search.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,674
d1c42b83eb24597507a0597981a4db3068328947c157ba65ac27c355b6a5dadc
// Checks if array 'a' is sorted. predicate isSorted(a: array<int>) reads a { forall i, j :: 0 <= i < j < a.Length ==> a[i] <= a[j] } // Finds a value 'x' in a sorted array 'a', and returns its index, // or -1 if not found. method binarySearch(a: array<int>, x: int) returns (index: int) requires ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/nitwit_tmp_tmplm098gxz_nit.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
9,583
72b13d4c2175fa4bd5efa76c8c6971d710f4b961fff318ec20a897eb26f4eb39
// Liam Wynn, 3/13/2021, CS 510p /* In this program, I'm hoping to define N's complement: a generalized form of 2's complement. I ran across this idea back in ECE 341, when I asked the professor about a crackpot theoretical "ternary machine". Looking into it, I came across a general form of 2's comp...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/paxos_proof_tmp_tmpxpmiksmt_triggers.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
289
d56d2492bba38bcad8233acbcdc327d1bcb44c2f68f4a2bc915557c0d509c9cf
// predicate P(x:int) // predicate Q(x:int) lemma M(a: seq<int>, m: map<bool,int>) requires 2 <= |a| requires false in m && true in m { assume forall i {:trigger a[i]} :: 0 <= i < |a|-1 ==> a[i] <= a[i+1]; var x :| 0 <= x <= |a|-2; assert a[x] <= a[x+1]; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Prog-Fun-Solutions_tmp_tmp7_gmnz5f_extra_mod.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
944
56a3b5c927f8dada6ba31c6556ddd722d2586f2c9482e9e61991002aea3780fc
ghost function f(n: nat): nat { if n == 0 then 1 else if n%2 == 0 then 1 + 2*f(n/2) else 2*f(n/2) } method mod(n:nat) returns (a:nat) ensures a == f(n) { var x:nat := 0; var y:nat := 1; var k:nat := n; while k > 0 invariant f(n) == x + y*f(k) invariant 0 <= k <= n ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Prog-Fun-Solutions_tmp_tmp7_gmnz5f_extra_mod2.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
774
f12e62fdd65246f7966d59f182495c62eaa002ccb6025d5ae613cfdd36076036
ghost function f2(n: nat): nat { if n == 0 then 0 else 5*f2(n/3) + n%4 } method mod2(n:nat) returns (a:nat) ensures a == f2(n) { var x:nat := 1; var y:nat := 0; var k:nat := n; while k > 0 invariant f2(n) == x*f2(k) + y invariant 0 <= k <= n decreases k { ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Prog-Fun-Solutions_tmp_tmp7_gmnz5f_extra_pow.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
563
1c2d211fd4e59f0009b6160cdc01e77647b680513d90a52e02bd4484824b99eb
ghost function pow(a: int, e: nat): int { if e == 0 then 1 else a*pow(a, e-1) } method Pow(a: nat, n: nat) returns (y: nat) ensures y == pow(a, n) { var x:nat := 1; var k:nat := 0; while k < n invariant x == pow(a, k) invariant 0 <= k <= n decreases n-k { assert ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Prog-Fun-Solutions_tmp_tmp7_gmnz5f_extra_sum.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
766
d16272f34252cf412cdd757c5386564858e9f897ea10b8a90a0262201c77ad11
ghost function sum(n: nat): int { if n == 0 then 0 else n + sum(n - 1) } method Sum(n: nat) returns (s: int) ensures s == sum(n) { var x:nat := 0; var y:nat := 1; var k:nat := n; while k > 0 invariant sum(n) == x + y*sum(k) invariant 0 <= k <= n decreases k { ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Prog-Fun-Solutions_tmp_tmp7_gmnz5f_mockExam2_p2.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
535
bdd24e4c066dd5b834dab1637d6d42b3183181195b8071b58b47ee798bc795cd
// problem 2: // name: Gabriele Berardi // s-number: s4878728 // table: XXX method problem2(p:int, q:int, X:int, Y:int) returns (r:int, s:int) requires p == 2*X + Y && q == X + 3 ensures r == X && s == Y { assert p == 2*X + Y && q == X + 3; r, s := p, q; assert r == 2*X + Y && s == X + ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Prog-Fun-Solutions_tmp_tmp7_gmnz5f_mockExam2_p3.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
626
f2d5e21c19a8381ce757f8139f061d333ceebedff4abe501e0cd7b150d35c5ed
// problem 3: // name: ....... (fill in your name) // s-number: s....... (fill in your student number) // table: ....... (fill in your table number) method problem3(m:int, X:int) returns (r:int) requires X >= 0 && (2*m == 1 - X || m == X + 3) ensures r == X { assert X >= 0 && (X == 1 - 2*m || m-3...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Prog-Fun-Solutions_tmp_tmp7_gmnz5f_mockExam2_p5.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
825
aa75501a4f585bb56f97b39c5081cc30f0d605bea66ef4de581e52de48a26163
// problem 5: // name: Gabriele Berardi // s-number: s4878728 // table: XXXX ghost function f(n: int): int { if n < 0 then 0 else 3*f(n-5) + n } method problem5(n:nat) returns (x: int) ensures x == f(n) { var a := 1; var b := 0; var k := n; while k >= 0 invariant f(n) ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Prog-Fun-Solutions_tmp_tmp7_gmnz5f_mockExam2_p6.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,155
d6993bc0f470d0a90eb32feeb660b49ba8864e4d946edaadfe7bc689e0971e77
// problem 6: // name: Gabriele Berardi // s-number: s4878728 // table: XXXXX ghost function f(n: int): int { if n <= 0 then 1 else n + f(n-1)*f(n-2) } ghost function fSum(n: nat): int { // give the body of this function // it should return Sum(i: 0<=i < n: f(i)) if n <= 0 then 0 else f(n-...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_advanced examples_ArrayMap.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,016
0d48bc4d530cfa5c326400820d7055d4da3366bdf54cfa70f477a819d56cd877
// RUN: /print:log.bpl method ArrayMap<A>(f: int -> A, a: array<A>) requires a != null requires forall j :: 0 <= j < a.Length ==> f.requires(j) requires forall j :: 0 <= j < a.Length ==> a !in f.reads(j) modifies a ensures forall j :: 0 <= j < a.Length ==> a[j] == f(j) { var i := 0; while i < a...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_advanced examples_demo.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
917
7d2b2827e559cb655c3126ddf4c0d6ba57d6e1eef4b40ceb4400bfa892b4e3ca
method Partition(a: array<int>) returns (lo: int, hi: int) modifies a ensures 0 <= lo <= hi <= a.Length ensures forall x | 0 <= x < lo :: a[x] < 0 ensures forall x | lo <= x < hi :: a[x] == 0 ensures forall x | hi <= x < a.Length :: a[x] > 0 { var i := 0; var j := a.Length; var k := a.Length; ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_advanced examples_EvenPredicate.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,212
b3f8ca7984b47cc67d97bf3b5e48b5763942a301c647383ffd30425c4330a0ed
// RUN: /compile:0 /nologo function IsEven(a : int) : bool requires a >= 0 { if a == 0 then true else if a == 1 then false else IsEven(a - 2) } lemma EvenSquare(a : int) requires a >= 0 ensures IsEven(a) ==> IsEven(a * a) { if a >= 2 && IsEven(a) { Even...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_advanced examples_GenericMax.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
684
f12cc10d34542f5fe1f82ff3e08317567278730a165694d3a59e67106a0774a2
method GenericMax<A>(cmp: (A, A) -> bool, a: array<A>) returns (max: A) requires a != null && a.Length > 0 requires forall x, y :: cmp.requires(x, y) requires forall x, y :: cmp(x, y) || cmp(y, x); requires forall x, y, z :: cmp(x, y) && cmp(y, z) ==> cmp(x, z); ensures forall x :: 0 <= x < a.Length ==...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_advanced examples_InsertionSort.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,041
ca9692de334dad2ae222dd1166ab8ceffcbe5e86ff4a457c8eeb9dcca9eab53c
predicate sorted (a:array<int>, start:int, end:int) // all "before" end are sorted requires a!=null requires 0<=start<=end<=a.Length reads a { forall j,k:: start<=j<k<end ==> a[j]<=a[k] } method InsertionSort (a:array<int>) requires a!=null && a.Length>1 ensu...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_advanced examples_MatrixMultiplication.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,424
330f53b61295077bd66360562d47fd36cd25346aa1127227939b4223dd42eb21
function RowColumnProduct(m1: array2<int>, m2: array2<int>, row: nat, column: nat): int reads m1 reads m2 requires m1 != null && m2 != null && m1.Length1 == m2.Length0 requires row < m1.Length0 && column < m2.Length1 { RowColumnProductFrom(m1, m2, row, column, 0) } function RowColumnProduc...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_advanced examples_Modules.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
578
3d935ac8d07c7de664595984fd03ccd2b4ef099bb5b37e8f6dbaf568e2e79791
// RUN: /compile:1 abstract module Interface { type T function F(): T predicate P(x: T) lemma FP() ensures P(F()) } module Implementation refines Interface { predicate P(x: T) { false } } abstract module User { import I : Interface lemma Main() ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_advanced examples_OneHundredPrisonersAndALightbulb.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,163
af80afef4a00b04d431aecf3da22120ea0af79a023d07573555aa512a720c745
// RUN: /compile:0 /nologo method CardinalitySubsetLt<T>(A: set<T>, B: set<T>) requires A < B ensures |A| < |B| decreases B { var b :| b in B && b !in A; var B' := B - {b}; assert |B| == |B'| + 1; if A < B' { CardinalitySubsetLt(A, B'); } else { assert A == B'; } } method st...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_advanced examples_Percentile.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,871
233b565edeef9d19eacf902a4b315c70f0f0ab1ce43af686a9345ee62f79de93
// Sum of elements of A from indices 0 to end. // end is inclusive! (not James's normal way of thinking!!) function SumUpto(A: array<real>, end: int): real requires -1 <= end < A.Length reads A { if end == -1 then 0.0 else A[end] + SumUpto(A, end-1) } function Sum(A: array<real>): real r...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_advanced examples_Refinement.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
534
f69ca4d209e7bce74aec5331440b97030d1a44a831808b1111408904dc090480
// RUN: /nologo /rlimit:10000000 /noNLarith abstract module Interface { function addSome(n: nat): nat ensures addSome(n) > n } abstract module Mod { import A : Interface method m() { assert 6 <= A.addSome(5); print "Test\n"; } } module Implementation refines Int...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_advanced examples_ReverseString.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,314
a9cd81c0e01d3080c6249e8752e2b70c10d921b7f9a1061a0d218aef173aedd1
// RUN: /compile:0 predicate reversed (arr : array<char>, outarr: array<char>) requires arr != null && outarr != null //requires 0<=k<=arr.Length-1 requires arr.Length == outarr.Length reads arr, outarr { forall k :: 0<=k<=arr.Length-1 ==> outarr[k] == arr[(arr.Length-1-k)] } method yarra(arr : array<cha...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_examples_bubblesort.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,758
07f916a03d2f5375c4e7b2dc94e8559a4cacafdeeac57c942e46145b5d49ab88
//https://stackoverflow.com/questions/69364687/how-to-prove-time-complexity-of-bubble-sort-using-dafny function NChoose2(n: int): int { n * (n - 1) / 2 } // sum of all integers in the range [lo, hi) // (inclusive of lo, exclusive of hi) function SumRange(lo: int, hi: int): int decreases hi - lo { if l...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_examples_relativeOrder.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,519
4306109ded14292deb45ed1550fbbef41c5f2f5b4f5fda81c54b571c4ea6ec74
predicate IsEven (n: int) { n % 2 == 0 } method FindEvenNumbers (arr: array<int>) returns (evenNumbers: array<int>) ensures forall x :: x in arr[..] && IsEven(x) ==> x in evenNumbers[..]; ensures forall x :: x !in arr[..] ==> x !in evenNumbers[..] ensures forall k, l :: 0 <= k < l < evenNumbers....
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_examples_simpleMultiplication.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
964
7735dce999ab094b2ae140d8a404e61d74e0221f4f63d4417838d440550bea1a
method Foo(y: int, x: int) returns (z: int) requires 0 <= y ensures z == x*y { var a: int := 0; z := 0; while a != y invariant 0 <= a <= y invariant z == a*x decreases y-a { z := z + x; a := a + 1; } return z; } function stringToSet(s: string): (r: set<char>) ensu...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_heap2.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,703
e0b19c76d76f3c95cd54f12ce7ad4a05fdb33d89446749251ab1e231655f41b2
class Heap { var arr: array<int> constructor Heap (input: array<int>) ensures this.arr == input { this.arr := input; } function parent(idx: int): int { if idx == 0 then -1 else if idx % 2 == 0 then (idx-2)/2 else (idx-1)/2 } predicate IsMaxHeap(input: seq<int>) { ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_leetcode_BoatsToSavePeople.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
4,750
cb3833c2ac8f1bd0655fb8c0959ed4d385015b31b6bb079683b226de13421f86
/* function numRescueBoats(people: number[], limit: number): number { //people.sort((a,b) => a-b); binsort(people, limit); let boats = 0; let lower = 0, upper = people.length-1; while(lower <= upper) { if(people[upper] == limit || people[upper]+people[lower] > limit) { b...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_leetcode_FindPivotIndex.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
4,626
7e9a19a03941e9e5a9e684d5eb04a5736a0c8d249287df41778d57182dec6669
/* https://leetcode.com/problems/find-pivot-index/description/ Given an array of integers nums, calculate the pivot index of this array. The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum of all the numbers strictly to the index's right. If the in...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_leetcode_lc-remove-element.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
891
126fee5a49bb8bd9522d66430b590b18f19e535cf21ddeff98aad1d16655f67a
//https://leetcode.com/problems/remove-element/ method removeElement(nums: array<int>, val: int) returns (i: int) ensures forall k :: 0 < k < i < nums.Length ==> nums[k] != val modifies nums { i := 0; var end := nums.Length - 1; while i <= end invariant 0 <= i <= nums.Length ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_leetcode_pathSum.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,544
7ff66d83ca766003ec01e52aaa17ed20c016410c715376874d6a1c14296fcf04
//https://leetcode.com/problems/path-sum /** function hasPathSum(root: TreeNode | null, targetSum: number): boolean { if(root == null) { return false; } if(root.val-targetSum == 0 && root.left == null && root.right == null) { return true; } return hasPathSum(root.left, targe...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_leetcode_ReverseLinkedList.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
8,530
a533d21f3dd2e744369359b1d081e0652db1eecdb1d7f5246f836d405fec8ef1
/* https://leetcode.com/problems/reverse-linked-list/description/ * class ListNode { * val: number * next: ListNode | null * constructor(val?: number, next?: ListNode | null) { * this.val = (val===undefined ? 0 : val) * this.next = (next===undefined ? null : next) * } * ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_leetcode_stairClimbing.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
6,837
5a927200c31f34c67fa69ec354105c951a92f5ccbdd240a63feb6b4f0c1ffad7
/* You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? function climbStairs(n: number): number { let steps = new Array(n+1); steps[0] = 0; steps[1] = 1; steps[2] = 2; for(let i = 3...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_leetcode_validAnagram.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,266
220058dabd5c997f46825fbb0377fbf23a6517adcf4e05249eef73615fd43770
method toMultiset(s: string) returns (mset: multiset<char>) ensures multiset(s) == mset { mset := multiset{}; for i := 0 to |s| invariant mset == multiset(s[0..i]) { assert s == s[0..i] + [s[i]] + s[(i+1)..]; // assert multiset(s) == multiset(s[0..i])+multiset{s[i]}+mu...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_lib_seq.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
16,240
167faebc687241ab1c80dc3982b4afa773d3f8ce04b8c80a418e8690a07f192c
module Seq { export reveals * function ToSet<A>(xs: seq<A>): set<A> ensures forall x :: x in ToSet(xs) ==> x in xs ensures forall x :: x !in ToSet(xs) ==> x !in xs { if xs == [] then {} else {xs[0]}+ToSet(xs[1..]) } predicate substring1<A(==)>(sub: seq<A>, super: ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_math_pearson.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
7,619
8dc8a7b19ed289b2cb2866320db663e16d905f779ef402752b1a1bd0e6162ac8
function eight(x: nat):nat { 9 * x + 5 } predicate isOdd(x: nat) { x % 2 == 1 } predicate isEven(x: nat) { x % 2 == 0 } lemma eightL(x: nat) requires isOdd(x) ensures isEven(eight(x)) { } function nineteenf(x: nat): nat { 7*x+4 } function nineteens(x: nat): nat { ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_algorithms and leetcode_ProgramProofs_ch15.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
3,057
c4f2aff4006e88aedfd9b0ba744097b6291016d1c6757366f8dbbaf7f5782441
predicate SplitPoint(a: array<int>, n: int) reads a requires 0 <= n <= n { forall i,j :: 0 <= i < n <= j < a.Length ==> a[i] <= a[j] } method SelectionSort(a: array<int>) modifies a ensures forall i,j :: 0 <= i < j < a.Length ==> a[i] <= a[j] ensures multiset(a[..]) == old(multiset(...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_basic examples_add_by_one.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,538
c3a1fe536aa41cee60dcb77e9c6987210bf02eb5cbc62d161c265879e6604855
method add_by_one (x:int, y:int) returns (r:int) requires y >= 0; ensures r == x + y; { var i:int := 0; r := x; while (i < y) invariant i <= y; invariant r == x + i; decreases y-i; { r := r + 1; i := i + 1; } return r; } ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_basic examples_add_by_one_details.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
627
9f7d4ecce16ee71891f08512bf25846425870874933e09859ddecae44dcf2336
method plus_one (x: int) returns (r:int) requires x >= 0; ensures r == x + 1; {return x+1;} method add_by_one (x:int, y:int) returns (r:int) { assume (y >= 0); var i:int := 0; r := x; assert (i <= y); assert (r == x + i); r := *; i := *; assume (i <= y); assume (r == x + i); i...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_basic examples_BubbleSort.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,101
608055ae33b14b7459b6b81f8159af91aec7782c7364bc55fd5c63affb02ef6b
predicate sorted(a:array<int>, from:int, to:int) requires a != null; reads a; requires 0 <= from <= to <= a.Length; { forall u, v :: from <= u < v < to ==> a[u] <= a[v] } predicate pivot(a:array<int>, to:int, pvt:int) requires a != null; reads a; requires 0 <= pvt < to <= a.Length; { foral...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_basic examples_BubbleSort_sol.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,231
26da783592a8c2f21805d6add28bd6361065ffecfadc5865e01287a09b92a579
predicate sorted_between (a:array<int>, from:nat, to:nat) reads a; requires a != null; requires from <= to; requires to <= a.Length; { forall i,j :: from <= i < j < to && 0 <= i < j < a.Length ==> a[i] <= a[j] } predicate sorted (a:array<int>) reads a; requires a!=null; { sorted_between ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_basic examples_find_max.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
479
2cfdc4a7050a9b1a81b89360f3129131365b59964ef8b2060195af49e0fa3d8c
method FindMax(a: array<int>) returns (max: int) requires a != null && a.Length > 0; ensures 0 <= max < a.Length; ensures forall x :: 0 <= x < a.Length ==> a[max] >= a[x]; { var i := 0; max := 0; while (i < a.Length) invariant i <= a.Length; invariant 0 <= max; invariant max == 0 ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_basic examples_product_details.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
663
416cb672193fb1eacf762b33ff6079cba8434bee8fd57221838b71f1e1f9b451
method CalcProduct(m: nat, n: nat) returns (res: nat) ensures res == m*n; { var m1: nat := m; res := 0; assert res == (m-m1)*n; m1, res := *, *; assume res == (m-m1)*n; if (m1!=0) { var n1: nat := n; assert (res == (m-m1)*n + (n-n1)); // havoc res, n1; res, n1 := *,...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_basic examples_sumto_sol.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,079
7cb5e0f646f7f2e578fba57dc54682b7cfceead4c11628733fb7687db4e6ab66
function sum_up_to (n: nat): nat { if (n == 0) then 0 else sum_up_to (n-1) + 1 } method SumUpTo (n: nat) returns (r: nat) ensures r == sum_up_to (n); { var i := 0; r := 0; while (i < n) invariant 0 <= i <= n; invariant r == sum_up_to (i); { r := r + 1; i := i + 1; } ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny0_GhostITECompilation.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,686
f0f4ecc98ecf329ba80919bbf27205215d6b35ba2666d32cb99da317b464c108
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --function-syntax:4 --relax-definite-assignment function F(x: nat, ghost y: nat): nat { if x == 0 then 0 else if y != 0 then F(x, y - 1) // this branch is not compiled (which even makes F auto-accumulator tail recursive) else F(...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny0_ModulePrint.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
861
2c49534d3db4cef10028c0c1896db17dc3df979173f3311a05db6a779648e501
// NONUNIFORM: Tests printing much more than compilation // RUN: %dafny /dafnyVerify:0 /compile:0 /env:0 /dprint:"%t.dfy" "%s" > "%t" // RUN: %dafny /dafnyVerify:0 /compile:0 /env:0 /printMode:DllEmbed /dprint:"%t1.dfy" "%t.dfy" >> "%t" // RUN: %dafny /env:0 /compile:3 /printMode:DllEmbed /dprint:"%t2.dfy" "%t1.dfy"...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny1_BDD.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,885
6c90465603bb10f5cfb831af08785d60fb4d9a9809e6481efb944f071953a9fc
// RUN: %testDafnyForEachResolver "%s" module SimpleBDD { class BDDNode { static ghost predicate bitfunc(f: map<seq<bool>, bool>, n: nat) { forall i:seq<bool> :: i in f <==> |i| == n } ghost var Contents: map<seq<bool>, bool> ghost var Repr: set<object> ghost var n: nat...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny1_ListContents.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,654
eeefc82519be0a0867ac516306514913052d29b415a7659d2ccb6ad31856c283
// 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...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny1_Queue.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
4,507
bc1491195eaab42e18dfdfb6859bab6f0532b9d7b5e6920b320c63e09ee4367c
// 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...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny2_Classics.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
3,669
a42c553994475597dce280b0f9a8191d72cc9fdf87a2d66f7bf34118bed2078e
// RUN: %testDafnyForEachResolver "%s" -- --warn-deprecation:false // 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...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny2_COST-verif-comp-2011-2-MaxTree-class.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
5,477
89e31d48b7d2da3ad31074765e890b99373996c593b96d78d1a1f057f7d89756
// RUN: %testDafnyForEachResolver "%s" -- --warn-deprecation:false /* 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 veri...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny2_COST-verif-comp-2011-3-TwoDuplicates.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
5,402
afded37c0bf363dd2d9b8efdae8138787e197de810e3bedca47556392e167841
// RUN: %testDafnyForEachResolver "%s" -- --warn-deprecation:false /* 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 ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny2_MajorityVote.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
16,774
764fa79c81b3d1cdfa80a3b2efc89a33dc0c44137ce92709f767f19f7c9b4085
// 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 ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny2_StoreAndRetrieve.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,838
b0f62d90cf31a41b09beb49761443fe1c09dff34a0bf804fb544772877530a54
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --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 uses these features, se...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny3_CachedContainer.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
6,139
97cd0f4fa49afde35b7e7f1603cbd74613fe5cbeeb3749566327df36734497ea
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --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 CachedClient instantia...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny3_CalcExample.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
5,973
9df9d58dd8aef80ad915ce57523a388d5e59f3fcf5b8de61ecdea033651c4676
// 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...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny3_InfiniteTrees.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
22,518
88b3da12427da6d74fccbc7750ab5fa65b7ef67a502fa0f73c8947e3ec935e61
// RUN: %dafny /compile:0 /deprecation:0 /dprint:"%t.dprint" "%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 | Cons(hea...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny3_Iter.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,661
dfe995c550f26a75dfa33592c0fd5cbdce4584ddb81febee3207e7ce3605bfc6
// 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 &...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny3_Streams.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
11,025
c52af90219576b867e7a0f6378c56c8cdc2fb81fc979ce74a32b1d134f022aff
// RUN: %testDafnyForEachResolver "%s" -- --warn-deprecation:false // ----- 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 ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny4_ACL2-extractor.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
7,318
1d961adf040e14c28678739bf9073e76e5001fc96c4be155c7fa9133c437ba96
// RUN: %dafny /compile:0 /deprecation:0 /proverOpt:O:smt.qi.eager_threshold=30 /dprint:"%t.dprint" "%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). data...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny4_Bug170.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,984
0ad3c2c3ed373566c440aeee6d22154dbc0cfa156850e603677a6250b45343b0
// RUN: %dafny /compile:0 /printTooltips "%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)...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny4_ClassRefinement.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,952
07b118425f887c4577f37bdcf374f4ff68dc74991accbbbe258996eae261dfa9
// RUN: %testDafnyForEachCompiler "%s" -- --relax-definite-assignment 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() ensures N == 0 ensu...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny4_NipkowKlein-chapter3.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
8,021
efd1285d891afb930294c7778f6b13e7adeefe044bf29d7ce95d64f25860ce9e
// RUN: %dafny /proverOpt:O:smt.qi.eager_threshold=30 /compile:0 /rprint:"%t.rprint" "%s" > "%t" // RUN: %diff "%s.expect" "%t" // This file is a Dafny encoding of chapter 3 from "Concrete Semantics: With Isabelle/HOL" by // Tobias Nipkow and Gerwin Klein. // ----- lists ----- datatype List<T> = Nil | Cons(h...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from dafny main repo_dafny4_Primes.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
6,261
22c8e78b125bcaa14332e17759aca7a181f5fd51f27e530a66cf20c5fb761635
// RUN: %testDafnyForEachResolver "%s" ghost predicate IsPrime(n: int) { 2 <= n && forall m :: 2 <= m < n ==> n % m != 0 // WISH It would be great to think about the status of modulo as a trigger } // The following theorem shows that there is an infinite number of primes lemma AlwaysMorePrimes(k: int) ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from_dafny_main_repo_dafny0_snapshots_Inputs_Snapshots1.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
107
1c6f40e99fb9e089a67796e9fbb976b53f5b7a0193429826ef51240ee9c7f554
method M() { N(); assert false; } method N() ensures P(); predicate P() { false }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_from_dafny_main_repo_dafny0_snapshots_Inputs_Snapshots5.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
333
f8dc263c42f732fc38029ff7102dd9dbb7a393532af7d4b529f89fc45718d621
method M() { N(); if (*) { } else { assert (forall b: bool :: b || !b) || 0 != 0; } N(); assert (forall b: bool :: b || !b) || 3 != 3; if (*) { } else { assert (forall b: bool :: b || !b) || 1 != 1; } } method N() ensures (forall b: bool :: b || !b) |...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_lightening_verifier.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
17,943
f8010ce4bcf2c34be4f4a22e1b1729a88fb414d92b316b2363d3e455b5eaf354
class CrashableMem<T> { var mem_ : array<T>; method read(off : int) returns (r : T) requires 0 <= off < mem_.Length; { return mem_[off]; } method write(off : int, val : T) requires 0 <= off < mem_.Length; modifies mem_; { mem_[off] := val; ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_mathematical objects verification_examples_fast_exp.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
3,299
9077f9edc8b7bdf63c30d557a2c129776f1e03b47200f822f3ebd59510023319
function exp(b: nat, n: nat): nat { if n == 0 then 1 else b * exp(b, n-1) } lemma exp_sum(b: nat, n1: nat, n2: nat) ensures exp(b, n1 + n2) == exp(b, n1) * exp(b, n2) { if n1 == 0 { return; } else { exp_sum(b, n1-1, n2); } } lemma exp_sum_auto(b: nat) ensures forall n1: nat, n2: ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_mathematical objects verification_examples_interval_example.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
4,114
998068ddbc03cdd562995dd3423782d8c13112dcd3484d09165c88258ea650d9
/* Here's a small but realistic setting where you could use Dafny. The setting is that we're implementing an interval library that manages a data structure with a low and a high value. It implements some computations on intervals, and we want to make sure those are right. */ // Interval is the Dafny ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_mathematical objects verification_examples_library.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
3,890
664329250ddf623b1ac84d8fcab8279b8258c21465c2d8df0e8d4419ad740775
/* A simple state machine modeling checking out and returning books in a library. */ // Status will track where one book is datatype Status = Shelf | Patron(name: string) datatype Book = Book(title: string) // The state of the whole library is just the status of every book owned by the // library. datatyp...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_mathematical objects verification_examples_logic.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
8,966
4cb8a4fc6976b9cc23c40b289d193cbc9b428d5fde02e42b0a1d6620994cf5cb
/* Review of logical connectives and properties of first-order logic. */ /* We'll be using boolean logic both to define protocols and to state their * properties, so it helps if you have an understanding of what the connectives * of logic mean and have a little fluency with manipulating them. */ /* The first ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_pregel algorithms_skeleton_nondet-permutation.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,021
ccf50c68d0217482b032d57fc2913747d1fd1b1b8d94fdff3c7379d919c9064e
module Permutation { /** * Given n >= 0, generate a permuation of {0,...,n-1} nondeterministically. */ method Generate(n: int) returns (perm: array<int>) requires n >= 0 ensures perm != null ensures perm.Length == n ensures fresh(perm) ensures isValid(perm, n) { var all := set x | 0 <= x...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_vampire project_original_Searching.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
561
3f57b7fe0db6d64fbb8cdbc6259378d4baa69979e8417982f68f6c424a90da6c
// Assuming Array is Object Blood // Blood Array<int> // index method Find(blood: array<int>, key: int) returns (index: int) requires blood != null ensures 0 <= index ==> index < blood.Length && blood[index] == key ensures index < 0 ==> forall k :: 0 <= k < blood.Length ==> blood[k] != key { index := 0; ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_variant examples_KatzManna.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,008
d0640d6cd56917071c3f2aea56906f7f77c6fdd7e90805bd070a8e00789fce7a
// RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t" // RUN: %diff "%s.expect" "%t" method NinetyOne(x: int, ghost proveFunctionalPostcondition: bool) returns (z: int) ensures proveFunctionalPostcondition ==> z == if x > 101 then x-10 else 91; { var y1 := x; var y2 := 1; while (true) // the f...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_variant examples_SumOfCubes.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,366
a1ac90c125203a886b53953dd9448b41416a96229653835a1d047098e03876ca
// RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t" // RUN: %diff "%s.expect" "%t" class SumOfCubes { static 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) retur...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_verified algorithms_inductive_props.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
3,846
ac46724de3a244047a205d79e4036660284459a3ce5ff2e552c7295e8041e8c8
// This file demonstrates how to "close" a critical "gap" between definitions // between Dafny and Coq. // In general, most commonly-used "building blocks" in Coq can be mapped to Dafny: // [Coq] [Dafny] // -------------------------------------------------------------------- // Inductive (...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Program-Verification-Dataset_tmp_tmpgbdrlnu__Dafny_verified algorithms_lol_sort.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,214
d1ae513e0fab01df7eced890711139120eeb265b5974f5540105263fa9f35ba4
// By `lol sort` here, I refer to a seemingly-broken sorting algorithm, // which actually somehow manages to work perfectly: // // for i in 0..n // for j in 0..n // if i < j // swap a[i], a[j] // // It is perhaps the simpliest sorting algorithm to "memorize", // even "symmetrically beautiful" as if...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Programmverifikation-und-synthese_tmp_tmppurk6ime_example_DafnyIntro_01_Simple_Loops.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,734
f26dda60e87481452c486e5277646ceeba3c08dbd68410b452dd4d447075aec4
// **************************************************************************************** // DafnyIntro.dfy // **************************************************************************************** // We write a program to sum all numbers from 1 to n // // Gauss' formula states t...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Programmverifikation-und-synthese_tmp_tmppurk6ime_PVS_Assignment_ex_04_Hoangkim_ex_04_Hoangkim.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
886
6d83dfdce08d36951e24dff4eb174cd6fd0db3e74b480fe4efe4681f0dd81e6f
//Problem 01 method sumOdds(n: nat) returns (sum: nat) requires n > 0; ensures sum == n * n; { sum := 1; var i := 0; while i < n-1 invariant 0 <= i < n; invariant sum == (i + 1) * (i + 1); { i := i + 1; sum := sum + 2 * i + 1; } assert su...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Programmverifikation-und-synthese_tmp_tmppurk6ime_PVS_Assignment_ex_05_Hoangkim_ex_05_Hoangkim.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,867
3a575a7f2192e95e391376958b2387fc72526b550d07ac9202449cd3943c4e82
//Problem01 function fib(n: nat):nat { if n < 2 then n else fib(n-2)+fib(n-1) } method fibIter(n:nat) returns (a:nat) requires n > 0 ensures a == fib(n) { a := 0; var b,x := 1,0; while x < n invariant 0 <= x <= n invariant a == fib(x) invariant b == fib(x+1) ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Programmverifikation-und-synthese_tmp_tmppurk6ime_PVS_Assignment_ex_06_Hoangkim_ex06-solution.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
722
45eef425dd18ab7afdf6a31f3399df883ad309de5fe14489bd93684d06e345bf
ghost function gcd(x:int,y:int):int requires x > 0 && y > 0 { if x==y then x else if x > y then gcd(x-y,y) else gcd(x,y-x) } method gcdI(m:int, n:int) returns (d:int) requires m > 0 && n > 0 ensures d == gcd(m,n) { var x,y := m,n; d := 1; while x != y decreases ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Programmverifikation-und-synthese_tmp_tmppurk6ime_PVS_Assignment_ex_06_Hoangkim_ex_06_hoangkim.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
806
8ba993ce8826573e42fb7c04b6396260b489ad42c011f14e20c97a8acd4e8f9b
//Problem01 //a) ghost function gcd(x: int, y: int): int requires x > 0 && y > 0 { if x == y then x else if x > y then gcd(x - y, y) else gcd(x, y - x) } method gcdI(m: int, n: int) returns (d: int) requires m > 0 && n > 0 ensures d == gcd(m, n); { var x: int; d := m; x ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Programmverifikation-und-synthese_tmp_tmppurk6ime_PVS_Assignment_ex_07_Hoangkim_ex07_Hoangkim.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,326
926133acce8e8128732b01a90933e0d563091adf3478e897aad841f6f1b2fe0d
//Problem01 //a) method swap(a: array<int>, i: nat, j: nat) modifies a requires a != null && a.Length > 0 && i < a.Length && j < a.Length ensures a[i] == old(a[j]) ensures a[j] == old(a[i]) { a[i], a[j] := a[j], a[i]; } //b) //Problem04 method FindMin(a: array<int>, lo: nat) returns (m...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Programmverifikation-und-synthese_tmp_tmppurk6ime_PVS_Assignment_ex_10_Hoangkim_ex10_hoangkim.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
3,840
e8243b48a69d2a906119bf2219c73ab973a06c43489053e412135c271d6d5924
//Problem01 method square0(n:nat) returns (sqn : nat) ensures sqn == n*n { sqn := 0; var i:= 0; var x; while i < n invariant i <= n && sqn == i*i { x := 2*i+1; sqn := sqn+x; i := i+1; } } /* 3 Verification conditions 1. VC1: Precondiotion i...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/ProjectosCVS_tmp_tmp_02_gmcw_Handout 1_CVS_handout1_55754_55780.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,672
cb3f002b8a719dae8aed744511abd5e525f56ee67fa988d897a11689f90cf66a
/** CVS 2021-22 Handout 1 Authors Gonçalo Martins Lourenço nº55780 Joana Soares Faria nº55754 */ // First Exercise lemma peasantMultLemma(a:int, b:int) requires b >= 0 ensures b % 2 == 0 ==> (a * b == 2 * a * b / 2) ensures b % 2 == 1 ==> (a * b == a + 2 * a * (b - 1) / 2) { if (...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/protocol-verification-fa2023_tmp_tmpw6hy3mjp_demos_ch01_fast_exp.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
4,209
f0d2169c0f673aaf3eacbbfb3a617e8c593aef0da8a07ee5d22bf80b388768f7
function exp(b: nat, n: nat): nat { if n == 0 then 1 else b * exp(b, n-1) } lemma exp_sum(b: nat, n1: nat, n2: nat) ensures exp(b, n1 + n2) == exp(b, n1) * exp(b, n2) { if n1 == 0 { return; } exp_sum(b, n1-1, n2); } // this "auto" version of exp_sum is convenient when we want to let Z3 f...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/protocol-verification-fa2023_tmp_tmpw6hy3mjp_demos_ch03_nim_v3.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,739
3a7a86ae3f9a53112967cf7b323c85db4170ed3359f74ca8dca5b57f359dea9b
// Nim version 3: fix the bug and demonstrate a behavior. // // In this version, we've fixed the bug by actually flipping whose turn it is in // each transition. datatype Player = P1 | P2 { function Other(): Player { if this == P1 then P2 else P1 } } datatype Variables = Variables(piles: seq<nat>, t...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/protocol-verification-fa2023_tmp_tmpw6hy3mjp_demos_ch04_inductive_chain.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
5,450
ea26a59841854a0b5438e02bcb05863558e231d488367f67ec9f2cf4033d4006
module Ex { // This simple example illustrates what the process of looking for an // inductive invariant might look like. datatype Variables = Variables(p1: bool, p2: bool, p3: bool, p4: bool) ghost predicate Init(v: Variables) { && !v.p1 && !v.p2 && !v.p3 && !v.p4 } // The s...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/protocol-verification-fa2023_tmp_tmpw6hy3mjp_demos_ch04_invariant_proof.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,419
0b092b010c73b7a1ed6d8462dcbb36cfd8a8ea49b521ee4cf0957d08ae793328
/* These three declarations are _abstract_ - we declare a state machine, but * don't actually give a definition. Dafny will assume nothing about them, so our * proofs below will be true for an abitrary state machine. */ type Variables predicate Init(v: Variables) predicate Next(v: Variables, v': Variables) ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/protocol-verification-fa2023_tmp_tmpw6hy3mjp_demos_ch04_leader_election.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
7,975
dad20c4662c04fb28be3eb7465994a2e13cac13866fcbd9f108eac602b5788dd
// We'll define "Between" to capture how the ring wraps around. // SOLUTION ghost predicate Between(start: nat, i: nat, end: nat) { if start < end then start < i < end else i < end || start < i } lemma BetweenTests() { assert Between(3, 4, 5); assert !Between(3, 2, 4); // when start >= end, beh...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/protocol-verification-fa2023_tmp_tmpw6hy3mjp_demos_ch04_toy_consensus.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
4,548
dbc7219ae9fafd4d6cc32926514858434d823ccb7d84da3ef3760126f4b4bfab
// Ported from ivy/examples/ivy/toy_consensus.ivy. // Ivy only supports first-order logic, which is limited (perhaps in surprising // ways). In this model of consensus, we use some tricks to model quorums in // first-order logic without getting into the arithmetic of why sets of n/2+1 // nodes intersect. type ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/protocol-verification-fa2023_tmp_tmpw6hy3mjp_demos_ch06_refinement_proof.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
3,653
7ef7c2c798222b252ab9b1ec23488407f91fb292ab61183b0f0c2a627c8389de
// Analogous to ch04/invariant_proof.dfy, we show what the conditions on a // refinement (an abstraction function, invariant, an initial condition, and an // inductive property) module Types { type Event(==, 0, !new) } import opened Types module Code { import opened Types type Variables(==, 0, !new...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/protocol-verification-fa2023_tmp_tmpw6hy3mjp_demos_dafny-internals_02-triggers_triggers2.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
552
ef1c99be0ff897c844256c62a65c06c8fb15ac073ce1f54fc8aa6485cb7d1425
function f(x: int): int function ff(x: int): int lemma {:axiom} ff_eq() ensures forall x {:trigger ff(x)} :: ff(x) == f(f(x)) lemma {:axiom} ff_eq2() ensures forall x {:trigger f(f(x))} :: ff(x) == f(f(x)) lemma {:axiom} ff_eq_bad() // dafny ignores this trigger because it's an obvious loop ensu...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/protocol-verification-fa2023_tmp_tmpw6hy3mjp_demos_dafny-internals_03-encoding_lemma_call.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
256
e70d0753f6f09f457956dc357c42df1bc9e9fb20a59a9efb3748344405fc847f
function f(x: int): int lemma {:axiom} f_positive(x: int) requires x >= 0 ensures f(x) >= 0 lemma f_2_pos() ensures f(2) >= 0 { f_positive(2); } lemma f_1_1_pos() ensures f(1 + 1) >= 0 { f_2_pos(); assert 1 + 1 == 2; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/protocol-verification-fa2023_tmp_tmpw6hy3mjp_demos_dafny-internals_03-encoding_pair.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,324
a4b1bc610300f85ebd9b163000d11b2ee341e967c99a8ace987c95c629edfa7a
// based on https://ethz.ch/content/dam/ethz/special-interest/infk/chair-program-method/pm/documents/Education/Courses/SS2019/Program%20Verification/05-EncodingToSMT.pdf module DafnyVersion { datatype Pair = Pair(x: int, y: int) function pair_x(p: Pair): int { p.x } function pair_y(p: Pair): int...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/protocol-verification-fa2023_tmp_tmpw6hy3mjp_exercises_chapter04-invariants_ch03exercise03.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
5,255
4dc8b7ad75e36c19053ce4749a16497a01616d8bbdafc80773cbe201a6e9786b
// Model a lock service that consists of a single server and an // arbitrary number of clients. // // The state of the system includes the server's state (whether the server // knows that some client holds the lock, and if so which one) // and the clients' states (for each client, whether that client knows // i...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/pucrs-metodos-formais-t1_tmp_tmp7gvq3cw4_fila.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
4,735
700016db572398bef42a9e40d439ad9dcff6a3c82da94f66665de27123d5cffa
/* OK fila de tamanho ilimitado com arrays circulares OK representação ghost: coleção de elementos da fila e qualquer outra informação necessária OK predicate: invariante da representação abstrata associada à coleção do tipo fila Operações - OK construtor inicia fila fazia - ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/QS_BoilerPlate1_tmp_tmpa29vtz9__Ex2.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,343
b91f1a1697d2fb8627f3e61ce3634f01214081a636a369fc830c05f7cb97f6d8
function sorted(s : seq<int>) : bool { forall k1, k2 :: 0 <= k1 <= k2 < |s| ==> s[k1] <= s[k2] } // Ex1 method copyArr(a : array<int>, l : int, r : int) returns (ret : array<int>) requires 0 <= l < r <= a.Length ensures ret[..] == a[l..r] { var size := r - l; ret := new int[size]; var i := ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/repo-8967-Ironclad_tmp_tmp4q25en_1_ironclad-apps_src_Dafny_Libraries_Util_seqs_simple.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,850
f251b36ce817689af93939a7b0fb7c8a6162ce8657205f36d6790933ab0934a2
static lemma lemma_vacuous_statement_about_a_sequence(intseq:seq<int>, j:int) requires 0<=j<|intseq|; ensures intseq[0..j]==intseq[..j]; { } static lemma lemma_painful_statement_about_a_sequence(intseq:seq<int>) ensures intseq==intseq[..|intseq|]; { } static lemma lemma_obvious_statement_about_...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/RollingMax.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,121
196ae2c3ca81d234a7d5fb3690d20545fe5e1932a434b1b3178ca2dceb992052
/* HumanEvalX 9 From a given list of integers, generate a list of rolling maximum element found until given moment in the sequence. */ function isMax(m: int, numbers: seq<int>): bool { m in numbers && forall i :: 0 <= i < |numbers| ==> numbers[i] <= m } method max(numbers: seq<int>) returns (resu...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/sat_dfy_tmp_tmpfcyj8am9_dfy_Seq.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,960
ebec5f5831782870b2932995368b1aa04404329f55401ab3c54f05e8d982b0ad
module Seq { function seq_sum(s: seq<int>) : (sum: int) { if s == [] then 0 else var x := s[0]; var remaining := s[1..]; x + seq_sum(remaining) } lemma SeqPartsSameSum(s: seq<int>, s1: seq<int>, s2: seq<int>) requires s...