Skip to content

Commit

Permalink
Revert "Change deprecated “forall ensures” to “assert by”"
Browse files Browse the repository at this point in the history
This reverts commit ce5c491.
  • Loading branch information
RustanLeino committed Jan 3, 2024
1 parent ce5c491 commit a2aac6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
16 changes: 4 additions & 12 deletions src/NonlinearArithmetic/Internals/ModInternals.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ module {:options "-functionSyntax:4"} ModInternals {
LemmaFundamentalDivMod(x, n);
LemmaFundamentalDivMod(x + n, n);
var zp := (x + n) / n - x / n - 1;
assert 0 == n * zp + ((x + n) % n) - (x % n) by {
LemmaMulAuto();
}
forall ensures 0 == n * zp + ((x + n) % n) - (x % n) { LemmaMulAuto(); }
if (zp > 0) { LemmaMulInequality(1, zp, n); }
if (zp < 0) { LemmaMulInequality(zp, -1, n); }
}
Expand All @@ -105,9 +103,7 @@ module {:options "-functionSyntax:4"} ModInternals {
LemmaFundamentalDivMod(x, n);
LemmaFundamentalDivMod(x - n, n);
var zm := (x - n) / n - x / n + 1;
assert 0 == n * zm + ((x - n) % n) - (x % n) by {
LemmaMulAuto();
}
forall ensures 0 == n * zm + ((x - n) % n) - (x % n) { LemmaMulAuto(); }
if (zm > 0) { LemmaMulInequality(1, zm, n); }
if (zm < 0) { LemmaMulInequality(zm, -1, n); }
}
Expand All @@ -119,9 +115,7 @@ module {:options "-functionSyntax:4"} ModInternals {
LemmaFundamentalDivMod(x, n);
LemmaFundamentalDivMod(x + n, n);
var zp := (x + n) / n - x / n - 1;
assert 0 == n * zp + ((x + n) % n) - (x % n) by {
LemmaMulAuto();
}
forall ensures 0 == n * zp + ((x + n) % n) - (x % n) { LemmaMulAuto(); }
if (zp > 0) { LemmaMulInequality(1, zp, n); }
if (zp < 0) { LemmaMulInequality(zp, -1, n); }
}
Expand All @@ -133,9 +127,7 @@ module {:options "-functionSyntax:4"} ModInternals {
LemmaFundamentalDivMod(x, n);
LemmaFundamentalDivMod(x - n, n);
var zm := (x - n) / n - x / n + 1;
assert 0 == n * zm + ((x - n) % n) - (x % n) by {
LemmaMulAuto();
}
forall ensures 0 == n * zm + ((x - n) % n) - (x % n) { LemmaMulAuto(); }
if (zm > 0) { LemmaMulInequality(1, zm, n); }
if (zm < 0) { LemmaMulInequality(zm, -1, n); }
}
Expand Down
16 changes: 4 additions & 12 deletions src/dafny/NonlinearArithmetic/Internals/ModInternals.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ module {:options "-functionSyntax:4"} Dafny.ModInternals {
LemmaFundamentalDivMod(x, n);
LemmaFundamentalDivMod(x + n, n);
var zp := (x + n) / n - x / n - 1;
assert 0 == n * zp + ((x + n) % n) - (x % n) by {
LemmaMulAuto();
}
forall ensures 0 == n * zp + ((x + n) % n) - (x % n) { LemmaMulAuto(); }
if (zp > 0) { LemmaMulInequality(1, zp, n); }
if (zp < 0) { LemmaMulInequality(zp, -1, n); }
}
Expand All @@ -105,9 +103,7 @@ module {:options "-functionSyntax:4"} Dafny.ModInternals {
LemmaFundamentalDivMod(x, n);
LemmaFundamentalDivMod(x - n, n);
var zm := (x - n) / n - x / n + 1;
assert 0 == n * zm + ((x - n) % n) - (x % n) by {
LemmaMulAuto();
}
forall ensures 0 == n * zm + ((x - n) % n) - (x % n) { LemmaMulAuto(); }
if (zm > 0) { LemmaMulInequality(1, zm, n); }
if (zm < 0) { LemmaMulInequality(zm, -1, n); }
}
Expand All @@ -119,9 +115,7 @@ module {:options "-functionSyntax:4"} Dafny.ModInternals {
LemmaFundamentalDivMod(x, n);
LemmaFundamentalDivMod(x + n, n);
var zp := (x + n) / n - x / n - 1;
assert 0 == n * zp + ((x + n) % n) - (x % n) by {
LemmaMulAuto();
}
forall ensures 0 == n * zp + ((x + n) % n) - (x % n) { LemmaMulAuto(); }
if (zp > 0) { LemmaMulInequality(1, zp, n); }
if (zp < 0) { LemmaMulInequality(zp, -1, n); }
}
Expand All @@ -133,9 +127,7 @@ module {:options "-functionSyntax:4"} Dafny.ModInternals {
LemmaFundamentalDivMod(x, n);
LemmaFundamentalDivMod(x - n, n);
var zm := (x - n) / n - x / n + 1;
assert 0 == n * zm + ((x - n) % n) - (x % n) by {
LemmaMulAuto();
}
forall ensures 0 == n * zm + ((x - n) % n) - (x % n) { LemmaMulAuto(); }
if (zm > 0) { LemmaMulInequality(1, zm, n); }
if (zm < 0) { LemmaMulInequality(zm, -1, n); }
}
Expand Down

0 comments on commit a2aac6d

Please sign in to comment.