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 |
|---|---|---|---|---|---|---|---|---|---|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/ordinal-subtraction-is-natural.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 243 | ba14f51a20955989cf25d599ce4839e6cc0807419f680431ec652ce9ea19d45e | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
function OrdinalSubtractionIsNatural(o0: ORDINAL, o1: ORDINAL): ORDINAL
requires o1.Offset <= o0.Offset
{
o0 - o1
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/ordinal-subtraction-underflow.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 229 | ebb09e191a6d4effc9bf64beef2a16666e9835036f92f79c41e2ab3e9cf3aa0e | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
function OrdinalSubtractionUnderflow(o0: ORDINAL, o1: ORDINAL): ORDINAL
requires o1.IsNat
{
o0 - o1
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/pattern-shape-is-valid.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 203 | 525aaa9a925ed14cb89d2d5f017f0a9d9851abfa2602992cf11d38836786aa45 | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
datatype D = D0(n: nat) | D1
method F(d: D) {
assert d.D0?;
var D0(n) := d;
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/precondition-satisfied.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 687 | 2c788f5a5877083c11c7ca2f1c08ea21ea93d806739a940eb7267935dacaad87 | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
function Div(x: int, y: int): int
requires y != 0
{
x / y
}
function BadDiv(a: int, b: int): int
{
Div(a, b)
}
function DivErrorMsg(x: int, y: int): int
requires {:error "divis... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/prefix-equality-limit.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 232 | e0e03aa93d3e226b47f038a1276373f8658d52e9b132f22acfd55e7687e9ee5b | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
codatatype Stream = More(Stream)
method PrefixEqualityLimit(s: Stream, i: int) {
ghost var g := s ==#[i] s;
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/read-frame-subset.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,696 | e85d1af7a1aab52f6e65b4adc142f928e8cf56b18dc9bd8bf83ab02e5417895b | // RUN: %exits-with 4 %verify --reads-clauses-on-methods --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class C {
var x: int
var y: int
}
function ReadField(s: seq<C>, c': C): bool
requires |s| > 4
reads s[2]
reads {s[3]}`x
reads {s[4]}`y
{
s[0].x == 1 || s[... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/requires-weaker.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 439 | f581fc27618f5c9de02a005c2dc5eaea8d47aa7232afcf01605518a83d8d9abc | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
predicate P(i: int)
predicate Q(i: int)
trait T {
method M(i: int)
returns (res: bool)
requires P(i)
requires Q(i)
}
class C extends T {
method M(i': int)
returns (res': bo... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/shift-lower-bound.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 180 | d72f1304d39bfc7c3d35bff87d6a8afdb14db38f6dc9c00eb6fe20d16e1f4d50 | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
function ShiftLowerBound(b: bv2): bv2 {
b.RotateLeft(-1)
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/shift-upper-bound.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 179 | c89668650a97217bdb2af0695c9c0efabb39560933ba970188ac9bd1f5bb3012 | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
function ShiftUpperBound(b: bv2): bv2 {
b.RotateLeft(3)
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/subrange-check-no-type-system-refresh.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 373 | c0ae103ba5adaa1d1eaf3cc8bcd463a2fecf84972d82bb331016bb69d2df550b | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions --type-system-refresh=false --general-newtypes=false "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method SubrangeCheck<T, U>(o: object?, p: T --> U, r: T ~> U, i: int) {
var nonNullVar: object := o;
var totalVar: T -> U := p;
var partia... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/subrange-check.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 340 | 43e39b166a45b0531fb328408e09e2431227e1186ad98f6b367d4f504c242832 | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions --type-system-refresh "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method SubrangeCheck<T, U>(o: object?, p: T --> U, r: T ~> U, i: int) {
var nonNullVar: object := o;
var totalVar: T -> U := p;
var partialVar: T --> U := r;
var na... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/trait-decreases.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 446 | 3745289774c9ff5354cdd5210ab084ca4686750895f782046cd0cab912fbd360 | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
trait T {
method M0(x: nat, y: bool) decreases x, y
method M1(x: nat, y: bool) decreases y, x
method M2(x: nat, y: bool) decreases false, x
}
class C extends T {
method M0(x: nat, y: bool) d... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/trait-frame.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 250 | 10a54bd5e5e02c3de94236b7b182c5f776911d3b212599007a2559d60d31ce0e | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
trait T {
method M()
function F(): bool
}
class C extends T {
method M() modifies this
function F(): bool reads this
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/valid-constructor-names.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 214 | ec77ad3a544f1a75a21083f06f8a8f433b5cf88a9ce666f72b23b8966293975a | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
datatype D = D0(n: nat) | D1 | D2(b: bool, n: nat)
method F(d: D) {
var d' := d.(n := 0);
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/witness-check.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 146 | bcc931e9cd9957e4c8ef1687f84da4d789288661b8f857814e83d824156672fa | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
newtype Pos = i: int | i > 0
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/yield-ensures.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 533 | 40f51b17edf87ee154d715763c37e2c490e6bdbe1e9978307c84dabb0e43e98a | // RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
iterator Repeat0(val: int, count: nat) yields (out: int, index: int)
yield ensures this.out == val
yield ensures 0 <= index <= count
{
for i := 0 to count { yield count, -i; }
}
iterator Repea... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/python/ReservedNames.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 122 | da6510c3628df1860181bb537b0bdc0aa062d2b9ccbccf95fcae55b4fdb60370 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s"
method Test(len: int, a: seq<int>) {
var len := |a|;
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/referrers/localsmemorylocation-errors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 475 | 12ae4df39abcfd5ec8fb8d10a4386c44b435db3284d0e0514d8f149d5aaee84e | // RUN: %exits-with 4 %verify --referrers --type-system-refresh "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class Test {
var x: int
constructor() {
x := 0;
}
}
method Parameters(i: Test, ghost mem_i: (object, field))
requires mem_i == locals`i
{
var mem_i2 := locals`i;
}
method CallParam... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/referrers/localsmemorylocation-resolutionerrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,789 | a9915cfcce8b57b57fab9ac053c7ce254ae75c90f939b9ef09791f4e8cc71491 | // RUN: %exits-with 2 %resolve --referrers --type-system-refresh "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class Test {
var x: int
constructor() {
x := 0;
}
}
method LocalVars(x: Test)
ensures locals`i == locals`i // WF Error: Local variable names cannot appear in contracts
{
var i := new ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/referrers/localsmemorylocation.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,750 | 31fb091e0be7bd5ae44c318073d9ef7bcc898bac3dabf23e6adca59bff4627ec | // RUN: %verify --referrers --type-system-refresh "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class TestLocals {
var x: int
constructor() {
x := 0;
}
}
method LocalVars() {
var i := new TestLocals();
var j := new TestLocals();
var mem_i := locals`i;
assert mem_i == locals`i;
asse... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/referrers/memorylocations-errors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,483 | 2cea4351497e23c6f739b146d2c51ca294e87fb0f2654020df1951cc65136bc9 | // RUN: %exits-with 4 %verify --referrers --type-system-refresh "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class Test {
var x: int
const c: int
}
opaque function ReadFirstElement(a: array<int>): int
reads a`[0] // Well-formedness error
opaque function ReadSecondElement(a: array<int>): int
requir... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/referrers/memorylocations-resolutionerrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,129 | b2614f0faaea766e60071ce54a3e1a10dfe0ec76192fd4242c053225adc4e38f | // RUN: %exits-with 2 %resolve --referrers --type-system-refresh "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class Test {
var x: int
const c: int
static const s: int
function f(): int { 0 }
}
method TestCaller(t1: Test, t2: Test, a: array<int>, i: int) {
ghost var error1 := t1`y; // Error: y not a... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/referrers/memorylocations.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,391 | 67ac1fb6c6c24ae0a0678f1e1ef3225bb210f41ba40de41ec33eba764e7dd62c | // RUN: %verify --referrers --type-system-refresh "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class Test {
var x: int
var y: int
const c: int
method InsideTest() {
assert `x == this`x;
}
function ReadTest(): int
reads `x
{
x
}
}
method TestClass(t1: Test, t2: Test... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/refinement/aliasInRefinee.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 428 | b4fec2a949c51bda5d5ab2b12c0552316e11961d2303ad0f1536e504050cab76 | // RUN: %baredafny resolve --use-basename-for-filename %s
module Aliased {
module Nested {
const x := 3
const y := 4
}
}
module Refinee {
import opened Aliased.Nested
}
module Refiner refines Refinee {
const z := y + 1
const x := "blocking"
}
module SecondNestedOpener {
impor... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/separate-verification/app.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,934 | 47351ed44489ac8bb79be6ba445e079dc1ff72a0487129ff9bfafffbbd22b35d | // NONUNIFORM: Multiple test scenarios - ideally would still test for each backend though
// RUN: %baredafny build %args -t:lib %S/Inputs/wrappers.dfy > %t
// RUN: %baredafny build %args -t:lib %S/Inputs/seq.dfy --library %S/Inputs/wrappers.doo >> %t
// RUN: %baredafny run %args %s --library %S/Inputs/seq.doo --... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/separate-verification/assumptions.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 344 | d2a419fbf96ebde3d8471e725c3fbe2b9e6ecc65b7ffce115e76df192f13a141 | // Passing --no-verify because TestAuditor.dfy intentionally has a failing assertion,
// but that would otherwise mean we don't get far enough to exercise the LibraryBackend.
// RUN: ! %build -t:lib --allow-axioms false --no-verify --reads-clauses-on-methods %args %s > %t
// RUN: %diff "%s.expect" %t
include "../... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/server/counterexample_commandline.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,212 | 5fbfe53fafe912607cedec30539ecd88c95cd937c0aeed95403ed971d6883c95 |
// RUN: %exits-with 4 %verify --extract-counterexample "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// The following method performs string equality comparison whereas its
// specification states that it must perform pattern matching (the difference
// being that the '?' metacharacter in the pattern is supposed ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/stdlibs/StandardLibraries.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 546 | 7b54afa4803e55efbb3ef617ae36c7730bcac74532b520e929b277b0f0ee2771 | // RUN: %testDafnyForEachCompiler "%s" -- --standard-libraries
// This is just a basic test of the mechanism to make the standard libraries
// available to user code in general.
// The DafnyStandardLibraries project itself contains
// tests and examples of the actual standard library code.
module UsesWrappers ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/stdlibs/StandardLibraries_Errors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 802 | 139509cd29f0a85a987187ba199e902c265e2c36e9bd35fb7a423f56646bdbcb | // This test asserts the current behavior for trying to use
// standard libraries in contexts that aren't supported:
// not providing the option, providing incompatible options,
// commands like formatting, etc.
// Valid:
// RUN: %verify --standard-libraries:true "%s" > "%t"
// RUN: %verify --standard-librari... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/stdlibs/StandardLibraries_TargetSpecific.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 356 | 5767ae73a3a1cf7d7f6c84236fc929834f182b380e9a1e6e63fb87f5f660e6ff | // This test just asserts what happens when you try to use a library
// that isn't available for all backends (see .check files).
// Full testing of such libraries is handled in the DafnyStandardLibraries
// project rather than here.
// RUN: %testDafnyForEachCompiler "%s" -- --standard-libraries:true
module Us... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/GeneralTraits.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,126 | 62769ea92b729050aee70aa83fb164835d9dcd76068a9a3490b3287732394b0e | // RUN: %exits-with 2 %build --type-system-refresh --general-traits full "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module Tests {
trait Parent { }
class Class extends Parent { }
datatype Dt extends Parent = Blue | Red
codatatype CoDt extends Parent = InfiniteBlue | InfiniteRed
type Abstract extend... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/GeneralTraitsCompile.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 10,237 | 0113839d34fd1cc316b9984c4a89b755732f8e9c3c10f4c2935773e94d86b977 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --general-traits=full --type-system-refresh=true
method Main() {
Tests.Test();
InstanceMemberInheritance.Test();
StaticMemberInheritanceAccessViaName.Test();
StaticMemberInheritanceAccessViaReceiver.Test();
NiceStarterTests.Test();
pri... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/GeneralTraitsVerify.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 10,907 | a696eb347d48f2d46279eeb0839c6993716d7d1cf2c624bf419a7e30f28d9669 | // RUN: %exits-with 4 %build --type-system-refresh --general-traits full "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module Tests {
trait Parent { }
class Class extends Parent { }
datatype Dt extends Parent = Blue | Red
codatatype CoDt extends Parent = InfiniteBlue | InfiniteRed
type Abstract extend... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/NonReferenceTraits.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 13,669 | 4d5c7e31cf21b9f7412fce2e9457115ea5105d5aa79709e1ad7dc724f7e10aff | // RUN: %exits-with 2 %build --general-traits legacy "%s" > "%t"
// RUN: %exits-with 2 %build --general-traits datatype "%s" >> "%t"
// RUN: %diff "%s.expect" "%t"
module Tests {
module M {
trait {:termination false} MX { }
trait {:termination false} MY extends object { }
trait {:termination fals... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/NonReferenceTraitsCompile.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,605 | c0b15a59a6cc2719348d0d255fa4d7d5462f6d2cb29663abe94f2e61de9e7451 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --general-traits=full
method Main() {
BoxingConcerns.Test();
RefAndBoxConversions.Test();
print "done\n";
}
module BoxingConcerns {
trait Parent { }
class Class extends Parent { }
method M(c: Class) {
var a: Parent;
var... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/NonReferenceTraitsVerify.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,522 | e9f7d0290a3b7e39614b01151ffdea75006ca58391ac237d77054ea7c28a0686 | // RUN: %exits-with 4 %build --general-traits datatype "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module ChildIsNonRefTrait {
trait Parent {
const yy: nat
function F(umpa: int): nat
requires yy < 300
ensures F(umpa) < yy + 900
method M() returns (p: nat)
requires yy < 100
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitBasix.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,688 | 2fccf8f3ffc4a0d0203c23fac1c62bbc750ba28ddcf0f0b7cbb3efd896fcbc8c | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module m1
{
trait I1
{
ghost function M1(x:int,y:int) :int
{
x*y
}
}
trait I2 extends object //all is fine in this trait
{
var x: int
function Twice(): int
reads this
{
x + x
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitCompile.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 19,935 | ff818ddc047b009cd6af2ab414868c02c7df67b837fabfdc6071c3264c7625fc | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment --type-system-refresh=true
trait TT
{
function Plus(x:int, y:int) : int
requires x > y
{
x + y
}
function Times(x:int, y:int) : int
requires x > y
static function StaticMinus(x:int, y:int) : in... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitCompileErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 576 | fc87bc46220442f7bc42c33d5360808d2da1d66a94e2f22e777bb0d802cb33d5 | // RUN: %exits-with 3 %build "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module StaticMembers {
trait Tr {
// the following static members must also be given bodies, but that's checked by the compiler
static ghost function Func(): int ensures false
static method Method() ensures false
static t... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitExample.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,510 | b454e29b81b9c61542f6e1d1b3a1d0521868252c3f49364219e60575a0f34233 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
trait Automobile extends object {
ghost var Repr: set<object>
ghost predicate Valid()
reads this, Repr
ensures Valid() ==> this in Repr
function Brand(): string
var position: int
method Drive()
r... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitExtend.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 809 | 778c1e71ff1aad000a11c1a2088d37da890a64b8047141cccacf14561f093db3 | // RUN: %exits-with 2 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
trait t
{
var f: int
function Plus (x:int, y:int) : int
requires x>y
{
x + y
}
function Mul (x:int, y:int, z:int) : int
requires x>y
{
x * y * z
}
//function BodyLess1() : int
static meth... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitMultiModule.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,614 | 8b5790891c2ac0edfa125e5679c63c0a1ff491239c179f2dd17dffca43bf97ec | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module M1
{
trait T1
{
method M1 (a:int)
}
trait {:termination false} T2
{
method M2 (a:int)
}
class C1 extends T1
{
method M1 (x:int)
{
var y: int := x;
}
}
}
module M2
{
import opened ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitOverride0.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,287 | a8ae9f27f265cc77de763b453c9c4b18fdfef174e6722d4f7f57a086dbcf227f | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
trait T1
{
var f: int
function Plus(x:int, y:int) : int
requires x>y
{
x + y
}
function Mul(x:int, y:int, z:int) : int
requires x>y
{
x * y * z
}
function BodyLess1() : int
function BodyLess2(a:int, ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitOverride1.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,259 | 163fa5ab6dbd07cb1f0e3db3edb256bdcc6dde50b324b7cf382f1078e4b69a56 | // RUN: %exits-with 4 %verify --relax-definite-assignment "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
trait T1
{
function Plus (x:int, y:int) : int
requires x>y
{
x + y
}
function bb(x:int):int
requires x>10
function BodyLess1(a:int) : int
requires a > 0
function dd(a:int... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitOverride2.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,112 | aebd16034be60bce854c1a66937f146c19a15db372a605cf3b589cbb45774fde | // RUN: %verify --relax-definite-assignment --allow-axioms "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
trait Spec<U> extends object {
var done: bool
var hasFailed: bool
ghost const Repr: set<object>
ghost predicate Valid()
requires done || hasFailed || (!done && !hasFailed) // tantamount to "true... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitPolymorphism.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 985 | fc9f359705c57cef27b64c0f51c10f23dad69dad56b44c87d741f68b7ae2c5bc | // RUN: %exits-with 2 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
trait T1
{
var f: int
function Plus(x: int, y: int): int
requires x > y
{
x + y
}
function Mul(x: int, y: int, z: int): int
requires x > y
{
x * y * z
}
//function BodyLess1() : int
stat... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitResolution0.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,060 | e33e137e00b3ab0a1103fbcee93778881a1d9ea993c35f610fd71a67b3be5881 | // RUN: %testDafnyForEachResolver "%s" -- --rprint:- --relax-definite-assignment
module M0 {
trait Tr<X> {
ghost function F(x: X): int { 15 }
}
class Cl<Y> extends Tr<Y> {
lemma M() {
var v := this; // Cl<Y>
var u: Tr := this; // Tr<Y>
var f := v.F; // Y -> int
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitResolution1.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 17,190 | 2986972ae908112c6dd01eba60c03c8e4e8012356a41ba15a587c411bb3f6dce | // RUN: %exits-with 2 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module M0 {
trait Tr<X> {
ghost function F(x: X): int { 15 }
}
class Cl<Y> extends Tr<Y> {
lemma M() {
var v := this; // Cl<Y>
var u: Tr := this; // Tr<Y>
var f := v.F; // Y -> int
var g :=... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitResolution2.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 11,208 | 56de34e64b475116eaf0fee94fb5faaca74a2ca9446eb2382b66d7b185db414d | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module M0 {
trait TrX<X> {
ghost function F(x: X): int { 15 }
}
trait Tr<X> extends TrX<X> {
}
class Cl<Y> extends Tr<Y> {
lemma M() {
var v := this; // Cl<Y>
var u: Tr := this; // Tr<Y>
var f := v.F; // ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/Traits-Fields.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 478 | 1634eaa2d2ec84a2ed750fcff0af8537aeeec33eb0db353683b3faf5b8b74fc2 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
trait J extends object
{
var x: int
}
class C extends J
{
}
method Main()
{
var c := new C;
var j: J? := new C;
j.x := 8;
c.x := 9;
assert j.x + 1 == c.x;
j := c;
assert j.x == 9;
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitsDecreases.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,715 | 7b2175128ccacd40b77d2259115d1e01e673a4180a2e2cc6f61551f55453272e | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
trait Trait {
// -----------------------
method A0(x: nat)
// default decreases: x
method A1(x: nat)
// default decreases: x
method A2(x: nat)
decreases x
method A3(x: nat)
decreases x
// -----------------------
method... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitsExtendingTraits.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,679 | 2802af71d136444d770eb6743fd6437bdf69f81d78e8b1975c6994ea4469ea8d | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module TheBasics {
trait A {
}
trait B {
}
trait C {
}
trait D {
}
trait X extends A, B {
}
trait Y extends C {
}
class K extends X, Y, D {
}
}
module ForbiddenCycles {
// The following two traits would for... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitsMultipleInheritance.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 496 | e8f2c5d75b8b43e50ad706836b313d5f59e4f1adb27c46438578f8a2dd9a5854 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
trait J1 extends object {
var x: int
}
trait J2 extends object {
var y: int
}
class C extends J1, J2 {
}
method Main()
{
var c := new C;
var j1: J1 := new C;
var j2: J2 := new C;
c.x := 10;
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitSpecsOverride0.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,517 | c240f09bf044b6e283e674baf3dfb0f60c11d675dab8a6cc170a0b211e40b00a | // RUN: %exits-with 2 %verify --allow-deprecation "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module Tests {
trait J
{
function F(k:int, y: array<int>): int
reads y;
decreases k;
ensures F(k, y) < 100
function G(y: int): int
{
100
}
method M(y: int) returns (kobra:int)
r... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitUsingParentMembers.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 890 | 38e01cd67b197a744119f4c37e6c5e8b20ed400ef267a2d5a44b153ec6eca761 | // RUN: %exits-with 4 %verify --relax-definite-assignment --allow-deprecation "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
trait P1
{
method N0() {
var a: array<int>;
if (5 < a.Length) {
a[5] := 12; // error: violates modifies clause
}
}
method Mul(x: int, y: int) returns (r: int)... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitVariance.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,146 | d4c4d612127df520ee23f4d871f42f67e04c53964dc5fb3dedcaa40da373f0f4 | // RUN: %exits-with 2 %build --general-traits full "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module NoVariance {
trait Trait<Y> { }
type AbstractType extends Trait<int> { }
datatype Datatype extends Trait<int> = Value
newtype Newtype extends Trait<int> = real
class Class extends Trait<int> {... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/traits/TraitVerify.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,845 | 501e97e2778ae3357a9d9124affa6427dacb48be2d744bb5e6156d93a738d838 | // RUN: %exits-with 4 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
trait Tr<X> extends object { }
class A extends Tr<int> { }
class B extends Tr<real> { }
class C<Y> extends Tr<Y> { }
method M(a: A, b: B) {
var c: C? := *;
var t; // Tr?<int>
t := a;
t := c;
}
method N(a: A, b: B) {
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/auto-triggers-fix-an-issue-listed-in-the-ironclad-notebook.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 915 | 109cb7d46581fb857fb6db0bb10a73a01cf2b512f9bd8f27c9187004f69a92eb | // RUN: %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This example was listed in IronClad's notebook as one place were z3 picked
// much too liberal triggers. THe Boogie code for this is shown below:
//
// forall k#2: Seq :: $Is(k#2, TSeq(TInt)) && $IsAlloc(k#2, TSeq(TInt), $Heap)
// ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/constructors-cause-matching-loops.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 291 | 6c4182a1001698004d6afcd31be4df4631d51f7198a3645e9e43b2408b8ddea0 | // RUN: %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file is just a small test to check that constructors do cause loops
datatype Nat = Zero | Succ(x: Nat)
ghost function f(n: Nat): Nat
method M() {
assert forall s :: true || f(Succ(s)) == f(s);
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/emptyTrigger.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 198 | e4a1f46364c82eabaa0f6dbe80e18ae9e671f44afa8e27c38ce7d33c105ffe09 | // RUN: ! %verify "%s" > "%t"
// RUN: ! %run "%s" >> "%t"
// RUN: %diff "%s.expect" "%t"
method M() {
assert exists z :: z <= 3;
assert exists z {:trigger} :: z <= 3;
assert true;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/function-applications-are-triggers.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 532 | 5b793de1edc73b41c29583c0e3bfa2fdd51fd5e2a63b9da2a8e9f4f760b44be6 | // RUN: %verify --show-hints --allow-axioms "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file checks that function applications yield trigger candidates
method M(P: (int -> int) -> bool, g: int -> int)
requires P.requires(g)
requires P(g) {
assume forall f: int -> int :: P.requires(f);
assume f... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/induction-triggers.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,661 | bfa267098d4438dcdab125ba000a5ef746d4366bd6a1e7feeabe1ef27ad731af | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" -- --show-hints
predicate f(n: nat) { if n == 0 then true else f(n-1) }
predicate g(n: nat) { false }
// Default: auto-generated trigger ⇒ Proof passes.
lemma Default(n: nat) ensures f(n) {}
// Manual list of variables ⇒ Proof passes.
lemma {:induc... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/InductionWithoutTriggers.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,902 | 18f6df864eabe6536b1d277046f7f986b54a37803b922a4f09d18eb2d7cf25e5 | // RUN: %testDafnyForEachResolver "%s" --expect-exit-code=4
ghost function Sum(n: nat, f: int -> int): int
{
if n == 0 then 0 else f(n-1) + Sum(n-1, f)
}
lemma TestTriggerWithLambdaExpression(n: nat, f: int -> int, g: int -> int)
{
// Once, trigger selection would crash on the following quantifier, which... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/large-quantifiers-dont-break-dafny.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,308 | 0c89077e8f71549d12a1998ab62bbbd006da53d4504537d5fdcf19424dbcdea2 | // RUN: %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This test ensures that the trigger collector (the routine that picks trigger
// candidates) does not actually consider all subsets of terms; if it did, the
// following would take horribly long
ghost predicate P0(x: bool)
ghost pred... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/let-expressions.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 366 | b2ddf11df76c99ad3bb392ff9e272b201ccd5b7095f34f152afc0a7f93d068c8 | // RUN: %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
ghost predicate Foo(s: seq<int>)
{
&& (forall i :: 0 <= i < |s| ==> var j := i; s[j] > 0)
&& (forall i :: 0 <= i < |s| ==> var j, k := i, i; s[k] > 0)
&& (forall i :: 0 <= i < |s|-1 ==> s[i] == s[i+1])
&& (forall i :: 0 <= ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/loop-detection-is-not-too-strict.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,827 | 952b909b5304e082974e75fb5d9c8592ccc2316a8522c94627523d9613354d6b | // RUN: %verify --show-hints --allow-axioms "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This test shows that the loop detection engine makes compromises when looking
// for subexpressions matching a trigger; in particular, it allows a
// subexpression to match a trigger without reporting a loop and without bein... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/loop-detection-looks-at-ranges-too.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 464 | f9222c64347e27708714f94a02216720db5558a717ea65a65a8c1ab14f7647be | // RUN: %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file checks that loops between the range and the term of a quantifier
// are properly detected.
ghost predicate P(x: int)
method M(x: int) {
// This will be flagged as a loop even without looking at the range
assert true ||... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/loop-detection-messages--unit-tests.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,217 | e5db32626a34e18defdd1abf2fabc8e5257639f7862440bdf3341d38c8794d71 | // RUN: %verify --show-hints --allow-warnings "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file is a series of basic tests for loop detection, focusing on the
// warnings and information messages
ghost function f(i: int): int
ghost function g(i: int): int
method M() {
assert forall i :: false ==> f... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/looping-is-hard-to-decide-modulo-equality.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,206 | 466ae0e9121adc408af70e4e6ed4e111a4f645d0eef9680be0314115be519aaa | // RUN: %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file shows cases where loops could hide behind equalities. In all three
// cases we behave the same; that is, we don't warn for loops that would only
// exist in the presence of an equality. The easiest way to understand the
// issue... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/matrix-accesses-are-triggers.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 298 | e0feeef97601af152fe870759fded17fc148208f8e900168a7da023f5d808043 | // RUN: %exits-with 4 %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file checks that multi-dimensional array accesses yield trigger candidates
method M(m: array2<int>)
requires forall i, j | 0 <= i < m.Length0 && 0 <= j < m.Length1 :: m[i, j] == m[j, i+1] {
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/nested-quantifiers-all-get-triggers.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 308 | 186b6de5096f1ed9c4f1e79e211ab1a4f87b46d46590a6f5be8f1004b3111b34 | // RUN: %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This checks that nested quantifiers do get triggers, and that the parent
// quantifier does not get annotated twice
method M() {
ghost var x := forall s: set<int>, x: int :: (x in s ==> forall y :: y == x ==> y in s);
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/old-is-a-special-case-for-triggers.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,509 | f0bcb45106b444434100dfade07ab1fdc010019e51d76a1e4c0ef5fca673b2ed | // RUN: %verify --show-hints "%s" --allow-warnings > "%t"
// RUN: %diff "%s.expect" "%t"
// This file ensures that `old()` receives the special treatment that it
// requires; that is, `old(f(x))` is not less liberal than `f(x)`, and
// old(f(f(x))) does not loop with f(x) (doesn't it?)
class C { }
ghost funct... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/redundancy-detection-is-bidirectional.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,109 | 3335a1da569c6f68e0ec182e6967a3f1d23961a7934cb650ad16d69ba7acc460 | // RUN: %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This test checks for tricky cases of redundancy suppression when building
// triggers.
ghost predicate P(x: int, y: int)
ghost predicate Q(x: int)
ghost predicate R(x: int)
method M() {
// For this term, it is enough to order the... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/regression-tests.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 687 | 650a743f30130059829820e115960bddb019b0ee14daa9c327020dfba06e2392 | // RUN: %verify --show-hints "%s" --allow-warnings > "%t"
// RUN: %diff "%s.expect" "%t"
// This tests checks that quantifier splitting is resilient to the fact that
// certain statements (like calc) can return duplicate subexpressions. This was
// once a problem, because a quantifier that got returned twice woul... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/set-construction-is-a-good-trigger.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 587 | fbde15fe6b64fae1e7d23e59e3627d7d3b0a3a05ab3b69ae850d70392c7074d4 | // RUN: %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file ensures that display expressions can be picked as triggers. This is
// useful for code that checks if a set, sequence, or multiset is a singleton.
method M(s: seq<int>, st: set<int>, mst: multiset<int>)
requires exists y :: ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/some-proofs-only-work-without-autoTriggers.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,970 | 6519c74f6b2df971d1cd4b9b732fff3ac6bf087c5644c0cc6d3741e7f012d65b | // RUN: %exits-with 4 %verify --allow-axioms --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// The examples below work nicely with /autoTriggers:0, but break when we use
// /autoTriggers.
// The issue is that the axioms for sequences are missing a number of facts,
// which was not a problem before /au... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/some-terms-do-not-look-like-the-triggers-they-match.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,043 | 70ef5dcbcddd2f1674c7dc8132af2ed7b44520a3dececa52b67cd8bb576d0144 | // RUN: %exits-with 4 %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file shows how Dafny detects loops even for terms that are not literal
// AST matches. This file also checks that triggers are reported exactly as
// picked (that is, `x in s` yields `s[x]` for a multiset s), but matches... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/splitting-picks-the-right-tokens.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 699 | 175ad259691f75ba8bb01abf583fddba4e7eb59a44bf837afc8199f4921306d1 | // RUN: %exits-with 4 %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file ensures that trigger splitting picks the right tokens
ghost function Id(i: int): int { i }
method MSuchThat()
requires forall x | x > 0 :: Id(x) > 1 && x > 2 && x > -1 { }
method MImplies()
// The bodie... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/splitting-triggers-recovers-expressivity.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,924 | 76d00d1d902a08322d3bcdff3a5284a24aa062e62e03cf0b7a1359d82c85a39a | // RUN: %exits-with 4 %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
ghost predicate P(i: int)
ghost predicate Q(i: int)
/* This file demonstrates a case where automatic trigger splitting is useful to
prevent loop detection from reducing expressivity too much. */
lemma exists_0()
requ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/splitting-triggers-yields-better-precondition-related-errors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 465 | 99c36808db21c0e7ef6cf3d34e6542d6d22a2bf1bd55554123f66cd82b68d4c0 | // RUN: %exits-with 4 %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This tests shows that, since quantifiers are split, it becomes possible to know more precisely what part of a precondition did not hold at the call site.
method f()
requires forall y :: y > 0 && y < 0 {
}
method g(x: ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/suppressing-warnings-behaves-properly.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 771 | 94420bbbb283da9c4d925d4aba6d9379cbd79550289d0e8a0a25dbd0f04d99e6 | // RUN: %verify --show-hints --allow-warnings "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file checks that suppressing warnings works properly
ghost predicate f(x: int)
ghost predicate g(x: int)
method M() {
assert forall n :: n >= 0 || n < 0;
assert forall n {:nowarn} :: n >= 0 || n < 0;
ass... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/triggers-prevent-some-inlining.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,025 | 7bc053e14966f8d5eebc3f8fda184e4c050f46c52a8155a28cf12b6525e36d80 | // RUN: %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file looks at the interactions between inlining and triggers. The
// sum_is_sum predicate gets a {sum(a, b)} trigger, which explicitly depends on
// one of the variables being passed in. Since triggers are generated prior to... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/TriggersForSuchThat.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,739 | a0740c24d82f6f005493f030c32d7451c13c2ab80359dd2fd3299651957c4f3b | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" -- --show-hints
module SuchThat {
predicate Q(x: int)
function F(x: int): int
method TestSuchThat()
requires Q(18)
{
// In the following lines, the trigger {Q(_)} is selected automatically
if
case true =>
assert exis... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/useless-triggers-are-removed.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 882 | 39f64f540292e4382fb54abb1dafae6e9a7e9bc231b99c70c39097a350378b14 | // RUN: %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file ensures that Dafny does get rid of redundant triggers before
// annotating a quantifier, and that ths process does not interfere with cycle
// detection.
ghost function f(x: int): int
ghost function g(x: int): int
ghost func... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/wf-checks-use-the-original-quantifier.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,228 | 68c0c31c0c6e1c7b73fd72986117a1f0379447bcf3dd10a74cbe0b426608f2ee | // RUN: %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This test checks that typical expressions requiring WF checks do not suddenly
// loose expressivity due to quantifier splitting. Without special care, the
// expression (forall x :: x != null && x.a == 0) could fail to verify.
// The lo... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/vacid0/Composite.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 5,853 | 35095a94ca44beb97588b58c35064480f1eb5be6be55dcbdd7025c6961b44cd0 | // RUN: %testDafnyForEachResolver "%s"
class Composite {
var left: Composite?
var right: Composite?
var parent: Composite?
var val: int
var sum: int
ghost function Valid(S: set<Composite>): bool
reads this, parent, left, right
{
this in S &&
(parent != null ==> parent in S && ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/vacid0/LazyInitArray.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,099 | 20d4688ec556746aeac424bf04d96a9827ca2457db0cbcf829cbb07a6b075456 | // RUN: %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class LazyInitArray<T(0)> {
ghost var Contents: seq<T>
var Zero: T
/*private*/ var a: array<T>
/*private*/ var b: array<int>
/*private*/ var c: array<int>
/*private*/ var n: int
/*private*/ ghost var d: seq<int>
/*private*/ ghost var... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/vacid0/SparseArray.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,935 | 24f22b71e5c8c995109a5abf5993f82b477ed335c7f02efadc9eec4427f9f743 | // RUN: %verify --allow-deprecation --relax-definite-assignment "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file was created in the early stages of Dafny, when the
// language didn't even support arrays yet. Still, as written,
// it does verify.
class SparseArray<T(0)> {
ghost var Contents: seq<T>;
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/verification/constructorFresh.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 346 | a5f56ed6e00864114d368da5a570b270d4b4562e01c6ef4037dc2de183514e6e | // RUN: ! %verify %s &> %t
// RUN: %diff "%s.expect" "%t"
class A {
constructor()
}
class Test {
var x: A
constructor()
ensures fresh(this.x)
ensures foo()
{
x := new A();
}
}
predicate foo()
requires false
ensures false
{ true }
method Main() {
var t := new T... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/verification/filter-symbol.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 667 | 6224f2acefc45f6c7ceb3160ec9d1957e80feb2982f1edcd3218b58e7670c41d | // RUN: %verify --filter-symbol='blaergaerga' %s > %t
// RUN: ! %verify --filter-symbol='P' %s >> %t
// RUN: ! %verify --filter-symbol='Q' %s >> %t
// RUN: ! %verify --filter-symbol='P.Q' %s >> %t
// RUN: ! %verify --filter-symbol='Q.P' %s >> %t
// RUN: ! %verify --filter-symbol='DT' %s >> %t
// RUN: ! %verify --... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/verification/filter.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,708 | dc623538faf5797bf20f2a6b0493f0ed41ace325bb08f966ab8e9f3312d77084 | // RUN: %verify --allow-warnings --filter-position='C:\windows\path.dfy' %s > %t
// RUN: ! %verify --filter-position='src/source1.dfy:5' %S/Inputs/dfyconfig.toml >> %t
// RUN: %verify --filter-position='src/source1.dfy:1' %S/Inputs/dfyconfig.toml >> %t
// RUN: ! %verify --filter-position='e.dfy' %S/Inputs/single-fil... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/verification/issue4894.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,070 | 86d675121a2f50758daf957febc70f10778d06722decc6198e0e93ab5af036b5 | // RUN: %verify %s > %t
// RUN: %diff "%s.expect" "%t"
class C_2 {
var F_C_2_real_1: real
var F_C_2_real_2: real
var F_C_2_real_3: real
var F_C_2_bool_4: bool
var F_C_2_real_5: real
var F_C_2_bool_6: bool
constructor (F_C_2_real_1: real, F_C_2_real_2: real, F_C_2_real_3: real, F_C_2_bool_4: boo... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/verification/nonLinearArithmetic.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,499 | d9d114ba326debc6689fa028a9823e8a5cde5f4870bdb1eee6143dd2c82fcd14 | // RUN: %verify "%s" --disable-nonlinear-arithmetic --allow-axioms --resource-limit 1e6 > "%t"
// RUN: %verify "%s" --allow-axioms --resource-limit 1e6 >> "%t"
// RUN: %diff "%s.expect" "%t"
module Power0 {
opaque function Pow(b: int, e: nat): int
decreases e
{
if e == 0 then
1
else
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/verification/outOfResourceAndIsolateAssertions.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 451 | eaf506914e8c50bb7b6e926e5024ec62564060add49b335d4b697e072fcfa85e | // RUN: ! %verify --isolate-assertions --cores=1 --progress Batch "%s" &> %t.raw
// RUN: %sed 's#\(time.*\)#<redacted>#g' %t.raw > %t
// RUN: %diff "%s.expect" "%t"
ghost function f(i:nat, j:nat):int {
if i == 0 then 0 else f(i - 1, i * j + 1) + f(i - 1, 2 * i * j)
}
lemma{:resource_limit 10000000} L()
{
as... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/verification/progress.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 323 | ff46395a0fcdef7afac07e565b9cbf7a8531c6e9238b9f89df2168ee85d5f4f4 | // RUN: %verify --cores=1 --progress Symbol --isolate-assertions %s > %t
// RUN: %diff "%s.expect" "%t"
method Foo()
{
assert true;
assert true;
}
method Faz() ensures true { }
method Fopple() ensures true { }
method Burp()
{
assert true;
assert true;
}
method Blanc() ensures true { ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/verification/relaxAssignmentEnforceDeterminism.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 271 | 666d9b49795f650ac975fff0317510a65acb513fee054a6f3a119b4e9a7bbc6f | // RUN: ! %baredafny build %args --relax-definite-assignment --enforce-determinism "%s" 2> "%t"
// RUN: %OutputCheck --file-to-check "%t" "%s"
// CHECK: The option relax-definite-assignment can not be used in conjunction with enforce-determinism.
method Foo() {
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VerifyThis2015/Problem1.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,775 | 3a10f01664ca2a93b274ea9e543b1046be1d8c9d8b26395c8c618139e2273ec5 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
// Rustan Leino
// 12 April 2015
// VerifyThis 2015
// Problem 1 -- Relaxed Prefix
// The property IsRelaxedPrefix is defined in terms of an auxiliary function. The
// auxiliary function allows a given number (here, 1... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VerifyThis2015/Problem2.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 12,201 | ea0e5091cdbf03f21d81f52389c0a5e306120289b59ee631c902c593c9f23eb3 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
// Rustan Leino
// 13 April 2015, and many subsequent enhancements and revisions
// VerifyThis 2015
// Problem 2 -- Parallel GCD
method SequentialGcd(A: int, B: int) returns (gcd: int)
requires A > 0 && B > 0
ensu... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VerifyThis2015/Problem3.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,009 | 70c8a06f8908328f1534f87c35358418b92a3409964d7809ce3c16d677afdc3c | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s"
// Rustan Leino
// 12 April 2015
// VerifyThis 2015
// Problem 3 -- Dancing Links
// The following method demonstrates that Remove and PutBack (defined below) have the desired properties
method Test(dd: DoublyLinkedList, x: Node)
requires dd.Vali... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VSComp2010/Problem1-SumMax.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,148 | 5d1473224a1144d5b6fdb2d772a6500f1859de2d2bd55e27c7acf3b502c3826c | // RUN: %testDafnyForEachResolver "%s"
// 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
// that 'sum' or 'max' return as th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.