(0) CHARACTERISTICS
-type specified: grid
-features: deterministic, non-parameterized
-foreign types: status, index, info
(1) SYNTAX
ACCESS-PROGRAMS
Arg#1 | Arg#2 | Arg#3 | Arg#4 | Arg#5 | Result Type | INIT | status:O | grid:VO | index:V | | | | DESTROY | status:O | grid:VO | | | | | GET_INDEX | status:O | grid:V | | | | index | PUT_INFO | status:O | grid:VO | index:V | info:V | | | GET_INFO | status:O | grid:V | index:V | | | info | PUT_CLUSTER | status:O | grid:VO | int:V | int:V | int:V | | DELETE_CLUSTER | status:O | grid:VO | int:V | int:V | int:V | | PUT_SLICE | status:O | grid:VO | int:V | int:V | | | DELETE_SLICE | status:O | grid:VO | int:V | int:V | | | COPY_SLICE | status:O | grid:VO | int:V | int:V | int:V | | COPY | status:O | grid:V | grid:VO | | | | |
---|
(2) CANONICAL TRACES
canonical(T) T = _ T = INIT(*1, *, xind).[PUT_INFO(*1, *, x[i], e[i])]i=1..nb_els where xind:<index>; nb_els:<int>; x[1]..x[nb_els]:<index>; e[1]..e[nb_els]:<info> [¬index::isNil(xind) i:<int>1 i i index::nbElems(xind) [index::getInt(xind, i) 1] nb_els = product(xind, index::nbElems(xind)) i:<int>1 i i index::nbElems(xind) [index::getInt(x[1], i) = 1 ] i:<int> [1 i i < nb_els index::isLt(x[i], x[i + 1])] xind = x[nb_els] ]AUXILIARY FUNCTIONS
copySlice: <grid> × <int> × <int> × <int> <grid>
copySlice(g, d, offset1, offset2) (g _ (1 d d nbDim(g)) (1 offset1 offset1 nthDim(g, d)) (1 offset2 offset2 < nthDim(g, d))) = new_g where new_g:<grid>; m:<int>; x[1]..x[m]:<index>; xind:<index>; e[1]..e[m]:<info>; f[1]..f[m]:<info> [g = INIT(*1, *, xind).[PUT_INFO(*1, *, x[i], e[i])]i=1..m canonical(new_g) new_g = INIT(*1, *, xind).[PUT_INFO(*1, *, x[i], f[i])]i=1..m i:<int>1 i i m [(index::getInt(x[i], d) offset2 f[i] = e[i] ) (index::getInt(x[i], d) = offset2 f[i] = getInfo(g, index::putInt(x[i], d, offset1)) )]]
deleteCluster: <grid> × <int> × <int> × <int> <grid>
deleteCluster(g, d, offset, nb) (g _ (1 d d nbDim(g)) (1 offset offset nthDim(g, d)) (1 nb nb < nthDim(g, d)) offset + nb - 1 nthDim(g, d)) =
Condition | Value |
---|---|
nb = 1 | deleteSlice(g, d, offset) |
nb > 1 | deleteCluster(deleteSlice(g, d, offset), d, offset, nb - 1) |
deleteSlice: <grid> × <int> × <int> <grid>
deleteSlice(g, d, offset) (g _ (1 d d nbDim(g)) (1 offset offset nthDim(g, d)) nthDim(g, d) > 1) = new_g where new_g:<grid>; m,n:<int>; x[1]..x[m], y[1]..y[n]:<index>; xind,yind:<index>; e[1]..e[m], f[1]..f[n]:<info> [g = INIT(*1, *, xind).[PUT_INFO(*1, *, x[i], e[i])]i=1..m canonical(new_g) new_g = INIT(*1, *, yind).[PUT_INFO(*1, *, y[i], f[i])]i=1..n nthDim(new_g, d) = nthDim(g, d) - 1 i:<int>1 i i nbDim(g) i d [nthDim(new_g, i) = nthDim(g, i) ] i,v:<int>1 i i n [index::getInt(y[i], d) = v (v < offset k:<int> [y[i] = x[k] f[i] = e[k] ]) (v offset k:<int> [index::putInt(y[i], d, v + 1) = x[k] f[i] = e[k] ])]]
getIndex: <grid> <index>
getIndex(g) (g _) = x where x:<index> [g = INIT(*1, *, x) ]
getInfo: <grid> × <index> <info>
getInfo(g, x) (isValidIndex(g, x)) = e where S1,S2:<grid>; e:<info> [g = S1.PUT_INFO(*1, *, x, e).S2 ]
isValidIndex: <grid> × <index> <bool>
isValidIndex(g, x) (g _) = nbDim(g) = index::nbElems(x) i:<int>1 i i nbDim(g) [1 index::getInt(x, i) index::getInt(x, i) nthDim(g, i)]
nbDim: <grid> <int>
nbDim(g) (g _) = index::nbElems(x) where x:<index>; T:<grid> [g = INIT(*1, *, x).T ]
nthDim: <grid> × <int> <int>
nthDim(g, d) (g _ (1 d d nbDim(g))) = index::getInt(x, d) where x:<index>; T:<grid> [g = INIT(*1, *, x).T ]
product: <index> × <int> <int>
product(y, j) (y _ j 1) =
Condition | Value |
---|---|
j = 1 | index::getInt(y, j) |
j > 1 | index::getInt(y, j) * product(y, j - 1) |
putCluster: <grid> × <int> × <int> × <int> <grid>
putCluster(g, d, offset, nb) (g _ (1 d d nbDim(g)) (0 offset offset nthDim(g, d)) nb > 0) =
Condition | Value |
---|---|
nb = 1 | putSlice(g, d, offset) |
nb > 1 | putCluster(putSlice(g, d, offset), d, offset, nb - 1) |
putInfo: <grid> × <index> × <info> <grid>
putInfo(g, y, e) (g _ isValidIndex(g, y)) = S1.PUT_INFO(*1, *, y, e).S2 where S1,S2:<grid>; f:<info> [g = S1.PUT_INFO(*1, *, y, f).S2 ]
putSlice: <grid> × <int> × <int> <grid>
putSlice(g, d, offset) (g _ (1 d d nbDim(g)) (0 offset offset nthDim(g, d))) = new_g where new_g:<grid>; xind,yind:<index>; m,n,v:<int>; x[1]..x[m]:<index>; e[1]..e[m]:<info>; y[1]..y[n]:<index>; f[1]..f[n]:<info> [g = INIT(*1, *, xind).[PUT_INFO(*1, *, x[i], e[i])]i=1..m canonical(new_g) new_g = INIT(*1, *, yind).[PUT_INFO(*1, *, y[i], f[i])]i=1..n nthDim(new_g, d) = nthDim(new_g, d) + 1 i:<int>1 i i nbDim(g) i d [nthDim(new_g, i) = nthDim(g, i) ] i:<int>1 i i n [index::getInt(y[i], d) = v (v offset k:<int> [y[i] = x[k] f[i] = e[k] ]) (v = offset + 1 f[i] = _ ) (v > offset + 1 k:<int> [index::putInt(y[i], d, v - 1) = x[k] f[i] = e[k] ])]]
(3) SEMANTICS
ACCESS-PROGRAMSLegality(INIT(s, (a, g), x)) =
Condition | Value |
---|---|
g _ | %nonempty_trace% |
g = _ x = _ | %no_init% |
g = _ (x _ (¬index::isNil(x) i:<int>1 i i index::nbElems(x) [index::getInt(x, i) 1] = false )) | %bad_index% |
g = _ (x _ (¬index::isNil(x) i:<int>1 i i index::nbElems(x) [index::getInt(x, i) 1] = true )) | %legal% |
INIT(s , (a, g), x) =
Condition | Value |
---|---|
g _ | status::NONEMPTY() |
g = _ x = _ | status::INIT() |
g = _ x _ ¬(¬index::isNil(x) i:<int>1 i i index::nbElems(x) [index::getInt(x, i) 1]) | status::INDEX() |
g = _ x _ (¬index::isNil(x) i:<int>1 i i index::nbElems(x) [index::getInt(x, i) 1]) | status::LEGAL() |
INIT(s, (a, g) , x) = G where G:<grid>; n:<int>; y[1]..y[n]:<index> [G = INIT(*1, *, x).[PUT_INFO(*1, *, y[i], _)]i=1..n ]
Legality(DESTROY(s, (a, g))) =
Condition | Value |
---|---|
g = _ | %no_init% |
g _ | %legal% |
DESTROY(s , (a, g)) =
Condition | Value |
---|---|
g = _ | status::INIT() |
g _ | status::LEGAL() |
DESTROY(s, (a, g) ) = _
Legality(GET_INDEX(s, g)) =
Condition | Value |
---|---|
g = _ | %no_init% |
g _ | %legal% |
GET_INDEX(s , g) =
Condition | Value |
---|---|
g = _ | status::INIT() |
g _ | status::LEGAL() |
GET_INDEX(s, g) = getIndex(g)
Legality(PUT_INFO(s, (a, g), x, e)) =
Condition | Value |
---|---|
g = _ | %no_init% |
g _ ¬isValidIndex(g, x) | %bad_access% |
g _ isValidIndex(g, x) | %legal% |
PUT_INFO(s , (a, g), x, e) =
Condition | Value |
---|---|
g = _ | status::INIT() |
g _ ¬isValidIndex(g, x) | status::ACCESS() |
g _ isValidIndex(g, x) | status::LEGAL() |
PUT_INFO(s, (a, g) , x, e) = putInfo(g, x, e)
Legality(GET_INFO(s, g, x)) =
Condition | Value |
---|---|
g = _ | %no_init% |
g _ ¬isValidIndex(g, x) | %bad_access% |
g _ isValidIndex(g, x) | %legal% |
GET_INFO(s , g, x) =
Condition | Value |
---|---|
g = _ | status::INIT() |
g _ ¬isValidIndex(g, x) | status::ACCESS() |
g _ isValidIndex(g, x) | status::LEGAL() |
GET_INFO(s, g, x) = getInfo(g, x)
Legality(PUT_CLUSTER(s, (a, g), d, nb, offset)) =
Condition | Value |
---|---|
g = _ | %no_init% |
g _ 1 d d nbDim(g) nb > 0 (0 offset offset nthDim(g, d)) = false | %bad_access% |
g _ 1 d d nbDim(g) nb > 0 (0 offset offset nthDim(g, d)) = true | %legal% |
PUT_CLUSTER(s , (a, g), d, nb, offset) =
Condition | Value |
---|---|
g = _ | status::INIT() |
g _ ¬(1 d d nbDim(g) nb > 0 (0 offset offset nthDim(g, d))) | status::ACCESS() |
g _ (1 d d nbDim(g) nb > 0 (0 offset offset nthDim(g, d))) | status::LEGAL() |
PUT_CLUSTER(s, (a, g) , d, nb, offset) = putCluster(g, d, offset, nb)
Legality(DELETE_CLUSTER(s, (a, g), d, nb, offset)) =
Condition | Value |
---|---|
g = _ | %no_init% |
g _ 1 d d nbDim(g) (1 nb nb nthDim(g, d)) (1 offset offset nthDim(g, d)) offset + nb - 1 nthDim(g, d) = false | %bad_access% |
g _ 1 d d nbDim(g) (1 nb nb nthDim(g, d)) (1 offset offset nthDim(g, d)) offset + nb - 1 nthDim(g, d) = true | %legal% |
DELETE_CLUSTER(s , (a, g), d, nb, offset) =
Condition | Value |
---|---|
g = _ | status::INIT() |
g _ ¬(1 d d nbDim(g) (1 nb nb < nthDim(g, d)) (1 offset offset nthDim(g, d)) offset + nb - 1 nthDim(g, d)) | status::ACCESS() |
g _ (1 d d nbDim(g) (1 nb nb < nthDim(g, d)) (1 offset offset nthDim(g, d)) offset + nb - 1 nthDim(g, d)) | status::LEGAL() |
DELETE_CLUSTER(s, (a, g) , d, nb, offset) = deleteCluster(g, d, offset, nb)
Legality(PUT_SLICE(s, (a, g), d, offset)) =
Condition | Value |
---|---|
g = _ | %no_init% |
g _ 1 d d nbDim(g) (0 offset offset nthDim(g, d)) = false | %bad_access% |
g _ 1 d d nbDim(g) (0 offset offset nthDim(g, d)) = true | %legal% |
PUT_SLICE(s , (a, g), d, offset) =
Condition | Value |
---|---|
g = _ | status::INIT() |
g _ ¬(1 d d nbDim(g) 0 offset offset nthDim(g, d)) | status::ACCESS() |
g _ (1 d d nbDim(g) 0 offset offset nthDim(g, d)) | status::LEGAL() |
PUT_SLICE(s, (a, g) , d, offset) = putCluster(g, d, offset, 1)
Legality(DELETE_SLICE(s, (a, g), d, offset)) =
Condition | Value |
---|---|
g = _ | %no_init% |
g _ 1 d d nbDim(g) 1 < nthDim(g, d) (1 offset offset nthDim(g, d)) = false | %bad_access% |
g _ 1 d d nbDim(g) 1 < nthDim(g, d) (1 offset offset nthDim(g, d)) = true | %legal% |
DELETE_SLICE(s , (a, g), d, offset) =
Condition | Value |
---|---|
g = _ | status::INIT() |
g _ ¬(1 d d nbDim(g) 1 < nthDim(g, d) 1 offset offset nthDim(g, d)) | status::ACCESS() |
g _ (1 d d nbDim(g) 1 < nthDim(g, d) 1 offset offset nthDim(g, d)) | status::LEGAL() |
DELETE_SLICE(s, (a, g) , d, offset) = deleteCluster(g, d, offset, 1)
Legality(COPY_SLICE(s, (a, g), d, offset1, offset2)) =
Condition | Value |
---|---|
g = _ | %no_init% |
g _ 1 d d nbDim(g) (1 offset1 offset1 nthDim(g, d)) (1 offset2 offset2 nthDim(g, d)) = false | %bad_access% |
g _ 1 d d nbDim(g) (1 offset1 offset1 nthDim(g, d)) (1 offset2 offset2 nthDim(g, d)) = true | %legal% |
COPY_SLICE(s , (a, g), d, offset1, offset2) =
Condition | Value |
---|---|
g = _ | status::INIT() |
g _ ¬(1 d d nbDim(g) 1 offset1 offset1 nthDim(g, d) 1 offset2 offset2 nthDim(g, d)) | status::ACCESS() |
g _ (1 d d nbDim(g) 1 offset1 offset1 nthDim(g, d) 1 offset2 offset2 nthDim(g, d)) | status::LEGAL() |
COPY_SLICE(s, (a, g) , d, offset1, offset2) = copySlice(g, d, offset1, offset2)
Legality(COPY(s, g, (a, h))) =
Condition | Value |
---|---|
g = _ h = _ | %no_init% |
g _ h _ | %legal% |
COPY(s , g, (a, h)) =
Condition | Value |
---|---|
g = _ h = _ | status::INIT() |
g _ h _ | status::LEGAL() |
COPY(s, g, (a, h) ) = g