Trilogy(ID:1440/tri005)


Paul Voda, UBC, 1988.
Logic programming language with numerical constraint-solving over the natural numbers. Syntactically a blend of Prolog, LISP and Pascal.
Contains three types of clauses: predicates (backtracking but no assignable variables), procedures (if-then-else but no backtracking; assignable variables), and subroutines (like procedures, but with input and system calls; callable only from top level or from other subroutines).

Interesting to note that it was reviewed favourably by Grogano, inventor of the very elegant Mouse language


Structures:
Related languages
LISP 1.5 => Trilogy   Incorporated some features of
Pascal (Jensen and Wirth) => Trilogy   Incorporated some features of
Prolog => Trilogy   Incorporated some features of
Trilogy => Trilogy II   Evolution of

References:
  • Voda, Paul and Jamie Andrews. "TRILOGY Users Manual" Complete Logic Systems, Inc., North Vancover, B.C. Canada, 1987 view details
  • Grogono, P. "Exotic Language of the Month Club: More Versatility with Pascal-like Trilogy." pp83-86. view details Extract: Introduction
    In "Cordell Green and the Age of Reasoning" (Com-putsrVisions,COMPUTER LANGUAGE, Aug. 1987, pp. 25-32), Green suggested that programmers will soon come to expect languages that support several paradigms. One such language already available, Trilogy, can be used for procedural, functional, logical, constraint, and data base programming. This column is based on my experiments with the first version of Trilogy, distributed by Complete Logic Systems Inc.
    Trilogy is implemented for IBM PCs and compatibles as an integrated development environment in the style introduced by UCSD Pascal and enhanced by Borland International Corp., Scotts Valley, Calif. The query and program occupy separate windows but can be modified by the same editor. Input and output appear in separate windows and can be redirected to files.
    Trilogy is a strongly typed language: the compiler can infer the type of each variable from a declaration or from its context. The single letter L denotes the type of long (32-bit) integers. The declaration x :: L introduces x as a symbolic variable of type L. Constants start with an uppercase letter and variables with a lowercase letter, the opposite of PROLOG'S convention but in some ways more natural. The words we capitalize in English denote specific objects or constants, not variables. For example, we capitalize "Montreal" and "San Francisco" but not "city" or "town."
    As in Pascal, the value of a variable in Trilogy can be restricted to a subrange. The declaration x .7 L[0..3] introduces x as a variable that must have one of the values 0, 1, 2, or 3. This declaration becomes a Trilogy query if it is preceded by all x or one x . The query all x :: L[O..3J has solutions x = 0, x = 1, x = 2, and x = 3. The query one x :: L[0..3] has the unique solution x = 0. Additional formulas can be added to restrict the values of x and the number of solutions. For example, the program all x :: LfO.JJ & x < 2 has two solutions: x = 0 and x = 1. Like all Trilogy programs, this program can be read as a predicate, a statement that is true or false depending on the values of its variables. The Trilogy processor's task is to find values of the variables for which the predicate is true.
    Trilogy is particularly efficient at finding integer solutions of linear equations. Here is a popular numerical problem: a box contains beetles and spiders with a total of seven insects and 46 legs. How many insects of each kind are in the box? The Trilogy program for this problem consists of the declarations for two integer variables, beetles :: L[O..J & and spiders :: L[O..J, and the two equations that incorporate the explicit information (seven insects and 46 legs) and implicit information (beetles and spiders have six and eight legs, respectively): beetles + spiders = 7 & and 6 * beetles + 8 * spiders = 46. Trilogy finds the solution?five spiders and one beetle?without backtracking.

          in Computer Language Magazine 5(4) view details
  • Voda , P. "The Constraint Language Trilogy: Semantics and Computations", Complete Logic Systems, 741 Blueridge Ave, North Vancouver BC, V7R 2J5. view details
          in Computer Language Magazine 5(4) view details
    Resources
    • Trilogy ad from COpmuter Languages issue iwth review