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/hints_removed/Dafny-Exercises_tmp_tmpjm75muf__Session7Exercises_ExerciseBinarySearch_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 2,087 | ba236cd6adf86b419b41c253a52c307480bebc7da2a789db2fd464f7dd0e746d | predicate sorted(s : seq<int>) {
forall u, w :: 0 <= u < w < |s| ==> s[u] <= s[w]
}
method binarySearch(v:array<int>, elem:int) returns (p:int)
requires sorted(v[0..v.Length])
ensures -1<=p<v.Length
ensures (forall u::0<=u<=p ==> v[u]<=elem) && (forall w::p<w<v.Length ==> v[w]>elem)
{
var c,f:=0,v.Leng... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/Dafny-Exercises_tmp_tmpjm75muf__Session7Exercises_ExerciseBubbleSort_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,301 | 22e64bfc08c3f314d9425d57237b46294e9e2ea3a4ed65a39fc57d0e28744d6d | predicate sorted_seg(a:array<int>, i:int, j:int) //j excluded
requires 0 <= i <= j <= a.Length
reads a
{
forall l, k :: i <= l <= k < j ==> a[l] <= a[k]
}
method bubbleSorta(a:array<int>, c:int, f:int)//f excluded
modifies a
requires 0 <= c <= f <= a.Length //when c==f empty sequence
ensures sorted_seg(... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/Dafny-Exercises_tmp_tmpjm75muf__Session7Exercises_ExerciseReplace_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 336 | 6a6e520c7e03292e80a5b45ea251560870bb701872b4bc401f53499c086c0189 |
method replace(v:array<int>, x:int, y:int)
modifies v
ensures forall k::0<=k<old(v.Length) && old(v[k])==x ==> v[k]==y
ensures forall k::0<=k<old(v.Length) && old(v[k])!=x ==> v[k]==old(v[k])
{
var i:=0;
while(i<v.Length)
{
if(v[i]==x){
v[i]:=y;
}
i:=i+... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/Dafny-Exercises_tmp_tmpjm75muf__Session7Exercises_ExerciseSelSort_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 703 | eb90a8dbeb354df09ddc8614c6c320d6105efd9d5f7757749f6345e79ae1fc7e | predicate sorted_seg(a:array<int>, i:int, j:int) //j not included
requires 0 <= i <= j <= a.Length
reads a
{
forall l, k :: i <= l <= k < j ==> a[l] <= a[k]
}
method selSort (a:array<int>, c:int, f:int)//f excluded
modifies a
requires 0 <= c <= f <= a.Length //when c==f empty sequence
ensures sorted_s... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/Dafny-Exercises_tmp_tmpjm75muf__Session7Exercises_ExerciseSeparate_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 929 | a921558b5bdfcab99ebb4eccb5729fe955c8d58016846d43ed1ef188e858a4f5 | predicate strictNegative(v:array<int>,i:int,j:int)
reads v
requires 0<=i<=j<=v.Length
{forall u | i<=u<j :: v[u]<0}
predicate positive(s:seq<int>)
{forall u::0<=u<|s| ==> s[u]>=0}
predicate isPermutation(s:seq<int>, t:seq<int>)
{multiset(s)==multiset(t)}
/**
returns an index st new array is a permutation... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/Dafny-Exercises_tmp_tmpjm75muf__Session8Exercises_ExerciseInsertionSort_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 622 | 0887fc77fc7e41206c4b0d70351e9dbac36c0088a0b74b90a0881229bf3db120 |
predicate sorted_seg(a:array<int>, i:int, j:int) //i and j included
requires 0 <= i <= j+1 <= a.Length
reads a
{
forall l, k :: i <= l <= k <= j ==> a[l] <= a[k]
}
method InsertionSort(a: array<int>)
modifies a;
ensures sorted_seg(a,0,a.Length-1)
ensures multiset(a[..]) == old(multiset(a[..])) /... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/Dafny-Exercises_tmp_tmpjm75muf__Session9Exercises_ExerciseSeqMaxSum_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,378 | 7373ffff8c326447c7c3f691afe00f5721587490cebf688ad85305b6dae4508e |
function Sum(v:array<int>,i:int,j:int):int
reads v
requires 0<=i<=j<=v.Length
{
if (i==j) then 0
else Sum(v,i,j-1)+v[j-1]
}
predicate SumMaxToRight(v:array<int>,i:int,s:int)
reads v
requires 0<=i<v.Length
{
forall l,ss {:induction l}::0<=l<=i && ss==i+1==> Sum(v,l,ss)<=s
}
method segMaxSum(... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-exercise_tmp_tmpouftptir_absIt_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 820 | 0bcd2ba088734f4ab5851a552176ee8b74a68a36871d0e94367ec6af4efd1ad3 | method AbsIt(s: array<int>)
modifies s
ensures forall i :: 0 <= i < s.Length ==> if old(s[i]) < 0 then s[i] == -old(s[i]) else s[i] == old(s[i])
ensures s.Length == old(s).Length
{
var i: int := 0;
while i < s.Length
{
if (s[i] < 0) {
s[i] := -s[i];
}
i := i + 1;
}
}
method Tester()
{... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-exercise_tmp_tmpouftptir_appendArray_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 447 | be1bef3cee54660e8817776dd44b941e6baa26ac0e128be08bbfc7e2fb0447a1 | method appendArray(a: array<int>, b: array<int>) returns (c: array<int>)
ensures c.Length == a.Length + b.Length
ensures forall i :: 0 <= i < a.Length ==> a[i] == c[i]
ensures forall i :: 0 <= i < b.Length ==> b[i] == c[a.Length + i]
{
c := new int[a.Length + b.Length];
var i := 0;
while i < a.Length
{
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-exercise_tmp_tmpouftptir_countNeg_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 495 | b6b2692b25bcad988bae0e04b20cea0127c45cbf16c071dbd0d7eb361b1d636e | function verifyNeg(a: array<int>, idx: int) : nat
reads a
requires 0 <= idx <= a.Length
{
if idx == 0 then 0
else verifyNeg(a, idx - 1) + (if a[idx - 1] < 0 then 1 else 0)
}
method CountNeg(a: array<int>) returns (cnt: nat)
ensures cnt == verifyNeg(a, a.Length)
{
var i := 0;
cnt := 0;
while i < a.L... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-exercise_tmp_tmpouftptir_filter_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 953 | ea0e67c041ed35a9983b1aa903094f12f08028e3bd707f2f8ce7c36102181adb | method Filter(a:seq<char>, b:set<char>) returns(c:set<char>)
ensures forall x :: x in a && x in b <==> x in c
{
var setA: set<char> := set x | x in a;
c := setA * b;
}
method TesterFilter()
{
var v:set<char> := {'a','e','i','o','u'}; // vowels to be used as a filter
var s:seq<char> := "ant-egg-ink... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-exercise_tmp_tmpouftptir_firstE_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 489 | 951ad6eb8720ed41fed7803c0dd5070d38841010ba3ed76107f6acbb96b047cc | method firstE(a: array<char>) returns (x: int)
ensures if 'e' in a[..] then 0 <= x < a.Length && a[x] == 'e' && forall i | 0 <= i < x :: a[i] != 'e' else x == -1
{
var i: int := 0;
while i < a.Length
{
if (a[i] == 'e') {
return i;
}
i := i + 1;
}
return -1;
}
method Main() {
var a: arra... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-exercise_tmp_tmpouftptir_maxArray_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 411 | 337b889561057f88eaae02250d5d439b686126551545582aa4b9e67312335a5a | method MaxArray(a: array<int>) returns (max:int)
requires a.Length > 0
ensures forall i :: 0 <= i < a.Length ==> a[i] <= max
ensures exists i :: 0 <= i < a.Length && a[i] == max
{
var i: nat := 1;
max := a[0];
while i < a.Length
{
if (a[i] > max) {
max := a[i];
}
i := i + 1;
}
}
method Ma... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-exercise_tmp_tmpouftptir_prac1_ex1_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 389 | 6f71e6122bf9bf6f27782a7b31a4b653f91091fa02f976e4c69517541ddb4b4b | predicate acheck(a: array<int>, n: int)
reads a
requires n >= 1
{
a.Length % 2 == 0 &&
forall i :: 0 <= i < a.Length ==>
if i % n == 0 then a[i] == 0 else a[i] != 0
}
method Main()
{
var arr: array<int> := new int[][0,42,0,42];
var res := acheck(arr, 2);
arr := new int[][];
res := acheck(arr... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-exercise_tmp_tmpouftptir_prac1_ex2_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 619 | b00a78a61f5feee465645afd2ff733f8e5bb7178ea213af7f1df560684f0015d | method Deli(a: array<char>, i: nat)
modifies a
requires a.Length > 0
requires 0 <= i < a.Length
ensures forall j :: 0 <= j < i ==> a[j] == old(a[j])
ensures forall j :: i <= j < a.Length - 1 ==> a[j] == old(a[j + 1])
ensures a[a.Length - 1] == '.'
{
var c := i;
while c < a.Length - 1
// unchanged first hal... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-exercise_tmp_tmpouftptir_prac3_ex2_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 454 | fee1b5610bdd31bc94916db257b2627dcfa3864c1a8b48371e24e9bc37dbe0cb | method GetEven(s: array<nat>) modifies s
ensures forall i :: 0 <= i < s.Length ==>
if old(s[i]) % 2 == 1 then s[i] == old(s[i]) + 1
else s[i] == old(s[i])
{
var i := 0;
while i < s.Length
if old(s[j]) % 2 == 1 then s[j] == old(s[j]) + 1
else s[j] == old(s[j])
{
if s[i] % 2 == 1 {
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-exercise_tmp_tmpouftptir_prac4_ex2_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,056 | 0729c0c26c520edaf71617da8238c553c9f41b61467d4a8689b2ba260258c750 | predicate triple(a: array<int>)
reads a
{
exists i :: 0 <= i < a.Length - 2 && a[i] == a[i + 1] == a[i + 2]
}
method GetTriple(a: array<int>) returns (index: int)
ensures 0 <= index < a.Length - 2 || index == a.Length
ensures index == a.Length <==> !triple(a)
ensures 0 <= index < a.Length - 2 <==> triple(a)... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-exercise_tmp_tmpouftptir_reverse_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 518 | d51d02d23d6bde4a930fefba0a1e79ed9db3867dc186c7bd69d723caed2b0aa6 | method Reverse(a: array<char>) returns (b: array<char>)
requires a.Length > 0
ensures a == old(a)
ensures b.Length == a.Length
ensures forall i :: 0 <= i < a.Length ==> b[i] == a[a.Length - i - 1]
{
b := new char[a.Length];
var i := 0;
while i < a.Length
{
b[i] := a[a.Length - i - 1];
i := i + 1;
}... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-exercise_tmp_tmpouftptir_zapNegatives_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 429 | d35a5000a84581bd1c83626336aa45ebf7cd7a8702d140197e23210bd4afb170 | method ZapNegatives(a: array<int>)
modifies a
ensures forall i :: 0 <= i < a.Length ==> if old(a[i]) < 0 then a[i] == 0
else a[i] == old(a[i])
ensures a.Length == old(a).Length
{
var i := 0;
while i < a.Length
else a[j] == old(a[j])
{
if a[i] < 0 {
a[i] := 0;
}
i := i + ... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/Dafny-experiences_tmp_tmp150sm9qy_dafny_started_tutorial_dafny_tutorial_array_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 459 | 0663e5d3af65fc57b0c5bc879584a9fba2699f58333a4d97d649ff91a8613f75 | method FindMax(a: array<int>) returns (i: int)
// Annotate this method with pre- and postconditions
// that ensure it behaves as described.
requires a.Length > 0
ensures 0<= i < a.Length
ensures forall k :: 0 <= k < a.Length ==> a[k] <= a[i]
{
// Fill in the body that calculates the INDEX of the maxi... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/Dafny-Grind75_tmp_tmpsxfz3i4r_problems_twoSum_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,318 | ef5931905893044d9389cb836ab50c05322c14cc28fa47516dd1ef56d1bd0a97 | /*
https://leetcode.com/problems/two-sum/
function twoSum(nums: number[], target: number): number[] {
const n = nums.length;
for(let i = 0; i < n; i++) {
for(let k = i+1; k < n; k++) {
if(nums[i] + nums[k] == target) return [i,k];
}
}
};
*/
predicate summingPair(i: na... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_allocated1_dafny0_fun-with-slices_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,632 | 73055686e2c8114c04105aeb2380f400639d652c378571270fe5783cf6dca790 | // RUN: %dafny /verifyAllModules /allocated:1 /compile:0 /print:"%t.print" /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This test was contributed by Bryan. It has shown some instabilities in the past.
method seqIntoArray<A>(s: seq<A>, a: array<A>, index: nat)
requires index + |s| <= a.Len... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_comp_Arrays_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 2,480 | 3b50c0017176514502d05338789c91dd99230fa5d8f8e89ec328c4c310069c4f | // RUN: %dafny /compile:3 /spillTargetCode:2 /compileTarget:cs "%s" > "%t"
// RUN: %dafny /compile:3 /spillTargetCode:2 /compileTarget:js "%s" >> "%t"
// RUN: %dafny /compile:3 /spillTargetCode:2 /compileTarget:go "%s" >> "%t"
// RUN: %dafny /compile:3 /spillTargetCode:2 /compileTarget:java "%s" >> "%t"
// RUN: %di... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny0_FuelTriggers_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 521 | e0273d3530a282c327792242730b18cf3c0919b9db91da6b5d2334e493db9fd5 | // RUN: %dafny /ironDafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// In one version of opaque + fuel, the following failed to verify
// because the quantifier in the requires used a trigger that included
// StartFuel_P, while the assert used StartFuelAssert_P. ... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny0_snapshots_Inputs_Snapshots0_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 66 | 1a2f7e326340400d69afef8fb153017cda99a29851d7f54364a8d0d593365ff7 | method foo()
{
bar();
}
method bar()
ensures false;
|
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny1_Cubes_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 379 | c2b95ce16b4fb2cd29c129069163412d4dc7a33d53f7abb3b50facc91290a631 | // RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method Cubes(a: array<int>)
modifies a
ensures forall i :: 0 <= i < a.Length ==> a[i] == i*i*i
{
var n := 0;
var c := 0;
var k := 1;
var m := 6;
while n < a.Length
{
a[n] := c;
c := c + k;
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny1_ListReverse_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 694 | 143002759768aad4a69b59feba039a10500a3ec4aed0bf85ce134be6d4ffeb12 | // RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
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 closur... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny1_MatrixFun_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 2,237 | 166e3853a8fdced9f3ca973e2c2564980a819f3bc1070f6daabecdd07035e7b8 | // RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
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
m... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny2_COST-verif-comp-2011-1-MaxArray_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 3,018 | 8863a3d67c35442db5fe717a27bf2b359a185945cca1b9f1f4ae2cd3508418fb | // RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
/*
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 return... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny2_Intervals_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,553 | 68592a0665d7679107d5f8e9b82f5c9634483bb33f2d650f1acdb6a93efe8ffe | // RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// 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>
function Valid(): bool
reads this, thr... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny2_SegmentSum_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 683 | 7d46365e7dfa81414c4a5f6b7074ad80db41d17134bf2e24fc1a743076419bc7 | // RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
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|
ens... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny2_TreeBarrier_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 3,411 | 302be9afb90cb22011bbb791c3e201feab1e1929c8fd25ff9465c50dec106481 | // RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
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
predicate validDown()
reads this, desc
{
this !in desc ... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny2_TuringFactorial_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 454 | 71ae3c755808a3942099901794fc068b63b20fa602505b28489603dc4f60f361 | // RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
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 < ... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny3_InductionVsCoinduction_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 3,881 | 80af4ef430ec47ba52b4c505439c5772b3654ce6c932d93bdbf90806102a8b49 | // RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// 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 integer... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_Bug144_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 384 | abb9d401bd0e3cba81d7a7b61f69d3dea67a8b7e296df6159175d486c65bc325 | // RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
predicate p(i:int)
method m1()
method m2()
{
assume exists i :: p(i);
m1();
}
class Test
{
var arr : array<int>;
predicate p(i: int)
method foo()
requires arr.Length > 0
modifies arr
{
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_Bug165_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 395 | 8a594498f395e699632675f378f7d9f7bd734a3bcf03df2983d6ef245c3f4678 | // RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
type T
function f(a: T) : bool
method Select(s1: seq<T>) returns (r: seq<T>)
ensures (forall e: T :: f(e) ==> multiset(s1)[e] == multiset(r)[e])
ensures (forall e: T :: (!f(e)) ==> 0 == multiset(r)[e])
method Main(s1: seq<T>)
{
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_Bug58_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 369 | 88f65460fcd5c02e1dff03858b984e4124db0697294a6854d06ceccd914c1748 | // RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
function M1(f:map<int, bool>, i:int):bool
function M2(f:map<int, bool>, i:int):bool
{
M1(map j | j in f :: f[j], i)
}
lemma L(f:map<int, bool>, i:int)
requires i in f;
requires M2(f, i);
requires forall j:int, f:map<in... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_Bug92_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,642 | e3b268ce89d2b529ef387e8b7bad9b01901e9cbf70e6b6fb3f8a91de90bc2269 | // RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module ModOpaque {
function {:opaque} Hidden(x:int) : (int, int)
{
(5, 7)
}
function Visible(x:int) : (int, int)
{
Hidden(x)
}
lemma foo(x:int, y:int, z:int)
requires (y, z) == Visib... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_Fstar-QuickSort_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 4,032 | 84cb8c515e93add108316ce738b764fee4fa88a83ebe72e461b596d17eeb5c16 | // RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// A Dafny rendition of an F* version of QuickSort (included at the bottom of this file).
// Unlike the F* version, Dafny also proves termination and does not use any axioms. However,
// Dafny needs help with a couple of lem... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_git-issue133_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 978 | bcfed88902ecc9bc1a270843fd5f8054174781e4381618bc40fe0aa495db1452 | // RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
datatype State = State(m:map<int, bool>)
lemma Test(s:State)
requires 42 in s.m
ensures s.(m := s.m[42 := s.m[42]]) == s
{
var s' := s.(m := s.m[42 := s.m[42]]);
}
datatype MyDt = MakeA(x: int, bool) | MakeB(s: multiset<int>, t: S... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_git-issue40_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 455 | 2a279b6ac6b97cf044432edf8758c8cd6acbda424fd210af0eab9a76924847d7 | // RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
function SeqRepeat<T>(count:nat, elt:T) : seq<T>
ensures |SeqRepeat<T>(count, elt)| == count
ensures forall i :: 0 <= i < count ==> SeqRepeat<T>(count, elt)[i] == elt
datatype Maybe<T> = Nothing | Just(v: T)
type Num = x | 0 <= x < 1... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_git-issue41_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,382 | 1a078686bb1ec70a07fa3c6b4342432b914163c43b67ef8f71728f0351603b97 | // RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
type uint32 = i:int | 0 <= i < 0x1_0000_0000
function last<T>(s:seq<T>):T
requires |s| > 0;
{
s[|s|-1]
}
function all_but_last<T>(s:seq<T>):seq<T>
requires |s| > 0;
ensures |all_but_last(s)| == |s| - 1;
{
s[..|s|... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_git-issue67_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 479 | 45021dd1dd31a9140fbb09ef024dbcf95718412a41d227799b0d890189ee811b | // RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class Node { }
predicate Q(x: Node)
predicate P(x: Node)
method AuxMethod(y: Node)
modifies y
method MainMethod(y: Node)
modifies y
{
AuxMethod(y); // remove this call and the assertion below goes through (as it should)
f... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_git-issue74_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 253 | 00fec2bcf4cab57d582a14eb538e228f4fb7c850747696d8ca3f61344ef44892 | // RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
function{:opaque} f(x:int):int { x }
lemma L()
ensures forall x:int :: f(x) == x
{
forall x:int
ensures f(x) == x
{
reveal f();
}
}
|
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_git-issue76_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 495 | 19e0f989c3139f73bbf194cf935254d7c97ba0344569597c7169569333086b1f | // RUN: %dafny /compile:3 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method Main() {
M0();
M1();
EqualityOfStrings0();
EqualityOfStrings1();
}
// The verification of the following methods requires knowledge
// about the injectivity of sequence displays.
method M0()
{
}
method M1()
{
va... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_Lucas-down_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 3,933 | 898d9f8ad14a547109c6245088fce13d3453914905b5aba3456c62cc3ace73bc | // RUN: %dafny /compile:0 /arith:1 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// Proof of the Lucas theorem
// Rustan Leino
// 9 March 2018
//
// Instead of the lemmas doing "up", like:
// P(k) == P(2*k)
// P(k) == P(2*k + 1)
// (see Lucas-up.dfy), the lemmas in this version go "down", like:
// P(k%2)... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_MonadicLaws_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 2,071 | 8a1c134f61216afe555d6e6615443d9b0a9b522f1fa2f6470737ee923ed41b93 | // RUN: %dafny /compile:0 /rprint:"%t.rprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// Monadic Laws
// Niki Vazou and Rustan Leino
// 28 March 2016
datatype List<T> = Nil | Cons(head: T, tail: List)
function append(xs: List, ys: List): List
{
match xs
case Nil => ys
case Cons(x, xs') => Cons(... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_dafny4_Regression19_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,028 | 146f851184bc1596e3f2fee3d830b61be3d453b930f49ba82dde809810cf0553 | // RUN: %dafny "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
predicate ContainsNothingBut5(s: set<int>)
{
forall q :: q in s ==> q == 5
}
predicate YeahContains5(s: set<int>)
{
exists q :: q in s && q == 5
}
predicate ViaSetComprehension(s: set<int>) {
|set q | q in s && q == 5| != 0
}
predicate... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_git-issues_git-issue-336_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 653 | 1fc2463cdd5caf26ee5a5ec1391fac6702e88186bc87b40891719e842cb7b731 | // RUN: %dafny "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
lemma TestMap(a: map<int, (int,int)>) {
// The following assertion used to not prove automatically
// the following map comprehension implicitly uses k as the key
== (map k | k in a :: a[k].0);
}
lemma TestSet0(a: set<int>) {
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_hofs_Compilation_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,038 | a8196fa6078496ba2d936b0683f1976ebda2355d6ae72dc66214a330060c54ab | // RUN: %dafny /compile:3 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class Ref<A> {
var val : A
constructor (a : A)
ensures val == a
{
val := a;
}
}
method Main() {
// simple
print "1 = ", (x => x)(1), "\n";
print "3 = ", (x => y => x + y)(1)(2), "\n";
print "3 = ", ((x,y) => y... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_hofs_Requires_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,209 | 2aab07343eef491246b05e78b6646b3ca2b27c45da275c8ab8110ba1fbc2bf80 | // RUN: %dafny /compile:3 /print:"%t.print" /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method Main()
{
test0(10);
test5(11);
test6(12);
test1();
test2();
}
predicate valid(x:int)
{
x > 0
}
function ref1(y:int) : int
requires valid(y);
{
y - 1
}
lemma assumption... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_hofs_WhileLoop_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 939 | f026acc268b9f32b6a6d1dbfb7683256c1611ee0fdbf177191b66774e585cc6a | // RUN: %dafny /compile:3 /print:"%t.print" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class Ref<A(0)> {
var val: A
}
method Nice(n: int) returns (k: int) {
var f : int -> int := x => x;
var i := new Ref<int>;
i.val := 0;
while i.val < n
{
i.val := i.val + 1;
f := x => f(x) + 1;
}... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_LanguageServerTest_DafnyFiles_symbolTable_15_array_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 159 | e707e0bf881fc660cc9062308cf1dd54ea9b17a16128213bb1abc118c5d74429 | method Main() {
var i := 2;
var s := [1, i, 3, 4, 5];
print |s|; //size
}
method foo (s: seq<int>)
requires |s| > 1
{
print s[1];
}
|
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_triggers_auto-triggers-fix-an-issue-listed-in-the-ironclad-notebook_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 921 | 9bc2f6f3f8c4cd1c6a14edfbc40f097ec613660d3720e6bc5a0a4d868e340cce | // RUN: %dafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" /printTooltips "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This example was listed in IronClad's notebook as one place were z3 picked
// much too liberal triggers. THe Boogie code for this is shown below:
//
// forall k#2: Seq Box :: $Is(k#2, TSeq... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_triggers_function-applications-are-triggers_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 535 | cf45b865632e1ffdd9dffe2e7021cf75c36b86ef11d358a95aa93eda0eaf0ef3 | // RUN: %dafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" /printTooltips "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file checks that function applications yield trigger candidates
method M(P: (int -> int) -> bool, g: int -> int)
requires P.requires(g)
requires P(g) {
assume forall f: int -... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_triggers_large-quantifiers-dont-break-dafny_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,542 | 6aca585a80c68a17dc90fd8e2c307d220a75ea9c45bd4579fd5b9b6c5a2e072a | // RUN: %dafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" /printTooltips "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This test ensures that the trigger collector (the routine that picks trigger
// candidates) does not actually consider all subsets of terms; if it did, the
// following would take horrib... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_triggers_loop-detection-looks-at-ranges-too_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 410 | a77185ba858b2b8d40ae5b91fb485026782a5f0076e318aeb65a8b01b6ac0303 | // RUN: %dafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" /printTooltips "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file checks that loops between the range and the term of a quantifier
// are properly detected.
predicate P(x: int)
method M(x: int) {
// This will be flagged as a loop even wi... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_tutorial_maximum_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,005 | 7267513283981c36407b1b4f623a63b0218e5b99a28f77f1685a562e74be3d90 | // RUN: %dafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" /printTooltips "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file shows how to specify and implement a function to compute the
// largest element of a list. The function is fully specified by two
// preconditions, as proved by the MaximumIsUniqu... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_vacid0_Composite_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 5,369 | 8f4e84c53a1f6b837367d62f7a0c904c38a160a71045333f652c1f154db307f8 | // RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class Composite {
var left: Composite?
var right: Composite?
var parent: Composite?
var val: int
var sum: int
function Valid(S: set<Composite>): bool
reads this, parent, left, right
{
this in S &&
(parent != n... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_VSComp2010_Problem1-SumMax_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,143 | fcc936443cd791fb14fc778d7efc1b57a91a61e0078a9ec95652fb62d2b85ed7 | // RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// VSComp 2010, problem 1, compute the sum and max of the elements of an array and prove
// that 'sum <= N * max'.
// Rustan Leino, 18 August 2010.
//
// The problem statement gave the pseudo-code for the method, but did not ask to prove
// t... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_VSI-Benchmarks_b1_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,271 | 2a8610a06a06262b09403690b317a41b7ee841c6586fb9b9e038c42a40e768ac | // RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// Spec# and Boogie and Chalice: The program will be
// the same, except that these languages do not check
// for any kind of termination. Also, in Spec#, there
// is an issue of potential overflows.
// Benchmark1
method Add(x: int, y: ... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_VSI-Benchmarks_b2_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,305 | b69b179e9017424f92d39458e27a357b79885fdb5dfdca7b0e9c89876c2982f6 | // RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class Benchmark2 {
method BinarySearch(a: array<int>, key: int) returns (result: int)
requires forall i, j :: 0 <= i < j < a.Length ==> a[i] <= a[j];
ensures -1 <= result < a.Length;
ensures 0 <= result ==> a[result] == key;
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-language-server_tmp_tmpkir0kenl_Test_vstte2012_Two-Way-Sort_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,813 | ec611466104a968c48848d36b4d5cd15e012fa690f4d46c3d4b5c8df47ab9dd3 | // RUN: %dafny /compile:0 /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This method is a slight generalization of the
// code provided in the problem statement since it
// is generic in the type of the array elements.
method swap<T>(a: array<T>, i: int, j: int)
requires 0 <= i < j < a.Leng... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-learn_tmp_tmpn94ir40q_R01_assertions_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 848 | c73f558a7a5d442b73af351e38c6f7bd91d059ad7d2b0322895dd1ffad6bd5c1 | method Abs(x: int) returns (y: int)
ensures 0 <= y
ensures x < 0 ==> y == -x
ensures x >= 0 ==> y == x
{
if x < 0 {
return -x;
} else {
return x;
}
}
method TestingAbs()
{
var w := Abs(4);
var v := Abs(3);
}
method TestingAbs2()
{
var v := Abs(3);
// property of v dep... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-learn_tmp_tmpn94ir40q_R01_functions_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 862 | e264e4d258be395b3f17a23537495a88db3acea31ef692bbb962b6facd0ce7dd | function abs(x: int): int
{
if x < 0 then -x else x
}
method Testing_abs()
{
var v := abs(3);
}
// Exercise 4. Write a function max that returns the larger of two given integer parameters. Write a test method using an assert that checks that your function is correct.
function max(a: int, b: int... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-mini-project_tmp_tmpjxr3wzqh_src_project2a_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 6,650 | b368d95cee6410034ba53285edc2e77bb044a75cd828366c92f7a808e088fa54 | /*
===============================================
DCC831 Formal Methods
2023.2
Mini Project 2 - Part A
Your name: Guilherme de Oliveira Silva
===============================================
*/
function rem<T(==)>(x: T, s: seq<T>): seq<T>
ensures x !in rem(x, s)
ensures forall i :: 0 <... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/Dafny-Practice_tmp_tmphnmt4ovh_BST_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 3,782 | 6d340765dea5e99e7d55f1910fd5329d58665f5ba3acfe6ee010969cc64beb25 | datatype Tree = Empty | Node(int,Tree,Tree)
method Main() {
var tree := BuildBST([-2,8,3,9,2,-7,0]);
PrintTreeNumbersInorder(tree);
}
method PrintTreeNumbersInorder(t: Tree)
{
match t {
case Empty =>
case Node(n, l, r) =>
PrintTreeNumbersInorder(l);
print n;
print "\n";
PrintTreeNumb... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/Dafny-Practice_tmp_tmphnmt4ovh_Pattern Matching_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 5,449 | 20bb1edf25852072b91566dc5beaa8d72cc1ffc4a3ca741b2b915b672e147d45 |
method {:verify true} FindAllOccurrences(text: string, pattern: string) returns (offsets: set<nat>)
ensures forall i :: i in offsets ==> i + |pattern| <= |text|
ensures forall i :: 0 <= i <= |text| - |pattern| ==> (text[i..i+|pattern|] == pattern <==> i in offsets)
{
offsets := {};
var i:int := 0;
//... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-programs_tmp_tmpcwodh6qh_src_expt_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 488 | 1ba3ab111fb62b7ccb7ca6ab5b46c3d189206c56cb3a9e3553b516abeed4867f | function Expt(b: int, n: nat): int
requires n >= 0
{
if n == 0 then 1 else b * Expt(b, n - 1)
}
method expt(b: int, n: nat) returns (res: int)
ensures res == Expt(b, n)
{
var i := 1;
res := 1;
while i < n + 1
{
res := res * b;
i := i + 1;
}
}
// source: https://www.dcc.fc.u... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-programs_tmp_tmpcwodh6qh_src_factorial_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 299 | 1da3b7084fd37d0a56f38dcc1eb80c9c65d3097c8cb4c5b18d51885c8050cf0a | function fact(n: nat): nat
ensures fact(n) >= 1
{
if n == 0 then 1 else n * fact(n - 1)
}
method factorial(n: nat) returns (res: nat)
ensures res == fact(n)
{
var i := 1;
res := 1;
while i < n + 1
{
res := i * res;
i := i + 1;
}
}
|
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-programs_tmp_tmpcwodh6qh_src_max_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 349 | 82c8df5f846eb97716acb700d154d38b524ecb72a42b40a4e3f4b675578dbf96 | method Max(a: int, b: int) returns (c: int)
ensures a >= b ==> c == a
ensures b >= a ==> c == b
{
if a > b {
return a;
} else {
return b;
}
}
method MaxTest() {
var low := 1;
var high := 10;
var v := Max(low, high);
}
function max(a: int, b: int): int
{
if a > b then a else b
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-programs_tmp_tmpcwodh6qh_src_ticketsystem_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 3,743 | 366cb020b746199a41bbec8311f2bb2514fdb7f59972309f716ed8ad5441ad76 | // Code taken from the following paper: http://leino.science/papers/krml260.pdf
// Each philosopher's pseudocode:
// repeat forever {
// Thinking:
// t: Ticket = ticket, ticket + 1 // request ticket to enter hungry state
// Hungry:
// //...
// wait until serving = t; // Enter
// ... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/Dafny-programs_tmp_tmpnso9eu7u_Algorithms + sorting_bubble-sort_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 1,537 | 6a5d4ca92f4bd1c02f9c993d1f288b2e50a10d74ba47e46e21029eff77caa59b | /*
Bubble Sort is the simplest sorting algorithm that works by
repeatedly swapping the adjacent elements if they are in wrong order.
*/
predicate sorted_between(A:array<int>, from:int, to:int)
reads A
{
forall i, j :: 0 <= i <= j < A.Length && from <= i <= j <= to ==> A[i] <= A[j]
}
predicate sort... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/Dafny-Projects_tmp_tmph399drhy_p2_arraySplit_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 799 | 478829ce0c813489b4305ee7d6aeb4f6756549eb18d5673b8e1010a930c0d87e | method ArraySplit (a : array<int>) returns (b : array<int>, c : array<int>)
ensures fresh(b)
ensures fresh(c)
ensures a[..] == b[..] + c[..]
ensures a.Length == b.Length + c.Length
ensures a.Length > 1 ==> a.Length > b.Length
ensures a.Length > 1 ==> a.Length > c.Length
{
var splitPoint : int := a... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-rope_tmp_tmpl4v_njmy_Rope_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 9,384 | 660e448f3ee91f9dd30e13b57ff86647e0557e01a21f716a23cae5f232746979 | module Rope {
class Rope {
ghost var Contents: string;
ghost var Repr: set<Rope>;
var data: string;
var weight: nat;
var left: Rope?;
var right: Rope?;
ghost predicate Valid()
reads this, Repr
ensures Valid() ==> this in Repr
{
this in Repr &&
(left != null ==>
left in Repr &... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-sandbox_tmp_tmp3tu2bu8a_Stlc_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 14,378 | 2e5569948033a121492369c3b84f6134625b40e6dce49f3c8cbbc4c3564fe9d7 | // Proving type safety of a Simply Typed Lambda-Calculus in Dafny
// adapted from Coq (http://www.cis.upenn.edu/~bcpierce/sf/Stlc.html)
/// Utilities
// ... handy for partial functions
datatype option<A> = None | Some(get: A)
/// -----
/// Model
/// -----
/// Syntax
// Types
datatype ty = TBase ... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_105_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 452 | 674df551be37bb90877cd1665a7cfc0795f5860b2bccc533fd773e7124dfa6c1 | function countTo( a:array<bool>, n:int ) : int
requires a != null;
requires 0 <= n && n <= a.Length;
reads a;
{
if (n == 0) then 0 else countTo(a, n-1) + (if a[n-1] then 1 else 0)
}
method CountTrue(a: array<bool>) returns (result: int)
requires a != null
ensures result == countTo(a, a.Length... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_106_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 340 | 6ea7aaa4871977ce0022422faaddb67eee22dbaf28621661ec634dda30c1d7f2 | method AppendArrayToSeq(s: seq<int>, a: array<int>) returns (r: seq<int>)
requires a != null
ensures |r| == |s| + a.Length
ensures forall i :: 0 <= i < |s| ==> r[i] == s[i]
ensures forall i :: 0 <= i < a.Length ==> r[|s| + i] == a[i]
{
r := s;
for i := 0 to a.Length
{
r := r... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_113_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 443 | 1cb9a7fa95db6751f23280c7644cbd32b619f6ba81da419a2509ecc044ab887c | predicate IsDigit(c: char)
{
48 <= c as int <= 57
}
method IsInteger(s: string) returns (result: bool)
ensures result <==> (|s| > 0) && (forall i :: 0 <= i < |s| ==> IsDigit(s[i]))
{
result := true;
if |s| == 0 {
result := false;
} else {
for i := 0 to |s|
{
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_126_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 385 | 45560330fa6097bd8d37fa39f6808a4c8837c378a1abe271b71d34ba6b63fa8e | method SumOfCommonDivisors(a: int, b: int) returns (sum: int)
requires a > 0 && b > 0
ensures sum >= 0
ensures forall d :: 1 <= d <= a && 1 <= d <= b && a % d == 0 && b % d == 0 ==> sum >= d
{
sum := 0;
var i := 1;
while i <= a && i <= b
{
if a % i == 0 && b % i == 0 {
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_133_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 487 | 688a1d7b3a5fdea153268c74dcf12ea7a7cbb5108979e6f54b34441464888fbf | function sumNegativesTo( a:array<int>, n:int ) : int
requires a != null;
requires 0 <= n && n <= a.Length;
reads a;
{
if (n == 0) then 0 else if a[n-1] < 0 then sumNegativesTo(a, n-1) + a[n-1] else sumNegativesTo(a, n-1)
}
method SumOfNegatives(a: array<int>) returns (result: int)
ensures result =... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_145_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 435 | 7fff0f014bc00890979608b70779def68ccbbff063ca9adb7d8657d64f75d450 | method MaxDifference(a: array<int>) returns (diff: int)
requires a.Length > 1
ensures forall i, j :: 0 <= i < a.Length && 0 <= j < a.Length ==> a[i] - a[j] <= diff
{
var minVal := a[0];
var maxVal := a[0];
for i := 1 to a.Length
{
if a[i] < minVal {
minVal := a[i];... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_161_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 651 | bef166f3b6a8208ed2344836e2edef01430d0a8adfd176fc4fc2fa0b37a08202 | predicate InArray(a: array<int>, x: int)
reads a
{
exists i :: 0 <= i < a.Length && a[i] == x
}
method RemoveElements(a: array<int>, b: array<int>) returns (result: seq<int>)
// All elements in the output are in a and not in b
ensures forall x :: x in result ==> InArray(a, x) && !InArray(b, x)
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_170_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 567 | 866884c3084d5ce4df7e9dcb1dfef1ae5fce0fc7dd95ce76b4a5af573c1225d4 | function sumTo( a:array<int>, start:int, end:int ) : int
requires a != null;
requires 0 <= start && start <= end && end <= a.Length;
reads a;
{
if (start == end) then 0 else sumTo(a, start, end-1) + a[end-1]
}
method SumInRange(a: array<int>, start: int, end: int) returns (sum: ... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_18_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 402 | 6664a8abfe346bcda4dec34d2e6b097cb4e9b6f34ceee077f4a792c78e8b43e3 | method RemoveChars(s1: string, s2: string) returns (v: string)
ensures |v| <= |s1|
ensures forall i :: 0 <= i < |v| ==> (v[i] in s1) && !(v[i] in s2)
ensures forall i :: 0 <= i < |s1| ==> (s1[i] in s2) || (s1[i] in v)
{
var v' : string := [];
for i := 0 to |s1|
{
if !(s1[i] in s2... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_230_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 430 | 04f8280911e3c260e741687dc581b5ed03749b21940299e61d94b7cc5b4cf67a | method ReplaceBlanksWithChar(s: string, ch: char) returns (v: string)
ensures |v| == |s|
ensures forall i :: 0 <= i < |s| ==> (s[i] == ' ' ==> v[i] == ch) && (s[i] != ' ' ==> v[i] == s[i])
{
var s' : string := [];
for i := 0 to |s|
{
if s[i] == ' '
{
s' := s' + [... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_249_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 647 | 986019b57dfefbdb3883c641d097d173d220d53ab7bffefbc91783539de24f8a | predicate InArray(a: array<int>, x: int)
reads a
{
exists i :: 0 <= i < a.Length && a[i] == x
}
method Intersection(a: array<int>, b: array<int>) returns (result: seq<int>)
// All elements in the output are in both a and b
ensures forall x :: x in result ==> (InArray(a, x) && InArray(b, x))
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_251_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 301 | 048237bebf72c298b6d53e917686b7a50080473827c29a9b98b0aae168fa4a14 | method InsertBeforeEach(s: seq<string>, x: string) returns (v: seq<string>)
ensures |v| == 2 * |s|
ensures forall i :: 0 <= i < |s| ==> v[2*i] == x && v[2*i + 1] == s[i]
{
v := [];
for i := 0 to |s|
{
v := v + [x, s[i]];
}
} |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_261_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 397 | 2c66efeed3b0fd1ac1258e6c46c8bb37bc63444a6132e18a899ea0fa68f9f164 | method ElementWiseDivision(a: seq<int>, b: seq<int>) returns (result: seq<int>)
requires |a| == |b|
requires forall i :: 0 <= i < |b| ==> b[i] != 0
ensures |result| == |a|
ensures forall i :: 0 <= i < |result| ==> result[i] == a[i] / b[i]
{
result := [];
var i := 0;
while i < |a|
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_267_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 262 | 32af6f21350dd8e5ed9a2a9d953d19729014e83a60ddd90ecee1e50329cf1a85 | method SumOfSquaresOfFirstNOddNumbers(n: int) returns (sum: int)
requires n >= 0
ensures sum == (n * (2 * n - 1) * (2 * n + 1)) / 3
{
sum := 0;
var i := 1;
for k:=0 to n
{
sum := sum + i * i;
i := i + 2;
}
} |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_273_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 342 | f8581fffc3448930ca6d78b6c6a8c02e383a51d3c13589381419319192ab0378 | method SubtractSequences(a: seq<int>, b: seq<int>) returns (result: seq<int>)
requires |a| == |b|
ensures |result| == |a|
ensures forall i :: 0 <= i < |result| ==> result[i] == a[i] - b[i]
{
result := [];
var i := 0;
while i < |a|
{
result := result + [a[i] - b[i]];
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_282_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 455 | 6e96847286ec0161c8b6791ada022dc1456c25a4dc7810f910fac978b2a3e2f9 | method ElementWiseSubtraction(a: array<int>, b: array<int>) returns (result: array<int>)
requires a != null && b != null
requires a.Length == b.Length
ensures result != null
ensures result.Length == a.Length
ensures forall i :: 0 <= i < result.Length ==> result[i] == a[i] - b[i]
{
result ... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_284_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 383 | e0fd5b52f9b361101a05229f6d35050923d221146ca09e63fe32f553f8afec61 | method AllElementsEqual(a: array<int>, n: int) returns (result: bool)
requires a != null
ensures result ==> forall i :: 0 <= i < a.Length ==> a[i] == n
ensures !result ==> exists i :: 0 <= i < a.Length && a[i] != n
{
result := true;
for i := 0 to a.Length
{
if a[i] != n {
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_290_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 340 | dfb202bbefa5f39c385016fc37c953fb857b8c0a34ea45e3f4a66650e7dc3d9e | method MaxLengthList(lists: seq<seq<int>>) returns (maxList: seq<int>)
requires |lists| > 0
ensures forall l :: l in lists ==> |l| <= |maxList|
ensures maxList in lists
{
maxList := lists[0];
for i := 1 to |lists|
{
if |lists[i]| > |maxList| {
maxList := lists[i];
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_2_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 647 | 2a5f3abcba5df3b51ccebf34820943e24c12364bea982d118eb8aa0fd4e58baa | predicate InArray(a: array<int>, x: int)
reads a
{
exists i :: 0 <= i < a.Length && a[i] == x
}
method SharedElements(a: array<int>, b: array<int>) returns (result: seq<int>)
// All elements in the output are in both a and b
ensures forall x :: x in result ==> (InArray(a, x) && InArray(b, x))
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_307_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 273 | a71c9d4ff48647f9762e67490a11b59ff5043ca1707ea68e3881e07cefb18c76 | method DeepCopySeq(s: seq<int>) returns (copy: seq<int>)
ensures |copy| == |s|
ensures forall i :: 0 <= i < |s| ==> copy[i] == s[i]
{
var newSeq: seq<int> := [];
for i := 0 to |s|
{
newSeq := newSeq + [s[i]];
}
return newSeq;
} |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_310_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 229 | efb2da7ce545fb3be6bbdf5105882c4814048f50400f95d8dee3f0691adb49b1 | method ToCharArray(s: string) returns (a: array<char>)
ensures a.Length == |s|
ensures forall i :: 0 <= i < |s| ==> a[i] == s[i]
{
a := new char[|s|];
for i := 0 to |s|
{
a[i] := s[i];
}
} |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_399_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 338 | 2e68cffc9d1902a084bd63cc8d56fcaf44255025826c409765e99b96e5b333ac | method BitwiseXOR(a: seq<bv32>, b: seq<bv32>) returns (result: seq<bv32>)
requires |a| == |b|
ensures |result| == |a|
ensures forall i :: 0 <= i < |result| ==> result[i] == a[i] ^ b[i]
{
result := [];
var i := 0;
while i < |a|
{
result := result + [a[i] ^ b[i]];
i :... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_3_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 327 | 1f32aacb2a07d12c9f69d59eca1c4b2ec806cdfb834894e9db5b280009168d18 | method IsNonPrime(n: int) returns (result: bool)
requires n >= 2
ensures result <==> (exists k :: 2 <= k < n && n % k == 0)
{
result := false;
var i := 2;
while i <= n/2
{
if n % i == 0
{
result := true;
break;
}
i := i + 1;
... |
sun-wendy/DafnyBench | DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_401_no_hints.dfy | Apache-2.0 | 67 | main | 0cd28feed9cd0179b07fdb9d002f8c39063658e4 | 2024-12-12T07:08:20Z | 670 | c7f2f67215b7a254e1febee360e7b88783f4a472417ac5e60ff1282a0d64a1bb | method IndexWiseAddition(a: seq<seq<int>>, b: seq<seq<int>>) returns (result: seq<seq<int>>)
requires |a| > 0 && |b| > 0
requires |a| == |b|
requires forall i :: 0 <= i < |a| ==> |a[i]| == |b[i]|
ensures |result| == |a|
ensures forall i :: 0 <= i < |result| ==> |result[i]| == |a[i]|
ensure... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.