(0) CHARACTERISTICS
-type specified: tree
-features: deterministic, non-parameterized
-foreign types: path
(1) SYNTAX
ACCESS-PROGRAMS
Arg#1 | Arg#2 | Arg#3 | Arg#4 | Result Type | SETNIL | tree:O | | | | | SETTREE | tree:O | int:V | tree:V | tree:V | | ALTERNODE | tree:VO | path:V | int:V | | | ALTERTREE | tree:VO | path:V | tree:V | | | GETNODE | tree:V | path:V | | | int | |
---|
(2) CANONICAL TRACES
canonical(T) T = _ i:<int>; U,V:<tree> [T = SETTREE(*, i, U, V) ]AUXILIARY FUNCTIONS
change: <tree> × <path> × <int> <tree>
change(R, P, j) (validpath(R, P)) =
Condition | Value |
---|---|
path::emptypath(P) | SETTREE(*, j, U, V) where U,V:<tree>; i:<int> [R = SETTREE(*, i, U, V) ] |
path::goleft(P) | SETTREE(*, i, change(U, path::subpath(P), j), V) where U,V:<tree>; i:<int> [R = SETTREE(*, i, U, V) ] |
path::goright(P) | SETTREE(*, i, U, change(V, path::subpath(P), j)) where U,V:<tree>; i:<int> [R = SETTREE(*, i, U, V) ] |
getval: <tree> × <path> <int>
getval(R, P) (validpath(R, P)) =
Condition | Value |
---|---|
path::emptypath(P) | i where U,V:<tree>; i:<int> [R = SETTREE(*, i, U, V) ] |
path::goleft(P) | getval(U, path::subpath(P)) where U,V:<tree>; i:<int> [R = SETTREE(*, i, U, V) ] |
path::goright(P) | getval(V, path::subpath(P)) where U,V:<tree>; i:<int> [R = SETTREE(*, i, U, V) ] |
update: <tree> × <path> × <tree> <tree>
update(R, P, X) (validpath(R, P)) =
Condition | Value |
---|---|
path::emptypath(P) | X |
path::goleft(P) | SETTREE(*, i, update(U, path::subpath(P), X), V) where U,V:<tree>; i:<int> [R = SETTREE(*, i, U, V) ] |
path::goright(P) | SETTREE(*, i, U, update(V, path::subpath(P), X)) where U,V:<tree>; i:<int> [R = SETTREE(*, i, U, V) ] |
validpath: <tree> × <path> <bool>
validpath(R, P) = i:<int>; U,V:<tree> [R = SETTREE(*, i, U, V) (path::emptypath(P) path::goleft(P) validpath(U, path::subpath(P)) path::goright(P) validpath(V, path::subpath(P)))]
(3) SEMANTICS
ACCESS-PROGRAMSLegality(SETNIL(n)) = %legal%
SETNIL(n ) = _
Legality(SETTREE(n, i, U, V)) = %legal%
SETTREE(n , i, U, V) = SETTREE(*, i, U, V)
Legality(ALTERNODE((n, T), P, i)) =
Condition | Value |
---|---|
¬validpath(T, P) | %invalidpath% |
validpath(T, P) | %legal% |
ALTERNODE((n, T) , P, i) = change(T, P, i)
Legality(ALTERTREE((n, T), P, X)) =
Condition | Value |
---|---|
¬validpath(T, P) | %invalidpath% |
validpath(T, P) | %legal% |
ALTERTREE((n, T) , P, X) = update(T, P, X)
Legality(GETNODE(T, P)) =
Condition | Value |
---|---|
¬validpath(T, P) | %invalidpath% |
validpath(T, P) T = _ | %empty% |
validpath(T, P) T _ | %legal% |
GETNODE(T, P) = getval(T, P)