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/dafny-language-server_tmp_tmpkir0kenl_Test_tutorial_maximum.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,124
28a5cece37f2e4d8130066b85a36e907badcd74eb03fdd5668994104155ac91b
// 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/ground_truth/dafny-language-server_tmp_tmpkir0kenl_Test_vacid0_Composite.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
5,872
9f464f0ae7673da9ffde7ae91c06896245b23202ccd7a2a96452bdee64829337
// 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/ground_truth/dafny-language-server_tmp_tmpkir0kenl_Test_VSComp2010_Problem1-SumMax.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,184
bad6904760905e4982eb137f406fc5f4887406e8f215b72466ce05344d8d347b
// 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/ground_truth/dafny-language-server_tmp_tmpkir0kenl_Test_VSI-Benchmarks_b1.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,373
789036c0e36a1c6e2abbf75ec3f8dfb9902580d33e559ee8d37b8f8da7ef81da
// 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/ground_truth/dafny-language-server_tmp_tmpkir0kenl_Test_VSI-Benchmarks_b2.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,476
9d378465a030932f0a0063d3d1a78067060f9a63b20e601e45c3a616f2e20b99
// 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/ground_truth/dafny-language-server_tmp_tmpkir0kenl_Test_vstte2012_Two-Way-Sort.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,012
724a8aa66f141313283e8f8a23abd6730020e84a3374c54a040a3599f13683a5
// 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/ground_truth/dafny-learn_tmp_tmpn94ir40q_R01_assertions.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
956
9b4016f60b08dc651bf0a3e2668409af66acabf7c069408554ea58f063926924
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); assert w >= 0; var v := Abs(3); assert 0 <= v; } method TestingAbs2() { var v...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-learn_tmp_tmpn94ir40q_R01_functions.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
941
35a3dbe434bab30bec7fb02521109006a3921dbf93241894390eb61fa16d9929
function abs(x: int): int { if x < 0 then -x else x } method Testing_abs() { var v := abs(3); assert v == 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. functio...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-mini-project_tmp_tmpjxr3wzqh_src_project2a.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
6,665
74105bf9c9424eb438428e9a8148e02b1c394fe4185f0e4513124ed0a0b30533
/* =============================================== 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> decreases s ensures x !in rem(x, s) ensures ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/Dafny-Practice_tmp_tmphnmt4ovh_BST.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
7,286
0c4cdb98b876ebf7d5bc53752c32b6bfd20ad55db99029b5e31699242513e4cd
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/ground_truth/Dafny-Practice_tmp_tmphnmt4ovh_Pattern Matching.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
11,125
0f521200d2bf4b847491b00527ca429ba074ce8ebe4f1d763857333f136a6381
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/ground_truth/dafny-programs_tmp_tmpcwodh6qh_src_expt.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
555
af39b63f523280e93983ed4349413ad38aac2cd156cd5474a9b2dead8b9f3dcb
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 invariant 0 < i <= n + 1 invariant res == Expt(b, i - 1) { res := r...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-programs_tmp_tmpcwodh6qh_src_factorial.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
458
04e319e84bbab9364ef6de78b418b60af95e727134707ec9eab38734a90e34a9
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 invariant 0 < i <= n + 1 invariant res == fact(i - 1) // result sat...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-programs_tmp_tmpcwodh6qh_src_max.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
399
7cd7cae5e799285dc7c52f31ca6425371723aceefc24a5a7019e67ca97a7c782
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); assert v == high; } function max(a: int, b: int): int { i...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-programs_tmp_tmpcwodh6qh_src_ticketsystem.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
3,776
eabef424dfedb5788e5b04dde9daf6d70c26ef27ceb85ce6cce91163976c9891
// 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/ground_truth/Dafny-programs_tmp_tmpnso9eu7u_Algorithms + sorting_bubble-sort.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,198
bc0cc8563399adc6d3d0463aa5d6d769449d0acf89e89df7d357fb4567d863ad
/* 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/ground_truth/Dafny-Projects_tmp_tmph399drhy_p2_arraySplit.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,027
636554326b11694e3742c84e561c64a38910b0a9cf72e8554af5eb02b2764fab
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/ground_truth/dafny-rope_tmp_tmpl4v_njmy_Rope.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
10,209
3cac16224d2902703270238b3058e7c2dcabeab990c116a23951c4c68a1b2ee6
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/ground_truth/dafny-sandbox_tmp_tmp3tu2bu8a_Stlc.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
16,012
f0d81426bacd5f70320942dd5baaabfaad022b3840057adf98f15d5ac12d7a39
// 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/ground_truth/dafny-synthesis_task_id_101.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
160
2d1e5891f2b16e2e673a7cdad33a5096185017a2c27b7c88fecf1a109ebc25d3
method KthElement(arr: array<int>, k: int) returns (result: int) requires 1 <= k <= arr.Length ensures result == arr[k - 1] { result := arr[k - 1]; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_105.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
549
33a16d2c3e23358b241791371e88f94aa3e4d07b321cd35dc88d61375ca94303
function countTo( a:array<bool>, n:int ) : int requires a != null; requires 0 <= n && n <= a.Length; decreases n; 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 == cou...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_106.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
538
2a2b4bd8d469548026b999d5d570116166b22a0473e9f8b7ab77250f6edf4366
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 invariant 0 <...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_113.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
558
b1b82ff054730fc12896ebed0bbad7e2f32247de5d1ca1d78594a37df0647ab6
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| i...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_126.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
550
94643fb88c19021f0d0bf8e377ba454013df9ef379749dadcf5eb13d921ba608
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 invariant 1 <= i <= a + 1 && 1 <= i <= b +...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_127.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
106
8111bd84ae645994e30130c6a56d4eef7336e3e201f8c28d5d1e2eb4e8e59471
method Multiply(a: int, b: int) returns (result: int) ensures result == a * b { result := a * b; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_133.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
591
3c1ee75cbdefab9bb4888dc3279af025a0384f67647be494e5ada853ff291c13
function sumNegativesTo( a:array<int>, n:int ) : int requires a != null; requires 0 <= n && n <= a.Length; decreases n; 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) ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_135.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
157
eb032131394007db9c01fe452eb4bb855d28eeb1c615d909e133c0bc7d1e9e0e
method NthHexagonalNumber(n: int) returns (hexNum: int) requires n >= 0 ensures hexNum == n * ((2 * n) - 1) { hexNum := n * ((2 * n) - 1); }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_139.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
232
c50759e29363099b78cf44a63fb1283218aea9317bc6d94944e837999deac87d
method CircleCircumference(radius: real) returns (circumference: real) requires radius > 0.0 ensures circumference == 2.0 * 3.14159265358979323846 * radius { circumference := 2.0 * 3.14159265358979323846 * radius; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_14.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
263
d3533a145f4bac80bd93d57c915dd4b58be94e6ac5a41ea07584a58b9acb86ab
method TriangularPrismVolume(base: int, height: int, length: int) returns (volume: int) requires base > 0 requires height > 0 requires length > 0 ensures volume == (base * height * length) / 2 { volume := (base * height * length) / 2; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_142.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
350
10fa48786dc30d6096ae48cd2a6bafb5d7f78d10a97200a5fd8c82861d946b35
method CountIdenticalPositions(a: seq<int>, b: seq<int>, c: seq<int>) returns (count: int) requires |a| == |b| && |b| == |c| ensures count >= 0 ensures count == | set i: int | 0 <= i < |a| && a[i] == b[i] && b[i] == c[i]| { var identical := set i: int | 0 <= i < |a| && a[i] == b[i] && b[i] == c[i];...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_143.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
149
68ee96eb55c347af2552319bb42fafe2015c09e46e3dc69c4b5cc6dc9e1c54d3
method CountArrays(arrays: seq<array<int>>) returns (count: int) ensures count >= 0 ensures count == |arrays| { count := |arrays|; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_145.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
588
4e92b3c6f0db10dd0985375b66a09ad9132f62380039fdde91b8d056b2e24071
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 invariant 1 <= i <= a.Length invariant minVal...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_161.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
839
69f354f3508a2f08f2a79745327c049b148c40f0a3757b7d4c36230ba94894df
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/ground_truth/dafny-synthesis_task_id_17.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
150
674a887803c2f3e38d8b1b08d9b2b4b825b40d7088afbe8c104441641fbda7cc
method SquarePerimeter(side: int) returns (perimeter: int) requires side > 0 ensures perimeter == 4 * side { perimeter := 4 * side; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_170.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
677
752784f5134e835629dd2f677d86f2816d3f73792abd35a715d8ea52950de29b
function sumTo( a:array<int>, start:int, end:int ) : int requires a != null; requires 0 <= start && start <= end && end <= a.Length; decreases end; reads a; { if (start == end) then 0 else sumTo(a, start, end-1) + a[end-1] } method SumInRange(a: array<int>, start: int, end:...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_171.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
152
0b5a618794da5ad57a116b3663cd8b44e34a440d767311ba9416c161eeca4a53
method PentagonPerimeter(side: int) returns (perimeter: int) requires side > 0 ensures perimeter == 5 * side { perimeter := 5 * side; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_18.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
607
74d552f1d4148f2012cdce7910801bb48988f4fe6bf689f558653e95a337054d
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| invariant 0 <= i <= |s1| ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_2.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
834
7a9e1787732add8a2c36fe27ef778fde5677eefa069ec20fab6bd2986838fee7
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/ground_truth/dafny-synthesis_task_id_227.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
307
34979f4f7afd9470c6eddfb8a5cf41a2a081263f0ff3dc75a831ecaeea915991
method MinOfThree(a: int, b: int, c: int) returns (min: int) ensures min <= a && min <= b && min <= c ensures (min == a) || (min == b) || (min == c) { if (a <= b && a <= c) { min := a; } else if (b <= a && b <= c) { min := b; } else { min := c; } }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_230.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
591
0f5489a1516cf90e46a3d393d6d56682f2f0e45b0e9b5575fe043b8ef4f6192b
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| invariant 0 <= i <= |s| invariant |s'| == i invarian...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_233.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
228
3ecc38282bbccc3961e017086963705e2caecec67c120e29cbfb231c57feec43
method CylinderLateralSurfaceArea(radius: real, height: real) returns (area: real) requires radius > 0.0 && height > 0.0 ensures area == 2.0 * (radius * height) * 3.14 { area := 2.0 * (radius * height) * 3.14; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_234.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
156
21c357464791a6b2c44cae6974f29b66293289774b18a7304b7c48455b6ad6b4
method CubeVolume(size: int) returns (volume: int) requires size > 0 ensures volume == size * size * size { volume := size * size * size; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_238.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
235
7f76ec99bdbe4fc525dcfe350ab9544747bab6d5454188314869a228268fadbc
method CountNonEmptySubstrings(s: string) returns (count: int) ensures count >= 0 ensures count == (|s| * (|s| + 1)) / 2 // Formula for the number of non-empty substrings of a string { count := (|s| * (|s| + 1)) / 2; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_240.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
380
f7cce902bd3cba601b99dc1353836bbe7478a7af97567c0f04d4cc8197225776
method ReplaceLastElement(first: seq<int>, second: seq<int>) returns (result: seq<int>) requires |first| > 0 ensures |result| == |first| - 1 + |second| ensures forall i :: 0 <= i < |first| - 1 ==> result[i] == first[i] ensures forall i :: |first| - 1 <= i < |result| ==> result[i] == second[i - |firs...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_242.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
129
a6286fc44efcbf17b7185ec8ad6edc31eeb2baa2135608bdd2cb6db03406e129
method CountCharacters(s: string) returns (count: int) ensures count >= 0 ensures count == |s| { count := |s|; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_249.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
836
152e5a1735d52c408b54bfef90f27a3826ffdb9988665f14437f501a9467509b
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/ground_truth/dafny-synthesis_task_id_251.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
458
90b06b5a029345cbd64f9551a9cec928a88171c466d5293533987a301cbb3f6c
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| invariant 0 <= i <= |s| invariant |v| == 2 * i ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_257.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
166
1e0a76fc3f8584029afda1c962f32cb5280a0edd603467ee79e1270e25b690d4
method Swap(a: int, b: int) returns (result: seq<int>) ensures |result| == 2 ensures result[0] == b ensures result[1] == a { result := [b, a]; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_261.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
534
75cde609c37cab363b8414d71fd93389abecaad839598f91cd5282437d5868e5
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/ground_truth/dafny-synthesis_task_id_262.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
313
11936f7b6ca5d6354dc5e057123288a31f19b1936538fe908f34279bce3888a0
method SplitArray(arr: array<int>, L: int) returns (firstPart: seq<int>, secondPart: seq<int>) requires 0 <= L <= arr.Length ensures |firstPart| == L ensures |secondPart| == arr.Length - L ensures firstPart + secondPart == arr[..] { firstPart := arr[..L]; secondPart := arr[L..]; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_264.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
165
1ac32d2b9ab00cad11b55afd8d69d2e646151d8f20fcc966a05c5e9f40336d1c
method DogYears(humanYears: int) returns (dogYears: int) requires humanYears >= 0 ensures dogYears == 7 * humanYears { dogYears := 7 * humanYears; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_266.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
152
553213473ecfdeae0c4b77b965568f544d220a5e98ccad78bb2cfdf7d6962a2b
method LateralSurfaceArea(size: int) returns (area: int) requires size > 0 ensures area == 4 * size * size { area := 4 * size * size; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_267.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
387
0c81cd1088057d5e39247425215e513091c33f2669cdee1a60bd10f4796a0eca
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 invariant 0 <= k <= n invariant sum == k * (2 * k - 1) * (2 * k + 1) / 3 invariant i == 2 * k + 1...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_268.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
147
2d91533e92a09928e089109e9f693cc0ff7f6a6421e921c236f4e0bdbde799a3
method StarNumber(n: int) returns (star: int) requires n >= 0 ensures star == 6 * n * (n - 1) + 1 { star := 6 * n * (n - 1) + 1; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_269.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
108
4879fe68742c3604e0f4b24075007818185c58b31e719b4b52123debcf77f69b
method AsciiValue(c: char) returns (ascii: int) ensures ascii == c as int { ascii := c as int; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_273.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
479
127d7450ca6c9308d317281d17f703b8ef4ae1637b7d2041a301b9a8eb690466
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| invariant 0 <= i <= |a| invariant |resul...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_276.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
253
123aae4121adb6994bb09bdb6df1ceeca1edd2229242f42a51725ae65277ec7c
method CylinderVolume(radius: real, height: real) returns (volume: real) requires radius > 0.0 requires height > 0.0 ensures volume == 3.14159265359 * radius * radius * height { volume := 3.14159265359 * radius * radius * height; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_279.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
166
447b1f77d3762b973e0f2d0c896c8de62f3f4fee8cf89bf73c83d6e05304d455
method NthDecagonalNumber(n: int) returns (decagonal: int) requires n >= 0 ensures decagonal == 4 * n * n - 3 * n { decagonal := 4 * n * n - 3 * n; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_282.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
609
59bcf3c34c45ea1632a2705fba613528b4fc75c736a97c7d6335f32b8bea9715
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/ground_truth/dafny-synthesis_task_id_284.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
488
8258a915ac19dea140e3681c749a8fc4f1b56127c39cf7808b897477cfca6e46
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 invariant 0 <= i <= a.Length ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_290.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
486
89dc7389de72a4d191a712f0bbd898c6a5cc037374a50a7d529db7528032eb75
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| invariant 1 <= i <= |lists| invariant forall l :: l in lists...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_292.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
131
df718f3411f7f923c5da4e1c6ee3541eed140c1684c466493e1f38ad400d1fbe
method Quotient(a: int, b: int) returns (result: int) requires b != 0 ensures result == a / b { result := a / b; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_3.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
423
60790c0e1b599073bc861de0f3f044de9c4ad58d1950663d8b4aa1d96998a2ef
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 invariant 2 <= i invariant result <==> (exists k :: 2 <= k < i && n % k == 0) { if n % i == ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_304.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
243
7166ee97ddd0a926b6c78c52fdb1ca7c97c2afb2694f37f1f6353a98cf9d3a8f
method ElementAtIndexAfterRotation(l: seq<int>, n: int, index: int) returns (element: int) requires n >= 0 requires 0 <= index < |l| ensures element == l[(index - n + |l|) % |l|] { element := l[(index - n + |l|) % |l|]; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_307.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
403
8ccffb819a32ecac49db0dcbdfac314af64e0c6a0e6d02f82687048dd48bb57d
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| invariant 0 <= i <= |s| invariant |newSeq| == i invariant forall k :: 0 <= k < i ==> newSeq[...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_309.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
230
d0d0d23984697e865580b1923bb275a9e7f42e03fe3bc10eb4f339954c841bcd
method Max(a: int, b: int) returns (maxValue: int) ensures maxValue == a || maxValue == b ensures maxValue >= a && maxValue >= b { if a >= b { maxValue := a; } else { maxValue := b; } }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_310.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
344
6952a2825a432e83dd1eb3679742ba6fb1d9a4c091bcc7d3fe93be54db579b33
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| invariant 0 <= i <= |s| invariant a.Length == |s| invariant forall k :: 0 <= k < i ==> a[k] == s[k] { ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_312.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
284
36633f9c4f5031457e1f93e022063f2f96977e227bcf9617b8524d6b301ef5ba
method ConeVolume(radius: real, height: real) returns (volume: real) requires radius > 0.0 && height > 0.0 ensures volume == (1.0/3.0) * (3.14159265358979323846) * radius * radius * height { volume := (1.0/3.0) * (3.14159265358979323846) * radius * radius * height; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_396.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
171
f5c847baf4236bd2b6adfee66e6ec675671a60c1ee8872e3da1e1c64f56fb1ab
method StartAndEndWithSameChar(s: string) returns (result: bool) requires |s| > 0 ensures result <==> s[0] == s[|s| - 1] { result := s[0] == s[|s| - 1]; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_397.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
529
0d0c5eabb4dff9d29df5f42830f7bd0f6ec6d3e258e470fd2074f782f736db80
method MedianOfThree(a: int, b: int, c: int) returns (median: int) ensures median == a || median == b || median == c ensures (median >= a && median <= b) || (median >= b && median <= a) || (median >= a && median <= c) || (median >= c && median <= a) || (median >= b && median <= c) || (median >= c && median <=...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_399.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
475
3b9e3bf708545444e70d1a3f3415339b1a95b751bd1397b08ad003668c0d5920
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| invariant 0 <= i <= |a| invariant |result| =...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_401.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,085
861b48ffe3335263ba4b34e11bd8a2c136252cd0b2d98e27847a19c74e4a3d59
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...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_404.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
230
975b83ccf56b1d61e88a7c7989bcd939fae418f5e53ca32faf38774201babf18
method Min(a: int, b: int) returns (minValue: int) ensures minValue == a || minValue == b ensures minValue <= a && minValue <= b { if a <= b { minValue := a; } else { minValue := b; } }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_406.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
112
35c9a0625fca4992626d261215d45c026000baa80476a81774f89af0f0022560
method IsOdd(n: int) returns (result: bool) ensures result <==> n % 2 == 1 { result := n % 2 == 1; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_412.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
914
37bf518ecafda9f51b84409b7e83df4dc79e7dfb9ea9e495e0d2a5aff5c0b053
/** * Remove odd numbers from an array of numbers **/ predicate IsEven(n: int) { n % 2 == 0 } method RemoveOddNumbers(arr: array<int>) returns (evenList: seq<int>) // All numbers in the output are even and exist in the input ensures forall i :: 0 <= i < |evenList| ==> IsEven(evenList[i]) && ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_414.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
419
79033a94de216c83ad367a99555ee3fc30bf55166e3c4554c44df6e6a0cd5f78
method AnyValueExists(seq1: seq<int>, seq2: seq<int>) returns (result: bool) ensures result <==> (exists i :: 0 <= i < |seq1| && seq1[i] in seq2) { result := false; for i := 0 to |seq1| invariant 0 <= i <= |seq1| invariant result <==> (exists k :: 0 <= k < i && seq1[k] in seq2) { ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_424.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
512
80786ebb3d7ee0d0a5136bc7ccd09fb7bc34b2ba7b82030afddd7e0ee99a6c9b
method ExtractRearChars(l: seq<string>) returns (r: seq<char>) requires forall i :: 0 <= i < |l| ==> |l[i]| > 0 ensures |r| == |l| ensures forall i :: 0 <= i < |l| ==> r[i] == l[i][|l[i]| - 1] { var rearChars: seq<char> := []; for i := 0 to |l| invariant 0 <= i <= |l| invaria...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_426.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
893
4d52425a4e4006ee33949cb0c29ceaffefaf4782d845bc3f4957224f669082ed
/** * Filter odd numbers from an array of numbers **/ predicate IsOdd(n: int) { n % 2 != 0 } method FilterOddNumbers(arr: array<int>) returns (oddList: seq<int>) // All numbers in the output are odd and exist in the input ensures forall i :: 0 <= i < |oddList| ==> IsOdd(oddList[i]) && oddLis...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_430.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
191
f6305014984a0913169cec2d733f9425f398e0b05af11142215051f7a022ae14
method ParabolaDirectrix(a: real, h: real, k: real) returns (directrix: real) requires a != 0.0 ensures directrix == k - 1.0 / (4.0 * a) { directrix := k - 1.0 / (4.0 * a); }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_431.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
781
a7c0fef52eff5da5fad7c7f6173d5196de61dd71f8f611a99bbb5243fa8fc53d
method HasCommonElement(a: array<int>, b: array<int>) returns (result: bool) requires a != null && b != null ensures result ==> exists i, j :: 0 <= i < a.Length && 0 <= j < b.Length && a[i] == b[j] ensures !result ==> forall i, j :: 0 <= i < a.Length && 0 <= j < b.Length ==> a[i] != b[j] { result :...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_432.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
155
7a80dea2a3222a2df897f5df44ad22871ddde6de7237250f48b3662675c683f2
method MedianLength(a: int, b: int) returns (median: int) requires a > 0 && b > 0 ensures median == (a + b) / 2 { median := (a + b) / 2; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_433.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
580
b99959bd9ef38218d4a160e942ae29f12f9677522f1741266e99fd4a42f0b48e
method IsGreater(n: int, a: array<int>) returns (result: bool) requires a != null ensures result ==> forall i :: 0 <= i < a.Length ==> n > a[i] ensures !result ==> exists i :: 0 <= i < a.Length && n <= a[i] { result := true; var i := 0; while i < a.Length invariant 0 <= i <= a.Le...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_435.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
136
f91fc9bf1f0041d7d5298ec923e40c40c6570affd29e771b1aeec2ae3cf541e8
method LastDigit(n: int) returns (d: int) requires n >= 0 ensures 0 <= d < 10 ensures n % 10 == d { d := n % 10; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_436.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
999
e07469a5757e8519ccbc8a20d38023aca6ad8301e42e56ae58f6c6dc0dc090e1
/** * Find negative numbers from an array of numbers **/ predicate IsNegative(n: int) { n < 0 } method FindNegativeNumbers(arr: array<int>) returns (negativeList: seq<int>) // All numbers in the output are negative and exist in the input ensures forall i :: 0 <= i < |negativeList| ==> IsNega...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_441.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
149
4b461b66766eae083d90bffae1059dbd27635e5a7ca0cfd5a8ac286aee363026
method CubeSurfaceArea(size: int) returns (area: int) requires size > 0 ensures area == 6 * size * size { area := 6 * size * size; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_445.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
478
1e0b73a9bfaa55fa6051b4862e32f16d05339de79d75b1b650c9afd4b0a6283b
method MultiplyElements(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| invariant 0 <= i <= |a| invariant |result...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_447.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
507
5c35a702535b24af166f6490dd70dd9c87813c607ac299679e5170925dd4969e
method CubeElements(a: array<int>) returns (cubed: array<int>) ensures cubed.Length == a.Length ensures forall i :: 0 <= i < a.Length ==> cubed[i] == a[i] * a[i] * a[i] { var cubedArray := new int[a.Length]; for i := 0 to a.Length invariant 0 <= i <= a.Length invariant cubedArray....
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_452.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
374
ecc8689413164ba40065cbbb26b87f6503fa4a43ff5be2c0634152815a8f27d3
method CalculateLoss(costPrice: int, sellingPrice: int) returns (loss: int) requires costPrice >= 0 && sellingPrice >= 0 ensures (costPrice > sellingPrice ==> loss == costPrice - sellingPrice) && (costPrice <= sellingPrice ==> loss == 0) { if (costPrice > sellingPrice) { loss := costPrice - sel...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_454.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
421
1d4d9a4874d37a52d84f5d7bab4ebf0546321c63bb5e456d848dbdeb18aac63a
method ContainsZ(s: string) returns (result: bool) ensures result <==> (exists i :: 0 <= i < |s| && (s[i] == 'z' || s[i] == 'Z')) { result := false; for i := 0 to |s| invariant 0 <= i <= |s| invariant result <==> (exists k :: 0 <= k < i && (s[k] == 'z' || s[k] == 'Z')) { ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_455.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
200
5c5b2db0e1d5db46a8f53c1531b092d09bc4f4a0ff03d0d7045de4afd5aba70a
method MonthHas31Days(month: int) returns (result: bool) requires 1 <= month <= 12 ensures result <==> month in {1, 3, 5, 7, 8, 10, 12} { result := month in {1, 3, 5, 7, 8, 10, 12}; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_457.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
503
279c7816d0cdd80f2b0f7d78d9959e0b1245257dd93af00bb62b36b37d33d7c3
method MinLengthSublist(s: seq<seq<int>>) returns (minSublist: seq<int>) requires |s| > 0 ensures minSublist in s ensures forall sublist :: sublist in s ==> |minSublist| <= |sublist| { minSublist := s[0]; for i := 1 to |s| invariant 0 <= i <= |s| invariant minSublist in s[..i...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_458.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
185
4e304d4fb7fa94210cc41e6481da824de1f8e4ca36014d3d442e451b4bbb5d83
method RectangleArea(length: int, width: int) returns (area: int) requires length > 0 requires width > 0 ensures area == length * width { area := length * width; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_460.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
471
13f47023c8daa8cf2874e43c9b13bf5ab6d6b31ddc00b565d8c837b4c08a95ec
method GetFirstElements(lst: seq<seq<int>>) returns (result: seq<int>) requires forall i :: 0 <= i < |lst| ==> |lst[i]| > 0 ensures |result| == |lst| ensures forall i :: 0 <= i < |result| ==> result[i] == lst[i][0] { result := []; for i := 0 to |lst| invariant 0 <= i <= |lst| ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_461.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
318
ac77a3d48a90f9b44e9d4d5b19de420d0759af96ac0bc69449cb91cb7cb8cfbb
predicate IsUpperCase(c: char) { 65 <= c as int <= 90 } method CountUppercase(s: string) returns (count: int) ensures count >= 0 ensures count == | set i: int | 0 <= i < |s| && IsUpperCase(s[i])| { var uppercase := set i: int | 0 <= i < |s| && IsUpperCase(s[i]); count := |uppercase|; }
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_470.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
616
33f32bd24d501f0076b8a3bdb9a03aa186e1abcd8a3383d2b32600674094ad28
method PairwiseAddition(a: array<int>) returns (result: array<int>) requires a != null requires a.Length % 2 == 0 ensures result != null ensures result.Length == a.Length / 2 ensures forall i :: 0 <= i < result.Length ==> result[i] == a[2*i] + a[2*i + 1] { result := new int[a.Length / 2];...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_472.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
472
fa8b9bc5780d0181c8a50868ff528bdd63c67dca07d7bcb16c264731f107c254
method ContainsConsecutiveNumbers(a: array<int>) returns (result: bool) requires a.Length>0 ensures result <==> (exists i :: 0 <= i < a.Length - 1 && a[i] + 1 == a[i + 1]) { result := false; for i := 0 to a.Length - 1 invariant 0 <= i <= a.Length - 1 invariant result <==> (exists ...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_474.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
637
d125164081be5a9042182e64c5908eb3ea2b63231b0649e158a522236157dd27
method ReplaceChars(s: string, oldChar: char, newChar: char) returns (v: string) ensures |v| == |s| ensures forall i :: 0 <= i < |s| ==> (s[i] == oldChar ==> v[i] == newChar) && (s[i] != oldChar ==> v[i] == s[i]) { var s' : string := []; for i := 0 to |s| invariant 0 <= i <= |s| invariant...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_476.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,237
3665e75e85fbeac78d0159c23eed11cdc067fb3e65bf6119bc1242f0d947708c
method SumMinMax(a: array<int>) returns (sum: int) requires a.Length > 0 ensures sum == Max(a[..]) + Min(a[..]) { var minVal := a[0]; var maxVal := a[0]; for i := 1 to a.Length invariant 1 <= i <= a.Length invariant minVal <= maxVal invariant forall k :: 0 <= k < i...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_477.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
903
baedee0a14f94a282c096c93dbd8a4225760dade680190cfdbd496a28edea39e
predicate IsUpperCase(c : char) { 65 <= c as int <= 90 } predicate IsUpperLowerPair(C : char, c : char) { (C as int) == (c as int) - 32 } function Shift32(c : char) : char { ((c as int + 32) % 128) as char } method ToLowercase(s: string) returns (v: string) ensures |v| == |s| en...
sun-wendy/DafnyBench
DafnyBench/dataset/ground_truth/dafny-synthesis_task_id_554.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
889
7741393f4b62cfe4390b317d9a7fedd01b6d6e7401557357e3473375d676c6af
/** * Find odd numbers from an array of numbers **/ predicate IsOdd(n: int) { n % 2 == 1 } method FindOddNumbers(arr: array<int>) returns (oddList: seq<int>) // All numbers in the output are odd and exist in the input ensures forall i :: 0 <= i < |oddList| ==> IsOdd(oddList[i]) && oddList[i]...