C.1 Binary numbers
Consider a decimal example such as the number 243:
2 4 3
2×102 + 4×101 + 3×100
- Here, the terminology is that 10 is the base of the
number system.
- The lowest power (0) occurs at the rightmost position, with
each successive digit going leftwards, representing a multiple of
a higher power of the base.
- There needs to be a separate symbol for each number less
than the base, in our case: 0,1, ... , 9.
- One can take this a step further and add decimals to the
right of the \(10^0\) position with a "marker" (decimal point)
to help readability
- For example, 243.51:
2 4 3 . 5 1
2×102 + 4×101 + 3×100 + 5×10-1 + 1×10-2
The same positional principles apply to binary numbers:
- Since we're using powers of 2, there are only 2 symbols (0 and 1).
- For example, the number 1101:
1 1 0 1
1×23 + 1×22 + 0×21 + 1×20 = 13 (in decimal)
- Each digit is called a bit.
- The above number is a 4-bit binary number.
- An 8-digit binary number is called a byte.
- Positional addition in binary (black) works as it does in
decimal (blue):
- We will occassionally see binary numbers represented
by the bits \(x_{n-1} x_{n-2} \ldots x_0\), where each
\(x_i \in\{0,1\}\).
- In this case, the actual value of the number is:
\(\sum_{i=0}^{n-1} x_i 2^i\).
Why is the binary representation of numbers important?
- It isn't because they're convenient to reason with.
- It's because the physical devices we use to store and
manipulate numbers are binary in nature.
\(\rhd\)
It's a limitation in our ability to manufacture devices.
- In hardware, it's easy to create devices that are
two-state: either "on" or "off":
- Each such storage device that holds one binary digit is
also called a bit.
- As we will see later, a qubit or quantum bit is
quite different.
\(\rhd\)
A single qubit will store a 2D complex vector.
C.2 Boolean functions
Let us, for a moment, look at a 2-input 1-output real-variable
function like we've seen before, for example: \(f(x_1, x_2) = 3 x_1 + x_2^2\)
- We can think of the function as a box that takes in two
real numbers, "does something" with those numbers
and outputs a real number as result.
- For example, \(f(1.5, 3) \eql 3\times 1.5 \; + \; 3^2 \eql 13.5\)
- While the inputs and output are real numbers in this case, the notion
of "doing something" with inputs to produce an output is quite general.
A Boolean function:
- Let's think of a variable as "holding" or representing a
real number as a value.
- Suppose we consider Boolean variables:
- Just as a real variable holds or represents a real number, a Boolean
variable holds just one of two values: True or False.
- For convenience, we'll use T for True and F for False.
- Then, a Boolean function, say of two variables, takes
in two Boolean values (through the input variables)
and outputs a Boolean value (through the output variable):
- Unlike real-valued functions, which can be of infinite
varieties, Boolean functions are limited in what they can do.
- For example, consider a 1-input, 1-output Boolean function
\(f(x)\):
- The input can only be T or F.
- The output can only be T or F.
- Here's one possible function
$$
f_1(T) \eql T \\
f_1(F) \eql F \\
$$
- Here's another
$$
f_2(T) \eql F \\
f_2(F) \eql T \\
$$
- And two more:
$$\eqb{
f_3(T) & \eql & T \;\;\;\;\;\;\;\;\;\;\;\;
f_4(T) & \eql & F\\
f_3(F) & \eql & T \;\;\;\;\;\;\;\;\;\;\;\;
f_4(F) & \eql & F\\
}$$
- There aren't any more - we have enumerated all possible
1-input 1-output Boolean functions.
- Can you reason through why there are exactly 16 different
2-input 1-output Boolean functions? (Hint: \(16 = 2^4\))
Truth tables and well-known Boolean functions:
C.3 Boolean algebra
- Just as ordinary numeric variables can be combined with
numeric operators in expressions, so can Boolean variables
and operators.
- For example:
$$
f(x_1,x_2,x_3) \eql
(x^\prime_1 \wedge x_2)
\vee (x_1 \wedge x_2)
\vee (x_2 \wedge x_3^\prime)
$$
- And just like in numeric expressions, there are all kinds
of simplification rules (distributivity, associativity and so on)
to help simplify, for example:
$$\eqb{
f(x_1,x_2,x_3) & \eql &
(x^\prime_1 \wedge x_2)
\vee (x_1 \wedge x_2)
\vee (x_2 \wedge x_3^\prime) \\
& \eql &
((x^\prime_1 \vee x_1) \wedge x_2)
\vee (x_2 \wedge x_3^\prime) \\
& \eql &
x_2
\vee (x_2 \wedge x_3^\prime) \\
}$$
- Sometimes, we repurpose numeric addition and multiplication
conventions and write
$$\eqb{
f(x_1,x_2,x_3) & \eql &
x^\prime_1 x_2
+ x_1 x_2
+ x_2 x_3^\prime \\
& \eql &
(x^\prime_1 + x_1) x_2
+ x_2 x_3^\prime \\
& \eql &
x_2
+ x_2 x_3 \\
}$$
Here, it's understood that '+' refers to Boolean OR.
- What do we know about such simplifications?
- It turns out to be an important problem in the design
of hardware, where understandably, one wants as few operations
as possible.
- Finding an optimized function (minimum number of operations)
is a challenging (and interesting) problem.
- There's a simple way to build an expression from
a truth table:
- Identify the rows where the end output is 1.
- To get a particular row's outcome to occur,
the variable values have to match
the row's input specification exactly.
- Then, the output will be 1 if the inputs match any of these
rows.
- "any of these f=1 rows" is expressed by the OR of
the individual rows.
- This approach provides a systematic way to build an expression
for a desired Boolean function:
- Build a truth table for the function.
- Write out the expression resulting from OR-ing the
f=1 rows.
- Optimize to simplify the expression.
- The method above produces a Boolean expression that uses
AND, OR and NOT (only these Boolean operators).
- But what do we do with a
Boolean expression that has XOR and NAND operators?
\(\rhd\)
This raises an important concept (for quantum computing): universality
Universal Boolean operators:
- We now know that XOR and NAND can be written entirely
in terms of AND/OR/NOT via the truthtable-to-expression approach:
- The set
of gates \(\{AND, OR, NOT\}\) is universal:
- We can turn any Boolean function into a truth table
and convert into an expression just using AND/OR/NOT gates.
- In fact, just \(\{AND, NOT\}\) is universal, as is \(\{OR, NOT\}\)
- What is less obvious is that there are other universal sets.
- Perhaps surprisingly, just the NAND gate by itself is
universal!
- The question of universality for Boolean gates now
seems addressed with AND/OR/NOT.
- However, the same question (of universality) for
quantum operators (also called quantum gates)
is not so straightforward, as we'll see.
Lastly, to round out our quick overview of Boolean algebra,
let's describe the problem of satisfiability:
- Consider an equation with real variables, such as
$$
2x_1 + 3x_1^2 - x_2 \eql 13
$$
-
This happens to have multiple solutions, for
example \(x_1=2, x_2=3\) or \(x_1=1, x_2=-8\).
- Notice that one variable appears twice. In general
a variable can occur multiple times.
- The general form of an equation is to have an expression
with variables on the left, and a constant (a value) on the right.
- We can write Boolean equations too, for example,
$$
(x_1^\prime \wedge x_2) \vee (x_1^\prime \wedge x_3) \eql T
$$
and ask if there are solutions.
- Broadly, this is called the satisfiability problem:
given a boolean equation, can one find True/False values for
the variables to make the equation hold?
- Notice that we can omit the right side and just ask
whether the expression on the left can be made True?
- It is common to restrict the type of Boolean expression
to be in Conjunctive Normal Form (CNF):
- For example:
$$
(x_1^\prime \vee x_2 \vee x_4^\prime) \wedge
(x_2 \vee x_3^\prime ) \wedge
(x_1 \vee x_2^\prime \vee x_3) \wedge
(x_1 \vee x_2 \vee x_3)
$$
- In this form, there are a bunch of clauses in parentheses
(four clauses above).
- The only operators allowed inside a clause are OR and complement.
- The complement is only applied to individual variables.
- It turns out that any Boolean expression can be
algebraically manipulated into this form, so it's not restrictive.
- When the number of variables present in each clause
is restricted, for example, to at most \(K\) variables, the
problem is called K-satisfiability.
- In the above example, the biggest clause has 3 variables, so
it's an instance of a 3-Satisfiability problem.
- Often, we use the shorter term K-SAT.
- The satisfiability problem is one of the most important
problems in computer science:
- No efficient algorithm is known for this problem.
- If an efficient algorithm were to be found, it can be
shown that the algorithm can be used to efficiently solve
thousands of other important problems.
- In that sense, satisfiability is (strangely) a
universal problem.
- We will later see how quantum computing offers some hope
of finding solutions to satisfiability.
C.4 Boolean circuits
- Let's return to the OR function above and imagine how this
might be implemented physically with electronic circuitry:
How to think of this:
- Think of the OR box as some circuitry that is set up
to receive electronic pulses on the input wires, and
to issue electronic pulses on the output wire.
- When the top input wire has nothing (interpreted as 0),
and the bottom one has an actual pulse (high enough voltage),
then the OR circuit "does its thing", which is to soon after
produce a burst of electricity (pulse) on the output wire.
- Thus, a little more abstractly, one can think of 0's
and 1's "flowing" through a circuit at discrete time steps.
- Consider this example:
Here we see that one can arrange these functional devices
in sequence to produce a result.
- In a circuit context, the boxes that perform the basic Boolean
operations like AND, OR, are called gates.
- We can reason about such combinations of Boolean gates:
By systematically
trying all input combinations, we can describe the output
for each.
Recognize the truth table on the right?
- Inputs can be staggered in, as in this example:
Note: the "pulse" of electricity for \(x_3\) would have to
be held long enough or timed to give enough time for \(y\)
to be created.
Let's build a more useful circuit in steps:
To summarize so far:
- Boolean operators (which are mathematical objects) can be
implemented directly in hardware using their equivalents called gates.
- Gates can be put together into circuits to compute
complicated Boolean functions.
- Designing efficient Boolean circuitry is challenging, and
in fact, a profession by itself (circuit design).
- Simple circuits like the 4-bit adder, though not necessarily
optimal in number of gates, can be intuitively put together
with smaller circuits.
C.5 Registers and memory
In all the circuits we've seen so far, we haven't mentioned
where the inputs come from or where the output "goes"
- In the 4-bit adder circuit above, for example, it's assumed
that the inputs "arrive" at the input wires together.
- Then, the particular values (0's and 1') flow through
the circuit, achieving the desired function.
- A little later, the output wires carry the resulting
0's and 1's that constitute the output:
- All of the "action" in the circuit is fleeting and it happens
very quickly.
- Clearly, to be of any use, we need to "hold" the results
long enough for future calculations or for human interaction.
- One common element of storage is a register, which is
an array of 1-bit storage devices:
- Each register can hold its value indefinitely (as long as
there's power).
- When desired, the input registers can be told to send their
values to the adder, which produces the output.
- The new added output replaces whatever was already there in the output
register.
- Registers are typically named like R1, R2 etc.
- Each register above is a 4-bit register:
- That is, each register has four "boxes" each of which can
hold a binary value (0 or 1).
- Such a box is called a bit.
- How do numbers get into the input registers to begin with?
Computing devices need more than registers to store data:
C.6 The Von Neumann architecture
Consider for a moment the most basic calculator that can perform only
addition, subtraction, multiplication and division:
The same program in a computer:
The Von Neumann architecture:
- If a program is to be executed quickly, the instructions
need to be in electronic form and stored somewhere.
- The (so-called) Von Neumann architecture solves this
problem by re-using the bit-patterns in memory
to encode such instructions.
- Thus, a particular bit pattern like 1101 if
interpreted as data will be the number 13.
- When interpreted as an instruction, it means "load".
(The hardware designers decide these interpretations.)
- Then, what remains to be done is to have an 'orchestrating'
unit that directs the sequence of actions.
- Here's a simplified picture:
Note:
- The data and instructions are both stored in memory,
typically in separate parts.
- The controller knows how to interpret the bit patterns
that represent instructions.
- The controller also knows how to sequence the instructions.
- What's interesting is that the controller itself
is built out of the same units (gates, registers) so that everything
runs fast.
- In other words, a full-fledged computer can be built out
of bits, and AND, OR, and NOT gates.
- We will later see that a quantum computer is built out
of qubits and quantum gates.
C.7 Networks and security
Let's examine networks in a simplified way:
- A laptop wirelessly connects to a wireless access point.
- This connects to a router (which may be combined with
the access point at home).
- The router connects to a larger router operated by
telecom company or larger router in an organization.
- The larger routers then connect to even larger routers
that form the backbone of the internet.
- Each particular connection can be thought of as
providing a way to transmit bits from one side to another:
- We're using a line conceptually to mean either an
actual wire or wireless.
- At any one moment, one side transmits
while the other receives.
- The above example shows how the bits 1011 might look like
going across.
Our focus is going to be security:
- In the typical style of security presentations, one person A
(for Alice) transmits something to person B (Bob), while
person E (Eve) listens in.
- What do Alice and Bob want?
- Confidentiality: Eve shouldn't be able to understand,
even if she successfully copied the bits.
- Integrity: Eve should not be able to manipulate the
bits Bob receives, or at least Bob should know if this happened.
- Authenticity. Eve should not be able to masquerade as Alice to Bob, or the other way around.
- Availability: If Eve simply blocks transmission,
Alice and Bob should know.
- Thus, measures to improve security need to address such concerns.
- Typically, one uses encryption to protect confidentiality.
- To protect integrity:
- The encrypted message should itself
contain something (a digest) such that any tampering
is detected.
- The message should contain something to verify that it is
Alice that indeed sent the message (to catch Eve if she
masquerades as Alice).
- To protect availability, Alice and Bob can arrange to send
pre-determined bits at certain intervals.
- There is a whole world of potential attacks and measures to
defend. We won't be able to go into all the details.
- And there's a whole world of encryption mathematics and
techniques, some of which uses integer factoring as
a foundation.
Quantum computing focuses on two aspects of security:
- Using a quantum computer to break encryption:
- This is the famous Shor's Algorithm for factoring integers.
- Our goal will be to understand how this works.
- Using transmission of quantum bits (qubits) to provide security:
- We will show that quantum bits have unusual properties that
enable strong security properties.
- For example, if Eve even "looks" at bits going by, Alice and Bob will know.
C.8 The state of computing today
First, a software/algorithms perspective:
- The past few decades have seen much progress in:
- Fast algorithms for many computational problems.
- Clever solutions to thorny security problems.
- Software infrastructure and tools that exploit inexpensive
hardware to scale solutions.
- But at the same time, there are stubbornly hard problems
resistant to algorithmic development:
- Many of these are the so-called combinatorial
optimization problems.
- Examples include: scheduling, routing, network design, and a
host of such optimization problems.
- There's also theory that remains to be solved:
- Example: nobody has proved that factorization is
hard, nor is there known a fast algorithm.
A hardware perspective:
- Each year, more and more gates get packed into the same space,
allowing a continuing miniaturization trend, sometimes called
Moore's Law.
- But miniaturization is now creeping up on limits imposed by
physics:
- When you get down to the size of atoms, the laws of physics
that typically apply at higher scales are now dominated by quantum physics.
- This means quantum effects apply, whether desirable (as in
the case of quantum computing) or not.
- Another issue is heat: the more you pack into the same space,
the more heat you dissipate per unit area, and the harder it is
to cool.
- The other trend is massive parallelism (using many
processors for a single computation) but that comes with caveats
too:
- It is hard to write programs for parallel machines.
- Some problems are resistant to parallelism.
- Parallelism can be expensive if most of the processors are
idle because parallelism cannot be extracted.
- Yet another trend is hardware specialization:
- The idea here is to design specialized hardware optimized for
particular tasks.
- The most prominent example is GPUs for high-speed graphics.
- A newer example is: hardware for machine-learning.
- It's hard to say where these trends will take us.
- But this is precisely why it's an interesting time: the nexus
of quantum hardware, parallelism and specialization points to a
exciting future!
This concludes our review.
Back to main review page