rhit-csse-projects / RESOLVE

RESOLVE (REusable SOftware Language with VErification) is a specification and programming language designed for verifying correctness of object oriented programs.
https://www.cs.clemson.edu/resolve/
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Easy: Misuse of loop changing clause #452 (10 hrs) #1

Open AdityaSenthilvel opened 4 weeks ago

AdityaSenthilvel commented 4 weeks ago

Including a changing clause for a loop but listing only a subset of changing variables is an error.

drholly77 commented 2 weeks ago

@rhit-csse-projects/t17-2425

Here is an example RESOLVE loop:

6       While ( 1 <= Length(Q) )
7           changing Q, T, E;
8           maintaining #Q = T o <E> o Q;
9           decreasing |Q|;
10      do
11          Enqueue(E,T);
12          Dequeue(E,Q);
13      end;

Inclusion (or not) of the changing clause by the developer:

How to know if X is changed in the loop body:

  1. X is used as an actual parameter in a call to an operation where the corresponding formal parameter mode is not one of these: restores, preserves, or evaluates
  2. X appears in a swap statement, e.g., X :=: Y
  3. X appears in left hand side of an assignment statement, e.g., X := Replica(Y);