class ArraySet { private static Object[] a; public static int size; /*: public static ghost specvar init :: bool; public static specvar content :: objset; vardefs "content == {n. EX j. n = a.[j] & 0 <= j & j < size}"; invariant "init --> a ~= null & 0 < a..Array.length & 0 <= size & size <= a..Array.length"; */ public static void initialize() /*: modifies init, content ensures "init & content = {}"; */ { a = new /*: hidden */ Object[100]; size = 0; //: init := "True"; } public static boolean contains(Object x) /*: requires "init & x ~= null" ensures "result = (x : content)"; */ { int i = 0; while (i < size) { if (a[i] == x) { return true; } else { i = i + 1; } } return false; } }