Dataset Viewer
Auto-converted to Parquet Duplicate
statement
stringlengths
1
4.4k
proof
stringlengths
0
42.3k
type
stringclasses
15 values
symbolic_name
stringlengths
1
66
library
stringclasses
158 values
filename
stringlengths
31
124
imports
listlengths
0
0
deps
listlengths
0
64
docstring
stringclasses
1 value
source_url
stringclasses
1 value
commit
stringclasses
1 value
{:compile false} {:termination false} {:extern} IComparable
{}
trait
IComparable
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:termination false} {:extern} Attribute
{}
trait
Attribute
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} {:nativeType "int"} int32 = x: int | -0x8000_0000 <= x < 0x8000_0000
newtype
int32
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} Func<TArg, TRet>
{}
class
Func
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} Int32
{}
class
Int32
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} String
{}
class
String
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} Boolean
{}
class
Boolean
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} Nullable
{}
class
Nullable
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} ValueTuple
{}
class
ValueTuple
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern "Tuple"} Tuple2<T1, T2>
{}
class
Tuple2
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[ "T1", "T2", "Tuple" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern "Tuple"} Tuple3<T1, T2, T3>
{}
class
Tuple3
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[ "T1", "T2", "T3", "Tuple" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern "Tuple"} Tuple4<T1, T2, T3, T4>
{}
class
Tuple4
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[ "T1", "T2", "T3", "T4", "Tuple" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern "Option"} Option<T>
{}
class
Option
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} List<T>
{}
class
List
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} IEnumerable<T>
{}
class
IEnumerable
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} ISet<T>
{}
class
ISet
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} HashSet<T>
{}
class
HashSet
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} Dictionary<TKey, TValue>
{}
class
Dictionary
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} BigInteger
{}
class
BigInteger
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:compile false} {:extern} AsyncLocal<A>
{}
class
AsyncLocal
AutoExtern
Source/AutoExtern/CSharpModel.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:extern "Printer"} Printer
{
class
Printer
AutoExtern.Test.Tutorial.ClientApp
Source/AutoExtern.Test/Tutorial/ClientApp/GroceryListPrinter.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
PrintGroceryList(list: GroceryList<Fruit>) decreases *
{ var items: LinkedList<Entry<Fruit>> := list.items; print "# Printing a grocery list\n"; /// Surprisingly, the generated trait `LinkedList` refers to the `Length` field /// as `LinkedList_Length`. This is because C# is more flexible than Dafny, and /// allows a class to define a field with a name that c...
method
PrintGroceryList
AutoExtern.Test.Tutorial.ClientApp
Source/AutoExtern.Test/Tutorial/ClientApp/GroceryListPrinter.dfy
[]
[ "Cons", "Fruit", "LinkedList", "left", "list" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:extern "Token"} Token extends object
{ var val: CsString var LeadingTrivia: CsString var TrailingTrivia: CsString var Next: Token? ghost var allTokens: seq<Token>
trait
Token
DafnyCore.AST
Source/DafnyCore/AST/DafnyInterface.dfy
[]
[ "CsString", "Next", "val" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Valid() reads this, allTokens decreases |allTokens|
{ && |allTokens| > 0 && allTokens[0] == this && (|| (|allTokens| == 1 && Next == null) || (&& |allTokens| > 1 && Next == allTokens[1] && Next.allTokens == allTokens[1..] && Next.Valid()) ) }
predicate
Valid
DafnyCore.AST
Source/DafnyCore/AST/DafnyInterface.dfy
[]
[ "Next" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
AlltokenSpec(i: int) requires Valid() decreases |allTokens| requires 0 <= i < |allTokens| ensures allTokens == allTokens[..i] + allTokens[i].allTokens
{ if i == 0 { } else { this.Next.AlltokenSpec(i - 1); } }
lemma
AlltokenSpec
DafnyCore.AST
Source/DafnyCore/AST/DafnyInterface.dfy
[]
[ "Valid" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
TokenNextIsIPlus1(middle: Token, i: int) requires Valid() requires 0 <= i < |allTokens| requires allTokens[i] == middle requires middle.Next != null ensures 0 <= i + 1 < |allTokens| && allTokens[i+1] == middle.Next
{ if i == 0 { } else { this.Next.TokenNextIsIPlus1(middle, i - 1); } }
lemma
TokenNextIsIPlus1
DafnyCore.AST
Source/DafnyCore/AST/DafnyInterface.dfy
[]
[ "Token", "Valid", "middle" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
TokenNextIsNullImpliesLastToken(middle: Token, i: int) requires middle.Valid() && this.Valid() requires 0 <= i < |allTokens| requires middle == allTokens[i] requires middle.Next == null ensures i == |allTokens|-1
{ if Next == null { } else { Next.TokenNextIsNullImpliesLastToken(middle, i-1); } } } @Compile(false)
lemma
TokenNextIsNullImpliesLastToken
DafnyCore.AST
Source/DafnyCore/AST/DafnyInterface.dfy
[]
[ "Compile", "Next", "Token", "middle" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:extern "TriviaFormatterHelper"} TriviaFormatterHelper
{
class
TriviaFormatterHelper
DafnyCore.AST
Source/DafnyCore/AST/DafnyInterface.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
EndsWithNewline(input: CsString)
predicate
EndsWithNewline
DafnyCore.AST
Source/DafnyCore/AST/DafnyInterface.dfy
[]
[ "CsString", "input" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:extern "System", "String.Empty"} CsStringEmpty: CsString
const
CsStringEmpty
DafnyCore.AST
Source/DafnyCore/AST/Formatting.dfy
[]
[ "CsString", "System" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
IIndentationFormatter
{
trait
IIndentationFormatter
DafnyCore.AST
Source/DafnyCore/AST/Formatting.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
GetNewLeadingTrivia(token: Token): CsString
function
GetNewLeadingTrivia
DafnyCore.AST
Source/DafnyCore/AST/Formatting.dfy
[]
[ "CsString", "Token" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
GetNewTrailingTrivia(token: Token): CsString
function
GetNewTrailingTrivia
DafnyCore.AST
Source/DafnyCore/AST/Formatting.dfy
[]
[ "CsString", "Token" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
IsAllocated<T>(x: T) ensures allocated(x)
{ }
lemma
IsAllocated
DafnyCore.AST
Source/DafnyCore/AST/Formatting.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
ReindentProgramFromFirstToken(firstToken: Token, reindent: IIndentationFormatter) returns (s: CsString) requires firstToken.Valid() ensures forall token: Token <- firstToken.allTokens :: s.Contains(token.val)
{ var token: Token? := firstToken; var sb := new CsStringBuilder(); ghost var i := 0; var allTokens := firstToken.allTokens; while(token != null) decreases if token == null then 0 else |token.allTokens| invariant 0 <= i <= |allTokens| invariant if to...
method
ReindentProgramFromFirstToken
DafnyCore.AST
Source/DafnyCore/AST/Formatting.dfy
[]
[ "ContainsTransitive", "CsString", "CsStringBuilder", "IIndentationFormatter", "IsAllocated", "Token" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:extern "Text.StringBuilder"} CsStringBuilder
{ ghost var built: CsString
class
CsStringBuilder
DafnyCore.AST
Source/DafnyCore/AST/System.dfy
[]
[ "CsString" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:extern} () @Axiom
constructor
CsStringBuilder
DafnyCore.AST
Source/DafnyCore/AST/System.dfy
[]
[ "Axiom" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:extern "Append"} Append(s: CsString) modifies this ensures built == String.Concat(old(built), s) // This hack is necessary because ToString is replaced by ToString_ // in the C# compiler, even if it's declared extern... @Axiom
method
Append
DafnyCore.AST
Source/DafnyCore/AST/System.dfy
[]
[ "Axiom", "CsString" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:extern @"ToString().ToString"} ToString() returns (r: CsString) ensures r == built
method
ToString
DafnyCore.AST
Source/DafnyCore/AST/System.dfy
[]
[ "CsString" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:extern "String"} CsString(!new,==) {
type
CsString
DafnyCore.AST
Source/DafnyCore/AST/System.dfy
[]
[ "String" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:extern} Contains(needle: CsString) @Axiom
predicate
Contains
DafnyCore.AST
Source/DafnyCore/AST/System.dfy
[]
[ "Axiom", "CsString" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
ContainsTransitive(other: CsString, needle: CsString) requires Contains(other) && other.Contains(needle) ensures Contains(needle)
lemma
ContainsTransitive
DafnyCore.AST
Source/DafnyCore/AST/System.dfy
[]
[ "Contains", "CsString" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
ContainsTransitive() ensures forall s1: CsString, s2: CsString, s3: CsString | s1.Contains(s2) && s2.Contains(s3) :: s1.Contains(s3)
{ forall s1: CsString, s2: CsString, s3: CsString | s1.Contains(s2) && s2.Contains(s3) { s1.ContainsTransitive(s2, s3); } } @Compile(false)
lemma
ContainsTransitive
DafnyCore.AST
Source/DafnyCore/AST/System.dfy
[]
[ "Compile", "CsString", "s1" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:extern "String"} String
{ @Axiom
class
String
DafnyCore.AST
Source/DafnyCore/AST/System.dfy
[]
[ "Axiom" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
{:extern} Concat(s1: CsString, s2: CsString): (r: CsString) ensures r.Contains(s1) ensures r.Contains(s2)
function
Concat
DafnyCore.AST
Source/DafnyCore/AST/System.dfy
[]
[ "CsString", "s1" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
UnaryOpFormat
= | NoFormat | CombineFormat
datatype
UnaryOpFormat
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
BinaryOpFormat
= | NoFormat | ImpliesFormat | EquivalenceFormat | ReverseFormat
datatype
BinaryOpFormat
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
SeqToHeight<T>(s: seq<T>, f: T --> nat): (r: nat) requires forall t <- s :: f.requires(t) ensures forall t <- s :: f(t) <= r
{ if |s| == 0 then 0 else var i := f(s[0]); var j := SeqToHeight(s[1..], f); if i < j then j else i }
function
SeqToHeight
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Name
= Name(dafny_name: string)
datatype
Name
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
VarName
= VarName(dafny_name: string)
datatype
VarName
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Module
= Module( name: Name, docString: string, attributes: seq<Attribute>, requiresExterns: bool, body: Option<seq<ModuleItem>>)
datatype
Module
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Attribute", "ModuleItem", "Name", "Option", "attributes", "name" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
ModuleItem
= | Module(Module) | Class(Class) | Trait(Trait) | Newtype(Newtype) | SynonymType(SynonymType) | Datatype(Datatype) {
datatype
ModuleItem
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Class", "Datatype", "Module", "Newtype", "SynonymType", "Trait" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
name(): Name
{ match this { case Module(m) => m.name case Class(m) => m.name case Trait(m) => m.name case Newtype(m) => m.name case SynonymType(m) => m.name case Datatype(m) => m.name } }
function
name
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Class", "Datatype", "Module", "Name", "Newtype", "SynonymType", "Trait" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
attributes(): seq<Attribute>
{ match this { case Module(m) => m.attributes case Class(m) => m.attributes case Trait(m) => m.attributes case Newtype(m) => m.attributes case SynonymType(m) => m.attributes case Datatype(m) => m.attributes } }
function
attributes
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Attribute", "Class", "Datatype", "Module", "Newtype", "SynonymType", "Trait" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Type
= UserDefined(resolved: ResolvedType) | Tuple(seq<Type>) | Array(element: Type, dims: nat) | Seq(element: Type) | Set(element: Type) | Multiset(element: Type) | Map(key: Type, value: Type) | SetBuilder(element: Type) | MapBuilder(key: Type, value: Type) | Arrow(args: seq<Type>, r...
datatype
Type
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Array", "Ident", "Map", "Multiset", "Object", "Primitive", "ResolvedType", "Seq", "Set", "Tuple", "key", "value" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Replace(mapping: map<Type, Type>): Type
{ if this in mapping then mapping[this] else match this { case UserDefined(resolved: ResolvedType) => Type.UserDefined(resolved.Replace(mapping)) case Tuple(arguments) => Type.Tuple(Std.Collections.Seq.Map( t requires t in arguments => t.Replace(map...
function
Replace
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Array", "Map", "Multiset", "Object", "Primitive", "ResolvedType", "Seq", "Set", "Tuple", "Type", "key", "mapping", "value" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
IsPrimitiveInt()
{ match this { case Primitive(Int) => true case UserDefined(ResolvedType(_, _, SynonymType(typ), _, _, _)) => typ.IsPrimitiveInt() case _ => false } }
predicate
IsPrimitiveInt
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Int", "Primitive", "ResolvedType", "SynonymType" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
IsGeneralTrait()
{ match this { case UserDefined(ResolvedType(_, _, typeKind, _, _, _)) => match typeKind { case SynonymType(typ) => typ.IsGeneralTrait() case Trait(GeneralTrait) => true case _ => false } case _ => false } }
predicate
IsGeneralTrait
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "GeneralTrait", "ResolvedType", "SynonymType", "Trait" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
GetGeneralTraitType(): (r: Type) requires IsGeneralTrait() ensures r.UserDefined? && r.resolved.kind == ResolvedTypeBase.Trait(GeneralTrait)
{ match this { case UserDefined(ResolvedType(_, _, typeKind, _, _, _)) => match typeKind { case SynonymType(typ) => typ.GetGeneralTraitType() case _ => this } } }
function
GetGeneralTraitType
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "GeneralTrait", "IsGeneralTrait", "ResolvedType", "SynonymType", "Type" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
IsClassOrObjectTrait()
{ match this { case UserDefined(ResolvedType(_, _, base, _, _, _)) => base.Class? || (base.Trait? && base.traitType.ObjectTrait?) case _ => false } }
predicate
IsClassOrObjectTrait
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "ResolvedType", "base" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
IsDatatype()
{ match this { case UserDefined(ResolvedType(_, _, typeKind, _, _, _)) => match typeKind { case SynonymType(typ) => typ.IsDatatype() case Datatype(_, _) => true case _ => false } case _ => false } }
predicate
IsDatatype
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Datatype", "ResolvedType", "SynonymType" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
GetDatatypeType(): (r: Type) requires IsDatatype() ensures r.UserDefined? && r.resolved.kind.Datatype?
{ match this { case UserDefined(ResolvedType(_, _, typeKind, _, _, _)) => match typeKind { case SynonymType(typ) => typ.GetDatatypeType() case _ => this } } }
function
GetDatatypeType
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "IsDatatype", "ResolvedType", "SynonymType", "Type" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Extends(other: Type) ensures this.Extends(other) ==> other < this
{ match this { case UserDefined(ResolvedType(_, _, _, _, _, extendedTypes)) => other in extendedTypes || exists i | 0 <= i < |extendedTypes| :: extendedTypes[i].Extends(other) case _ => false } }
predicate
Extends
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "ResolvedType", "Type" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
RemoveSynonyms(): Type
{ match this { case UserDefined(ResolvedType(path, typeArgs, typeKind, attributes, properMethods, extendedTypes)) => match typeKind { case SynonymType(typ) => typ.RemoveSynonyms() case _ => var newtypeArgs := seq(|typeArgs|, i requires 0 <= i <...
function
RemoveSynonyms
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Array", "Map", "Multiset", "Object", "Primitive", "ResolvedType", "Seq", "Set", "SynonymType", "Tuple", "Type", "attributes", "key", "value" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Variance
= | Nonvariant | Covariant | Contravariant
datatype
Variance
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Contravariant", "Covariant", "Nonvariant" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
TypeArgDecl
= TypeArgDecl( name: Ident, bounds: seq<TypeArgBound>, info: TypeParameterInfo)
datatype
TypeArgDecl
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Ident", "TypeArgBound", "TypeParameterInfo", "name" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
TypeArgBound
= | SupportsEquality | SupportsDefault | TraitBound(typ: Type)
datatype
TypeArgBound
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Type" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Primitive
= Int | Real | String | Bool | Char | Native
datatype
Primitive
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Bool", "Char", "Int", "Native", "Real", "String" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
NewtypeRange
= | U8(overflow: bool) // Whether arithmetic operations can overflow and wrap | I8(overflow: bool) | U16(overflow: bool) | I16(overflow: bool) | U32(overflow: bool) | I32(overflow: bool) | U64(overflow: bool) | I64(overflow: bool) | U128(overflow: bool) | I128(overflow: bool) ...
datatype
NewtypeRange
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Bool", "Map", "Sequence", "U8" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
CanOverflow()
{ (U8? || I8? || U16? || I16? || U32? || I32? || U64? || I64? || U128? || I128?) && overflow }
predicate
CanOverflow
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "U8" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
HasArithmeticOperations()
{ !Bool? && !Map? && !Sequence? }
predicate
HasArithmeticOperations
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Bool", "Map", "Sequence" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Attribute
= Attribute(name: string, args: seq<string>)
datatype
Attribute
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "name" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
NewtypeType
= NewtypeType(baseType: Type, range: NewtypeRange, erase: bool)
datatype
NewtypeType
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "NewtypeRange", "Type" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
TraitType
= | ObjectTrait() // Traits that extend objects with --type-system-refresh, all traits otherwise | GeneralTrait()
datatype
TraitType
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "GeneralTrait" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
TypeParameterInfo
= TypeParameterInfo(variance: Variance, necessaryForEqualitySupportOfSurroundingInductiveDatatype: bool)
datatype
TypeParameterInfo
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Variance" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
EqualitySupport
= Never | ConsultTypeArguments
datatype
EqualitySupport
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Never" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
ResolvedTypeBase
= | Class() | Datatype(equalitySupport: EqualitySupport, info: seq<TypeParameterInfo>) | Trait(traitType: TraitType) | SynonymType(baseType: Type) | Newtype(baseType: Type, range: NewtypeRange, erase: bool)
datatype
ResolvedTypeBase
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Class", "Datatype", "EqualitySupport", "Newtype", "NewtypeRange", "SynonymType", "Trait", "TraitType", "Type", "TypeParameterInfo" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
ResolvedType
= ResolvedType( path: seq<Ident>, typeArgs: seq<Type>, kind: ResolvedTypeBase, attributes: seq<Attribute>, properMethods: seq<Name>, extendedTypes: seq<Type>) {
datatype
ResolvedType
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Attribute", "Ident", "Name", "ResolvedTypeBase", "Type", "attributes" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Replace(mapping: map<Type, Type>): ResolvedType
{ ResolvedType( path, Std.Collections.Seq.Map( t requires t in typeArgs => t.Replace(mapping), typeArgs), match kind { case Newtype(baseType, range, erase) => ResolvedTypeBase.Newtype(baseType.Replace(mapping), range, erase) case _ => kind ...
function
Replace
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Newtype", "ResolvedType", "Type", "attributes", "mapping" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Ident
= Ident(id: Name)
datatype
Ident
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Name", "id" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Class
= Class( name: Name, docString: string, enclosingModule: Ident, typeParams: seq<TypeArgDecl>, superTraitTypes: seq<Type>, fields: seq<Field>, body: seq<ClassItem>, attributes: seq<Attribute>)
datatype
Class
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Attribute", "ClassItem", "Field", "Ident", "Name", "Type", "TypeArgDecl", "attributes", "name" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Trait
= Trait( name: Name, docString: string, typeParams: seq<TypeArgDecl>, traitType: TraitType, parents: seq<Type>, downcastableTraits: seq<Type>, body: seq<ClassItem>, attributes: seq<Attribute>)
datatype
Trait
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Attribute", "ClassItem", "Name", "TraitType", "Type", "TypeArgDecl", "attributes", "name" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Datatype
= Datatype( name: Name, docString: string, enclosingModule: Ident, typeParams: seq<TypeArgDecl>, ctors: seq<DatatypeCtor>, body: seq<ClassItem>, isCo: bool, equalitySupport: EqualitySupport, attributes: seq<Attribute>, superTraitTypes: seq<Type>, superTraitNegativeTypes: seq<...
datatype
Datatype
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Attribute", "ClassItem", "DatatypeCtor", "EqualitySupport", "Ident", "Name", "Type", "TypeArgDecl", "attributes", "name" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
DatatypeDtor
= DatatypeDtor( formal: Formal, callName: Option<string>)
datatype
DatatypeDtor
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Formal", "Option" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
DatatypeCtor
= DatatypeCtor( name: Name, docString: string, args: seq<DatatypeDtor>, hasAnyArgs: bool /* includes ghost */)
datatype
DatatypeCtor
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "DatatypeDtor", "Name", "name" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Newtype
= Newtype( name: Name, docString: string, typeParams: seq<TypeArgDecl>, base: Type, range: NewtypeRange, constraint: Option<NewtypeConstraint>, witnessStmts: seq<Statement>, witnessExpr: Option<Expression>, equalitySupport: EqualitySupport, attributes: seq<Attribute>, ...
datatype
Newtype
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Attribute", "ClassItem", "EqualitySupport", "Expression", "Name", "NewtypeConstraint", "NewtypeRange", "Option", "Statement", "Type", "TypeArgDecl", "attributes", "base", "name" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
NewtypeConstraint
= NewtypeConstraint(variable: Formal, constraintStmts: seq<Statement>)
datatype
NewtypeConstraint
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Formal", "Statement" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
SynonymType
= SynonymType( name: Name, docString: string, typeParams: seq<TypeArgDecl>, base: Type, witnessStmts: seq<Statement>, witnessExpr: Option<Expression>, attributes: seq<Attribute>)
datatype
SynonymType
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Attribute", "Expression", "Name", "Option", "Statement", "Type", "TypeArgDecl", "attributes", "base", "name" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
ClassItem
= Method(Method)
datatype
ClassItem
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Method" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Field
= Field(formal: Formal, isConstant: bool, defaultValue: Option<Expression>, isStatic: bool)
datatype
Field
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Expression", "Formal", "Option" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Formal
= Formal(name: VarName, typ: Type, attributes: seq<Attribute>)
datatype
Formal
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Attribute", "Type", "VarName", "attributes", "name" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Method
= Method( docString: string, attributes: seq<Attribute>, isStatic: bool, hasBody: bool, outVarsAreUninitFieldsToAssign: bool, // For constructors wasFunction: bool, // To choose between "&self" and "&mut self" overridingPath: Option<seq<Ident>>, name: Name, typeParams: seq<TypeArgDec...
datatype
Method
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Attribute", "Formal", "Ident", "Name", "Option", "Statement", "Type", "TypeArgDecl", "VarName", "attributes", "name" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
CallSignature
= CallSignature(parameters: seq<Formal>, inheritedParams: seq<Formal>)
datatype
CallSignature
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Formal" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
CallName
= CallName(name: Name, onType: Option<Type>, receiverArg: Option<Formal>, receiverAsArgument: bool, signature: CallSignature) | MapBuilderAdd | MapBuilderBuild | SetBuilderAdd | SetBuilderBuild
datatype
CallName
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "CallSignature", "Formal", "Name", "Option", "Type", "name" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
Statement
= DeclareVar(name: VarName, typ: Type, maybeValue: Option<Expression>) | Assign(lhs: AssignLhs, value: Expression) | If(cond: Expression, thn: seq<Statement>, els: seq<Statement>) | Labeled(lbl: string, body: seq<Statement>) | While(cond: Expression, body: seq<Statement>) | Foreach(boundName: Va...
datatype
Statement
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Assign", "AssignLhs", "Break", "Call", "CallName", "Expression", "Field", "If", "Option", "Print", "Return", "TailRecursive", "Type", "VarName", "While", "name", "value" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
AssignLhs
= Ident(ident: VarName) | Select(expr: Expression, field: VarName, isConstant: bool) | Index(expr: Expression, indices: seq<Expression>)
datatype
AssignLhs
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Expression", "Ident", "Index", "Select", "VarName", "field" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
CollKind
= Seq | Array | Map
datatype
CollKind
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "Array", "Map", "Seq" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
TypedBinOp
= TypedBinOp(op: BinOp, leftType: Type, rightType: Type, resultType: Type)
datatype
TypedBinOp
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "BinOp", "Type" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
BinOp
= Eq(referential: bool) | Div(overflow: bool) | EuclidianDiv() | Mod() | EuclidianMod() | Lt() | // a <= b is !(b < a) LtChar() | Plus(overflow: bool) | Minus(overflow: bool) | Times(overflow: bool) | BitwiseAnd() | BitwiseOr() | BitwiseXor() | BitwiseShiftRight() | BitwiseShiftLeft() | ...
datatype
BinOp
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[ "And", "Concat", "Div", "Eq", "In", "Lt", "Minus", "Mod", "Or", "Plus", "SeqPrefix", "Subset", "Times" ]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
SelectContext
= SelectContextDatatype | SelectContextGeneralTrait | SelectContextClassOrObjectTrait
datatype
SelectContext
DafnyCore.Backends.Dafny
Source/DafnyCore/Backends/Dafny/AST.dfy
[]
[]
https://github.com/dafny-lang/dafny
8bb7795048d9252198380dec49ffac1e933e25ae
End of preview. Expand in Data Studio

Dafny

A structured dataset of functions, lemmas, and predicates from Dafny, a verification-aware programming language.

Source

Schema

Column Type Description
statement string Declaration signature/claim with the leading keyword removed (verbatim slice); the full declaration minus its proof
proof string Verbatim proof/body, empty if the declaration has none
type string Declaration keyword
symbolic_name string Declaration identifier
library string Sub-library
filename string Repository-relative source path
imports list[string] File-level Require/Import modules
deps list[string] Intra-corpus identifiers referenced
docstring string Preceding documentation comment, empty if absent
source_url string Upstream repository
commit string Upstream commit extracted

Statistics

  • Entries: 23,281
  • With proof: 20,098 (86.3%)
  • With docstring: 0 (0.0%)
  • Libraries: 158

By type

Type Count
method 7,955
function 4,447
lemma 2,370
predicate 1,858
datatype 1,315
type 1,201
class 1,140
const 1,002
newtype 772
trait 501
constructor 477
codatatype 124
iterator 117
copredicate 1
colemma 1

Example

{:extern "Token"} Token extends object
{
    var val: CsString
    var LeadingTrivia: CsString
    var TrailingTrivia: CsString
    var Next: Token?
    ghost var allTokens: seq<Token>
  • type: trait | symbolic_name: Token | Source/DafnyCore/AST/DafnyInterface.dfy

Use

Each declaration is split into a statement (signature/claim) and a proof (body) that are disjoint and together form the complete declaration, for proof modeling, autoformalization, retrieval, and dependency analysis via deps.

Citation

@misc{dafny_dataset,
  title  = {Dafny},
  author = {Norton, Charles},
  year   = {2026},
  note   = {Extracted from https://github.com/dafny-lang/dafny, commit 8bb7795048d9},
  url    = {https://huggingface.co/datasets/phanerozoic/Dafny}
}
Downloads last month
92

Collection including phanerozoic/Dafny