Suppose that I have a set S consisting of {0₁, ¯1₂, 0₂, 1₂, ¯2₃, ¯1₃, 0₃, 1₃, 2₃, ¯3₄, ¯2₄, ¯1₄, 0₄, 1₄, 2₄, 3₄}. I want to define the following operations over S:
S < 0which returns one if and only ifSis negative.¯Swhich returns the negation ofS.S + 0which returnsSplus zero, which isSunchanged.S + 1which returns the absolute value ofSplus one, modulo the subscript. For example:- Both
¯1₃ + 1and1₃ + 1evaluate to2₃. - Both
¯2₃ + 1and2₃ + 1evaluate to0₃. - The expression
0₃ + 1evaluates to1₃.
- Both
S ¢ 0which returns the carry ofS + 0, which is zero.S ¢ 1which returns the carry ofS + 1, which is one if and only ifS + 1 = 0ₙforn > 1.
This information can be captured in the form of a truth table:
S S<0 ¯S S+0 S+1 S¢0 S¢1
┌───┬───┬───┬───┬───┬───┬───┐
│ 0₁│ 0 │ 0₁│ 0₁│ 0₁│ 0 │ 0 │
├───┼───┼───┼───┼───┼───┼───┤
│¯1₂│ 1 │ 1₂│¯1₂│ 0₂│ 0 │ 1 │
├───┼───┼───┼───┼───┼───┼───┤
│ 0₂│ 0 │ 0₂│ 0₂│ 1₂│ 0 │ 0 │
├───┼───┼───┼───┼───┼───┼───┤
│ 1₂│ 0 │¯1₂│ 1₂│ 0₂│ 0 │ 1 │
├───┼───┼───┼───┼───┼───┼───┤
│¯2₃│ 1 │ 2₃│¯2₃│ 0₃│ 0 │ 1 │
├───┼───┼───┼───┼───┼───┼───┤
│¯1₃│ 1 │ 1₃│¯1₃│ 2₃│ 0 │ 0 │
├───┼───┼───┼───┼───┼───┼───┤
│ 0₃│ 0 │ 0₃│ 0₃│ 1₃│ 0 │ 0 │
├───┼───┼───┼───┼───┼───┼───┤
│ 1₃│ 0 │¯1₃│ 1₃│ 2₃│ 0 │ 0 │
├───┼───┼───┼───┼───┼───┼───┤
│ 2₃│ 0 │¯2₃│ 2₃│ 0₃│ 0 │ 1 │
├───┼───┼───┼───┼───┼───┼───┤
│¯3₄│ 1 │ 3₄│¯3₄│ 0₄│ 0 │ 1 │
├───┼───┼───┼───┼───┼───┼───┤
│¯2₄│ 1 │ 2₄│¯2₄│ 3₄│ 0 │ 0 │
├───┼───┼───┼───┼───┼───┼───┤
│¯1₄│ 1 │ 1₄│¯1₄│ 2₄│ 0 │ 0 │
├───┼───┼───┼───┼───┼───┼───┤
│ 0₄│ 0 │ 0₄│ 0₄│ 1₄│ 0 │ 0 │
├───┼───┼───┼───┼───┼───┼───┤
│ 1₄│ 0 │¯1₄│ 1₄│ 2₄│ 0 │ 0 │
├───┼───┼───┼───┼───┼───┼───┤
│ 2₄│ 0 │¯2₄│ 2₄│ 3₄│ 0 │ 0 │
├───┼───┼───┼───┼───┼───┼───┤
│ 3₄│ 0 │¯3₄│ 3₄│ 0₄│ 0 │ 1 │
└───┴───┴───┴───┴───┴───┴───┘
What I want to do is convert this many-valued truth table into a boolean truth table so that I can implement the operations using bitwise operators for parallelization. Sounds simple enough. Assign 0000 to 0₁, 0001 to ¯1₂, ..., 1111 to 3₄. Solve the resulting Karnaugh map to get a CNF or DNF expression and call it a day.
Unfortunately, the resulting CNF or DNF expressions might not be efficient with this naive mapping of S to boolean values. I want to find the most efficient way to represent this many-valued truth table as a boolean truth table. Here, efficient means using the fewest operators to implement the various operations with preference being given to addition, negation, carry and comparison in that order. However, the problem is that there are 16! or 20922789888000 ways to map S to boolean values. Is there a better way to find the solution than brute force?
