S-Expression representation of four-valued expressions.
We represent expressions in our four-valued logic using a simple
S-Expression (sexpr) format.
The semantics of these expressions is given by 4v-sexpr-eval.
- NIL is special and always evaluates to X.
- All atoms other than NIL represent variables and get their values from
- (f a1 a2 ... an) is a function application of f to arguments
a1 ... an, where each ai is itself a sexpr.
Since we only have four constants, we don't permit quoted constants; instead
we just have constant functions. That is, in any environment,
- (T) produces T,
- (F) produces F,
- (Z) produces Z, and
- (X) produces X.
We also have around a dozen functions like AND, OR, NOT,
ITE, etc., that correspond to the 4v-operations. The particular
set of understood functions are determined by 4v-sexpr-eval.
A wonderful feature of our 4v sexpr language is that, since all of these
operations are monotonic,
monotonicity is an intrinsic property of every sexpr.
As with our aig and ubdd
representations, we generally expect to create all sexprs with hons, and
we often memoize operations that deal with sexprs. We provide some
4vs-constructors for building s-expressions.
- Collect the set of variables in an s-expression.
- Evaluate a sexpr under an environment.
- Translation from 4v-sexprs into a faigs.
- 4v-sexpr-restrict with inline rewriting.
- Primitive functions for constructing 4v-sexprs.
- 4v-sexpr-compose with inline rewriting.
- Basic substitution operation for 4v-sexprs.
- Extract a portion of a 4v-sexpr alist.
- Alternate substitution operation for 4v-sexprs.
- (4v-nsexpr-p x) recognizes s-expressions where every variable
is a natural number.
- Does a 4v-sexpr always evaluate to a purely Boolean value, i.e., is
it never X or Z?
- Extension of the four-valued lattice ordering to sexprs.
- A simplified version of 4v-sexpr-to-faig that constructs its
own onoff list out of the variables of the sexpr.
- Useful equivalence relations for reasoning about 4v-sexprs.
- Recognizer for 4v-sexprs that cannot evaluate to Z.
- Basic structural induction scheme for s-expressions.
- Gather up a sub-alist from some 4v environment.