Advertisement
Guest User

Untitled

a guest
Nov 24th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 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 (VC 1)
  4. s := x * y;
  5. assert(y >= 1 & x >= 0 & x == x0 & s == x0*y);
  6. t := x ;
  7. assert (y >= 1 & x >= 0 & t == x0 & s == x0*y); % Asn
  8.  
  9. while y > 1 do {
  10. assert (y >= 1 & x >= 0 & t == x0 & s == x0*y & y > 1); % Inv & guard
  11. y := y - 1;
  12. assert (y >= 0 & x >= 0 & t == x0 & s == x0*(y+1) & y > 0) % Asn
  13. x := t;
  14. assert (!!) % Asn
  15.  
  16. while !(x == 0) do {
  17. assert(!! & !(x==0)); % Inv & guard
  18.  
  19. x := x - 1;
  20. s := s - 1;
  21.  
  22. assert(!!);
  23. };
  24. assert(!! & x == 0); % Partial While
  25. assert(y >= 1 & x >= 0 & t == x0 & s == x0*y);
  26. };
  27.  
  28. assert(y >= 1 & x >= 0 & t == x0 & s == x0*y & !(y > 1)); % Partial While
  29. assert(s == x0); % Implied (VC 3)
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement