CoreBoole.mesa 
Copyright © 1985 by Xerox Corporation. All rights reversed.
Created by Bertrand Serlet July 31, 1985 3:03:17 pm PDT
Bertrand Serlet January 20, 1986 4:00:00 pm PST
DIRECTORY
Core USING [CellType],
Rope USING [ROPE];
CoreBoole: CEDAR DEFINITIONS = BEGIN
Theory
This interface defines the basic functions for manipulating Boolean expressions.
Common Types
ROPE: TYPE = Rope.ROPE;
Expression Type
Expressions may be:
constants among {true, false};
expressions created by Var, gateway between variables and expressions;
expressions created by operators such as Not, And, Or, If, etc ... .
The public of an Expression contains all the inputs of the Expression, and only the inputs. The structure of this public is flat, and functions returning expressions will generate their own flat public.
Expression: TYPE = Core.CellType;
Constants
true: READONLY Expression;
false: READONLY Expression;
Operators returning Expressions
Var: PROC [var: ROPE] RETURNS [result: Expression];
Case is significant
Not: PROC [expr: Expression] RETURNS [result: Expression];
And: PROC [expr1, expr2, expr3, expr4, expr5: Expression ← true] RETURNS [result: Expression];
Or: PROC [expr1, expr2, expr3, expr4, expr5: Expression ← false] RETURNS [result: Expression];
Xor: PROC [expr1, expr2, expr3, expr4, expr5: Expression ← false] RETURNS [result: Expression];
Nand: PROC [expr1, expr2, expr3, expr4, expr5: Expression ← true] RETURNS [result: Expression];
Nor: PROC [expr1, expr2, expr3, expr4, expr5: Expression ← false] RETURNS [result: Expression];
AndList: PROC [exprs: LIST OF Expression] RETURNS [result: Expression];
OrList: PROC [exprs: LIST OF Expression] RETURNS [result: Expression];
XorList: PROC [exprs: LIST OF Expression] RETURNS [result: Expression];
NandList: PROC [exprs: LIST OF Expression] RETURNS [result: Expression];
NorList: PROC [exprs: LIST OF Expression] RETURNS [result: Expression];
If: PROC [cond, then, else: Expression] RETURNS [result: Expression];
Useful operator computing: Or[And[cond, then], And[Not[cond], else]].
Other operations
EvalProc: TYPE = PROC [var: ROPE, expr: Expression] RETURNS [whenTrue, whenFalse: Expression];
ToRopeProc: TYPE = PROC [expr: Expression, deep: INT ← 9] RETURNS [ROPE];
FindVarProc: TYPE = PROC [expr: Expression] RETURNS [var: ROPE];
NIL if no var found
Eval: EvalProc;
ToRope: ToRopeProc;
FindVar: FindVarProc;
Equal: PROC [expr1, expr2: Expression] RETURNS [BOOL];
END.