## Notes on Ternary Logic.

Along with ternary arithmetic, a computer built of ternary hardware can also exploit ternary logic. Consider the task of comparing two numbers. In a machine based on binary logic, comparison is often a two-stage process. First you ask, "Is x less than y?"; depending on the answer, you may then have to ask a second question, such as "Is x equal to y?" Ternary logic simplifies the process: A single comparison can yield any of three possible outcomes: "less," "equal" and "greater."

### Reversible Gates

- NOP: The most dull gate (number 8) this does not change the input. It is its own complement. Applying it any number of times get you back to your intial value.
- NEG Gate: Balanced ternary gates have a tighter relationship between logical and mathmatical negation. The are the same bitwise operator. It is its own complement. Applying it multiple time every even application brings back the intial value.
- INC and DEC Gate: These gates can arithmetically be thought of as single trit increment or decrement without carry, but with roll over. These gates are also complementary . Every 3 applications of either one of these gates in a row bring back the intial value.
- Gate 2 & 6: The these gates are most intuitively expressed as combinations of NEG, INC and DEC.

To learn more, see reversible computing.

### Single Input Gates

+ | 0 | - | Number | Name | Definitions |
---|---|---|---|---|---|

- | - | - | -13 | False | NEG(LAX(LAX)) |

- | - | 0 | -12 | NEG(LAX) | |

- | - | + | -11 | DEC(DEC(LAX)) | |

- | 0 | - | -10 | Abn | NEG(LAX(DEC)) |

- | 0 | 0 | -9 | DEC(LAX(NEG)) | |

- | 0 | + | -8 | Neg | NEG |

- | + | - | -7 | isZ | DEC(DEC(LAX(DEC))) |

- | + | 0 | -6 | Inc | DEC(DEC) |

- | + | + | -5 | DEC(NEG(LAX(NEG))) | |

0 | - | - | -4 | NEG(LAX(NEG)) | |

0 | - | 0 | -3 | DEC(LAX(DEC)) | |

0 | - | + | -2 | Dec | DEC |

0 | 0 | - | -1 | DEC(LAX) | |

0 | 0 | 0 | 0 | Clear | DEC(LAX(LAX)) |

0 | 0 | + | 1 | NEG(DEC(LAX)) | |

0 | + | - | 2 | NEG(DEC) | |

0 | + | 0 | 3 | NEG(DEC(LAX(DEC))) | |

0 | + | + | 4 | LAX(NEG) | |

+ | - | - | 5 | Floor | DEC(DEC(LAX(NEG))) |

+ | - | 0 | 6 | DEC(NEG) | |

+ | - | + | 7 | DEC(NEG(LAX(DEC))) | |

+ | 0 | - | 8 | NOP | NEG(NEG) |

+ | 0 | 0 | 9 | Flat | NEG(DEC(LAX(NEG))) |

+ | 0 | + | 10 | Abs | LAX(DEC) |

+ | + | - | 11 | Ceil | DEC(NEG(LAX)) |

+ | + | 0 | 12 | Lax | LAX |

+ | + | + | 13 | True | LAX(LAX) |