summaryrefslogtreecommitdiff
path: root/source/know/concept/toffoli-gate/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'source/know/concept/toffoli-gate/index.md')
-rw-r--r--source/know/concept/toffoli-gate/index.md24
1 files changed, 6 insertions, 18 deletions
diff --git a/source/know/concept/toffoli-gate/index.md b/source/know/concept/toffoli-gate/index.md
index 7de7600..ba9d3ba 100644
--- a/source/know/concept/toffoli-gate/index.md
+++ b/source/know/concept/toffoli-gate/index.md
@@ -16,43 +16,31 @@ of which it returns $$A$$ and $$B$$ unchanged,
and flips $$C$$ if both $$A$$ and $$B$$ are true.
In circuit diagrams, its representation is:
-<a href="toffoli.png">
-<img src="toffoli.png" style="width:19%">
-</a>
+{% include image.html file="toffoli.png" width="19%" alt="Toffoli gate symbol" %}
This gate is reversible, because $$A$$ and $$B$$ are preserved,
and are all you need to reconstruct to $$C$$.
Moreover, this gate is universal,
because we can make a NAND gate from it:
-<a href="nand.png">
-<img src="nand.png" style="width:38%">
-</a>
+{% include image.html file="nand.png" width="38%" alt="NAND gate made of Toffoli gate" %}
A NAND is enough to implement every conceivable circuit.
That said, we can efficiently implement NOT, AND, and XOR using a single Toffoli gate too.
Note that NOT is a special case of NAND:
-<a href="not.png">
-<img src="not.png" style="width:32%">
-</a>
+{% include image.html file="not.png" width="32%" alt="NOT gate made of Toffoli gate" %}
-<a href="and.png">
-<img src="and.png" style="width:35%">
-</a>
+{% include image.html file="and.png" width="35%" alt="AND gate made of Toffoli gate" %}
-<a href="xor.png">
-<img src="xor.png" style="width:35%">
-</a>
+{% include image.html file="xor.png" width="35%" alt="XOR gate made of Toffoli gate" %}
Using these, we can, as an example, make an OR gate
from three Toffoli gates,
thanks to the fact that $$A \lor B = \neg (\neg A \land \neg B)$$,
i.e. OR is NAND of NOT $$A$$ and NOT $$B$$:
-<a href="or.png">
-<img src="or.png" style="width:50%">
-</a>
+{% include image.html file="or.png" width="50%" alt="OR gate made of Toffoli gates" %}
Thanks to its reversibility and universality,
the Toffoli gate is interesting for quantum computing.