File size: 1,418 Bytes
6851d40 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | // RUN: %verify "%s"
/*******************************************************************************
* Original: Copyright (c) Microsoft Corporation
* SPDX-License-Identifier: MIT
*
* Modifications and Extensions: Copyright by the contributors to the Dafny Project
* SPDX-License-Identifier: MIT
*******************************************************************************/
module {:options "-functionSyntax:4"} ModInternalsNonlinear {
/* WARNING: Think three times before adding to this file, as nonlinear
verification is highly unstable! */
/* the remainder of 0 divided by an integer is 0 */
lemma LemmaModOfZeroIsZero(m:int)
requires 0 < m
ensures 0 % m == 0
{
}
/* describes fundementals of the modulus operator */
lemma LemmaFundamentalDivMod(x:int, d:int)
requires d != 0
ensures x == d * (x / d) + (x % d)
{
}
/* the remained of 0 divided by any integer is always 0 */
lemma Lemma0ModAnything()
ensures forall m: int {:trigger 0 % m} :: m > 0 ==> 0 % m == 0
{
}
/* a natural number x divided by a larger natural number gives a remainder equal to x */
lemma LemmaSmallMod(x:nat, m:nat)
requires x < m
requires 0 < m
ensures x % m == x
{
}
/* the range of the modulus of any integer will be [0, m) where m is the divisor */
lemma LemmaModRange(x:int, m:int)
requires m > 0
ensures 0 <= x % m < m
{
}
}
|