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-synthesis_task_id_412_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
650
845c092262b656b00c5b937585dec3c29b9ef1c0ac5c17520af20faccc59ee66
/** * 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/hints_removed/dafny-synthesis_task_id_414_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
308
5508a78c5e15ad021029a84ae0d161fdd5a33d07c71dd1cd67da92456627acd4
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| { if seq1[i] in seq2 { result := true; break; } } }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_424_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
364
924aa23e6d74bcb0303865cfa59ac9266059faac24280ef33c201ca4742973d0
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| { rearChars := rearChars + [l[i][|l...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_426_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
636
6d57dac092c437fff569d4d21f9a7c374d819e9a8a42a0a6500cd6b342e186d8
/** * 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/hints_removed/dafny-synthesis_task_id_431_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
531
bf8671fc0ae9401f0e998f123575b84bbce407198f2c1b11bcb1ac55425eace7
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/hints_removed/dafny-synthesis_task_id_433_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
409
cb15c9ed7b37b5ae7a414a22ac3c05d8be26c490e6770ff00e12a29112e98d1d
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 { if n <= a[i] { ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_436_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
707
4c7670989665faf90123500e0d1762ccc9f722e35e69843306f1319b3ef46afb
/** * 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/hints_removed/dafny-synthesis_task_id_445_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
341
c411fee78363268f1a084ed7c6ece08e4c76cdd84d23ca2fbed903c7a62d828c
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| { result := result + [a[i] * b[i]]; ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_447_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
338
72ef8df2bf48142118c7e085c1b43e1626e6ad755d155bdacbb9bd1c2fddf6db
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 { cubedArray[i] := a[i] * a[i] * a[i]; } ret...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_454_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
300
6773e93c23cbf7f67ad1600bd752fbc91563d16b6bf01efd9fd26e82910d346d
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| { if s[i] == 'z' || s[i] == 'Z' { result := true; break; } } }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_457_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
345
d792543829b2216ec053af5000eed1aa9d33f2384e65c629eb741f256e2693b0
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| { if |s[i]| < |minSublist| { minSublist := s...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_460_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
334
0d6f58ffa01584a6b903391c6da56fb55bac92e7bf5926e0e1b25b16a30014ed
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| { result := result + [lst[i][...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_470_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
446
d7e731f4c7b8e9ae4347f50a0c5e7f5b0203685f08f7a50c5f22246dbda5136f
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/hints_removed/dafny-synthesis_task_id_472_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
350
0e30211c1f59680881868d869237e372fe74bb281414d54c668c84d709775509
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 { if a[i] + 1 == a[i + 1] { result := true; ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_474_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
463
c74ce20461064b19956d64731481e166696c69cbbbafc8c238019e31127714a0
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| { if s[i] == oldChar ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_476_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
925
5d1159cd2b16f997a9c225b8f5cab4f24373b7fb7db80c91e6b5a9fbb6748eda
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 { if a[i] < minVal { minVal := a[i]; } else if a[i] > maxVal { max...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_477_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
677
5d8cc0b3fac5ed78596e5649630e2211e44aecc422e4e437c94f3f6dc89073d3
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/hints_removed/dafny-synthesis_task_id_554_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
632
f5e8354e3dcaa8cf7becf6e0903a0318ce214834037acdc5f5a223996ed7200d
/** * 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]...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_555_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
373
544e830bd8369c2d3ced18477e3c25fe1ec831f9a398d7029560c1c4a2cb8e26
method DifferenceSumCubesAndSumNumbers(n: int) returns (diff: int) requires n >= 0 ensures diff == (n * n * (n + 1) * (n + 1)) / 4 - (n * (n + 1)) / 2 { var sumCubes := 0; var sumNumbers := 0; for i := 1 to n + 1 { sumCubes := sumCubes + i * i * i; sumNumbers := sumNumbe...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_557_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,084
551262d5918554a469af603ba5c6ae9ade47cc676290f6259fb63dc2bc7a1b94
predicate IsLowerCase(c : char) { 97 <= c as int <= 122 } predicate IsUpperCase(c : char) { 65 <= c as int <= 90 } predicate IsLowerUpperPair(c : char, C : char) { (c as int) == (C as int) + 32 } predicate IsUpperLowerPair(C : char, c : char) { (C as int) == (c as int) - 32 } fun...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_565_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
223
09c79fb1aa2de966ea13191b3079b9cc1669a799b1280dcd44ea3849bf61eabc
method SplitStringIntoChars(s: string) returns (v: seq<char>) ensures |v| == |s| ensures forall i :: 0 <= i < |s| ==> v[i] == s[i] { v := []; for i := 0 to |s| { v := v + [s[i]]; } }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_566_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,777
22cc4b4131a44073142cfc6e8341666dbb4d4a06c86f5b1b7c1634b527bf3900
method SumOfDigits(number: nat) returns (sum: nat) requires number >= 0 ensures sum >= 0 ensures sum == SumDigits(number) { sum := 0; var n: nat := number; // Let's find out the number of digits, which is the same as powers of ten for the given number ghost var ndigits := NumberOfDigits(number);...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_567_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
431
fd6eb07a017f6b9b2b22b3d183fefaf7d1315b480697492ff9f71b57ae5c39de
method IsSorted(a: array<int>) returns (sorted: bool) requires a.Length > 0 ensures sorted <== forall i, j :: 0 <= i < j < a.Length ==> a[i] <= a[j] ensures !sorted ==> exists i, j :: 0 <= i < j < a.Length && a[i] > a[j] { sorted := true; for i := 0 to a.Length - 1 { if a[i] > a[...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_572_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
430
b4b0dd3e20343a1bdfdd1f27d417a1ac913ffeff44dbd2e1c56c29b1bbee80af
method RemoveDuplicates(a: array<int>) returns (result: seq<int>) requires a != null ensures forall x :: x in result <==> exists i :: 0 <= i < a.Length && a[i] == x ensures forall i, j :: 0 <= i < j < |result| ==> result[i] != result[j] { var res: seq<int> := []; for i := 0 to a.Length { ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_573_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,392
046c16d61b87ddd672ed1466f60c67c7a2b2db63eba2e7e82e9bc874cf072a2b
method UniqueProduct (arr: array<int>) returns (product: int) ensures product == SetProduct((set i | 0 <= i < arr.Length :: arr[i])) { var p := 1; var seen: set<int> := {}; for i := 0 to arr.Length { if ! (arr[i] in seen) { seen := seen + { arr[i] }; p :...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_576_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
377
b728e46cde5f962921cd39ee417f9a44e48143abc4de1b4557dcfede9304bf72
method IsSublist(sub: seq<int>, main: seq<int>) returns (result: bool) ensures true <== (exists i :: 0 <= i <= |main| - |sub| && sub == main[i..i + |sub|]) { if |sub| > |main| { return false; } for i := 0 to |main| - |sub| + 1 { if sub == main[i..i + |sub|] { r...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_578_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
357
6fd522910c243a681c7e8d6e3f1659e8bd700cb3004c03f9497ec9ec401842be
method Interleave(s1: seq<int>, s2: seq<int>, s3: seq<int>) returns (r: seq<int>) requires |s1| == |s2| && |s2| == |s3| ensures |r| == 3 * |s1| ensures forall i :: 0 <= i < |s1| ==> r[3*i] == s1[i] && r[3*i + 1] == s2[i] && r[3*i + 2] == s3[i] { r := []; for i := 0 to |s1| { r :=...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_579_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
866
3e65180b867b71210b0d01d2e40ee763a651ce6fb8fc8e4e94a1afdeac8a64e2
predicate InArray(a: array<int>, x: int) reads a { exists i :: 0 <= i < a.Length && a[i] == x } method DissimilarElements(a: array<int>, b: array<int>) returns (result: seq<int>) // All elements in the output are either in a or b, but not in both or neither ensures forall x :: x in result ==> (...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_587_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
255
c391d4fda18abd5d0bd593754ddda9c188bf02afd05890c8ee830e117ef93ce3
method ArrayToSeq(a: array<int>) returns (s: seq<int>) requires a != null ensures |s| == a.Length ensures forall i :: 0 <= i < a.Length ==> s[i] == a[i] { s := []; for i := 0 to a.Length { s := s + [a[i]]; } }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_588_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
939
7684f15abb452756fb7afb0a1b9f3db7129e034ee31141730c5936b643c3004a
method DifferenceMinMax(a: array<int>) returns (diff: int) requires a.Length > 0 ensures diff == Max(a[..]) - Min(a[..]) { var minVal := a[0]; var maxVal := a[0]; for i := 1 to a.Length { if a[i] < minVal { minVal := a[i]; } else if a[i] > maxVal { ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_594_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
957
5145b70e2479ed7db716cb8468423a052ba138d3ec402597efe825e151604018
predicate IsEven(n: int) { n % 2 == 0 } predicate IsOdd(n: int) { n % 2 != 0 } method FirstEvenOddDifference(a: array<int>) returns (diff: int) requires a.Length >= 2 requires exists i :: 0 <= i < a.Length && IsEven(a[i]) requires exists i :: 0 <= i < a.Length && IsOdd(a[i]) ensu...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_599_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
292
6e8ceaff986d43772b770268ebff388147f850533a5645ccf11f1ae255ffdf0b
method SumAndAverage(n: int) returns (sum: int, average: real) requires n > 0 ensures sum == n * (n + 1) / 2 ensures average == sum as real / n as real { sum := 0; for i := 1 to n + 1 { sum := sum + i; } average := sum as real / n as real; }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_602_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
944
0257ba753def6a1f47e1170ab3e13d7c265049b8d7e92fc26772a0ba173cd0a9
method FindFirstRepeatedChar(s: string) returns (found: bool, c: char) ensures found ==> exists i, j :: 0 <= i < j < |s| && s[i] == s[j] && s[i] == c && (forall k, l :: 0 <= k < l < j && s[k] == s[l] ==> k >= i) ensures !found ==> (forall i, j :: 0 <= i < j < |s| ==> s[i] != s[j]) { c := ' '; found...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_603_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
436
aa14c363be787ef895b7619fdf0f0175d87a7bd9d1d6ae9d8bdb6e89f07b39e0
method LucidNumbers(n: int) returns (lucid: seq<int>) requires n >= 0 ensures forall i :: 0 <= i < |lucid| ==> lucid[i] % 3 == 0 ensures forall i :: 0 <= i < |lucid| ==> lucid[i] <= n ensures forall i, j :: 0 <= i < j < |lucid| ==> lucid[i] < lucid[j] { lucid := []; var i := 0; while...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_605_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
325
730e7893569e26f617487a2fac98375b32621c6221523f19f0a7bbf6c1630ba8
method IsPrime(n: int) returns (result: bool) requires n >= 2 ensures result <==> (forall k :: 2 <= k < n ==> n % k != 0) { result := true; var i := 2; while i <= n/2 { if n % i == 0 { result := false; break; } i := i + 1; ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_610_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
471
3a2b8cd86d125723ed8c98e8a63b91715fb98725a6b1291c6c421047ba610f9d
method RemoveElement(s: array<int>, k: int) returns (v: array<int>) requires 0 <= k < s.Length ensures v.Length == s.Length - 1 ensures forall i :: 0 <= i < k ==> v[i] == s[i] ensures forall i :: k <= i < v.Length ==> v[i] == s[i + 1] { v := new int[s.Length - 1]; var i := 0; while i...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_616_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
508
db5d9b77a98849855e511f57ae08d1ad0c427087efe6e7c3380811fe99592790
method ElementWiseModulo(a: array<int>, b: array<int>) returns (result: array<int>) requires a != null && b != null requires a.Length == b.Length requires forall i :: 0 <= i < b.Length ==> b[i] != 0 ensures result != null ensures result.Length == a.Length ensures forall i :: 0 <= i < resul...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_618_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
361
a87ddf05a2d336d388277a61b19b2ed3c290dbbaaed4e0f0448da54414eafe1a
method ElementWiseDivide(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 := []; for i := 0 to |a| { re...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_61_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
606
cd793351593a1d16bebb928f7310eb85dd88516ec03b27fe2b8e0eceabebd0e2
predicate IsDigit(c: char) { 48 <= c as int <= 57 } method CountSubstringsWithSumOfDigitsEqualToLength(s: string) returns (count: int) ensures count >= 0 { count := 0; for i := 0 to |s| { var sum := 0; for j := i to |s| { if j == |s| || !IsDigit(s[j...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_623_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
455
391c002bf6cdc88fc812679d4a8d3cf348efeba0a83febb94403079fe10301ad
method PowerOfListElements(l: seq<int>, n: int) returns (result: seq<int>) requires n >= 0 ensures |result| == |l| ensures forall i :: 0 <= i < |l| ==> result[i] == Power(l[i], n) { result := []; for i := 0 to |l| { result := result + [Power(l[i], n)]; } } function Power...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_624_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
690
a3eb5bffc68d36e7b7c61f6dd66d196fd65a7367cebdc001811c56a62f7b6a1c
predicate IsLowerCase(c : char) { 97 <= c as int <= 122 } predicate IsLowerUpperPair(c : char, C : char) { (c as int) == (C as int) + 32 } function ShiftMinus32(c : char) : char { ((c as int - 32) % 128) as char } method ToUppercase(s: string) returns (v: string) ensures |v| == |s| ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_627_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
503
11adade8a8849d735f864771c572f764eadddb236b615f941b6a7119da7e8f82
method SmallestMissingNumber(s: seq<int>) returns (v: int) requires forall i, j :: 0 <= i < j < |s| ==> s[i] <= s[j] requires forall i :: 0 <= i < |s| ==> s[i] >= 0 ensures 0 <= v ensures v !in s ensures forall k :: 0 <= k < v ==> k in s { v := 0; for i := 0 to |s| { if...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_629_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
590
323dcc61197ed6712631f2f59b42d461f6b573a4e35f1eb7b30a322ead3cb1c0
predicate IsEven(n: int) { n % 2 == 0 } method FindEvenNumbers(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]) && evenList[i] in arr[..] // All even numbers in the input a...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_62_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
302
0cda86e1f565c1c4488da068d7af7c7c4e35761f7dd836f9d46d8e02c552541b
method FindSmallest(s: array<int>) returns (min: int) requires s.Length > 0 ensures forall i :: 0 <= i < s.Length ==> min <= s[i] ensures exists i :: 0 <= i < s.Length && min == s[i] { min := s[0]; for i := 1 to s.Length { if s[i] < min { min := s[i]; } } }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_632_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,094
9c6d9e00d1055994d4d36235c4b030a86480f8e571961a334deae126193c0507
method MoveZeroesToEnd(arr: array<int>) requires arr.Length >= 2 modifies arr // Same size ensures arr.Length == old(arr.Length) // Zeros to the right of the first zero ensures forall i, j :: 0 <= i < j < arr.Length && arr[i] == 0 ==> arr[j] == 0 // The final array is a permutation of...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_644_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
580
f225e428f45258a8a466c9d47fe459c400797678c64a02472823ce6352b64279
method Reverse(a: array<int>) modifies a; ensures forall k :: 0 <= k < a.Length ==> a[k] == old(a[(a.Length-1) - k]); { var l := a.Length - 1; var i := 0; while (i < l-i) { a[i], a[l-i] := a[l-i], a[i]; i := i + 1; } } method ReverseUptoK(s: array<int>, k: int) modifies s requires 2 <...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_69_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
312
ecce2c7a88d1e8bb70b48f87018d1a024b96442878418c3b514be32c1ab22ac3
method ContainsSequence(list: seq<seq<int>>, sub: seq<int>) returns (result: bool) ensures result <==> (exists i :: 0 <= i < |list| && sub == list[i]) { result := false; for i := 0 to |list| { if sub == list[i] { result := true; break; } } }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_70_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
478
e75e6047b17139f7c94318f29c80f2777c624afe764208232d82815b9aea0c68
method AllSequencesEqualLength(sequences: seq<seq<int>>) returns (result: bool) ensures result <==> forall i, j :: 0 <= i < |sequences| && 0 <= j < |sequences| ==> |sequences[i]| == |sequences[j]| { if |sequences| == 0 { return true; } var firstLength := |sequences[0]|; result := tr...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_728_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
299
b798d36003a6b4df0069a6e6fc0ef9cecfcfb32526c9f6bb3c7c4b86605623e9
method AddLists(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 := []; for i := 0 to |a| { result := result + [a[i] + b[i]]; } }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_732_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
530
ae1205074305282ec2e37c64412edd61868773e4754ba3ea31557eee61694244
predicate IsSpaceCommaDot(c: char) { c == ' ' || c == ',' || c == '.' } method ReplaceWithColon(s: string) returns (v: string) ensures |v| == |s| ensures forall i :: 0 <= i < |s| ==> (IsSpaceCommaDot(s[i]) ==> v[i] == ':') && (!IsSpaceCommaDot(s[i]) ==> v[i] == s[i]) { var s' : string := []; ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_733_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
626
68a15596e5c11495fa8c25c6bbd303603aba37db322601d7ab7fd05fab829752
method FindFirstOccurrence(arr: array<int>, target: int) returns (index: int) requires arr != null requires forall i, j :: 0 <= i < j < arr.Length ==> arr[i] <= arr[j] ensures 0 <= index < arr.Length ==> arr[index] == target ensures index == -1 ==> forall i :: 0 <= i < arr.Length ==> arr[i] != targe...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_741_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
490
17f54fd5fdffafdeb6615c2d0e8ae00b9e82de37e8a7b88ce705684ac3914da8
method AllCharactersSame(s: string) returns (result: bool) ensures result ==> forall i, j :: 0 <= i < |s| && 0 <= j < |s| ==> s[i] == s[j] ensures !result ==> (|s| > 1) && (exists i, j :: 0 <= i < |s| && 0 <= j < |s| && i != j && s[i] != s[j]) { if |s| <= 1 { return true; } var firs...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_743_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
333
19bb6011848465b2d6c83dc3a0266decd4afdc0da6340f78f8d574ff578803f2
method RotateRight(l: seq<int>, n: int) returns (r: seq<int>) requires n >= 0 ensures |r| == |l| ensures forall i :: 0 <= i < |l| ==> r[i] == l[(i - n + |l|) % |l|] { var rotated: seq<int> := []; for i := 0 to |l| { rotated := rotated + [l[(i - n + |l|) % |l|]]; } retur...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_751_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
546
5c534144fbe511bc29aba933a23f60dee191adae7b588b1fb6fcf399c0d90518
method IsMinHeap(a: array<int>) returns (result: bool) requires a != null ensures result ==> forall i :: 0 <= i < a.Length / 2 ==> a[i] <= a[2*i + 1] && (2*i + 2 == a.Length || a[i] <= a[2*i + 2]) ensures !result ==> exists i :: 0 <= i < a.Length / 2 && (a[i] > a[2*i + 1] || (2*i + 2 != a.Length && a[i] ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_755_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,328
f177fac37e7a4f2ffeae2457c5937e3357e5baf59bb387173e680caf6fcf8be0
function MinPair(s: seq<int>) : (r: int) requires |s| == 2 ensures s[0] <= s[1] <==> r == s[0] ensures s[0] > s[1] ==> r == s[1] { if s[0] <= s[1] then s[0] else s[1] } function min(s: seq<int>) : (r: int) requires |s| >= 2 ensures forall i :: 0 <= i < |s| ==> r <= s[i] { if ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_759_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
411
2613b05ab758043cf1d0cb5e1dfa97c7a4f42fc3612951063e31483f79f64ecd
method IsDecimalWithTwoPrecision(s: string) returns (result: bool) ensures result ==> (exists i :: 0 <= i < |s| && s[i] == '.' && |s| - i - 1 == 2) ensures !result ==> !(exists i :: 0 <= i < |s| && s[i] == '.' && |s| - i - 1 == 2) { result := false; for i := 0 to |s| { if s[i] == '.' ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_760_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
537
b2de6ea2f024a56a4ccf31577efaca95b632de38a2dbb30ab9aefa94bc201b4c
method HasOnlyOneDistinctElement(a: array<int>) returns (result: bool) requires a != null ensures result ==> forall i, j :: 0 <= i < a.Length && 0 <= j < a.Length ==> a[i] == a[j] ensures !result ==> exists i, j :: 0 <= i < a.Length && 0 <= j < a.Length && a[i] != a[j] { if a.Length == 0 { ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_769_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
357
65da9b86d183a39230aa656ff4e4a041c357fc651b7c5aeac839d6fb9c27667f
method Difference(a: seq<int>, b: seq<int>) returns (diff: seq<int>) ensures forall x :: x in diff <==> (x in a && x !in b) ensures forall i, j :: 0 <= i < j < |diff| ==> diff[i] != diff[j] { diff := []; for i := 0 to |a| { if a[i] !in b && a[i] !in diff { diff :...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_770_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
300
d983f5756d83fbe2a40f9b4bc3f022b2db3d103f582fedccfb956b467647586b
method SumOfFourthPowerOfOddNumbers(n: int) returns (sum: int) requires n > 0 ensures sum == n * (2 * n + 1) * (24 * n * n * n - 12 * n * n - 14 * n + 7) / 15 { sum := 0; var i := 1; for k := 0 to n { sum := sum + i * i * i * i; i := i + 2; } }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_775_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
373
a67b4d4fbaa54043e550ef7446587005875a5a9ec51c82797fdc9f65ee30d738
predicate IsOdd(n: int) { n % 2 == 1 } method IsOddAtIndexOdd(a: array<int>) returns (result: bool) ensures result <==> forall i :: 0 <= i < a.Length ==> (IsOdd(i) ==> IsOdd(a[i])) { result := true; for i := 0 to a.Length { if IsOdd(i) && !IsOdd(a[i]) { resu...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_784_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,782
5dc3babacaa00cb575f548a2ef9c131501d3602c7eb6283a2724edffd2d6f720
predicate IsEven(n: int) { n % 2 == 0 } predicate IsOdd(n: int) { n % 2 != 0 } predicate IsFirstEven(evenIndex: int, lst: seq<int>) requires 0 <= evenIndex < |lst| requires IsEven(lst[evenIndex]) { forall i :: 0 <= i < evenIndex ==> IsOdd(lst[i]) } predicate IsFirstOdd(oddIndex: ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_790_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
378
6e6a231ccd229cc5a59e34364f3de5a9690df878ec515de4371a1acccc24cf7f
predicate IsEven(n: int) { n % 2 == 0 } method IsEvenAtIndexEven(lst: seq<int>) returns (result: bool) ensures result <==> forall i :: 0 <= i < |lst| ==> (IsEven(i) ==> IsEven(lst[i])) { result := true; for i := 0 to |lst| { if IsEven(i) && !IsEven(lst[i]) { ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_793_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
502
a3833f44ca94c285c599bd73615e02ab84ff3409bd1570fc6fd58066595cd3ce
method LastPosition(arr: array<int>, elem: int) returns (pos: int) requires arr.Length > 0 requires forall i, j :: 0 <= i < j < arr.Length ==> arr[i] <= arr[j] ensures pos == -1 || (0 <= pos < arr.Length && arr[pos] == elem && (pos <= arr.Length - 1 || arr[pos + 1] > elem)) ensures forall i :: 0 <= ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_798_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
371
769ad52d1adaf917cb953cb618e70ebd09281527c137ae00c5ac7a07fe4ff5f5
function sumTo( a:array<int>, n:int ) : int requires a != null; requires 0 <= n && n <= a.Length; reads a; { if (n == 0) then 0 else sumTo(a, n-1) + a[n-1] } method ArraySum(a: array<int>) returns (result: int) ensures result == sumTo(a, a.Length) { result := 0; for i := 0 to a.Length ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_803_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
333
d6ac46800d7b8897fd7aee4088bc61f55c608ba6b592d14d03d1b79caf29df60
method IsPerfectSquare(n: int) returns (result: bool) requires n >= 0 ensures result == true ==> (exists i: int :: 0 <= i <= n && i * i == n) ensures result == false ==> (forall a: int :: 0 < a*a < n ==> a*a != n) { var i := 0; while (i * i < n) { i := i + 1; } return i...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_804_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
345
0fa7c9531a087f131812efac40e688e2162a7bdf81696d8674973b4c12950733
predicate IsEven(n: int) { n % 2 == 0 } method IsProductEven(a: array<int>) returns (result: bool) ensures result <==> exists i :: 0 <= i < a.Length && IsEven(a[i]) { result := false; for i := 0 to a.Length { if IsEven(a[i]) { result := true; br...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_807_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
539
5d30d802d5a7b9277140af1a2c232b87435cd64885d5d66994bf51720cb9f1ea
predicate IsOdd(x: int) { x % 2 != 0 } method FindFirstOdd(a: array<int>) returns (found: bool, index: int) requires a != null ensures !found ==> forall i :: 0 <= i < a.Length ==> !IsOdd(a[i]) ensures found ==> 0 <= index < a.Length && IsOdd(a[index]) && forall i :: 0 <= i < index ==> !IsOdd(a[...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_808_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
241
265a3297d3c461b7e64ed53be22513bbc01788c38419afa97694e2662d039438
method ContainsK(s: seq<int>, k: int) returns (result: bool) ensures result <==> k in s { result := false; for i := 0 to |s| { if s[i] == k { result := true; break; } } }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_809_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
384
0bb7889f0d0dc390663655ed736d25abcda5bd51a11667209ee9bb2a49bbdf6c
method IsSmaller(a: seq<int>, b: seq<int>) returns (result: bool) requires |a| == |b| ensures result <==> forall i :: 0 <= i < |a| ==> a[i] > b[i] ensures !result <==> exists i :: 0 <= i < |a| && a[i] <= b[i] { result := true; for i := 0 to |a| { if a[i] <= b[i] { ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_8_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
298
2c56bbb7a7396b7343d677cc3b91cc5bfe4b144bc39af8504252f0299f21337a
method SquareElements(a: array<int>) returns (squared: array<int>) ensures squared.Length == a.Length ensures forall i :: 0 <= i < a.Length ==> squared[i] == a[i] * a[i] { squared := new int[a.Length]; for i := 0 to a.Length { squared[i] := a[i] * a[i]; } }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_94_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
531
03efa416ef07108f64948bbcd3bc000673dc2a9796a31f39b4cb77b63fc0e172
method MinSecondValueFirst(s: array<seq<int>>) returns (firstOfMinSecond: int) requires s.Length > 0 requires forall i :: 0 <= i < s.Length ==> |s[i]| >= 2 ensures exists i :: 0 <= i < s.Length && firstOfMinSecond == s[i][0] && (forall j :: 0 <= j < s.Length ==> s[i][1] <= s[j][1]) { var ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-synthesis_task_id_95_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
321
0342049ab635341b74978b70a67b77088caf1584883775f477fc8d62bc45ee76
method SmallestListLength(s: seq<seq<int>>) returns (v: int) requires |s| > 0 ensures forall i :: 0 <= i < |s| ==> v <= |s[i]| ensures exists i :: 0 <= i < |s| && v == |s[i]| { v := |s[0]|; for i := 1 to |s| { if |s[i]| < v { v := |s[i]|; } } ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-training_tmp_tmp_n2kixni_session1_training1_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
5,642
7efa39684d44d6128675f64bbe65a748314829df8fe0e21da2e1c41e615eb0b4
/* * Copyright 2021 ConsenSys Software Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/Dafny-VMC_tmp_tmpzgqv0i1u_src_Math_Exponential_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
993
9eaddd2a36bfdeb035c9747b02292a76960221bbe638e0dd9ce37e117a72122e
module Exponential { ghost function {:axiom} Exp(x: real): real lemma {:axiom} FunctionalEquation(x: real, y: real) ensures Exp(x + y) == Exp(x) * Exp(y) lemma {:axiom} Increasing(x: real, y: real) requires x < y ensures Exp(x) < Exp(y) lemma {:axiom} EvalOne() ensures 2.718281828 ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/Dafny-VMC_tmp_tmpzgqv0i1u_src_Math_Helper_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
4,552
cb59db3130c08f26b3402dc15cf6f2f6257d22c52c1a30fb3a2372e3b178cc34
/******************************************************************************* * Copyright by the contributors to the Dafny Project * SPDX-License-Identifier: MIT *******************************************************************************/ module Helper { /************ Definitions ***********...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-workout_tmp_tmp0abkw6f8_starter_ex01_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
316
8bc42c3fa69c3fb16b5518d5fd9bec3621383e1d044f4d75f583fe24446236fd
method Max(a: int, b: int) returns (c: int) ensures c >= a && c >= b && (c == a || c == b) { if (a >= b) { return a; } else { return b; } } method Main() { print "Testing max...\n"; var max := Max(3, 4); max := Max(-3, 4); max := Max(-3, -4); max := Max(5555555, 5555); }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-workout_tmp_tmp0abkw6f8_starter_ex02_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
152
9a9dc983df43a678f98b030e47760f77863044248425c91324be2acfdc5bf61f
method Abs(x: int) returns (y: int) requires x < 0 ensures 0 < y ensures y == -x { return -x; } method Main() { var a := Abs(-3); }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-workout_tmp_tmp0abkw6f8_starter_ex03_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
386
103755245b3078fbfe890d6f91009c49e4500f4f410e515c0878df61f45433cb
method Abs(x: int) returns (y: int) requires x == -1 ensures 0 <= y ensures 0 <= x ==> y == x ensures x < 0 ==> y == -x { return x + 2; } method Abs2(x: real) returns (y: real) requires x == -0.5 ensures 0.0 <= y ensures 0.0 <= x ==> y == x ensures x < 0.0 ==> y == -x { return x + 1.0; } m...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-workout_tmp_tmp0abkw6f8_starter_ex09_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
369
e44b93792f67f87a779ed04ddb2958e50101b24be4f7f9916cfa11f12260daf8
function fib(n: nat): nat { if n == 0 then 0 else if n == 1 then 1 else fib(n - 1) + fib(n - 2) } method ComputeFib(n: nat) returns (b: nat) ensures b == fib(n) { var i: int := 1; if 0 <= n < 2 { return n; } b := 1; var c := 1; while i < n { b, c := c, b + c; i := i + 1; } } me...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny-workout_tmp_tmp0abkw6f8_starter_ex12_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
555
bd469eb6a38974f8ec6261e276b75214e762fcc3789fb16da1f558aa41d39fc6
method FindMax(a: array<int>) returns (max_idx: nat) requires a.Length > 0 ensures 0 <= max_idx < a.Length ensures forall j :: 0 <= j < a.Length ==> a[max_idx] >= a[j] { max_idx := 0; var i: nat := 1; while i < a.Length { if a[i] > a[max_idx] { max_idx := i; } i := i + 1; } return m...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/DafnyExercises_tmp_tmpd6qyevja_Part1_Q1_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
367
3d87f9c4eeba609e96ce07d74dea7b41b737621f2125e4590c02ce163b61f599
method addArrays(a : array<int>, b : array<int>) returns (c : array<int>) requires a.Length == b.Length ensures b.Length == c.Length ensures forall i:int :: 0 <= i <c.Length ==> c[i] == a[i] + b[i] { c := new int[a.Length]; var j := 0; while (j < a.Length) { c[j] := a[j] +...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/DafnyPrograms_tmp_tmp74_f9k_c_automaton_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
4,592
94484b079e0126717c3be06dd167edf54c25b628ed3c1088dc8aaf45906a958e
/** Consider cellular automata: a row of cells is repeatedly updated according to a rule. In this exercise I dabbled with, each cell has the value either false or true. Each cell's next state depends only on the immediate neighbours, in the case where the cell is at the edges of the row, the inexistent neighbours a...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/DafnyPrograms_tmp_tmp74_f9k_c_invertarray_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
676
46e47837391e81d171e067865307f303fd63fa881df23a3804de8aaabec8abb3
/** Inverts an array of ints. */ method InvertArray(a: array<int>) modifies a ensures forall i | 0 <= i < a.Length :: a[i] == old(a[a.Length-1-i]) { var index := 0; while index < a.Length / 2 // the elements i before position index are already switched with the old value of position a.Length -...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/DafnyPrograms_tmp_tmp74_f9k_c_map-multiset-implementation_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
7,168
03ef9215ccb75e79f6ab95c6a68a8b04ad730d8cb629a2091962f154de0dbea9
/** This ADT represents a multiset. */ trait MyMultiset { // internal invariant ghost predicate Valid() reads this // abstract variable ghost var theMultiset: multiset<int> method Add(elem: int) returns (didChange: bool) modifies this requires Valid() ensures Valid() ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/DafnyPrograms_tmp_tmp74_f9k_c_prime-database_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,941
176bde4c7543fb796aabc9ed9eebd07582aede70e47e018f24470d0d9b0e6c54
//predicate for primeness ghost predicate prime(n: nat) { n > 1 && (forall nr | 1 < nr < n :: n % nr != 0) } datatype Answer = Yes | No | Unknown //the class containing a prime database, if a number is prime it returns Yes, if it is not No and if the number //is not in the database it returns Unknown class ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/DafnyProjects_tmp_tmp2acw_s4s_CombNK_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,045
f3d7c750705aa4dc680f04e4bdc1855aceb0ee97b82c9382f3194498a05aa0e1
/* * Formal specification and verification of a dynamic programming algorithm for calculating C(n, k). * FEUP, MIEIC, MFES, 2020/21. */ // Initial recursive definition of C(n, k), based on the Pascal equality. function comb(n: nat, k: nat): nat requires 0 <= k <= n { if k == 0 || k == n then 1 else co...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/DafnyProjects_tmp_tmp2acw_s4s_findMax_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,091
19c13d6d9c0c7fc38f6e48497caebf9fce24afd6ee57ced47b96d78359df573a
/* * Formal verification of a simple algorithm to find the maximum value in an array. * FEUP, MIEIC, MFES, 2020/21. */ // Finds the maximum value in a non-empty array. method findMax(a: array<real>) returns (max: real) requires a.Length > 0 ensures exists k :: 0 <= k < a.Length && max == a[k] ensures f...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/DafnyProjects_tmp_tmp2acw_s4s_Graph_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,527
b3307dc63f3ff9e5e031b09804524de5d472434e546914740021636401ae0bbe
// Simple directed graph with vertices of any type T. class {:autocontracts} Graph<T(==)> { var V: set<T>; // vertex-set var E: set<(T, T)>; // edge-set // Class invariant. ghost predicate Valid() { // edges must refer to vertices that belong to the vertex-set // and self-loops (edge...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/DafnyProjects_tmp_tmp2acw_s4s_longestPrefix_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
638
a146528d27ad80cdee42d806a5df9d9af5c122bfc4922311f96f6108f3c83a10
// MFES, Exam 8/Sept/20201, Exercise 5 // Computes the length (i) of the longest common prefix (initial subarray) // of two arrays a and b. method longestPrefix(a: array<int>, b: array <int>) returns (i: nat) ensures i <= a.Length && i <= b.Length ensures a[..i] == b[..i] ensures i < a.Length && i < b.Le...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/DafnyProjects_tmp_tmp2acw_s4s_partitionOddEven_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
816
bc981e0ae4c554975018ac9a08ebd0c19421b330600a25d85c04f6779278c5fe
// Rearranges the elements in an array 'a' of natural numbers, // so that all odd numbers appear before all even numbers. method partitionOddEven(a: array<nat>) modifies a ensures multiset(a[..]) == multiset(old(a[..])) ensures ! exists i, j :: 0 <= i < j < a.Length && even(a[i]) && odd(a[j]) { var ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/DafnyProjects_tmp_tmp2acw_s4s_RawSort_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,221
241524d37f229b825d4bdc66d6770ee06a32182b9ef293babf9a2881a8727ccb
/** * Proves the correctness of a "raw" array sorting algorithm that swaps elements out of order, chosen randomly. * FEUP, MFES, 2020/21. */ // Type of each array element; can be any type supporting comparision operators. type T = int // Checks if array 'a' is sorted by non-descending order. ghost predic...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/DafnyProjects_tmp_tmp2acw_s4s_sqrt_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
487
19e3d31453839dd08b884443750413e0827e2735c5882a00531f9833af86ff3d
method sqrt(x: real) returns (r: real) requires x >= 0.0 ensures r * r == x && r >= 0.0 method testSqrt() { var r := sqrt(4.0); //if (2.0 < r) { monotonicSquare(2.0, r); } if (r < 2.0) { monotonicSquare(r, 2.0); } } lemma monotonicMult(c: real, x: real, y: real) requires x < y && c > 0.0 e...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny_examples_tmp_tmp8qotd4ez_leetcode_0001-two-sum_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
932
e65e27af53e232707d7868d41d241d44c17fbee19d56e38219f9367d18d5638d
// If this invariant is added explicitly to the loop then the verfication never finishes. // It could be {:opaque} for a more controlled verification: // assert InMap([], m, target) by { // reveal InMap(); // } predicate InMap(nums: seq<int>, m: map<int, int>, t: int) { forall j :: 0 <= j < |nums| ==> t - num...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny_examples_tmp_tmp8qotd4ez_leetcode_0027-remove-element_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
493
8b7aa7f63a57a652cf3e26bd00c8edb2923fbafb82189ce73c13c82e22de032e
method RemoveElement(nums: array<int>, val: int) returns (newLength: int) modifies nums ensures 0 <= newLength <= nums.Length ensures forall x :: x in nums[..newLength] ==> x != val ensures multiset(nums[..newLength]) == multiset(old(nums[..]))[val := 0] { var i := 0; var j := 0; whi...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny_examples_tmp_tmp8qotd4ez_leetcode_0069-sqrt_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
620
1076186e94764a8b037021d2838f21625fea4c50cfc9c3ee6cccf88b0d01d399
// Author: Shaobo He predicate sqrt(x: int, r: int) { r*r <= x && (r+1)*(r+1) > x } lemma uniqueSqrt(x: int, r1: int, r2: int) requires x >= 0 && r1 >= 0 && r2 >= 0; ensures sqrt(x, r1) && sqrt(x, r2) ==> r1 == r2 {} method mySqrt(x: int) returns (res: int) requires 0 <= x; ensures sqrt(x, res); { ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny_examples_tmp_tmp8qotd4ez_leetcode_0070-climbing-stairs_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
310
b4acce86712d8b1610251cb831567de34194d5ce5ced155a019584ac38f2a596
function Stairs(n: nat): nat { if n <= 1 then 1 else Stairs(n - 2) + Stairs(n - 1) } // A simple specification method ClimbStairs(n: nat) returns (r: nat) ensures r == Stairs(n) { var a, b := 1, 1; var i := 1; while i < n { a, b := b, a + b; i := i + 1; } return b; }
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny_examples_tmp_tmp8qotd4ez_leetcode_0277-find-the-celebrity_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,323
993ddc7366238954306f192bd1ccc3aaa06bcd48db08f5b9f2f1cccbe1d1b30d
// Author: Shaobo He predicate knows(a: int, b: int) predicate isCelebrity(n : int, i : int) requires n >= 0 && 0 <= i < n; { forall j :: 0 <= j < n && i != j ==> knows(j, i) && !knows(i, j) } lemma knowerCannotBeCelebrity(n: int, i: int) requires n >= 0 && 0 <= i < n ensures (exists j :: 0 <= j < n ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny_examples_tmp_tmp8qotd4ez_lib_math_DivMod_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
1,960
4e92eb74faf7d27395eafd119e7f804b3c7b82618fc83d3bb36b734fbf063bf3
module DivMod { function {:opaque} DivSub(a: int, b: int): int requires 0 <= a && 0 < b { if a < b then 0 else 1 + DivSub(a - b, b) } function {:opaque} ModSub(a: int, b: int): int requires 0 <= a && 0 < b { if a < b then a else ModSub(a - b, b) } lemma DivModAdd1(a: int, ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny_examples_tmp_tmp8qotd4ez_test_shuffle_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
2,368
2a6b47a6181613a14d465690e4df02ea1082ae003632c366b5eb69b58d341d5e
method random(a: int, b: int) returns (r: int) // requires a <= b ensures a <= b ==> a <= r <= b lemma eqMultiset_t<T>(t: T, s1: seq<T>, s2: seq<T>) requires multiset(s1) == multiset(s2) ensures t in s1 <==> t in s2 { calc <==> { t in s1; t in multiset(s1); // Not necessary: // t ...
sun-wendy/DafnyBench
DafnyBench/dataset/hints_removed/dafny_experiments_tmp_tmpz29_3_3i_circuit_no_hints.dfy
Apache-2.0
67
main
0cd28feed9cd0179b07fdb9d002f8c39063658e4
2024-12-12T07:08:20Z
14,655
501a7a552be3ac3824689bc63f5b67f0b2f4123410dd64cada4d5839b39d4a27
module Base { // We want to represent circuits. // A Circuit is composed of nodes. // Each node can have input ports and output ports. // The ports are represented just by the index of the node, and the index // of the port on the node. datatype INodePort = inodeport(node_id: nat, port_...