{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Simon's Algorithm\n", "\n", "**Abstract:** We study a quantum algorithm known as Simon's algorithm, which provided the first example of an exponential speedup over the best known classical algorithm by using a quantum computer to solve a particular problem. Originally published in 1994, Simon's algorithm was a precursor to Shor's well-known factoring algorithm, and it served as inspiration for many of the seminal works in quantum computation that followed. \n", "\n", "This notebook is aimed at users with some basic knowledge of quantum computing and quantum circuits.\n", "\n", "### Table of Contents\n", "* [Simon's Problem Statement](#statement)\n", " * [Example for n=3](#example)\n", "* [Classical Complexity](#classicalcomplexity)\n", "* [Quantum Algorithm for Simon's Problem](#quantumalgorithm)\n", " * [Quantum Circuit](#circuit)\n", " * [Running Simon's Algorithm](#runningintro)\n", " * [Classical Post-Processing](#postprocessintro)\n", "* [Quantum Complexity](#quantumcomplexity)\n", "* [Implementing Simon's Algorithm in Amazon Braket](#implementation)\n", "* [References](#references)\n", "* [Appendix](#appendix)\n", " * [Implementing an Oracle Function](#oracleimplementation)\n", " * [Implementing the Classical Post-Processing](#appendixpostprocessing)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Simon's Problem Statement: \n", "\n", "Suppose we’re given a function $f:\\{0,1\\}^n \\rightarrow \\{0,1\\}^n$ that maps bit strings to bit strings along with the promise that\n", "$$\\forall x,y \\in \\{0,1\\}^n, \\quad f(x) = f(y) \\iff x=y\\oplus s,$$\n", "for some unknown $n$-bit string $s \\in \\{0,1\\}^n$, and where $\\oplus$ means bitwise addition modulo 2.\n", "\n", "Said another way, there exists an unknown string $s$ such that, $\\forall x, \\; f(x)=f(x\\oplus s)$. When $s$ is non-zero, the function is two-to-one as it maps *exactly* two inputs to every unique output.\n", "\n", "The goal of Simon's problem is to determine if $f$ is one-to-one, or two-to-one, or equivalently to find the secret string $s$.\n", "\n", "Since we're given the promise that $f(x)=f(y)\\implies x=y\\oplus s$, this means that $s=x\\oplus y$ whenever $f(x)=f(y)$. Thus, one way to solve this problem is to find two inputs to the function $f$ that produce the *same* output; $s$ is then the XOR of those two input strings. See [[1]](#References) for more details." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "