This package contains some commonly used proof functions for manipulating array-views.
prfun array_v_split {a:vt0p} {l:addr} {n:int}{i:nat | i <= n} ( pfarr: array_v (INV(a), l, n) ) :<prf> @( array_v (a, l, i), array_v (a, l+i*sizeof(a), n-i) ) // end of [array_v_split]
prfun array_v_unsplit {a:vt0p} {l:addr} {n1,n2:int} ( pf1arr: array_v (INV(a), l, n1) , pf2arr: array_v (a, l+n1*sizeof(a), n2) ) :<prf> array_v (a, l, n1+n2) // end of [array_v_unsplit]
prfun
array_v_extend :
{a:vt0p}
{l:addr}{n:int}
(array_v (INV(a), l, n), a @ l+n*sizeof(a)) -<prf> array_v (a, l, n+1)
prfun
array_v_unextend :
{a:vt0p}
{l:addr}
{n:int | n > 0}
(array_v (INV(a), l, n)) -<prf> (array_v (a, l, n-1), a @ l+(n-1)*sizeof(a))
prfun array_v_takeout {a:vt0p} {l:addr} {n:int } {i:nat | i < n} ( pfarr: array_v (INV(a), l, n) ) :<prf> vtakeout ( array_v (a, l, n), a @ (l+i*sizeof(a)) ) (* end of [array_v_takeout] *)
fun{a:t@ype} array_get_at {n:int}{i:nat | i < n} ( A: &(@[a][n]), i: size_t (i) ) : a = x where { prval (pfat, fpf) = array_v_takeout{..}{..}{n}{i} (view@(A)) val x = ptr_get<a> (pfat | ptr1_add_guint<a> (addr@(A), i)) prval () = view@(A) := fpf (pfat) } // end of [array_get_at]where array_v_takeout is called to generate a proof of the at-view needed for reading from cell i in the given array A.
praxi
array_v_group
{a:vt0p}{l:addr}{m,n:int}
(pf: array_v (INV(a), l, m*n)): array_v (@[a][n], l, m)
praxi
array_v_ungroup
{a:vt0p}{l:addr}{m,n:int}
(pf: array_v (@[INV(a)][n], l, m)): array_v (INV(a), l, m*n)
This page is created with ATS by Hongwei Xi and also maintained by Hongwei Xi. |