Programming language support Loop invariant
whiley
the whiley programming language provides first-class support loop invariants. loop invariants expressed using 1 or more clauses, following illustrates:
the max() function determines largest element in integer array. defined, array must contain @ least 1 element. postconditions of max() require returned value is: (1) not smaller element; and, (2) matches @ least 1 element. loop invariant defined inductively through 2 clauses, each of corresponds clause in postcondition. fundamental difference each clause of loop invariant identifies result being correct current element i, whilst postconditions identify result being correct elements.
Comments
Post a Comment