Features of the Computer Algebra Language FLAC
Victor L. Kistlerov
Institute for Control Sciences, Profsoyuznaya 65, Moscow, USSR
FLAC [1] is well defined functional language based on the concept
of suspended computations. FLAC supports the notion of function as
well as the notion of algebraic computations simulated by term
conversion.
Let us consider computational model which is a basis of the
language.
Let F be a certain mathematical partially defined function on an
appropriate set, say X, F:X ---> Y. Assume further that any element of
X is labeled by a unique symbolic name, e.g. x, y1 etc. Such
primitive unstructured elements will be called simple ground terms.
It is clear that, if we compute F at a point x in X where F is well
defined then we obtain an element of Y which is also identified by a
ground term.
It is essential for our computation model that if F(x1) is computed
at a point x1 in X but F is not well defined at this point then the
computation is still considered valid and a new object which is called
intesional of the function F is generated and appended to the
condomain Y. The intensional is represented by an object which is
called the intensional of the function F and syntactically identical
to the function call F(x1).
The procedure of such completion of the partial function F is
called suspension of computation.
The elements of the target set Y might have been simple ground
term. Following the above mentioned concept of suspended computations
set Y is extended by some intensionals of the form F(x1,...,xn).
F G
Looking at a composition X ---> Y ---> Z we see that Z will be extended
by ground terms of the form G(y1, F(x1,...,xn),...). For adequate
programing the language has built-in facilities for structure analyses
of composite applicative ground terms.
The necessity of a suspension is motivated by the need of further
computations of external functional calls which continues on the
extended domain after completion functions on intensionals of partial
functions. We considered the computations as partial computations.
Thus we interpret algebraic data types as intensionals of partial
functions and algebraic operations for these as partial computations.
For instance -1, 1/2, sqrt(-1), sin(x) are considered as intensional
of the partial functions subtraction, division, square root and sine
respectively.
For the above-mentioned structure analysis of intensionals
variables of tow types are present in FLAC: one is term variable
(shorthanded further to term-variable) and the another is variable of
list of terms (further: list-variable). A value of a term-variable is
either simple ground term or an applicative ground term, and a value
of a list-variable is a list of terms, which is a sequences of ground
terms separated by commas. The token of a term variable is a leading
"&" in its name, while the token of a list variable is a leading "#".
A definition of a function is represented now as a sequence of
statements of the following form:
= :
Here the left-hand side describes a class (subset) of argument's
values of the function in question and the right-hand side is a rule
for computing the value of this function on the specified class of
arguments.
A step of computation of a FLAC-program is a conversion of a
function call which consists of pattern matching the call with the
left-hand side of one of the statements (including binding of the
term- and list-variables) and subsequent evaluation of the right-hand
side of the statement with prior substitution into it of the values of
the term- and list-variables thus bound while matching. This is
similar to mechanism of pattern matching in REFAL [2] language.
If actually function call in question matches no left-hand side of
no statement then the computation is suspended i.e. the result of the
computation will be the intensional of the functional call itself (in
no way transformed).
Note that if, on the other hand, the function call in questions
matches more than one left-hand side then the sequentially first one
is selected for further interpretation.
Due to the computational model FLAC is adequate language for
algebraic computations. The mechanism of suspension of computations
makes possible to design any kind data, occurring in algebra. The
mechanism of pattern matching enables the implementation of the
analysis of designed of algebraic structures with any degree of
detailing. To denote the algebraic computations one can use infix
operations and their semantics can be defined as FLAC-program. All
these operations can be overloaded. An essential proper of FLAC is
its being both system implementation language and language of system
for a computer algebra system.
By this time some versions of FLAC language is implemented for
IBM/PC MS DOS.
References,
1. Kristlerov V. L. Design Principles of the Computer Algebra
Language FLAC, Preprint Inst. for Control Sci., Moscow, 1987 (in
Russian).
2. Turchin V. F. Refal-5, programming guide & reference manual.
New England Publishing Co. Holyoke 1989.
Go to
Experimental Systems