
\chapter{Basics of Multiple-Valued Cube Calculus}
\label{CHEN-Chapter2}

Most of the efficient  modern logic synthesis programs use 
{\bf cube calculus} to represent and process Boolean functions. This
representation is used in U.C.Berkeley programs, including the well-known
Espresso \cite{brayton84}, MIS II and SIS, and many others 
\cite{perk88,perk89,song93,song93b}. 
This calculus has been used for Boolean minimizers, tautology and 
satisfiability checkers, verifiers and other software tools\cite{perk92}.

In this chapter, the concept of a {\bf set} is presented first because 
it is used as a fundament of cube calculus; then the concept of cube and
the cube calculus are presented. The last part of this chapter presents
positional notation of cubes and how to carry out the cube calculus in positional notation.
The notations shown in Table \ref{tbl:notation} will be used
in the entire book to represent different types of objects.

\addtolength{\extrarowheight}{2pt}
\begin{table}[H]
\caption{Notation}
\begin{center}
\begin{tabular}{|l|l|l|} \hline
{\bf Type} & {\bf Font} & {\bf Example} \\ \hline
variable & lower case letter & $a,\; b,\; x,\; x_i $ \\ \hline
literal & lower case letter  & $\overline{a},\; x_i^{0,1,3}$ \\ \hline
cube    & upper case letter & $A, \; B$ \\ \hline
array of cubes & upper case letter with arrow on head & $\vec{A}, \; \vec{B}$
 \\ \hline
set & curly braces & $\{0, 1, \ldots, n\}$ \\ \hline
the name of set & upper case letter & $P, \; S$ \\ \hline
\end{tabular}
\end{center}
\label{tbl:notation}
\end{table}
\addtolength{\extrarowheight}{- 2pt}

\section{Sets}
\label{CHEN-section2.1}

A {\bf set} is a collection of objects called {\bf elements} or {\bf members}.
As listed in Table \ref{tbl:notation}, we use curly braces to indicate sets.

For instance, the set of all integers between 0 and 5 is written as:\\

\centerline{\{0,1,2,3,4,5\}} 

the infinite set of all positive, odd integers can be described by: \\

\centerline{\{1,3,5,7,\ldots\}} 

The membership of a element $a$ in a set $A$ is denoted by $a \in A$ to
mean {\em ``$a$ is an element of $A$''}. A set which has no element is called an
{\bf empty set} (denoted by $\emptyset$). The empty set is a subset of all sets.
The elements contained in a set are either listed explicitly or described
by their properties.

The following relations between two sets are used in cube calculus:
\begin{itemize}
\item Two sets $A$ and $B$ are {\bf equal}, or {\bf identical}, if they
      contain precisely the same elements. It is denoted by $A=B$.
\item A set $A$ is said to be a {\bf subset} of $B$ if every element of
      $A$ is also an element of $B$. It it denoted by $A \subseteq B$.
\item If $A \subseteq B$, and $B$ contains at least one element which
      is not contained in $A$, then $A$ is said to be {\bf proper subset} 
      of $B$. It is denoted by $A \subset B$.
\end{itemize}

The elements of the sets are taken from {\bf universal set} ($U$). The 
following basic {\bf set operations} are used in cube calculus:
\begin{itemize}
\item The {\bf complement} of $A$ in universal set $U$ (denoted by $\neg A$)
      is the set of all elements of $U$ that are not elements of $A$.
\item The {\bf intersection} of $A$ and $B$ (denoted by $A \cap B$)
      is the set containing the elements that are in both $A$ and $B$.
\item The {\bf union} of $A$ and $B$ (denoted by $A \cup B$) is the
      set containing the elements that are in either $A$ or $B$.
\end{itemize}

\noindent
\begin{example}
~\label{CHEN-Example2.1}
\end{example}

\noindent
Assuming that the universal set $U$ is \{0,1,2,3,4,5\}, a set
$A$ is \{0,1,2,3\} and another set $B$ is \{2,3,4\}. Then 
$\neg A = \{4,5\}$, $A \cap B = \{2,3\}$, and $A \cup B = \{0,1,2,3,4\}$.

The universal set $U$ of possible values of a binary variable is \{0,1\}.
For a binary variable $a$, literal $\overline{a}$ means that literal is true
when variable $a$ is 0, and can be described by $a^{\{0\}}$, where
\{0\} is the true set of literal $\overline{a}$. More detailed discussion on
sets can be found in \cite{set1,set2}.

\section{The Concept of A Cube}
\label{CHEN-section2.2}

The basic concepts of cube calculus are a {\bf cube} and an {\bf array of
cubes}. A cube is a {\bf product of literals}. For example, product
$\overline{a} b c \overline{d}$ is a cube. An array of cubes is
{\bf a sum of cubes}. A logic function can be represented by a cube or an array of cubes. 
For instance, a simple 2-input binary logic function {\bf AND} can be 
described by a cube as: $f_{AND}(a,b)=ab$; another simple 2-input 
binary logic function {\bf XOR} (exclusive OR) can be described by an array 
of cubes as: $f_{XOR}(a,b)~=~\overline{a}b~+~a\overline{b}$.

In a binary logic, a {\bf literal} is a binary variable with negation or 
without negation ($x$ or $\overline{x}$). In a  multi-valued logic
a literal ($x_i^{S_i}$) is a variable ($x_i$) with its set of values 
($S_i$) for which the variable is true.

A multi-valued input, two-valued output, incompletely specified switching
function ({\bf multi-valued function} for short) is a mapping:
\begin{equation}
 f(x_1,x_2,\cdots,x_n): P_1 \times P_2 \times \cdots \times P_n \mapsto B
\end{equation}

