NANDgame circuit
1 Preliminary
1.1 How to build circuit out of truth table
- SOP (Sum-of-Product rule): Find the rows of truth table where output is 1. Get the product(AND) of the inputs. Sum(OR) them with the other rows where output is 1.
- Intuition is AND is more restrictive: you first target the results individually with AND gate then your combine each of the results with the OR gate.
- BUT What if we had more than 1 output? Pretend as if there were 2 truth tables with 1 output, then use the SOP rule on each of the truth tables.
2 Summary
- The input of a circuit are similar to inexhaustable assumptions used in proof tree.
- The output of a circuit is similar to the bottom AKA root of the proof tree.
- HOWEVER, the caveat is multiple outputs are possible meaning we have multiple proof trees representing a n-ary output circuit.
- EG. AND-component has 1-output so 1 proof tree.
- EG. HALFADDER-component has 2-output, 1 for high-bit, 1 for low-bit so 2 proof trees
- HOWEVER, the caveat is multiple outputs are possible meaning we have multiple proof trees representing a n-ary output circuit.
3 Analysis
- Writeout the function type cardinality
- Look at number of inputs, ask if ordered or unordered
- Look at number of outputs, ask if ordered or unordered
- Write out (N Ordered Inputs) -> (K Ordered Outputs)
- Try to find a logical equivalence, N Ordered Inputs will tell you that you need N variables in your logic equation.
UnOrdered inputs mean the order of the variable doesnt matter.
eg. InverseMultiplexer :: (1 Inputs) -> (9 UnOrdered Output)
“(9 UnOrdered Output)” means we should have 9 proof trees built using 1 inexhaustable assumption representing the “(1 Inputs)”
3.1 Describing RELAYS
- “Relay default on”
- 2 Ordered Inputs : C and IN
- 1 Output
Relay_default_on :: (2 Ordered Inputs) -> (1 Output)
Relay_default_on := (NOT C) /\ IN
- “Relay default off”
- 2 Ordered Inputs : C and IN
- 1 Output
Relay_default_off :: (2 Ordered Inputs) -> (1 Output)
Relay_default_off := C /\ IN
3.2 Level NAND
The question is how do we build NAND using Relay_default_on and Relay_default_off?
- First translate NAND into basic symbols
NOT (A /\ B)
- Write out available tactics AKA logical equations of “Relay_default_on” and “Relay_default_off”. These logical equations are analogous to term introduction rules in a proof true.
- Rule1: Given any symbols C, IN: we can build term
(NOT C) /\ IN
- Rule2: Given any symbols C, IN: we can build term
C /\ IN
- Write out available variables, These variables are analogous to inexhaustable assumptions in a proof tree
- VARIABLES: A B Power
- Build the solution via the variables
A /\ B
via Rule2(NOT (A /\ B)) /\ Power
via Rule1 applied to 1.- Translate back rule into relays
- Connect A and B to Relay_default_off aka Rule2
- Connect output of step 1 into C and Power to IN in Relay_default_on aka Rule1
\[\cfrac{C \qquad IN}{\lnot C \land IN}\tag{Relay_default_on}\] \[\cfrac{C \qquad IN}{C \land IN}\tag{Relay_default_off}\] \[\cfrac{X \land Power}{X} \qquad \cfrac{Power \land X}{X} \tag{Logical Reduction Rules}\]
\[\cfrac{\cfrac{A \qquad B}{A \land B}\qquad Power}{\cfrac{\lnot (A \land B) \land Power}{\lnot (A \land B)}}\]
3.3 Level Half-adder
- GOAL:
half-adder :: 2 Ordered Inputs -> 2 Ordered Outputs
- VARIABLES: A B
- Understand the MAX/MIN of the problem:
- The MIN output is 0 and the MAX output is 2 or “10” in binary
- This means there are 3 states needed for the output, 00, 01, 10
- Information theory: in theory we can make 8 states just by connecting A to High Output, B to Low Output.
- Since the problem actually has 3 output, clearly we need some Gates that reduces information.
Gates like AND, OR, XOR, reduces information into 2 states 0,1.
If we use 2 Gates one for High-bit, one for Low-bit we can in-theory get MAX 4 states
BUT our GOAL is 3 states so clearly we need find 2 gates that has 2 rows or 2 Overlapping states in the truth table
- Since the problem actually has 3 output, clearly we need some Gates that reduces information.
- Information theory: in theory we can make 8 states just by connecting A to High Output, B to Low Output.
- Solution:
- High-bit := A AND B
- Low-bit := A XOR B
A | B | Hi | Lo | Description |
---|---|---|---|---|
0 | 0 | 0 | 0 | |
0 | 1 | 0 | 1 | <- 2 Overlapping states |
1 | 0 | 0 | 1 | <- 2 Overlapping states |
1 | 1 | 1 | 0 |
\[\cfrac{X \qquad Y}{X \land Y} \qquad \cfrac{X \qquad Y}{X \oplus Y} \tag{and-rule xor-rule}\] \[ \cfrac{\cfrac{\cfrac{A \qquad B}{A \land B}}{Hi} \qquad \cfrac{\cfrac{A \qquad B}{A \oplus B}}{Low}}{(Hi,Low)_{Adder}}\tag{the solution of built circuit}\]
Extra stuff using the Adder circuit via elimination rules:
\[ \cfrac{\pi_1(Hi,Low)_{Adder}}{Hi} \qquad \cfrac{\pi_2(Hi,Low)_{Adder}}{Low}\]
3.4 Full Adder
- GOAL:
full-adder :: 3 Ordered Inputs -> 2 Ordered Outputs
- VARIABLES: A B C
- Understand the MAX/MIN of the problem:
- The MIN output is 0 and the MAX output is 3 or “11” in binary
- Take halfadder of A,B then take resultant low bit and halfadder it to C, then the low bit of that is the low bit.
Take the high bit of both half adders than OR them to get the high bit.
3.5 Multi-bit Adder
- Before our Adders only added 1-bit numbers, but what if we want to add 2-bit numbers with a 1-bit carry number like “11”+“11”+“1” = “111”
- Use 2 full adders