Skip to content

Instantly share code, notes, and snippets.

@riceluxs1t
Created April 26, 2019 04:13
Show Gist options
  • Save riceluxs1t/3864412a8ce7f9d5ffa7c1f38fde8291 to your computer and use it in GitHub Desktop.
Save riceluxs1t/3864412a8ce7f9d5ffa7c1f38fde8291 to your computer and use it in GitHub Desktop.
method Divide(x: nat, y: nat) returns (q: nat, r: nat)
requires y > 0;
ensures q * y + r == x && r >= 0 && r < y;
{
q := 0;
r := x;
while (r >= y)
{
r := r - y;
q := q + 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment