Dafny

1 program Added 2025-10-22T16:59:04Z Model: google/gemini-2.5-proTemp: 0.4 Evidence Report issue View issues
Aliases: —
Provenance: commit cea627b23c · authored 2025-10-22T18:59:05+02:00 · model google/gemini-2.5-pro

Sources mentioning this language

6 sources · pl_id: pl/dafny
LLM (this repo) · 1PldbLinguistWikipediaRosettacodeWikidata · Q48989398

Wikipedia infobox

Pulled from the wikimedia/structured-wikipedia snapshot — see data/raw/wikipedia_pl_facts.*.jsonl and pl_fact.csv for the long-table provenance.

Paradigmsimperative · functional
Typingstatic, strong, safe
Designed byMicrosoft Research · K. Rustan M. Leino
First appeared2009
LicenseMIT
Homepagehttp://dafny.org

Extensions claimed by this language

2 claims. Each row is one upstream assertion with its strength. SWH column shows file occurrences with that extension across the entire archive.
ExtensionSourceStrengthSWH
.dfylinguistprimary62.3K files
.dfywikipediaproposed62.3K files

Related languages

Dale (0.18)DATR (0.18)Dawn (0.18)Diby (0.18)Darwin (0.15)

LLM-contributed programs

Verified Binary Search

Provenance: commit cea627b23c · authored 2025-10-22T18:59:05+02:00 · model google/gemini-2.5-pro · Temp 0.4
code.dfy · license: MIT · added: 2025-10-22T16:59:04Z
method BinarySearch(a: array<int>, key: int) returns (index: int)
  requires a != null && a.Length > 0
  requires forall i,j :: 0 <= i < j < a.Length ==> a[i] <= a[j]
  ensures -1 <= index < a.Length
  ensures index == -1 ==> forall k :: 0 <= k < a.Length ==> a[k] != key
  ensures 0 <= index ==> a[index] == key
{
  var low := 0;
  var high := a.Length;
  index := -1;
  while low < high && index == -1
    invariant 0 <= low <= high <= a.Length
    invariant index == -1 ==> forall k :: 0 <= k < low || high <= k < a.Length ==> a[k] != key
    invariant -1 <= index < a.Length
    invariant index != -1 ==> 0 <= index < a.Length && a[index] == key
  {
    var mid := (low + high) / 2;
    if a[mid] < key {
      low := mid + 1;
    } else if key < a[mid] {
      high := mid;
    } else {
      index := mid;
    }
  }
}

Real programs from Software Heritage

No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)

Contribute — propose a file extension

Tell us where to find evidence about Dafny (mapped to pl/dafny). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Dafny/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Daffodil Daft →