11/23/2009

Trinary Logic

I was recently reading a book on binary logic circuits, and I got an idea. Since electronic charges can be positive or negative, why not make a logic system with three values: positive charge, negative charge, and no charge. I invented a system of "trinary" logic which uses these three values. I don't know if it could be implemented in hardware, but I know it could be easily implemented in software.

The rules of trinary logic are:
The + and * functions represent addition and multiplication as in normal math, but 1+1=-1 and -1+-1=1

This means that and number plus itself is the opposite of itself:

0+0=0*-1
1+1=1*-1
-1+-1=-1*-1

This makes trinary logic useful in constructing cryptographic systems (systems of codes)

I recommend that the negative symbol be used to represent -1 because -1 is the only negative value in trinary. Similarly, you can substitute "neg" for -1 while speaking.

4 comments:

  1. Alternately, one could consider this to be modular arithmatic. Your - would be 2 and your 0 would be three. Thus 2+2(mod 3)=1 and so forth. Thinking of it this way, one can easily extend the system to accomadate, say, 5 values: {1,2,3,4,5}. 2*4(mod 5)=3. Modular arithmatic makes for some very difficult problems, like finding the 3rd root of 6 (mod 7).

    ReplyDelete
  2. One notable difference between my system and other modular systems is that - and 0 act like themselves during multiplication. You could say it is (mod +/-2), but that is confusing.
    (PS to Scott: Check your E-mail for more code stuff)

    ReplyDelete
  3. Mark,

    Very clever. I did some googling on "trinary logic" and the first hit is this wikipedia entry:
    http://en.wikipedia.org/wiki/Ternary_logic

    Dad

    ReplyDelete
  4. Cool! I wonder if ternary computers use my modular thing. By the way Scott, I remembered why I originally decided to do the mod thing: When adding and subtracting multiple-digit quantities 1+1 would be -1 with a carry of 1 and -1-1 would be 1 with a borrow of 1.

    ReplyDelete