Is there any procedure that guaranteed to find the Minimal CNF form of an expression $?$

algorithmsboolean-algebracomputer scienceconjunctive-normal-formlogic

For example: Find the Minimal CNF form of $abcd+a'b'c'd'$:

My attempts:

Consider $$abcd+a'b'c'd'$$

By Distributeive law we have:
$$\boxed{\begin{array}{ccccc}d'
&\color{orange}{a+d'}&b+d'&\color{red}{c+d'}&\top\\
c'&a+c'&\color{red}{b+c'}&\top&\color{orange}{d+c'}\\
b'&\color{red}{a+b'}&\top&\color{orange}{c+b'}&d+b'\\
a'&\top&\color{orange}{b+a'}&c+a'&\color{red}{d+a'}\\
\cdot&a&b&c&d
\end{array}}$$

That implies $abcd+a'b'c'd'\equiv \color{orange}{(a+d')}(b+d')\dots (c+a')\color{red}{(d+a')}$, however if we pick either $\color{red}{\text{red}}$ or $\color{orange}{\text{orange}}$ expressions and connect them with '$\cdot$'(and), they implies everything else.

For example, let's take $\color{red}{(a+b')(b+c')(c+d')(d+a')}$, then we have:

\begin{align}
&\color{red}{(a+b')(b+c')}\to\boxed{a+c'}\\
&\color{red}{(b+c')(c+d')}\to\boxed{b+d'}\\
&\color{red}{(a+b')(d+a')}\to\boxed{d+b'}\\
&\color{red}{(a+b')}(b+d')\to\boxed{\color{orange}{a+d'}}\\
&\color{red}{(d+a')}(b+d')\to\boxed{\color{orange}{b+a'}}\\
&\color{red}{(c+d')}(d+b')\to\boxed{\color{orange}{c+b'}}\\
&\color{red}{(b+c')}(d+b')\to\boxed{\color{orange}{d+c'}}\\
&\color{orange}{(b+a')(c+b')}\to\boxed{c+a'}\\
\end{align}

Hence we can take them out from the expression, similarly if we pick the $\color{orange}{\text{orange}}$ expression:

\begin{align}
&\hspace{3ex}abcd+a'b'c'd'\\
&\equiv\color{red}{(a+b')(b+c')(c+d')(d+a')}\\
&\equiv\color{orange}{(a+d')(b+a')(c+b')(d+c')}
\end{align}


Another approach is use a k-map, however 'Karnaugh maps do not always give the simplest expression.'

For example, again we consider $abcd+a'b'c'd'$ that:

$$\boxed{\begin{array}{ccccc}
&a'b'&a'b&ab&ab'\\
c'd'&1&\color{blue}{0}&0&\color{lightgreen}{0}\\
c'd&0&\color{blue}{0}&0&\color{lightgreen}{0}\\
cd&0&\color{blue}{0}&1&\color{lightgreen}{0}\\
cd'&0&\color{blue}{0}&0&\color{lightgreen}{0}
\end{array}}
\boxed{\begin{array}{ccccc}
&a'b'&a'b&ab&ab'\\
c'd'&1&0&0&0\\
c'd&\color{red}{0}&\color{red}{0}&\color{red}{0}&\color{red}{0}\\
cd&0&0&1&0\\
cd'&\color{orange}{0}&\color{orange}{0}&\color{orange}{0}&\color{orange}{0}
\end{array}}\\
\boxed{\begin{array}{ccccc}
&a'b'&a'b&ab&ab'\\
c'd'&1&0&0&0\\
c'd&\color{lightblue}{0}&\color{lightblue}{0}&0&0\\
cd&\color{lightblue}{0}&\color{lightblue}{0}&1&0\\
cd'&0&0&0&0
\end{array}}
\boxed{\begin{array}{ccccc}
&a'b'&a'b&ab&ab'\\
c'd'&1&\color{lightgrey}{0}&\color{lightgrey}{0}&0\\
c'd&0&\color{lightgrey}{0}&\color{lightgrey}{0}&0\\
cd&0&0&1&0\\
cd'&0&0&0&0
\end{array}}$$

\begin{align}
&\hspace{3ex}(\color{blue}{a'b})'(\color{lightgreen}{ab'})'(\color{red}{c'd})'(\color{orange}{cd'})'(\color{lightblue}{da'})'(\color{lightgrey}{bc'})'\\
&\equiv(a+b')(a'+b)(c'+d)(d'+a)(b'+c)
\end{align}

Some works are still required here to simplify the expression $\dots$

Is there any procedure that guaranteed to find the Minimal CNF form of an expression $?$

Update:

Would Quine–McCluskey algorithm apply on this $?$
(I just found this algorithm, I think it might work $\dots$)

Best Answer

Yes, as you suspected in your update, the Quine-McCluskey algorithm is an algorithm with exactly this purpose.

Indeed, without a systematic algorithm, you are left with a kind of ad hoc 'trial-and-error' method of trying to simplify, like you do in the first part of your post.

And, as you realized, a K-map does not guarantee the most simple form either: you can, of course 'hit upon' a covering that turns out to be minimal, but without an algorithm you would have no guarantee it is in fact minimal. And, you could end up with a non-minimal covering .. as you yourself ended up with.

I should also point out that the Quine-McCluskey algorithm is typically presented for generating minimal DNF expressions ... but of course we can follow a completely analagous routine to find a minimal CNF.

Now, if do this for your particular example, you'd get a prime implicant chart with 14 implicants, and 12 prime implicants. Unfortunately, none of the prime implicants are essential, and so you'll have to use something like Petrick's method to find a minimal covering.

Related Question