\noindent
where $x_i$ is a {\bf multi-valued ($p_i$-valued) variable}, 
$P_i = \{0,1,2,\cdots,p_i-1\}$
is the  {\bf set of values} that variable $x_i$ may assume,
$B = \{0,1,\text{X}\}$ ( X denotes a {\bf don't care value}). Value $n$ denotes the 
{\bf number of variables (number of positions)}. For any subset $S_i \in P_i$,
$x_i^{S_i}$ is a literal of $x_i$ representing the function such that:
\begin{equation}
 x_i^{S_i} = 
 \begin{cases}
    1 & \qquad \text{if} \;\; x_i \in S_i \\
    0 & \qquad \text{if} \;\; x_i \notin S_i
 \end{cases}
\end{equation}
$S_i$ is called {\bf true values set} ({\bf true set} for short) of literal
 $x_i^{S_i}$. For example, a four-valued input logic of $x^{\{1,2,3\}}=1$
if $x \in \{1,2,3\}$, which means $x^{\{1,2,3\}}=1$ if $x=1$ or $x=2$ 
or $x=3$; otherwise, $x^{\{1,2,3\}}=0$.
We always assume that the set of possible values of a $n$-valued logic
variable is $\{0,1,2,\ldots,n-1\}$.

A product of literals, $x_1^{S_1} x_2^{S_2} \cdots x_n^{S_n}$,
is refereed to as a {\bf product term} (also called {\bf product} or 
{\bf term} for short), and can be represented by a cube. A product term 
that includes literals for all function variables $x_1,x_2,\ldots,x_n$
is called a {\bf full term}. Any literal of the form $x_i^{P_i}$ is always
equal to 1 since the literal is true for all possible values of $x_i$,
thus $x_i^{P_i}x_j^{S_j}$ can be written as $x_j^{S_j}$.

A sum of products is denoted as a {\bf Sum-Of-Products (SOP) Expression}
while a product of sums is called a {\bf Product-Of-Sums (POS) Expression}.
An EXOR of products will be called a {\bf Exclusive Sum Of Products} 
expression {\bf ESOP}. A product of EXORs will be called a {\bf Product Of Exclusive 
Sums} expression ({\bf POES}). SOPE, POSE, ESOP and POES are all represented as an 
arrays of cubes. Products of SOPEs (PSOPEs) are also used in {\bf 
Generalized Propositional Formulas} expressions to solve Boolean and Multi-valued
equations. They are represented as {\bf arrays of arrays of cubes}.

\begin{definition}
The {\bf degree} of a cube is the number of literals in the cube that
are not equal to one (in other word, $P_i \neq S_i$).
\end{definition}

\noindent
\begin{example}
~\label{CHEN-Example2.2}
\end{example}

The degree of binary cube $a^{\{0\}}b^{\{1\}}c^{\{1\}}d^{\{0,1\}}$ is
3 (assuming $a$,$b$,$c$ and $d$ are binary variables).

\begin{definition}
The {\bf difference} of two cubes is the number of variables for which the
corresponding literals have different true sets. 
\end{definition}

\begin{definition}
The {\bf distance} of two
cubes is the number of variables for which the corresponding literals have 
disjoint true sets.
\end{definition}

\noindent
\begin{example}
~\label{CHEN-Example2.3}
\end{example}

\noindent
Given two cubes $A=a^{\{0,1\}}b^{\{0\}}c^{\{0\}}$, 
$B=a^{\{1,2\}}b^{\{1\}}c^{\{0\}}$. The difference of cubes $A$ and $B$ is
2 because they have different true sets on variables $a$ and $b$.
The distance of cubes $A$ and $B$ is 1 because they have disjoint true
sets on variable $b$.

\section{Cube Calculus Operations}
\label{CHEN-section2.3}

The cube calculus operations presented in this boook can be categorized
into three groups: 
\begin{enumerate}
\item {\bf simple combinational operations}, 
\item {\bf  complex combinational operations}, and 
\item {\bf sequential operations}. 
\end{enumerate}

Each cube operation has one or two operand cube(s). Cubes $A$ and $B$ are 
used to represent these arguments and they can be described by:
\begin{align}
A &=x_1^{S^A_1} x_2^{S^A_2} \cdots x_i^{S^A_i} \cdots x_n^{S^A_n}\\
B &=x_1^{S^B_1} x_2^{S^B_2} \cdots x_i^{S^B_i} \cdots x_n^{S^B_n}
\end{align}
where $S^A_i$ and $S^B_i$ are the true sets of literal $x_i^{S^A_i}$
and $x_i^{S^B_i}$, respectively.
       % is the set of possible values of variable $x_i$ that let
       % literal $x_i^{S^A_i}$ be true. Similarly, $S^B_1$ is the set of 
       % possible values of variable $x_i$ that let literal $x_i^{S^B_i}$ be true; 
Value $n$ is the {\bf number of variables}. In this chapter, $S$ represents the
{\bf true set of a literal}, the subscript of $S$ represents the
{\bf index of the literal} (index of a variable corresponding to this literal), 
the superscript of $S$ represents the
{\bf operand cube} ($A$ or $B$).

\subsection{Simple combinational cube operations}
\label{CHEN-section2.3.1}

Simple combinational cube operations are defined as {\bf single set operations}.
Such a set operation is applied on all pairs of true sets $S^A_i$ 
and $S^B_i$ of corresponding literals of operand cubes.
A simple combinational cube operation produces one resultant cube. 
The {\bf intersection} and the {\bf supercube} are 
simple combinational cube operations presented in this section.

\subsubsection{Intersection}

The intersection of two cubes $A$ and $B$ is the cube that is included
in both $A$ and $B$. The intersection operation of cubes $A$ and $B$ 
is defined as follows:
\vspace{3pt}
\begin{equation}
A \cap B = 
 \begin{cases}
   x_1^{S^A_1 \cap S^B_1} \cdots x_n^{S^A_n \cap S^B_n} 
     & \quad\text{if there is no such $i$ that}\; S^A_i \cap S^B_i=\emptyset\\
   \epsilon & \quad\text{otherwise}
 \end{cases}
\end{equation}

\noindent
where $S^A_i \cap S^B_i$ is a set intersection operation. $\emptyset$ denotes
an empty set, and $\epsilon$ denotes a contradiction.

\noindent
\begin{example}
~\label{CHEN-Example2.4}
~ \end{example}

\noindent
Assuming two cubes $A=ab$ and $B=b\overline{c}$, where $a$, $b$ and 
$c$ are binary variables. The intersection of two cubes $A$ and $B$ is
the following:
\begin{align*}
& A = ab = ab\text{X} = a^{\{1\}}~b^{\{1\}}~c^{\{0,1\}} \\
& B = bc = \text{X}b\overline{c}~ =~ a^{\{0,1\}}~b^{\{1\}}~c^{\{0\}} \\
& A \cap B = a^{\{1\}\cap\{0,1\}}~ b^{\{1\}\cap\{1\}} ~c^{\{0,1\}\cap\{0\}} 
~ =~ a^{\{1\}} ~b^{\{1\}}~ c^{\{0\}}~ =~ ab\overline{c}
\end{align*}

\begin{figure}[H]
\hbox{
\begin{minipage}{3in}
\centerline{\hbox{
\psfig{figure=fig/oper1a.eps,height=0.9in}
}}
\centerline{(a) Operand cubes}
\end{minipage}
\begin{minipage}{2.8in}
\centerline{\hbox{
\psfig{figure=fig/oper1b.eps,height=0.9in}
}}
\centerline{(b) Resultant cube}
\end{minipage}}
% \caption{Intersection $A\cap B=ab \cap b\overline{c} = ab\overline{c}$}
\caption{An example of Intersection operation}
\label{fig:intersection}
\end{figure}

Example~\ref{CHEN-Example2.4} % 2.4 
is illustrated in Figure \ref{fig:intersection} by
Karnaugh map. The intersection operation can be used in Ashenhurst/Curtis functional 
decomposition \cite{ismvl97a,ismvl97b}, in Satisfiability problem~\ref{[???]}, and
in many other discussed in the forthcoming chapters.

\subsubsection{Supercube}

The {\bf supercube} of two cubes $A$ and $B$ is the smallest cube that
includes cubes $A$ and $B$.  The supercube operation of cubes $A$ and $B$ 
is defined as follows:
\begin{equation}
A \cup B = x_1^{S^A_1 \cup S^B_1} \cdots x_n^{S^A_n \cup S^B_n}
\end{equation}
where $S^A_i\cup S^B_i$ is a set union. 

\noindent
\begin{example} 
~\label{CHEN-Example2.5}
\end{example} 

\noindent
The supercube on two cubes $A$ and $B$ used 
in Example~\ref{CHEN-Example2.4} % 2.4
follows:
\begin{equation*}
A \cup B = a^{\{1\}\cup\{0,1\}}~ b^{\{1\}\cup\{1\}} ~c^{\{0,1\}\cup\{0\}} 
~ =~ a^{\{0,1\}}~ b^{\{1\}}~ c^{\{0,1\}}~ =~ b
\end{equation*}

\begin{figure}[H]
\hbox{
\begin{minipage}{3in}
\centerline{\hbox{
\psfig{figure=fig/oper1a.eps,height=0.9in}
}}
\centerline{(a) Operand cubes}
\end{minipage}
\begin{minipage}{2.8in}
\centerline{\hbox{
\psfig{figure=fig/oper2b.eps,height=0.9in}
}}
\centerline{(b) Resultant cube}
\end{minipage}}
% \caption{Supercube $A\cup B=ab \cup b\overline{c} = b$}
\caption{Example of Supercube operation}
\label{fig:supercube}
\end{figure}

Example~\ref{CHEN-Example2.5} % 2.5 
is illustrated in Figure \ref{fig:supercube} by
Karnaugh map. The supercube operation can be used in graph coloring approaches
to the logic minimization problem \cite{coloring}, see also Chapter~\ref{XXX}.

\subsection{Complex combinational cube operations}
\label{CHEN-section2.3.2}

{\bf Complex combinational cube operations} are defined by two set operations
and one set relation. These two set operations are called {\bf before}
($bef$ for short) and {\bf active} ($act$ for short).
All variables whose pair of true sets $S^A_i$ and $S^B_i$ 
satisfy {\bf relation} are said to be {\bf special variables}.
The {\bf active set operation} is applied on all pairs of true sets $S^A_i$ and 
$S^B_i$ of special variables. The {\bf before set operation} is applied on 
the others. A complex combinational cube operation produces one {\bf resultant cube}
like a simple combinational cube operation. {\bf Prime} is an example of a complex 
combinational cube operation presented in this section.

\subsubsection{Prime}

The {\bf prime operation} of two cubes $A$ and $B$ is defined as:
\begin{equation}
A \;' B = x_1^{S^A_1} \cdots
 x_{k-1}^{S^A_{k-1}} ~x_k^{S^A_k \cup S^B_k} ~x_{k+1}^{S^A_{k+1}} \cdots
 x_{l-1}^{S^A_{l-1}}~ x_l^{S^A_l \cup S^B_l}~ x_{l+1}^{S^A_{l+1}} \cdots
 x_n^{S^A_n} 
\end{equation}
Where the relation for the prime operation is $S^A_i \cap S^B_i \neq \emptyset$.
The {\it active} set operation is $S^A_i \cup S^B_i$,
and the {\it before} set operation is $S^A_i$.
In the above equation, variables $x_k$ and $x_l$ are the special variables.

% \example Assuming two cubes $A=\overline{a}bcd$ and $B=a\oveline{c}$,
% where $a$, $b$, $c$ and $d$ are binary variables. 
% The prime of $A \;' B$ is defined as follows:
% \begin{align*}
% & A = \overline{a}bcd = a^{\{0\}}b^{\{1\}}c^{\{1\}}d^{\{1\}} \\
% & B = a\overline{c} = a\text{X}\overline{c}\text{X} 
%     = a^{\{1\}}b^{\{0,1\}}c^{\{0\}}d^{\{0,1\}} 
% \end{align*}
% Because:
% \begin{align*}
% & S^A_b \cap S^B_b = \{1\} \cap \{0,1\} = \{1\} \neq \emptyset \\
% & S^A_d \cap S^B_d = \{1\} \cap \{0,1\} = \{1\} \neq \emptyset 
% \end{align*}
% variable $b$ and $d$ are special variables. Therefore,
% \begin{equation*}
%   A \;' B = a^{S^A_a}b^{S^A_b\cup S^B_b}
%             c^{S^A_c}d^{S^A_d\cup S^B_d}
%           = a^{\{0\}}b^{\{0,1\}}c^{\{1\}}d^{\{0,1\}} 
%           = \overline{a}c
% \end{equation*}

\noindent
\begin{example}
~\label{CHEN-Example2.6}
\end{example}

\noindent
Assuming two cubes $A~=~\overline{x_1}x_2x_3x_4$ and $B=x_1\overline{x_3}$,
where $x_1$, $x_2$, $x_3$ and $x_4$ are binary variables. 
The prime of $A \;' B$ is defined as follows:

\begin{align*}
& A~ =~ \overline{x_1}x_2x_3x_4 = x_1^{\{0\}}~x_2^{\{1\}}~x_3^{\{1\}}~x_4^{\{1\}} \\
& B~ =~ x_1\overline{x_3} = x_1\text{X}\overline{x_3}\text{X} 
     ~=~ x_1^{\{1\}}~x_2^{\{0,1\}}~x_3^{\{0\}}~x_4^{\{0,1\}} 
\end{align*}
Because:
\begin{align*}
& S^A_2 \cap S^B_2 = \{1\} \cap \{0,1\} = \{1\} \neq \emptyset \\
& S^A_4 \cap S^B_4 = \{1\} \cap \{0,1\} = \{1\} \neq \emptyset 
\end{align*}
variable $x_2$ and $x_4$ are special variables. Therefore,
\begin{equation*}
  A \;' B = x_1^{S^A_1}x_2^{S^A_2\cup S^B_2}
            x_3^{S^A_3}x_4^{S^A_4\cup S^B_4}
          = x_1^{\{0\}}x_2^{\{0,1\}}x_3^{\{1\}}x_4^{\{0,1\}} 
          = \overline{x_1}x_3
\end{equation*}

\begin{figure}[H]
\hbox{
\begin{minipage}{3in}
\centerline{\hbox{
\psfig{figure=fig/oper3a.eps,height=1.5in}
}}
\centerline{(a) Operand cubes}
\end{minipage}
\begin{minipage}{2.8in}
\centerline{\hbox{
\psfig{figure=fig/oper3b.eps,height=1.5in}
}}
\centerline{(b) Resultant cube}
\end{minipage}}
\caption{Example of Prime operation}
\label{fig:prime}
\end{figure}

Example~\ref{CHEN-Example2.6} % 2.6 
is illustrated in Figure \ref{fig:prime} by
Karnaugh map. The prime operation is used in the ESOP minimization program
EXORCISM, developed at PSU \cite{perk88,perk89}, see also Chapter~\ref{CHAPTER-XXX}.

\subsubsection{Consensus}

The {\bf consensus operation} on cubes $A$ and $B$ is defined as follows:
\begin{equation}
 A \;*\; B =
  \begin{cases}
     A \cap B & \quad\text{when}\; distance(A,B)=0 \\
     \emptyset       & \quad\text{when}\; distance(A,B)>1 \\
     A *_{basic} B & \quad\text{when}\; distance(A,B)=1 \\
  \end{cases}
\end{equation}
where $A \;*_{basic}\; B$ is defined as follows:
\begin{equation}
 A \; *_{basic}\; B = 
   x_1^{S^A_1\cap S^B_1} \cdots x_{k-1}^{S^A_{k-1}\cap S^B_{k-1}}
~ x_k^{S^A_k \cup S^B_k}~ x_{k+1}^{S^A_{k+1} \cap S^B_{k+1}} \cdots
   x_n^{S^A_n \cap S^B_n}  
\end{equation}
\noindent
where $S^A_k \cap S^B_k = \emptyset$.
For basic consensus operation, the {\it before} set operation is 
$S^A_i \cap S^B_i$, the {\it active} set operation is 
$S^A_i \cup S^B_i$, and the {\it relation} is always true.

\noindent
\begin{example}
~\label{CHEN-Example2.7}
\end{example}

\noindent
Assuming two cubes $A=x_1x_2\overline{x_3}$ and $B=x_1\overline{x_2}$,
where $x_1$, $x_2$, $x_3$ and $x_4$ are binary variables. 
Because the distance of cubes $A$ and $B$ is 1, then cubes $A$ and 
$B$ have consensus as follows: 
\begin{align*}
& A~ =~ x_1x_2\overline{x_3}~ =~ x_1^{\{1\}}~x_2^{\{1\}}~x_3^{\{0\}}~x_4^{\{0,1\}} \\
& B~ =~ x_1\overline{x_2}~ =~ x_1\overline{x_2}\text{XX} 
    ~=~ x_1^{\{1\}}~x_2^{\{0\}}~x_3^{\{0,1\}}~x_4^{\{0,1\}} 
\end{align*}
Because:
\begin{equation*}
S^A_2 \cap S^B_2 = \{1\} \cap \{0\} = \emptyset 
\end{equation*}
variable $x_2$ is a special variable. Therefore,
\begin{equation*}
  A \; *\; B = x_1^{S^A_1 \cap S^B_1}~x_2^{S^A_2 \cup S^B_2} ~
            x_3^{S^A_3 \cap S^B_3}~x_4^{S^A_4 \cap S^B_4}
    ~=~ x_1^{\{1\} \cap \{1\}}~ x_2^{\{0\} \cup \{1\}}~ x_3^{\{0\} \cap \{0,1\}}~ x_4^{\{0,1\} \cap \{0,1\}}
          ~=~ x_1\overline{x_3}
\end{equation*}

\begin{figure}[H]
\hbox{
\begin{minipage}{3in}
\centerline{\hbox{
\psfig{figure=fig/oper7a.eps,height=1.5in}
}}
\centerline{(a) Operand cubes}
\end{minipage}
\begin{minipage}{2.8in}
\centerline{\hbox{
\psfig{figure=fig/oper7b.eps,height=1.5in}
}}
\centerline{(b) Resultant cube}
\end{minipage}}
\caption{Example of Prime operation}
\label{fig:cons}
\end{figure}

Example~\ref{CHEN-Example2.7} % 2.7
is illustrated in Figure \ref{fig:cons} by Karnaugh map.
The consensus operation is used for finding prime implicants, and finding
prime implicants is a basic step of the well-known
{\bf Quine-McCluskey algorithm}
that is used for two-level logic minimization. Consensus is also
used in its variants \cite{coud94}, 
as well as many other basic algorithms for two-level, three-level and
multi-level logic minimization and machine learning \cite{hach96}.
A dual operation to consensus, {\bf resolution}, is 
a base of automatic theorem-proving,~\cite{XXXX}.

\subsubsection{Cofactor}

The {\bf cofactor operation} of two cubes $A$ and $B$ is defined as:
\begin{equation}
 A \; | \; B =
  \begin{cases}
     A \, |_{basic} \, B& \quad\text{when}\; A \cap B \neq \emptyset \\
     \emptyset & \quad \text{otherwise}
  \end{cases}
\end{equation}
where $A\, |_{basic}\, B$ is defined as follows:
\begin{equation}
A\, |_{basic}\, B = x_1^{S^A_1\cap S^B_1} \cdots
 x_{k-1}^{S^A_{k-1}\cap S^B_{k-1}}~ x_k^U~ x_{k+1}^{S^A_{k+1}\cap S^B_{k+1}}\cdots
 x_{l-1}^{S^A_{l-1}\cap S^B_{l-1}}~ x_l^U ~x_{l+1}^{S^A_{l+1}\cap S^B_{l+1}}\cdots
 x_n^{S^A_n\cap S^B_n} 
\label{eq:cofactor}
\end{equation}

\noindent
where the relation for cofactor operation is $S^A_i \supseteq S^B_i$.

The result of the {\it active} set operation is always $U$ (universal set),
and the {\it before} set operation is $S^A_i \cap S^B_i$. In the above 
equation, variables $x_k$ and $x_l$ are special variables.

\noindent
\begin{example}
~\label{CHEN-Example2.8}
\end{example}

\noindent
Assuming two cubes $A=x_1x_2x_3$ and $B=x_1$,
where $x_1$, $x_2$, $x_3$ and $x_4$ are binary variables. The cofactor of 
$A | B$ is defined as follows:
\begin{align*}
& A = x_1x_2x_3 = x_1x_2x_3\text{X} 
             = x_1^{\{1\}}x_2^{\{1\}}x_3^{\{1\}}x_4^{\{0,1\}} \\
& B = x_1 = x_1\text{XXX} 
          = x_1^{\{1\}}x_2^{\{0,1\}}x_3^{\{0,1\}}x_4^{\{0,1\}} 
\end{align*}
Because:
\begin{align*}
& S^A_1=\{1\}\; , S^B_1=\{1\} \; \rightarrow \; S^A_1 \supseteq S^B_1 \\
& S^A_2=\{1\}\; , S^B_2=\{0,1\} \; \rightarrow \; S^A_2 \not\supseteq S^B_2 \\
& S^A_3=\{1\}\; , S^B_3=\{0,1\} \; \rightarrow \; S^A_3 \not\supseteq S^B_3 \\
& S^A_4=\{0,1\}\; , S^B_4=\{0,1\} \; \rightarrow \; S^A_4 \supseteq S^B_4
\end{align*}
variable $x_1$ and $x_4$ are special variables. Therefore,
\begin{equation*}
  A | B ~ =~ x_1^U ~x_2^{S^A_2 \cap S^B_2}~ x_3^{S^A_3 \cap S^B_3}~ x_4^U
   ~=~ x_1^{\{0,1\}}~ x_2^{\{1\} \cap \{0,1\}} 
    ~ x_3^{\{1\} \cap \{0,1\}} ~x_4^{\{0,1\}} 
%       = x_1^{\{0,1\}} x_2^{\{1\}} x_3^{\{1\}} x_4^{\{0,1\}}
        = x_2x_3
\end{equation*}

\begin{figure}[H]
\hbox{
\begin{minipage}{1.8in}
\centerline{\hbox{
\psfig{figure=fig/oper8a.eps,height=1.5in}
}}
\centerline{(a) Operand cubes}
\end{minipage}
\begin{minipage}{1.8in}
\centerline{\hbox{
\psfig{figure=fig/oper8b.eps,height=1.5in}
}}
\centerline{(b) Intersection}
\end{minipage}
\begin{minipage}{1.8in}
\centerline{\hbox{
\psfig{figure=fig/oper8c.eps,height=1.5in}
}}
\centerline{(c) Result cube}
\end{minipage}}
\caption{Example of Cofactor operation}
\label{fig:cofactor}
\end{figure}

This example is illustrated in Figure \ref{fig:cofactor} by a Karnaugh map.
In the Karnaugh map, first we calculate the intersection of cubes $A$ and $B$,
the intersection result is shown in Figure \ref{fig:cofactor}(b), then we 
remove variable $x_1$ which means in the result cube, variable $x_1$ can 
be either 1 or 0 ({\bf don't care}); the result cube is shown in Figure 
\ref{fig:cofactor}(c). If there is no intersection of two operand cubes,
then the cofactor is an empty cube. The cofactor operation is an important 
operation used in functional decomposition \cite{ismvl97a,ismvl97b},
creation of decision diagrams, and many other applications.

\subsection{Sequential cube operations}
\label{CHEN-section2.3.3}

All sequential cube operations are defined as a single formula that has
three set 
operations and one set relation. These three set operations are called
{\it before} ($bef$ for short), {\it active} ($act$ for short) and 
{\it after}(aft for short), respectively. All variables whose pair of 
true sets $S^A_i$ and $S^B_i$ satisfy {\it relation} are said to be 
{\it special variables}.

The sequential cube operations produces $m$ resultant cubes, where $m$
is the number of special variables for a given operation. The sequential
cube operations can be generally described by the following fundamental
equation: 
\vspace{3pt}
\begin{align}
& A (op) B = 
  \Big\{ x_1^{aft(S^A_1,S^B_1)} \cdots x_{i-1}^{aft(S^A_{i-1},S^B_{i-1})}
   x_i^{act(S^A_i,S^B_i)}~ x_{i+1}^{bef(S^A_{i+1},S^B_{i+1})} \cdots
   x_n^{bef(S^A_n,S^B_n)}  \nonumber \\
& \qquad\qquad\qquad
  \Big| \;\text{for such}\; i=1,\ldots,n, \;\text{that}\; 
  relation(S^A_i, S^B_i) \;\text{is true} \Big\} % \nonumber
\label{eq:seqcco}
\end{align}

\noindent
where $x_i$ is a special variable, $bef$, $act$ and $aft$ are set operations.

Every special variable produces a resultant cube according to 
Equation~\ref{eq:seqcco}. This equation is a general pattern of all cube calculus
operations and it was mentioned in the introduction.

\subsubsection{Crosslink}

The {\bf crosslink operation} on cubes $A$ and $B$ produces an array of cubes
defined as:
\begin{align}
& A \;\uplus\; B = \Big\{ x_1^{S^B_1} \cdots x_{i-1}^{S^B_{i-1}}~
   x_i^{S^A_i \cup S^B_i}~ x_{i+1}^{S^A_{i+1}} \cdots
   x_n^{S^A_n}  \nonumber \\
& \qquad\qquad\qquad\quad
  \Big| \;\text{for such}\; i=1,\ldots,n, \;\text{that}\; 
  S^A_i \cap S^B_i = \emptyset \Big\} 
\end{align}
For crosslink operation, the {\it before} set operation is 
$bef(S^A_i,S^B_i)=S^A_i$, the {\it active} set operation is 
$act(S^A_i,S^B_i)=S^A_i \cup S^B_i$, the {\it after}
set operation is $aft(S^A_i,S^B_i)=S^B_i$, and the {\it relation} is 
$S^A_i \cap S^B_i = \emptyset$.
The crosslink operation can only be applied to two cubes when the
two operand cubes are of the same degree, and {\tt X} (don't care) must
be in same position(s).

\noindent 
\begin{example}
~\label{CHEN-Example2.9}
\end{example}

\noindent 
 Assuming variables $x_1$, $x_2$, $x_3$ and $x_4$ 
are binary, two cubes $A~=~\overline{x_1}~\overline{x_3}$ and $B=x_1x_3$, 
the crosslink operation $A \;\uplus\; B$ follows:
\begin{align*}
& A~ =~ \overline{x_1}~\overline{x_3}~ =~ \overline{x_1}\text{X}\overline{x_3}\text{X} 
   ~ =~ x_1^{\{0\}}~x_2^{\{0,1\}}~x_3^{\{0\}}~x_4^{\{0,1\}} \\
& B ~=~ x_1x_3 = x_1\text{X}\overline{x_3}\text{X} 
   ~ =~ x_1^{\{1\}}x_2^{\{0,1\}}x_3^{\{1\}}x_4^{\{0,1\}} 
\end{align*}
Because:
\begin{align*}
& S^A_1 \cap S^B_1 = \{0\} \cap \{1\} = \emptyset \\
& S^A_3 \cap S^B_3 = \{0\} \cap \{1\} = \emptyset 
\end{align*}
the variable $x_1$ and $x_3$ are special variables. And two resultant cubes
are:
\begin{align*}
& x_1^{S^A_1\cup S^B_1}x_2^{S^A_2}x_3^{S^A_3}x_4^{S^A_4}
   ~ =~ x_1^{\{0\}\cup \{1\}}~x_2^{\{0,1\}}~x_3^{\{0\}}~x_4^{\{0,1\}} 
   ~=~ x_1^{\{0,1\}}~x_2^{\{0,1\}}~x_3^{\{0\}}~x_4^{\{0,1\}} 
   ~=~ \overline{x_3} \\
 & x_1^{S^B_1}~x_2^{S^B_2}~x_3^{S^A_3\cup S^B_3}~x_4^{S^A_4}
   ~=~ x_1^{\{1\}}~x_2^{\{0,1\}}~x_3^{\{0\}\cup \{1\}}~x_4^{\{0,1\}} 
   ~=~ x_1^{\{1\}}~x_2^{\{0,1\}}~x_3^{\{0,1\}}~x_4^{\{0,1\}} 
   = x_1
\end{align*}
Therefore, 
\begin{equation*}
  A \;\uplus\; B ~=~ \overline{x_1}~\overline{x_3} \;\uplus\; x_1x_3 ~ =~ \overline{x_3} + x_1
\end{equation*}

\begin{figure}[H]
\hbox{
\begin{minipage}{3in}
\centerline{\hbox{
\psfig{figure=fig/oper4a.eps,height=1.5in}
}}
\centerline{(a) Operand cubes}
\end{minipage}
\begin{minipage}{2.8in}
\centerline{\hbox{
\psfig{figure=fig/oper4b.eps,height=1.5in}
}}
\centerline{(b) Resultant cube}
\end{minipage}}
\caption{Example of Crosslink operation}
\label{fig:crosslink}
\end{figure}

The Example~\ref{CHEN-Example2.9} % 2.9
is illustrated in Figure \ref{fig:crosslink} by Karnaugh map.
The crosslink operation can be used in the minimization of logic functions
in some canonical forms based on EXOR logic, for instance, in the Generalized
Reed Muller form \cite{perk88}, as well as the general-purpose AND/EXOR
expression (non-canonical), called ESOPs. The function $f~=~\overline{x_1}~\overline{x_3}+x_1x_3$ can be
realized using EXOR gates as:\\
\centerline{$f~ =~ \overline{x_1}~\overline{x_3} + x_1x_3 ~=~ \overline{x_3} \oplus x_1$}

\begin{figure}[H]
\hbox{
\begin{minipage}{1.8in}
\centerline{\hbox{
\psfig{figure=fig/oper9a.eps,height=1.5in}
}}
\centerline{(a) Operand cubes}
\end{minipage}
\begin{minipage}{1.8in}
\centerline{\hbox{
\psfig{figure=fig/oper9b.eps,height=1.5in}
}}
\centerline{(b) intermediate result}
\end{minipage}
\begin{minipage}{1.8in}
\centerline{\hbox{
\psfig{figure=fig/oper9c.eps,height=1.5in}
}}
\centerline{(c) Resultant cubes}
\end{minipage}}
\caption{An example of using Complex Crosslink operations to minimize function
$\overline{x_1} x_3 x_4~\oplus~
x_1 x_2 \overline{x_3} ~\oplus~
x_1 \overline{x_2} x_3 x_4 ~\oplus~
x_1 x_2 x_3 \overline{x_4}
~\Longrightarrow~ x_1 x_2 ~\oplus~ x_3 x_4$
}
\label{fig:crosslink2}
\end{figure}

Another more complex example is shown in Figure \ref{fig:crosslink2}.
As shown in Figure \ref{fig:crosslink2}(a), we have a function
$f = A \oplus B \oplus C \oplus D$, where $A$, $B$, $C$ and $D$ are
four cubes. First, we calculate $C\,\uplus\, D$ and obtain cubes $E$ and $F$,
and the function becomes $f = A \oplus B \oplus E \oplus F$ as shown in
Figure \ref{fig:crosslink2}(b). Second we calculate $A\,\uplus\, E$ and 
$B\,\uplus\, F$, and obtain cubes $G$ and $H$; therefore, the function is
simplified as $f = G \oplus H$.

The crosslink operation is used in ESOP minimization
program EXORCISM, developed at PSU by an undergraduate student
Martin Helliwell in 1988/89 \cite{perk88,perk89}.
A more powerful cube operation, called {\bf exorlink}, and a new ESOP 
minimization programs EXORCISM-MV-2 and EXORCISM-MV-3 based on variants of {\it exorlink} operation 
were developed also at PSU \cite{song93,song93b,song97}, see Chapter~\ref{CHAPTER-XXX}.

\subsubsection{Sharp}

The {\bf (non-disjoint) sharp operation} on cubes $A$ and $B$ is defined as follows:
\begin{equation}
 A \;\#\; B =
  \begin{cases}
     A & \quad\text{when}\; A \cap B = \emptyset \\
     \emptyset & \quad\text{when}\; A \subseteq B \\
     A \#_{basic} B & \quad \text{otherwise}
  \end{cases}
\end{equation}
where $A \;\#_{basic}\; B$ is defined as follows:
\begin{align}
& A \;\#_{basic}\; B = 
   \Big\{ x_1^{S^A_1} \cdots x_{i-1}^{S_{A,i-1}}~
   x_i^{S^A_i \cap (\neg S^B_i)} ~x_{i+1}^{S_{A,i+1}} \cdots
   x_n^{S^A_n}  \nonumber \\
& \qquad\qquad\qquad % \qquad \qquad
  \Big| \;\text{for such}\; i=1,\ldots,n, \;\text{that}\; 
  \neg(S^A_i \subseteq S^B_i) \Big\} 
\end{align}
For sharp operation, the {\it before} set operation is $S^A_i$, 
the {\it active} set operation is $S_{A_i} \cap (\neg S^B_i)$, the 
{\it after} set operation is $S^A_i$, and the {\it relation}
is $\neg(S^A_i \subseteq S^B_i)$.

\noindent
\begin{example}
~\label{CHEN-Example2.10}
\end{example}

\noindent
Assuming variables $x_1$, $x_2$, $x_3$ and $x_4$ 
are binary, two cubes $A=\overline{x_3}$ and $B=x_2x_4$, the sharp
operation $A \;\#\; B$ follows:
\begin{align*}
& A~ =~ \overline{x_3} = \text{XX}\overline{x_3}\text{X} 
 ~=~ x_1^{\{0,1\}}~x_2^{\{0,1\}}~x_3^{\{0\}}~x_4^{\{0,1\}} \\
& B~ =~ x_2x_4 ~=~ \text{X}x_2\text{X}x_4 
    ~=~ x_1^{\{0,1\}}~x_2^{\{1\}}~x_3^{\{0,1\}}~x_4^{\{1\}} 
\end{align*}
Because:
\begin{align*}
& \neg(S^A_2 \subseteq S^B_2) ~=~ \neg (\{0,1\} \subseteq \{1\}) = true \\
& \neg(S_{A,4} \subseteq S_{B,4}) ~=~ \neg (\{0,1\} \subseteq \{1\}) = true 
\end{align*}
variables $x_2$ and $x_4$ are special variables. Thus, 2 resultant cubes are:
\begin{align*}
& x_1^{S^A_1}~x_2^{S^A_2\cap (\neg S^B_2)}~x_3^{S^A_3}~x_4^{S^A_4}
 ~=~ x_1^{\{0,1\}}~x_2^{\{0,1\}\cap (\neg \{1\})}~x_3^{\{0\}}~x_4^{\{0,1\}} 
  ~ =~ x_1^{\{0,1\}}~x_2^{\{0\}}~x_3^{\{0\}}~x_4^{\{0,1\}} 
 ~=~ \overline{x_2}~\overline{x_3} \\
 & x_1^{S^A_1}~x_2^{S^A_2}~x_3^{S^A_3}~x_4^{S^A_4\cap (\neg S^B_4)}
   ~=~ x_1^{\{0,1\}}~x_2^{\{0,1\}}~x_3^{\{0\}}~x_4^{\{0,1\}\cap (\neg \{1\})} 
   ~=~ x_1^{\{0,1\}}~x_2^{\{0,1\}}~x_3^{\{0\}}~x_4^{\{0\}} ~=~ \overline{x_3}~\overline{x_4}
\end{align*}
Therefore, 
\begin{equation*}
  A \;\#\; B = \overline{x_3} \;\#\; x_2x_4 
    ~=~ \overline{x_2}~\overline{x_3} + \overline{x_3}~\overline{x_4}
\end{equation*}

\begin{figure}[H]
\hbox{
\begin{minipage}{3in}
\centerline{\hbox{
\psfig{figure=fig/oper5a.eps,height=1.5in}
}}
\centerline{(a) Operand cubes}
\end{minipage}
\begin{minipage}{2.8in}
\centerline{\hbox{
\psfig{figure=fig/oper5b.eps,height=1.5in}
}}
\centerline{(b) Resultant cube $A\,\#\, B$}
\end{minipage}}
\caption{Example of Sharp operation}
\label{fig:sharp}
\end{figure}
\noindent Remember, universal set $U$ of possible values of a binary variable is
\{0,1\}, therefore, $\neg\{1\} = \{0\}$. This example is also illustrated
in Figure \ref{fig:sharp} by a Karnaugh map. The sharp operation can be 
used in the tautology problem \cite{hach96}, TANT network minimization~\cite{TANT},
2-level minimization, and many other.

\subsubsection{Disjoint sharp}

The {\bf disjoint sharp operation} on cubes $A$ and $B$ is defined as follows:
\begin{equation}
 A \;\#d\; B =
  \begin{cases}
     A & \quad\text{when}\; A \cap B = \emptyset \\
     \emptyset & \quad\text{when}\; A \subseteq B \\
     A \#d_{basic} B & \quad \text{otherwise}
  \end{cases}
\end{equation}
where $A \;\#d_{basic}\; B$ is defined as follows:
\begin{align}
& A \;\#d_{basic}\; B ~=~ 
   \Big\{ x_1^{S^A_1\cap S^B_1} \cdots x_{i-1}^{S^A_{i-1}\cap S^B_{i-1}}~
   x_i^{S^A_i \cap (\neg S^B_i)}~ x_{i+1}^{S^A_{i+1}} \cdots
   x_n^{S^A_n}  \nonumber \\
& \qquad\qquad\qquad\qquad
  \Big| \;\text{for such}\; i=1,\ldots,n, \;\text{that}\; 
  \neg(S^A_i \subseteq S^B_i) \Big\} 
\end{align}
For disjoint sharp operation, the {\it before} set operation is $S^A_i$, 
the {\it active} set operation is $S_{A_i} \cap (\neg S^B_i)$, the 
{\it after} set operation is $S^A_i\cap S^B_i$, and the {\it relation}
is $\neg(S^A_i \subseteq S^B_i)$.

\noindent
\begin{example}
~\label{CHEN-Example2.11}
\end{example}

\noindent
The disjoint sharp operation $A \;\#d\; B$, where $A$ and $B$ are
used in Example 2.5, is calculated as follows: 

\begin{figure}[H]
\hbox{
\begin{minipage}{3in}
\centerline{\hbox{
\psfig{figure=fig/oper5a.eps,height=1.5in}
}}
\centerline{(a) Operand cubes}
\end{minipage}
\begin{minipage}{2.8in}
\centerline{\hbox{
\psfig{figure=fig/oper6b.eps,height=1.5in}
}}
\centerline{(b) Resultant cube $ A\,\#d\, B$}
\end{minipage}}
\caption{Example of Disjoint Sharp operation}
\label{fig:dsharp}
\end{figure}

Since the {\it relation} of disjoint sharp is the same as sharp, therefore
variables $x_2$ and $x_4$ are still special variables. Thus, two
resultant cubes are:
\begin{align*}
 x_1^{S^A_1\cap S^B_1}~x_2^{S^A_2\cap (\neg S^B_2)}~
  x_3^{S^A_3}~x_4^{S^A_4}
  & ~=~ x_1^{\{0,1\}\cap \{0,1\}}~x_2^{\{0,1\}\cap (\neg \{1\})}~
     x_3^{\{0\}}~x_4^{\{0,1\}}  \\
  & ~ =~ x_1^{\{0,1\}}~x_2^{\{0\}}~x_3^{\{0\}}~x_4^{\{0,1\}} 
   ~=~ \overline{x_2}~\overline{x_3} \\
 x_1^{S^A_1\cap S^B_1}~x_2^{S^A_2\cap S^B_2}~ x_3^{S^A_3\cap S^B_3}~x_4^{S^A_4\cap (\neg S^B_4)}
  & ~ =~ x_1^{\{0,1\}\cap \{0,1\}}~x_2^{\{0,1\}\cap \{1\}}~
      x_3^{\{0\}\cap \{0,1\}}~x_4^{\{0,1\}\cap (\neg \{1\})} \\
  &~ =~ x_1^{\{0,1\}}~x_2^{\{1\}}~x_3^{\{0\}}~x_4^{\{0\}} 
    ~=~ x_2\overline{x_3}~\overline{x_4}
\end{align*}
Therefore, 
\begin{equation*}
  A \;\#d\; B = \overline{x_3} \;\#d\; x_2x_4 
   ~=~ \overline{x_2}~\overline{x_3} + x_2\overline{x_3}~\overline{x_4}
\end{equation*}

The Example~\ref{CHEN-Example2.11} % 2.11 
is also illustrated in Figure \ref{fig:dsharp} by a
Karnaugh map. The disjoint sharp operation can be used in tautology
problem \cite{hach96} and in conversions between SOP and ESOP representations,~\ref{FALKOWSKI-DISJOINT}.

% \tinytitle{Asymmetric consensus}
% 
% The asymmetric consensus is similar to symmetric consensus, but 
% the condition $\neg(S^A_i \subseteq S^B_i)$ is additionally checked.
% The defined is follows:
% \begin{equation}
%  A \;*a\; B =
%   \begin{cases}
%      A \cap B & \quad\text{when}\; distance(A,B)=0 \\
%      \emptyset      & \quad\text{when}\; distance(A,B)>1 \\
%      A *a_{basic} B & \quad \text{otherwise}
%   \end{cases}
% \end{equation}
% where $A \;\#a_{basic}\; B$ is defined as follows:
% \begin{align}
% & A \;\*a_{basic}\; B = 
%    \Big\{ x_1^{S^A_1\cap S^B_1} \cdots x_{i-1}^{S^A{i-1}\cap S^B_{i-1}}
%    x_i^{S^A_i \cup S^B_i} x_{i+1}^{S^A_{i+1} \cap S^B_{i+1}} \cdots
%    x_n^{S^A_n \cap S^B_n}  \nonumber \\
% & \qquad\qquad\qquad\qquad
%   \Big| \;\text{for such}\; i=1,\ldots,n, \text{that}\;
%     \neg(S^A_i \subseteq S^B_i). \Big\} 
% \end{align}
% 
% For asymmetric consensus operation, the {\it before}, {\it active}
% and {\it after} set operations are the same as that of symmetric 
% consensus operation. The set relation is $\neg(S^A_i \subseteq S^B_i)$.

\subsection{Summary of cube calculus operations}
\label{CHEN-section2.3.4}

From the above formulas (\ref{CHEN-EQU2.3} to ~\ref{CHEN-EQU2.15}), it is can be seen that sequential
cube operations are the most complex operations in three groups of cube 
operations. Every sequential cube operation is defined by three set 
operations and one set relation. For the consistency of description, 
all cube operations in these three groups can be generally 
described by three set operations and one
set relation. For simple combinational cube operations, only one set 
operation is used (called {\it before});
For complex combinational cube operations, two set operations and 
one set relation are used.

All cube operations (some of them are basic operations) described in this
chapter are summarized in Table \ref{tbl:ccop}. Every row describes one 
cube operation. For each operation, its name, notation, set relation and
three set operations (called {\bf output functions} in the Table) are 
listed from left to right, respectively.

\addtolength{\extrarowheight}{2pt}
\begin{table}[H]
%\begin{table}[h]
\caption{Cube Calculus Operations}
% \renewcommand{\multirowsetup}{\centering}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|} \hline
% title
  \multirow{2}{0.65in}{{\bf Operation}}
& \multirow{2}{0.7in}{{\bf Notation}}
& \multirow{2}{0.7in}{{\bf Relation}}
& \multicolumn{3}{c|}{{\bf Output Functions}} \\ \cline{4-6}
 & & & $before$ & $active$ & $after$ \\ \hline
% content
crosslink & $A \;\uplus\; B$& $S^A_i \cap S^B_i = \emptyset$ & 
    $S^A_i$ & $S^A_i \cup S^B_i$ & $S^B_i$ \\ \hline
sharp & $A \;\#_{basic}\; B$ & $\neg (S^A_i \subseteq S^B_i)$ & 
    $S^A_i$ & $S^A_i \cap (\neg S^B_i) $ & $S^A_i$ \\ \hline
disjoint sharp & $A \;\#d_{basic}\; B$ & $\neg (S^A_i \subseteq S^B_i)$ &
    $S^A_i$ & $S^A_i \cap (\neg S^B_i) $ & $S^A_i \cap S^B_i$ \\ \hline
consensus & $A \;\ast_{basic}\; B$ & 1 & 
    $S^A_i \cap S^B_i$ & $S^A_i \cup S^B_i$ & $S^A_i \cap S^B_i$ \\ \hline
% asym cons & $A \;\ast_a\; B$ & $\neg(S^A_i \subseteq S^B_i)$ & 
%    $S^A_i \cap S^B_i$ & $S^A_i \cup S^B_i$ & $S^A_i \cap S^B_i$ \\ \hline
intersection & $A \;\cap\; B$ & 1 & $S^A_i \cap S^B_i$ & -- & -- \\ \hline
supercube & $A \;\cup\; B$ & 1 & $S^A_i \cup S^B_i$ & -- & -- \\ \hline
prime & $A\;' B$ & $S^A_i \cap S^B_i\neq\emptyset$&$S^A_i$&$S^A_i \cup S^B_i$& --
      \\ \hline
cofactor & $A\, |_{basic}\, B$ & $S^A_i \supseteq S^B_i$ 
         & $S^A_i\cap S^B_i$ & $U$ & -- \\ \hline
\end{tabular}
% \caption{Cube Calculus Operations}
\end{center}
\label{tbl:ccop}
\end{table}
\addtolength{\extrarowheight}{- 2pt}


\section{Positional Notation and Cube Operations in Positional Notation}
\label{CHEN-section2.4}

From the above section, it can be seen that all cube  operations are broken 
down into several set relations and set operations, and it is easy to
carry out these set relations and set operations by hand. Now, the 
problem is how to represent sets in some way that they can be processed
most efficiently by computers. Our answer to this problem is the 
{\bf positional notation}.

\subsection{Positional notation}
\label{CHEN-section2.4.1}

In {\bf Positional notation}, every possible value of a variable (binary 
or multi-valued) is represented by one bit, 0 or 1. Thus, a $p$-valued
variable is represented by a string of $p$-bit; The $i$-th possible
value is represented by the $i$-th bit. If the literal of this variable 
is true for a specific possible value (say the $i$-th possible value), the 
corresponding bit (the $i$-th bit) is set to 1, otherwise, it is set to 0. 

\begin{table}[H]
%\begin{table}[b]
\caption{Positional Notation for binary literals}
\vspace{3mm}
\centering
\begin{tabular}{|c|l|} \hline
\hspace*{0.2in}{\bf Binary literals}\hspace{0.2in} 
&\hspace*{0.2in} {\bf Positional Notation} \hspace*{0.2in} \\ \hline

               &                                      \\
$\overline{x}$ & \hspace*{0.1in} $\overline{x}=x^0 = x^{10} \rightarrow 10$ \\ \hline

               &                                      \\
$x$ & \hspace*{0.1in} $x=x^1=x^{01} \rightarrow 01$ \\ \hline

               &                                      \\
X (don't care) & \hspace*{0.15in}$\text{X}=x^{0,1}=x^{11}\rightarrow 11$ \\ \hline

               &                                      \\
$\epsilon$ (contradiction) & \hspace*{0.1in} $\epsilon=x^{\emptyset}=x^{00}\rightarrow 00$ \\ \hline

\end{tabular}
\label{tbl:ccop2}
\end{table}

\enlargethispage{10pt}
For example, a four-valued variable $x$ is represented by a string of 
4 bits. Literal $x^{\{0,2\}}$ is represented by 1010 because the first
and third possible values let the literal be true.

The positional notation for binary literals is shown in table \ref{tbl:ccop2}.
The {\it don't care} means the variable can be either 0 or 1, so both bits
are set to 1. The {\it contradiction} means that the literal is not true for
any possible value of variable, so both bits are set to 0. The last two cases,
{\it don't care} and {\it contradiction}, 
can be extended to multi-valued variables. For $p$-valued variable, 
the string of 1's (the number of 1's is $p$) presents a {\it don't care}, and
the string of 0's (the number of 0 is $p$) presents a {\it contradiction}.

\subsection{Set operations in positional notation}
\label{CHEN-section2.4.2}

As listed in Table \ref{tbl:ccop}, all set operations used in cube operations
are based on three basic set operations: intersection, union and complement.
These three set operations can be executed using bitwise operations in 
positional notation:
\begin{itemize}
\item The set intersection operation can be executed using {\bf bitwise AND} on 
      two strings of bits that represent two true sets of literals in positional notation. 

\noindent
\begin{example}
~\label{CHEN-Example2.12A}
\end{example}

\noindent
Assume two literals $x^{\{0,1,2\}}$ and $x^{\{0,2,3\}}$, 
where $x$ is a 4-valued variable. Thus two true sets of these two literals 
are \{0,1,2\} and \{0,2,3\}, respectively. The intersection of
these two true sets is $\{0,1,2\}\cap\{0,2,3\}=\{0,2\}$. In positional 
notation, set \{0,1,2\} is represented by 1110, and set \{0,2,3\} 
is represented by 1011. The bitwise AND of 1110 and 1011 is 1010, 
which means set \{0,2\}, and this is just what we want. Therefore, the set
intersection operation is executed  by bitwise AND in positional notation.
  
\item The set union operation can be executed using {\bf bitwise OR} on two 
      string of bits that represent two true sets of literals in positional notation. 

\noindent
\begin{example}
~\label{CHEN-Example2.12}
\end{example}

\noindent
Assume two literals $x^{\{0,2\}}$ and $x^{\{3\}}$, where $x$ 
is a 4-valued variable. Thus two true sets of these two literals are 
\{0,2\} and \{3\}, respectively. The union of these two true sets is 
$\{0,2\}\cup\{3\}=\{0,2,3\}$. In positional notation, set 
\{0,2\} is represented by 1010, and set \{3\} is represented by
0001. The bitwise OR of 1010 and 0001 is 1011, which means set \{0,2,3\},
and this is just what we want. Therefore, the set union operation is executed 
by bitwise OR in positional notation.
  
\item The set complement operation can be executed using {\it bitwise NOT}
      on the string of bits that represents the true set of literal in 
      positional notation. 

\noindent
\begin{example}
~ \label{CHEN-Example2.13}
\end{example}

\noindent
Assume a literal $x^{\{0,2\}}$, where $x$ is a 4-valued variables.
Thus the true sets of the literal is \{0,2\}. The complement of the true 
set is $\neg\{0,2\}=\{1,3\}$ (the $U=\{0,1,2,3\}$ for 4-valued variable). 
In positional notation, set 
\{0,2\} is represented by 1010. The bitwise NOT of 1010 is 0101, which 
means set \{1,3\}, and this is just what we want. Therefore, the set complement 
operation is executed by bitwise NOT in positional notation.
\end{itemize}

All other set operations can be done by combining these three basic
set operations.

\vspace{2mm}
\noindent
\begin{example}
~\label{CHEN-Example2.14}
\end{example}
}

\noindent
Assume two literals $S^A=x^{\{0,2\}}$ and $S^B=x^{\{2,3\}}$,
where $x$ is a 4-valued variables. Thus two true sets of these two literals
are $S^A=\{0,2\}$ and $S^B=\{2,3\}$, respectively. The set operation is: \\
\centerline{
$S^A \cap (\neg S^B) = 1010\; AND\; (NOT\; 0011) = 1010\; AND\; 1100 = 1000$
} \\
where $AND$ and $OR$ are bitwise operations. The result 1000 represents set 
\{0\}, which is correct result. This kind of set operation is called 
{\bf set difference}, and is used in sharp and disjoint sharp cube operations.

\subsection{Set relations in positional notation}
\label{CHEN-section2.4.3}

The result of set relation is {\bf true} or {\bf false} and can be
represented by one bit, 1 presents {\it true} and 0 presents {\it false}.
The set relation can not be done by bitwise function because it is
the function of all bits of two operand sets in positional notation.

Set relation is broken down into two parts in positional notation,
{\bf partial relation} and {\bf relation type}. The {\it partial relation}
determines whether or not a pair of the same possible value of two literals
satisfy the {\it relation} ``locally". The {\it relation type} determines 
the method of combining {\it partial relations}.

Assuming there are two literals $x^A$ and $x^B$, where $x$ is $p$-valued 
variable $x$, $A$ is positional notation of true set of literal
$x^A$, and $A=[a_0,a_2,\ldots,a_{p-1}]$, where $a_i$ presents the $(i+1)$-th
possible value of the literal (Note: the possible value starts with 0,
ends with $p-1$), and $a_i \in \{0,1\}$. Similarly, 
$B=[b_0,b_1,\ldots,b_{p-1}]$, where $b_i \in \{0,1\}$.

For the crosslink operation, the set relation is $S^A \cap S^B = \emptyset$. 
Thus partial relation is $a_i \cdot b_i = 0$, or 
$\overline{a_i} + \overline{b_i} = 1$ (from De Morgan's theorem). 
If and only if all pairs of possible values satisfy this partial relation,
then the set relation is satisfied. This can be written as:
\begin{equation*}
  relation(A,B) = (\overline{a_0} + \overline{b_0}) \cdot
    (\overline{a_1} + \overline{b_1}) \cdots 
    (\overline{a_{p-1}} + \overline{b_{p-1}})
\end{equation*}
Therefore, the {\it partial relation} is $\overline{a_i}+\overline{b_i}=1$,
and the {\it relation type} of crosslink operation is $AND$ type because 
$AND$ function is used to combining all {\it partial relations}.

An example of $OR$ type relation is the one used in the sharp operation, 
where the {\it relation} is $\neg(S^A \subseteq S^B)$. Thus partial relation
is $\neg (A_i \subseteq B_i)$, 
where $A_i$ is the subset of the true set $S^A$. If the set $S^A$ includes
the possible value $i-1$, then the set $A_i$ has one element that is the
possible value $i-1$ and is represented by $a_i=1$; otherwise, the set
$A_i$ is an empty set and is represented by $a_i=0$. It can be seen that
$a_i$ is the $i$-th bit of the bit string that represents the set $S^A$
in positional notation.  The same thing is with $B_i$ and $b_i$. 

\addtolength{\extrarowheight}{2pt}
\begin{table}[H]
%\begin{table}[h]
\caption{The partial relation of sharp operation}
\centering
\begin{tabular}{|c c|c|c|c|} \hline
      &                             &                           &                           \\
$a_i$ & $b_i$ & $A_i \subseteq B_i$ & $\neg(A_i \subseteq B_i)$ & $a_i\cdot \overline{b_i}$ \\ \hline
0 & 0 & 1 & 0 & 0 \\ \hline
0 & 1 & 1 & 0 & 0 \\ \hline
1 & 0 & 0 & 1 & 1 \\ \hline
1 & 1 & 1 & 0 & 0 \\ \hline
\end{tabular}
\label{tbl:ccop3}
\end{table}
\addtolength{\extrarowheight}{- 2pt}

Table \ref{tbl:ccop3} shows how to find the {\it partial relation}
function for the sharp operation. The first column shows two bits $a_i$ 
and $b_i$. The next two columns show the value of the negated 
{\it partial relation} and the {\it partial relation} itself, the last column
shows the bitwise function used to determine the {\it partial relation}. 
%
In the first two rows, $a_i=0$ means that the set $A_i$ is an empty set, 
and it is subset of all sets, thus $A_i \subseteq B_i$ are 1's (true). 
In the third row, $a_i=1$ means that the set $A_i$ includes one element
that is possible value $i-1$, and $b_i=0$ means that the set $B_i$ is an
empty set, thus $A_i \subseteq B_i$ is 0 (false).
In the fourth row, $a_i=b_i=1$ means that the sets $A_i$ and $B_i$ 
include one same element that is possible value $i-1$, thus sets $A_i$ and
$B_i$ are equal, and $A_i \subseteq B_i$ is 1 (true).
Therefore, the set relation of sharp operation can be determined by:
\begin{equation*}
  relation(A,B) = (a_0 \cdot \overline{b_0}) +
    (a_1 \cdot \overline{b_1}) + \ldots +
    (a_{p-1} \cdot \overline{b_{p-1}})
\end{equation*}
where the {\it partial relation} function is $a_i\cdot \overline{b_i}$,
and the {\it relation type} is $OR$.

\subsection{Summary of cube operations in positional notation}
\label{CHEN-section2.4.4}

From the above discussion, {\it before}, {\it active}, {\it after} set 
operations and {\it partial (set) relation} can be defined by
bitwise functions on bits. Therefore, all cube operations (some of them 
are basic operations) can be completely 
specified by 4 bitwise functions and {\it relation type}. Table
\ref{tbl:ccop4} summarizes all cube operations described in
this chapter in bitwise functions and relation type. 

\addtolength{\extrarowheight}{2pt}
\begin{table}[H]
%\begin{table}[h]
\caption{Cube Calculus Operations in bitwise function and relation type}
% \renewcommand{\multirowsetup}{\centering}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|} \hline
% title
  \multirow{3}{0.65in}{{\bf Operation}}
& \multirow{3}{0.7in}{{\bf Notation}}
& \multicolumn{2}{c|}{{\bf Relation}}
& \multicolumn{3}{c|}{{\bf Output Function}} \\ \cline{3-7}
 & & {\it partial} & {\it relation} 
 & \multirow{2}{0.45in}{$before$} 
 & \multirow{2}{0.45in}{$active$} 
 & \multirow{2}{0.45in}{$after$} \\
 & & {\it relation} & {\it type} & & & \\ \hline
% content
crosslink & $A \;\uplus\; B$
    % & \raisebox{-1.5pt}{$\overline{a_i}+\overline{b_i}$} 
    & $\overline{a_i}+\overline{b_i}$ 
    & and & $a_i$ & $a_i + b_i$ & $b_i$ \\ \hline
sharp & $A \;\#_{basic}\; B$ 
    % & \raisebox{-1.5pt}{$a_i \cdot \overline{b_i}$} & or & $a_i$ 
    & $a_i \cdot \overline{b_i}$ & or & $a_i$ 
    % & \raisebox{-1.5pt}{$a_i \cdot \overline{b_i}$} & $a_i$ \\ \hline
    & $a_i \cdot \overline{b_i}$ & $a_i$ \\ \hline
disjoint sharp & $A \;\#d_{basic}\; B$ 
    % & \raisebox{-1.5pt}{$a_i \cdot \overline{b_i}$} & or & $a_i$ 
    & $a_i \cdot \overline{b_i}$ & or & $a_i$ 
    % & \raisebox{-1.5pt}{$a_i \cdot \overline{b_i}$} & $a_i \cdot b_i$ \\ \hline
    & $a_i \cdot \overline{b_i}$ & $a_i \cdot b_i$ \\ \hline
consensus & $A \;\ast_{basic}\; B$ & 1 & and &
    $a_i \cdot b_i$ & $a_i + b_i$ & $a_i \cdot b_i$ \\ \hline
% asym sym cons & $A \;\ast_a\; B$ 
%     & \raisebox{-1.5pt}{$a_i \cdot \overline{b_i}$}  
%     & and & $a_i \cdot b_i$ & $a_i + b_i$ & $a_i \cdot b_i$ \\ \hline
intersection & $A \;\cap\; B$ & -- & -- & $a_i \cdot b_i$ & -- & -- \\ \hline
super cube & $A \;\cup\; B$ & -- & -- & $a_i + b_i$ & -- & -- \\ \hline
prime&$A\; ' B$ &$a_i \cdot b_i$ & or & $a_i$&$a_i + b_i$ & --\\ \hline
cofactor&$A|_{basic}B$ &$a_i + \overline{b_i}$ & and & $a_i\cdot b_i$ & 1 & --
      \\ \hline
\end{tabular}
\end{center}
\label{tbl:ccop4}
\end{table}
\addtolength{\extrarowheight}{- 2pt}

The following examples show the entire procedure to carry out cube calculus
operations in positional notation.

\vspace{2mm}
\noindent
\begin{example}
~\label{CHEN-Example2.15}
\end{example}

\noindent
Variables $x_1$, $x_2$ and $x_3$ all have 3 possible values, 
thus the sets of possible values are $P_1=P_2=P_3=\{0,1,2\}$. A cube of 
$x_1^{\{0,1\}}~x_2^{\{2\}}~x_3^{\{0,1,2\}}$ is denoted as 
$x_1^{110}~x_2^{010}~x_3^{111}$ in positional notation; and it 
is written as [110-010-111] for simplifying.

\vspace{2mm}
\noindent
\begin{example}
~\label{CHEN-Example2.16}
\end{example}

\noindent
Assuming cubes $A=x_1x_2$ and $B=x_2x_3\overline{x_4}$, where variables 
$x_1$, $x_2$, $x_3$ and $x_4$ are binary, the intersection of cubes $A$ and 
$B$ follows:
\begin{align*}
 A \cap B~ =~  & x_1x_2 \cap x_2x_3\overline{x_4} \\
          ~=~  & x_1^{\{1\}}~x_2^{\{1\}}~x_3^{\{0,1\}}~x_4^{\{0,1\}} \cap
               x_1^{\{0,1\}}~x_2^{\{1\}}~x_3^{\{1\}}~x_4^{\{0\}} \\
          ~=~  & x_1^{[01]}~x_2^{[01]}~x_3^{[11]}~x_4^{[11]} \cap
               x_1^{[11]}~x_2^{[01]}~x_3^{[01]}~x_4^{[10]} 
\end{align*}
\begin{align*}
 \hspace*{0.75in} 
          ~=~  & x_1^{[01]\cdot[11]}~x_2^{[01]\cdot[01]}~
               x_3^{[11]\cdot[01]}~x_4^{[11]\cdot[10]} \\
          ~=~  & x_1^{[01]}~x_2^{[01]}~x_3^{[01]}~x_4^{[10]} \\
          ~=~  & x_1x_2x_3\overline{x_4}
\end{align*}
where `$\cdot$' is a bitwise $AND$ operation.

When two opposite literals are multiplied, if the contradiction is generated
from the bitwise operation, then there is no resultant cube, which means 
that there is no intersection between two operand cubes.

\noindent
\begin{example}
~\label{CHEN-Example2.17}
\end{example}

\noindent
Assuming cubes $A=ab$ and $B=a\overline{b}$, where $a$ and $b$ are
binary variables. Then the intersection of cubes $A$ and $B$ is:
\begin{equation*}
 ab \cdot a\overline{b} = [01-01] \cdot [01-10] = [01-\underbrace{00}_{\epsilon}]
\end{equation*}

\noindent
where 00 is a contradiction symbol for a binary variable, and the 
contradiction is denoted by $\epsilon$ (see Table \ref{tbl:ccop2}).

\noindent
\begin{example}
~\label{CHEN-Example2.18}
\end{example}

\noindent
Redo the crosslink operation shown in Example 2.8 in positional notation as follows:

\begin{align*}
& A ~=~ \overline{x_1}~\overline{x_3} 
    ~=~ x_1^{\{0\}}~x_2^{\{0,1\}}~x_3^{\{0\}}~x_4^{\{0,1\}} 
    ~=~ [\overset{a_{1,0}}{1}\overset{a_{1,1}}{0}-
       \overset{a_{2,0}}{1}\overset{a_{2,1}}{1}-
       \overset{a_{3,0}}{1}\overset{a_{3,1}}{0}-
       \overset{a_{4,0}}{1}\overset{a_{4,1}}{1}] \\
& B ~=~ x_1x_3 
    = x_1^{\{1\}}~x_2^{\{0,1\}}~x_3^{\{1\}}~x_4^{\{0,1\}}
    = [\overset{b_{1,0}}{0}\overset{b_{1,1}}{1}-
       \overset{b_{2,0}}{1}\overset{b_{2,1}}{1}-
       \overset{b_{3,0}}{0}\overset{b_{3,1}}{1}-
       \overset{b_{4,0}}{1}\overset{b_{4,1}}{1}] 
\end{align*}

\noindent
where the header of bit is the name of the bit. The subscript of bit name 
has two parts separated by comma (`,'), the first part represents the index
of the variable, and the second part represents the possible value.
This notation will also be used in the next chapters.
Because:
\begin{align*}
 relation(A_1,B_1) &=(\overline{a_{1,0}}+\overline{b_{1,0}})\cdot
                     (\overline{a_{1,1}}+\overline{b_{1,1}})
         =(\overline{1}+\overline{0})\cdot(\overline{0}+\overline{1})=1 \\ 
 relation(A_2,B_2) &=(\overline{a_{2,0}}+\overline{b_{2,0}})\cdot
                     (\overline{a_{2,1}}+\overline{b_{2,1}})
         =(\overline{1}+\overline{1})\cdot(\overline{1}+\overline{1})=0 \\ 
 relation(A_3,B_3) &=(\overline{a_{3,0}}+\overline{b_{3,0}})\cdot
                     (\overline{a_{3,1}}+\overline{b_{3,1}})
         =(\overline{1}+\overline{0})\cdot(\overline{0}+\overline{1})=1 \\ 
 relation(A_4,B_4) &=(\overline{a_{4,0}}+\overline{b_{4,0}})\cdot
                     (\overline{a_{4,1}}+\overline{b_{4,1}})
         =(\overline{1}+\overline{1})\cdot(\overline{1}+\overline{1})=0 
\end{align*}

\noindent
the variables $x_1$ and $x_3$ are special variables. The two resultant 
cubes are:
\begin{align*}
& x_1^{A_1 + B_1}x_2^{A_2}x_3^{A_3}x_4^{A_4}
   ~=~ x_1^{[10] + [01]}~x_2^{[11]}~x_3^{[10]}~x_4^{[11]}
   ~=~ x_1^{[11]}~x_2^{[11]}~x_3^{[10]}~x_4^{[11]}
   ~=~ \overline{x_3} \\
&  x_1^{B_1}~x_2^{B_2}~x_3^{A_3 + B_3}~x_4^{A_4}
  ~=~ x_1^{[01]}~x_2^{[11]}~x_3^{[10]+[01]}~x_4^{[11]}
  ~ =~ x_1^{[01]}~x_2^{[11]}~x_3^{[11]}~x_4^{[11]}
   ~=~ x_1
\end{align*}

\noindent
where `+' is the bitwise $OR$ operation.

