
System-change inputs.
When
is-system-change. ~ KE Y:operand =
is-system-change:key = T,
key specifies that the user is authorized to make a system
change and that input = ~INPUT:operand represents a
functionfthat is to be applied to D to produce the new
statef.'D. (Of courseflD can be a useless new state; no
constraints are placed on it.) The output is a report,
namely report-change: <input,D>.
Expression inputs.
When is-expression:key = T, the
system understands that the output is to be the meaning
of the FFP expression input; ~INPUT:operand produces
it and it is evaluated, as are all expressions. The state is
unchanged.
Program inputs and system self-protection.
When is-
program:key = T, both the output and new state are
given by (pinput):D = <output,newstate>. If newstate
contains file in suitable condition and the definitions of
system and other protected functions, then
system-check: <output,newstate> =<output, newstate>.
Otherwise, system-check: <output,newstate>
= <error-report, D>.
Although program inputs can make major, possibly dis-
astrous changes in the state when it produces newstate,
system-check can use any criteria to either allow it to
become the actual new state or to keep the old. A more
sophisticated system-check might correct only prohibited
changes in the state. Functions of this sort are possible
because they can always access the old state for compar-
ison with the new state-to-be and control what state
transition will finally be allowed.
File query inputs. If is-query:key = T, the function
query-response is designed to produce the output =
answer to the query input from its operand <input,fie>.
File update inputs. If
is-update:key = T,
input speci-
fies a file transaction understood by the function update,
which computes updated-file = update: <input,file>. Thus
J, FILE has <updated-file, D> as its operand and thus
stores the updated fde in the cell FILE in the new state.
The rest of the state is unchanged. The function report-
update generates the output from its operand
<input,fie>.
14.4.3 Installing the system program. We have de-
scribed the function called system by some FP definitions
(using auxiliary functions whose behavior is only indi-
cated). Let us suppose that we have FP definitions for
all the nonprimitive functions required. Then each defi-
nition can be converted to give the name and contents of
a cell in D (of course this conversion itself would be done
by a better system). The conversion is accomplished by
changing each FP function name to its equivalent atom
(e.g., update becomes UPDATE) and by replacing func-
tional forms by sequences whose first member is the
controlling function for the particular form. Thus
,l, FILEo[update, defs] is converted to
<COMP,<STORE, FILE>,
< CONS, UPDATE, DEFS>>,
and the FP function is the same as that represented by
the FFP object, provided that update ~- p UPDATE and
COMP, STORE, and CONS represent the controlling
functions for composition, store, and construction.
All FP definitions needed for our system can be
converted to cells as indicated above, giving a sequence
Do. We assume that the AST system has an empty state
to start with, hence SYSTEM is not defined. We want to
define SYSTEM initially so that it will install its next
input as the state; having done so we can then input Do
and all our definitions will be installed, including our
program--system--itself. To accomplish this we enter
our first input
<RESET, <CELL, SYSTEM, loader>>
where loader ~- <CONS, <CONST, DONE>,ID>.
Then, by the transition rule for RESETwhen SYSTEM
is undefined in D, the cell in our input is put at the
head of D -- ~, thus defining pSYSTEM -= ploader v-
[DONE, id]. Our second input is Do, the set of definitions
we wish to become the state. The regular transition rule
causes the AST system to evaluate
#( S YSTEM:Do) = [DONE, id]:Do = <DONE, Do>. Thus
the output from our second input is DONE, the new
state is Do, and pSYSTEM is now our system program
(which only accepts inputs of the form <key, input>).
Our next task is to load the file (we are given an
initial value file). To load it we input aprogram into the
newly installed system that contains file as a constant
and stores it in the state; the input is
<program-key, [DONE, store-file]> where
pstore-file --- ~FILEo[file, id].
Program-key identifies [DONE, store-file] as a program
to be applied to the state Do to give the output and new
state D1, which is:
pstore-file:Do = ~,FILEo[file, id]:D0,
or Do with a cell containing file at its head. The output
is DONE:Do = DONE. We assume that system-check
will pass <DONE, Di> unchanged. FP expressions have
been used in the above in place of the FFP objects they
denote, e.g. DONE for <CONST, DONE>.
14.4.4 Using the system. We have not said how the
system's file, queries or updates are structured, so we
cannot give a detailed example of file operations. How-
ever, the structure of subsystem shows clearly how the
system's response to queries and updates depends on the
functions query-response, update, and report-update.
Let us suppose that matrices m, n named M, and N
are stored in D and that the function MM described
earlier is defined in D. Then the input
<expression-key, (MMo[~ M, ~ N]o DEFS:#)>
would give the product of the two matrices as output and
an unchanged state. Expression-key identifies the appli-
cation as an expression to be evaluated and since defs:#
= D and [~'M, I'N]:D = <re,n>, the value of the expres-
sion is the result MM:<m,n>, which is the output.
637
Communications August 1978
of Volume 21
the ACM Number 8