1 (** Simple example to illustrate the C memory model *)
9 function ([]) (a: ptr 'a) (i: int): 'a = Map.get a.data.Array.elts (a.offset + i)
11 let locate_max (a: ptr int64) (n: int32): int32
13 requires { valid a n }
14 ensures { 0 <= result < n }
15 ensures { forall i. 0 <= i < n -> a[i] <= a[result] }
18 invariant { 0 <= idx < n }
19 invariant { forall i. 0 <= i < j -> a[i] <= a[idx] }
20 if get_ofs a idx < get_ofs a j then idx <- j