Simon's Algorithm

#quantum #qnickel

Part of Womanium Quantum + AI 2024 program


Definition

Simon's algorithm provides an exponential speed-up compared to known classical solutions to the same problem. The problem that algorithm solves has practical uses in the analysis of certain crypto-systems and inspired many other algorithms such as Shor's factoring algorithm.

Problem

The problem defines a function f as:

f:{0,1}n{0,1}n

With the promise that:

f(x)=f(xs),s{0,1}norf(x)=f(y)(xy){0n,s}

The goal of the problem is to determine the secret string s, in the least number of queries of f.

Bitwise XOR

The symbol represents the bitwise XOR operation.
It can also be said that it is a bitwise addition modulo 2.

The problem can also be defined as determining whether a function is two-to-one or one-to-one, in which case we need to determine whether s is the zero string 0n or not.

Classical Solution

Classically we would have either a deterministic or a probabilistic solution, where our goal is to find x1 and x2 such that f(x1)=f(x2), then we can get s, by applying bitwise xor on x1 and x2.

s=x1x2

Deterministically, we would need to cover a large area of the search space to be able to tell whether such strings exist or not, this would usually require 2n1+1 queries (one over half).

Probabilistically, we would cover a "large enough" area to solve the problem with high certainty, but less than 100% certainty.

The best classical solution has a complexity of O(2n/2).

Simon's Algorithm

The proposed algorithm has two parts, a classical part and a quantum part. The quantum part works with a complexity of O(n), to obtain n-1 linearly independent equations. Then we solve the linear system classically. Note that the string 0n will always be a solution but we need to determine if it's the only solution or not.

SA.png|600

We define the oracle Uf as the oracle the implements the function f such that

Uf(|x|y)=|x|f(x)y

We also define

N=2n

Let's start by applying the quantum part of the algorithm.

|0n|0nHnIn1Nx{0,1}n|x|0nUf1Nx{0,1}n|x|f(x)0n=1Nx{0,1}n|x|f(x)n

Now we measure the second half of the qubits, the one that we stored the oracle result in. We will observe a random result to one of the inputs x.

Let's assume we observe the result of f(z) for some z{0,1}n. Now we study the result and what we know about it based on whether the function is two-to-one or one-to-one.

Two-To-One (s0n)

If the function is two-to-one then we know that two states could've resulted in the same outcome which are the state z and zs, therefore we can represent the state of the system as:

12(|z+|zs)

Then after applying the Hadamard gate the system state will change to:

12(|z+|zs)Hn12Ny{0,1}n((1)zy+(1)(zs)y)|y

We know that zy=(zs)y, because if zy(zs)y then (1)zy+(1)(zs)y=0, this implies that all states would have a measurement probability of 0% which is impossible.

Using zy=(zs)y we get:

zy=(zs)yzy=(zy)(sy)sy=0

Now we apply that as such

(1)zy+(1)(zs)y=(1)zy+(1)(zy)(sy)=(1)zy+(1)zy=2(1)zy

Let's plug that back in the system state

12Ny{0,1}nsy=0((1)zy+(1)(zs)y)|y=12Ny{0,1}nsy=02(1)zy|y=22Ny{0,1}nsy=0(1)zy|y

Therefore, all strings that satisfy sy=0 will have an equal probability of measurement. The probability of measuring a particular string y that satisfies sy=0 is

(22N)2=422n=12n1

But the probability of measuring any string y that satisfies the condition is 1.

One-To-One (s=0n)

If the function f is a one-to-one function it implies that the measured result is the outcome of just one of the states, which will not change our representation of the system.

Now we apply the Hadamard gate

|zHn1Ny{0,1}n(1)zy|y

This means that all states have an equal probability of being measured.


< Prev | Next: Numbers and Adders >