|[ var c, n : int ; var b[0..N) : int { 0 < n <= N & c = (# i : n <= i < N : b.i < 0) }; if b.(n-1) < 0 --> c,n := c+1, n-1 [] b.(n-1) >= 0 --> n := n-1 fi { c = (# i : n <= i < N : b.i < 0) } ]|
|[ var c,n : int ; var b[0..N) : int { N >= 0 } ; c, n := 0, N; do n != 0 --> if b.(n-1) < 0 --> c,n := c+1, n-1 [] b.(n-1) >= 0 --> n := n-1 fi od { c = (# i : 0 <= i < N : b.i < 0 ) } ]|
|[ var c,n : int ; var b[0..N) : int { N >= 0 } ; c, n := 0, 0; do n != N --> if b.n < 0 --> c,n := c+1, n+1 [] b.n >= 0 --> n := n+1 fi od { c = (# i : 0 <= i < N : b.i < 0 ) } ]|
|[ con N : int { N >= 1 } ; var n : int ; n := 1 ; do 2 * n <= N --> n := 2 * n * od { 1 <= n <= N < 2 * n & (EXISTS p : p >= 0 : n = 2^p) } ]|
UP to CSCI 550 Assignments document?