Advertisement
Guest User

Untitled

a guest
Nov 24th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. proc main() {
  2. assert(y >= 1 & x >= 0 & x == x0);
  3. assert(y >= 1 & x >= 0 & x == x0 & x*y == x0*y); % Implied (eq_i and eq_e)
  4. s := x * y;
  5. assert(y >= 1 & x >= 0 & x == x0 & s == x0*y); % Asn
  6. t := x;
  7. assert(y >= 1 & x >= 0 & t == x0 & s == x0*y); % Asn
  8. while y > 1 do {
  9. assert(y >= 1 & x >= 0 & t == x0 & s == x0*y & y > 1); % OuterInv & Guard
  10. assert(y-1 > 0 & x >= 0 & t == x0 & s == x0*(y-1+1)); % Implied (VC1)
  11. y := y - 1;
  12. assert(y > 0 & x >= 0 & t == x0 & s == x0*(y+1)); % Asn
  13. x := t;
  14. assert(y > 0 & x >= 0 & t == x0 & x == x0 & s == x0*(y+1)); % Asn
  15. assert(y > 0 & t == x0 & s == x0*y + x); % Implied (VC2)
  16. while !(x == 0) do {
  17. assert(y > 0 & t == x0 & s == x0*y + x & !(x==0)); % InnerInv & Guard
  18. assert(y > 0 & s-1 == x0*y + x - 1); % Implied (VC3)
  19. x := x - 1;
  20. assert(y > 0 & s-1 == x0*y + x); % Asn
  21. s := s - 1;
  22. assert(y > 0 & t == x0 & s == x0*y + x); % InnerInv by Asn
  23. };
  24. assert(y > 0 & t == x0 & s == x0*y + x & x == 0); % InnerInv
  25. assert(y >= 1 & x >= 0 & t == x0 & s == x0*y); % OuterInv, Implied (VC4)
  26. };
  27. assert(y >= 1 & x >= 0 & t == x0 & s == x0*y & !(y>1)); % While
  28. assert(s == x0); % Implied (VC5)
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement