A CnfClause
is a disjunction of CnfAtom
objects. It represents a statement
that is true if at least one of the atoms is true. These are for example of the form
X %among% c("a", "b", "c") | Y %among% c("d", "e", "f") | ...
CnfClause
objects can be constructed explicitly, using the CnfClause()
constructor,
or implicitly, by using the |
operator on CnfAtom
s or other CnfClause
objects.
CnfClause
objects which are not tautologies or contradictions are named lists;
the value ranges of each symbol can be accessed using [[
, and these clauses
can be subset using [
to get clauses containing only the indicated symbols.
However, to get a list of CnfAtom
objects, use as.list()
.
Note that the simplified form of a clause containing a contradiction is the empty list.
Upon construction, the CnfClause
is simplified by (1) removing contradictions, (2) unifying
atoms that refer to the same symbol, and (3) evaluating to TRUE
if any atom is TRUE
.
Note that the order of atoms in a clause is not preserved.
Using CnfClause()
on lists that contain other CnfClause
objects will create
a clause that is the disjunction of all atoms in all clauses.
If a CnfClause
contains no atoms, or only FALSE
atoms, it evaluates to FALSE
.
If it contains at least one atom that is always true, the clause evaluates to TRUE
.
These values can be converted to, and from, logical(1)
values using as.logical()
and as.CnfClause()
.
CnfClause
objects can be negated using the !
operator, and combined using the
&
operator. Both of these operations return a CnfFormula
, even if the result
could in principle be represented as a single CnfClause
.
This is part of the CNF representation tooling, which is currently considered
experimental; it is for internal use.