Skip to content

Instantly share code, notes, and snippets.

@michaelochurch
Last active October 10, 2020 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save michaelochurch/69d91ad51053d06287b6434a1ac8b209 to your computer and use it in GitHub Desktop.
Save michaelochurch/69d91ad51053d06287b6434a1ac8b209 to your computer and use it in GitHub Desktop.
I believe this is correct. Please let me know if there are errors.
X | - 0 +
---------
- | + 0 -
0 | - 0 +
+ | 0 + -
Call this gate "R". It's universal, assuming we have fan-out (trit-copying) and the constants. That is, a circuit of R's can be built
to represent any function f: T^n -> T where T = {-, 0, +}.
(Note: in the binary case we don't need to assume constants because NAND(x, x) = NOT x and NAND(x, NOT x) = True. So we can generate
constants, even on unknown inputs, in the binary case. I haven't found a way to generate reliable constants (from unknown input) in
ternary logic based on one universal gate.)
Proof: Consider R(-, x), R(0, x), R(+, x) as functions of x. They correspond to a swap, the identity, and a cycle in S3. They generate
the entire group. So, every permutation can be generated from R (assuming we can create constants.)
We'll use ~x as a shorthand for R(-, x), which swaps + and -.
Let Check+ = R(x, 0) as a function of x. That gives us a unary function that sends {-, 0} to 0 and + to +. Since we have all the
permutations, we have analogous Check- and Check0 (unary indicators).
This is enough to prove that R can generate all unary functions. We have the permutation group, we have a Check0. Combining those, we can
build any function that maps exactly 2 of {+, 0, -} to the same range element (i.e. apply a permutation, Check0, then another permutation). There are 18 of those. The other three unary functions are constants.
How do we establish that R can generate all functions from T^n -> T? To do that:
1. Show that it can generate any indicator function g s.t. g(t) = 0 for all but one t in T^n. WLOG, show it for g(t) = +.
2. Show that it can generate Mod3+, below:
| - 0 +
---------
- | + - 0
0 | - 0 +
+ | 0 + -
If both of those are true, then an arbitrary f: T^n -> T can be built up as a sum of indicator functions (with no mutually exclusive
support). This is analogous to disjunctive normal form in binary logic.
To build an indicator function, all we need is the binary AND., in addition to the single-variable indicators. The gate/function:
S(x, y) = Check-(R(x, y))
will function as AND when x and y are in {+, 0}. Using single-variable indicators (above) and this AND, we can build any multi-variable
indicator we want, e.g. I((a, b, c) = (+, -, 0)) = AND(I(a = +), AND(I(b = -), I(c = 0))).
So now we need to prove that R generates Mod3+, which is analogous (enough, since the indicators can be made to be disjoint) to
disjunction.
The controlled cycle is CC(x, y) = R(Check+(x), y). If x = +, then it returns y + 1 mod 3, i.e. - to 0, 0 to +, and + to -. Otherwise, it
returns y.
Then Mod3+(x, y) = CC(Check+(x), CC(Check-(x), CC(Check-(x), y))).
Therefore, the gate R is universal, assuming that all three constants are available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment