Vincent Russo
http://vprusso.github.io/
Fri, 12 Nov 2021 17:03:08 +0000Fri, 12 Nov 2021 17:03:08 +0000Jekyll v3.9.0The Scirate Python Package<script src="https://apis.google.com/js/platform.js"></script>
<h2 id="the-scirate-python-package">The Scirate Python Package</h2>
<p>I recently cobbled together <a href="https://github.com/vprusso/scirate"><code class="language-plaintext highlighter-rouge">scirate</code></a>, a Python package that can extract information
from the website <a href="https://scirate.com">Scirate</a>. If you are not familiar with Scirate, it’s a website that
aggregates content from <a href="https://arxiv.org/">arXiv</a> and allows users to “scite” papers. Giving a paper a
“scite” is very similar to the “like” or “thumbs up” button on other social media platforms.
Giving a paper a “scite” can range from an endorsement of the content, to interest in the
research, to “Hey, I know the authors and they are nice people”.</p>
<p>When I was a Ph.D. student, Scirate was, and indeed still is, primarily used by researchers
in the quantum information community. Since I am most familiar with this category, along
with the fact that this community is most active on Scirate, we will focus on applying the
<a href="https://github.com/vprusso/scirate"><code class="language-plaintext highlighter-rouge">scirate</code></a> Python package with a focus on quantum physics postings.</p>
<p>For more information on the <a href="https://github.com/vprusso/scirate"><code class="language-plaintext highlighter-rouge">scirate</code></a> Python package I wrote along with documentation,
examples, etc., please consult the following <a href="https://github.com/vprusso/scirate">Github link</a> or official release page on <a href="https://pypi.org/project/scirate/">PyPI</a>.</p>
<h3 id="example-usage">Example Usage</h3>
<p>In this post we will take a look at some examples of how one may make use of this Python
package. Before embarking on these examples, you must have Python installed on your machine.
Currently, the <code class="language-plaintext highlighter-rouge">scirate</code> package supports Python 2.7 and 3.5. You will also require the <code class="language-plaintext highlighter-rouge">pip</code>
module installed to install Python packages. The <code class="language-plaintext highlighter-rouge">scirate</code> package can then be
installed via <code class="language-plaintext highlighter-rouge">pip</code> as</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">pip</span> <span class="n">install</span> <span class="n">scirate</span>
</code></pre></div></div>
<p>Once installed, you will be ready to go. First, we will create a client to interface
with the Scirate website:</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Import the Scirate client module and create a client object.
</span><span class="kn">from</span> <span class="nn">scirate.client</span> <span class="kn">import</span> <span class="n">ScirateClient</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">ScirateClient</span><span class="p">()</span>
</code></pre></div></div>
<p>The client will be responsible for requesting information from Scirate and will serve
as the intermediary for requesting and obtaining data.</p>
<p>For basic examples and usage, you may consult the <a href="https://github.com/vprusso/scirate#examples">README file</a> which lists some of
the more basic functionality and examples of what one can use the <code class="language-plaintext highlighter-rouge">scirate</code> Python
package for. In the next immediate sections, we will be replicating much of what is
already contained in the README to make this post as self-contained as possible. The
final sections will be building on that to explore some slightly more involved examples
that may be of interest.</p>
<h3 id="basic-usage">Basic Usage</h3>
<p>In this basic usage section we will be replicating much of what is present in the README
of the <code class="language-plaintext highlighter-rouge">scirate</code> Python package. If you have already consulted the README, you can
skip over this section.</p>
<h4 id="papers">Papers</h4>
<p>Let us access a paper on Scirate via the arXiv identifier. Say we want to
access information via Scirate on the following listing <a href="https://arxiv.org/abs/1509.01147">1509.01147</a>.</p>
<p>We can grab some of the basic information, such as the authors, title, abstract, arXiv category,
etc.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">scirate.paper</span> <span class="kn">import</span> <span class="n">SciratePaper</span>
<span class="n">paper</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="n">paper</span><span class="p">(</span><span class="s">"1509.01147"</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">paper</span><span class="p">)</span>
<span class="o">>>></span> <span class="s">"The Information Paradox for Black Holes"</span>
<span class="k">print</span><span class="p">(</span><span class="n">paper</span><span class="p">.</span><span class="n">authors</span><span class="p">)</span>
<span class="o">>>></span> <span class="p">[</span><span class="s">'S. W. Hawking'</span><span class="p">]</span>
<span class="k">print</span><span class="p">(</span><span class="n">paper</span><span class="p">.</span><span class="n">abstract</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">50</span><span class="p">])</span>
<span class="o">>>></span> <span class="s">"I propose that the information loss paradox can be"</span>
<span class="k">print</span><span class="p">(</span><span class="n">paper</span><span class="p">.</span><span class="n">category</span><span class="p">)</span>
<span class="o">>>></span> <span class="s">"hep-th"</span>
</code></pre></div></div>
<p>We can also grab some of the more Scirate-specific metrics. Such as the number of
scites for a given article, who scited the article, etc.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">print</span><span class="p">(</span><span class="n">paper</span><span class="p">.</span><span class="n">scites</span><span class="p">)</span>
<span class="o">>>></span> <span class="mi">6</span>
<span class="k">print</span><span class="p">(</span><span class="n">paper</span><span class="p">.</span><span class="n">scitors</span><span class="p">)</span>
<span class="o">>>></span> <span class="p">[</span><span class="s">'Andrew Childs'</span><span class="p">,</span> <span class="s">'Jonny'</span><span class="p">,</span> <span class="s">'Mehdi Ahmadi'</span><span class="p">,</span> <span class="s">'Noon van der Silk'</span><span class="p">,</span> <span class="s">'Ryan L. Mann'</span><span class="p">,</span> <span class="s">'Tom Wong'</span><span class="p">]</span>
</code></pre></div></div>
<p>Consult the documentation for further examples of information that can be obtained
from a paper.</p>
<h4 id="authors">Authors</h4>
<p>You can get information about an author as well.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">scirate.author</span> <span class="kn">import</span> <span class="n">ScirateAuthor</span>
<span class="n">author</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="n">author</span><span class="p">(</span><span class="s">"Terrance"</span><span class="p">,</span> <span class="s">"Tao"</span><span class="p">,</span> <span class="s">"math.CO"</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">author</span><span class="p">)</span>
<span class="o">>>></span> <span class="s">"Terrance Tao"</span>
<span class="k">print</span><span class="p">(</span><span class="n">author</span><span class="p">.</span><span class="n">papers</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="o">>>></span> <span class="s">"An inverse theorem for an inequality of Kneser"</span>
<span class="k">print</span><span class="p">(</span><span class="n">author</span><span class="p">.</span><span class="n">arxiv_ids</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="o">>>></span> <span class="s">"1711.04337"</span>
<span class="n">Using</span> <span class="n">the</span> <span class="n">arXiv</span> <span class="n">identifier</span> <span class="n">along</span> <span class="k">with</span> <span class="n">what</span> <span class="n">we</span> <span class="n">did</span> <span class="ow">in</span> <span class="n">the</span> <span class="n">Papers</span>
<span class="n">section</span><span class="p">,</span> <span class="n">we</span> <span class="n">can</span> <span class="n">obtain</span> <span class="n">further</span> <span class="n">information</span> <span class="n">about</span> <span class="n">that</span> <span class="n">paper</span> <span class="k">if</span>
<span class="n">we</span> <span class="n">wish</span>
<span class="sb">``</span><span class="err">`</span><span class="n">python</span>
<span class="n">paper</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="n">paper</span><span class="p">(</span><span class="n">author</span><span class="p">.</span><span class="n">arxiv_ids</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="k">print</span><span class="p">(</span><span class="n">paper</span><span class="p">.</span><span class="n">scites</span><span class="p">)</span>
<span class="o">>>></span> <span class="mi">0</span>
</code></pre></div></div>
<p>Note that the mathematician Terrance Tao published on multiple arXiv
categories. We can look up his papers under the math.NT category as
well.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">author</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="n">author</span><span class="p">(</span><span class="s">"Terrance"</span><span class="p">,</span> <span class="s">"Tao"</span><span class="p">,</span> <span class="s">"math.NT"</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">author</span><span class="p">.</span><span class="n">papers</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="o">>>></span> <span class="s">"Long gaps in sieved sets"</span>
<span class="k">print</span><span class="p">(</span><span class="n">author</span><span class="p">.</span><span class="n">category</span><span class="p">)</span>
<span class="o">>>></span> <span class="n">math</span><span class="p">.</span><span class="n">NT</span>
</code></pre></div></div>
<h4 id="categories">Categories</h4>
<p>One may also wish to look at papers under various arXiv identifier
listings on Scirate. For instance, one may wish to find all of the
papers posted under the ‘quant-ph’ category posted on September 7, 2017.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">scirate.category</span> <span class="kn">import</span> <span class="n">ScirateCategory</span>
<span class="n">category</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="n">category</span><span class="p">(</span><span class="s">"quant-ph"</span><span class="p">,</span> <span class="s">"09-07-2017"</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">category</span><span class="p">.</span><span class="n">papers</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">2</span><span class="p">])</span>
<span class="o">>>></span> <span class="p">[</span><span class="s">'Quantum Advantage from Conjugated Clifford Circuits'</span><span class="p">,</span> <span class="s">'Extended Nonlocal Games from Quantum-Classical Games'</span><span class="p">]</span>
</code></pre></div></div>
<h4 id="highest-scited-papers-of-the-year">Highest Scited Papers of the Year</h4>
<p>As an example, say we want to determine what the highest scited papers were in the “quant-ph”
category for 2017. We can use Python’s built-in <code class="language-plaintext highlighter-rouge">datetime</code> module to define objects
referring to the start and end date range:</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Use Python's datetime module to set a range of dates. Our range
# starts on the first day of 2017 and ends at the last day of 2017.
</span><span class="kn">import</span> <span class="nn">datetime</span>
<span class="n">start_date</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">.</span><span class="n">date</span><span class="p">(</span><span class="mi">2017</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="n">end_date</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">.</span><span class="n">date</span><span class="p">(</span><span class="mi">2017</span><span class="p">,</span> <span class="mi">12</span><span class="p">,</span> <span class="mi">31</span><span class="p">)</span>
</code></pre></div></div>
<p>We now want to cycle through all of the days within this range and extract the highest number
of scites received for each day. Both of these things are accomplished with the following
snippet of code.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Loop through all days in 2017. Save information on each paper with the
# highest number of scites for each day and store in respective lists.
</span><span class="kn">from</span> <span class="nn">scirate.category</span> <span class="kn">import</span> <span class="n">ScirateCategory</span>
<span class="n">date</span> <span class="o">=</span> <span class="n">start_date</span>
<span class="n">delta</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">.</span><span class="n">timedelta</span><span class="p">(</span><span class="n">days</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="n">max_scites</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">max_scites_dates</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">max_scites_arxiv_ids</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">while</span> <span class="n">d</span> <span class="o"><=</span> <span class="n">end_date</span><span class="p">:</span>
<span class="n">category</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="n">category</span><span class="p">(</span><span class="s">"quant-ph"</span><span class="p">,</span> <span class="n">date</span><span class="p">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">"%Y-%m-%d"</span><span class="p">))</span>
<span class="k">if</span> <span class="n">category</span><span class="p">.</span><span class="n">scites</span> <span class="o">!=</span> <span class="p">[]:</span>
<span class="n">daily_max_scite</span> <span class="o">=</span> <span class="n">category</span><span class="p">.</span><span class="n">scites</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="n">daily_max_arxiv_id</span> <span class="o">=</span> <span class="n">category</span><span class="p">.</span><span class="n">arxiv_ids</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="n">max_scites</span><span class="p">.</span><span class="n">append</span><span class="p">(</span><span class="n">daily_max_scite</span><span class="p">)</span>
<span class="n">max_scites_arxiv_ids</span><span class="p">.</span><span class="n">append</span><span class="p">(</span><span class="n">daily_max_arxiv_id</span><span class="p">)</span>
<span class="n">max_scites_dates</span><span class="p">.</span><span class="n">append</span><span class="p">(</span><span class="n">date</span><span class="p">)</span>
<span class="n">d</span> <span class="o">+=</span> <span class="n">delta</span>
</code></pre></div></div>
<p>The above <code class="language-plaintext highlighter-rouge">while</code> loop goes through each day and checks whether or not there were postings
on that day. If so, we extract the listing with the highest number of scites. This may be
obtained by consulting the zeroth index, as listings are sorted from the highest number of
scites to the lowest. We then store the number of scites that the highest ranked article
has for that day along with the date it was posted and also the arXiv identifier for
later processing.</p>
<p>This code doesn’t take all that long to compute, however, one may wish to only run this
once and store the resulting lists for easy retrieval. To accomplish this, we can make
use of the <code class="language-plaintext highlighter-rouge">pickle</code> module in Python like so:</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Pickle lists to byte files for faster retrieval and to
# avoid excess computation.
</span><span class="kn">import</span> <span class="nn">pickle</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s">'max_scites.pkl'</span><span class="p">,</span> <span class="s">'wb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="n">pickle</span><span class="p">.</span><span class="n">dump</span><span class="p">(</span><span class="n">max_scites</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s">'max_scites_arxiv_ids.pkl'</span><span class="p">,</span> <span class="s">'wb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="n">pickle</span><span class="p">.</span><span class="n">dump</span><span class="p">(</span><span class="n">max_scites_arxiv_ids</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s">'max_scites_dates.pkl'</span><span class="p">,</span> <span class="s">'wb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="n">pickle</span><span class="p">.</span><span class="n">dump</span><span class="p">(</span><span class="n">max_scites_dates</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span>
</code></pre></div></div>
<p>Once the pickled files have been stored, you may load them directly into your script
as opposed to computing the contents from scratch again.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Retrieve pickled files.
</span><span class="n">max_scites</span> <span class="o">=</span> <span class="n">pickle</span><span class="p">.</span><span class="n">load</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="s">'max_scites.pkl'</span><span class="p">,</span> <span class="s">'rb'</span><span class="p">))</span>
<span class="n">max_scites_arxiv_ids</span> <span class="o">=</span> <span class="n">pickle</span><span class="p">.</span><span class="n">load</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="s">'max_scites_arxiv_ids.pkl'</span><span class="p">,</span> <span class="s">'rb'</span><span class="p">))</span>
<span class="n">max_scites_dates</span> <span class="o">=</span> <span class="n">pickle</span><span class="p">.</span><span class="n">load</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="s">'max_scites_dates.pkl'</span><span class="p">,</span> <span class="s">'rb'</span><span class="p">))</span>
</code></pre></div></div>
<p>Now we can determine what the highest number of scites was for 2017.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Print the maximum number of scites over all
# papers of 2017.
</span><span class="nb">max</span><span class="p">(</span><span class="n">max_scites</span><span class="p">)</span>
<span class="o">>>></span> <span class="mi">114</span>
</code></pre></div></div>
<p>The most scited paper on Scirate in 2017 received 114 scites. We can determine
what paper this was by consulting the other list of items that held the arXiv
identifiers of each paper.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Use the paper module in the scirate package to
# extract further information about the highest
# scited paper.
</span><span class="kn">from</span> <span class="nn">scirate.paper</span> <span class="kn">import</span> <span class="n">SciratePaper</span>
<span class="n">arxiv_id</span> <span class="o">=</span> <span class="n">max_scites_arxiv_ids</span><span class="p">[</span><span class="n">max_scites</span><span class="p">.</span><span class="n">index</span><span class="p">(</span><span class="nb">max</span><span class="p">(</span><span class="n">max_scites</span><span class="p">))]</span>
<span class="k">print</span><span class="p">(</span><span class="n">arxiv_id</span><span class="p">)</span>
<span class="o">>>></span> <span class="mf">1704.00690</span>
<span class="n">paper</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="n">paper</span><span class="p">(</span><span class="n">arxiv_id</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">paper</span><span class="p">.</span><span class="n">title</span><span class="p">)</span>
<span class="o">>>></span> <span class="n">Quantum</span> <span class="n">advantage</span> <span class="k">with</span> <span class="n">shallow</span> <span class="n">circuits</span>
<span class="k">print</span><span class="p">(</span><span class="n">paper</span><span class="p">.</span><span class="n">authors</span><span class="p">)</span>
<span class="o">>>></span> <span class="p">[</span><span class="s">'Sergey Bravyi'</span><span class="p">,</span> <span class="s">'David Gosset'</span><span class="p">,</span> <span class="s">'Robert Koenig'</span><span class="p">]</span>
</code></pre></div></div>
<h3 id="total-daily-postings">Total Daily Postings</h3>
<p>In this section, we will take a look at producing a bar chat that displays the cumulative total
of postings for each day of the week over the entire year of 2017. We start off by creating
an empty ordered dictionary that will store the labels for each weekday along with the cumulative
counts of papers published on those days.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">weekday_dict</span> <span class="o">=</span> <span class="n">collections</span><span class="p">.</span><span class="n">OrderedDict</span><span class="p">()</span>
<span class="n">weekday_dict</span><span class="p">[</span><span class="s">"MON"</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">weekday_dict</span><span class="p">[</span><span class="s">"TUE"</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">weekday_dict</span><span class="p">[</span><span class="s">"WED"</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">weekday_dict</span><span class="p">[</span><span class="s">"THU"</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">weekday_dict</span><span class="p">[</span><span class="s">"FRI"</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
</code></pre></div></div>
<p>Now we will range over all of the dates for which postings were made available. We actually
already computed this in the <code class="language-plaintext highlighter-rouge">max_scites_dates</code>. By ranging over these dates and extracting
the year, month, and day, we can determine the number of papers posted on that particular
day with the following snippet of code.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Loop over all dates with postings on Scirate and
# accumulate respective total postings for each
# day of the week.
</span><span class="k">for</span> <span class="n">date</span> <span class="ow">in</span> <span class="n">max_scites_dates</span><span class="p">:</span>
<span class="n">s</span> <span class="o">=</span> <span class="n">date</span><span class="p">.</span><span class="n">split</span><span class="p">(</span><span class="s">"-"</span><span class="p">)</span>
<span class="n">year</span><span class="p">,</span> <span class="n">month</span><span class="p">,</span> <span class="n">day</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">s</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span> <span class="nb">int</span><span class="p">(</span><span class="n">s</span><span class="p">[</span><span class="mi">1</span><span class="p">]),</span> <span class="nb">int</span><span class="p">(</span><span class="n">s</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
<span class="n">d</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">.</span><span class="n">date</span><span class="p">(</span><span class="n">year</span><span class="p">,</span> <span class="n">month</span><span class="p">,</span> <span class="n">day</span><span class="p">)</span>
<span class="n">category</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="n">category</span><span class="p">(</span><span class="s">"quant-ph"</span><span class="p">,</span> <span class="n">d</span><span class="p">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">"%Y-%m-%d"</span><span class="p">))</span>
<span class="k">print</span><span class="p">(</span><span class="n">date</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">category</span><span class="p">.</span><span class="n">papers</span><span class="p">)</span>
<span class="n">weekday_dict</span><span class="p">[</span><span class="n">weekday_list</span><span class="p">[</span><span class="n">d</span><span class="p">.</span><span class="n">weekday</span><span class="p">()]]</span> <span class="o">+=</span> <span class="nb">len</span><span class="p">(</span><span class="n">category</span><span class="p">.</span><span class="n">papers</span><span class="p">)</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s">'weekday_dict.pkl'</span><span class="p">,</span> <span class="s">'wb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="n">pickle</span><span class="p">.</span><span class="n">dump</span><span class="p">(</span><span class="n">weekday_dict</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span>
</code></pre></div></div>
<p>Just as we did before, we will pickle the result so we can refer to it later instead of computing
this every single time. Once we have computed the content to be stored in <code class="language-plaintext highlighter-rouge">weekly_dict</code>, we can
load it in from the pickeled file and produce our bar chart.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Load the pickled file and create a bar chart that
# displays the cumulative number of postings on each
# day of the week.
</span><span class="n">weekday_dict</span> <span class="o">=</span> <span class="n">pickle</span><span class="p">.</span><span class="n">load</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="s">'weekday_dict.pkl'</span><span class="p">,</span> <span class="s">'rb'</span><span class="p">))</span>
<span class="n">weekday_list</span> <span class="o">=</span> <span class="p">[</span><span class="s">"MON"</span><span class="p">,</span> <span class="s">"TUE"</span><span class="p">,</span> <span class="s">"WED"</span><span class="p">,</span> <span class="s">"THU"</span><span class="p">,</span> <span class="s">"FRI"</span><span class="p">]</span>
<span class="n">x</span> <span class="o">=</span> <span class="n">np</span><span class="p">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="n">y</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">weekday_dict</span><span class="p">.</span><span class="n">values</span><span class="p">())</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xticks</span><span class="p">(</span><span class="n">np</span><span class="p">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">5</span><span class="p">),</span> <span class="n">weekday_list</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">bar</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">"Day of Week"</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s">"Total Number of Scites"</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span>
</code></pre></div></div>
<p>Running the above code will generate the following bar chart.</p>
<p align="center">
<center>
<figure>
<img src="https://i.imgur.com/oK07itH.png" alt="Bar chart of weekly postings." />
</figure>
</center>
</p>
<h3 id="conclusion">Conclusion</h3>
<p>This post was just a brief look at the <code class="language-plaintext highlighter-rouge">scirate</code> Python package I wrote and an example of some
of the things you may want to do with it. By all means, if you make use of this module to do
anything interesting, I would most certainly like to see what you have done. Thanks again for
reading, and happy coding!</p>
Thu, 12 Apr 2018 01:58:35 +0000
http://vprusso.github.io/blog/2018/scirate/
http://vprusso.github.io/blog/2018/scirate/pythonsciratequantum informationAn Brief Overview of my Thesis<h3 id="introduction">Introduction</h3>
<p>In early 2017, I completed my Ph.D. in computer science at the <a href="https://uwaterloo.ca/">University of Waterloo</a> and <a href="https://uwaterloo.ca/institute-for-quantum-computing/">Institute for Quantum Computing</a> under my advisors <a href="https://cs.uwaterloo.ca/~watrous">John Watrous</a> and <a href="http://faculty.iqc.uwaterloo.ca/mmosca/">Michele Mosca</a>. I cannot overstate how lucky I was in having both John and Mike as my supervisors. None of this would have been possible without them, and I greatly thank them for all of their time, effort, and help during my Ph.D.</p>
<p>In this post I’ll be giving a “readers digest” version of my thesis that is targeted towards a non-specialist in the field of quantum computing. I will however assume a bit of mathematical background, but nothing beyond what would be generally be taught in an undergraduate mathematics course. I’ll do my best to be as inclusive as possible and provide links where necessary to fill in any gaps that various readers may have.</p>
<p>More information beyond this post may be found in the <a href="https://arxiv.org/abs/1704.07375">“Extended Nonlocal Game”</a> thesis document.</p>
<h3 id="lets-play-a-game">Let’s Play a Game</h3>
<p>In this game, we have two players that we give the names <em>Alice</em> and <em>Bob</em>:</p>
<p align="center">
<center>
<figure>
<img src="http://i.imgur.com/VYukcM5.png" alt="The players: Alice and Bob." />
</figure>
</center>
</p>
<p>Alice and Bob are in separate locations and may not communicate once the game begins. Prior to the game however, Alice and Bob are free to communicate with each other. In addition to the players, there is also another party in this game that is referred to as the <em>referee</em>:</p>
<p align="center">
<center>
<figure>
<img src="http://i.imgur.com/WxilsYS.png" alt="The referee." />
</figure>
</center>
</p>
<p>Alice and Bob want to play in a cooperative fashion against the referee.</p>
<p>Now that we have set the stage with respect to the actors and actresses we will encounter in this game, let us see how it is actually played.</p>
<p align="center">
<center>
<figure>
<img src="http://i.imgur.com/H4QdgfK.png" alt="A nonlocal game." />
</figure>
</center>
</p>
<p>The above figure shows how the game unfolds.</p>
<ol>
<li>
<p>The referee randomly generates questions denoted as $x$ and $y$. The referee sends the question $x$ to Alice and the question $y$ to Bob. The referee also keeps a copy of $x$ and $y$ for reference.</p>
</li>
<li>
<p>Alice and Bob each receive their respective questions. They are then each expected to respond to their questions with answers that we denote as $a$ and $b$. Alice sends $a$ to the referee, and Bob sends $b$.</p>
</li>
<li>
<p>When the referee receives $a$ and $b$ from Alice and Bob, it evaluates a particular function that is predicated on the questions ($x$ and $y$) as well as the answers ($a$ and $b$). The outcome of this function is either $0$ or $1$, where an outcome of $0$ indicates a loss for Alice and Bob and an outcome of $1$ indicates a win for Alice and Bob.</p>
</li>
</ol>
<p>Alice and Bob’s goal in the above game is to get the function in Step 3 to output a $1$, or equivalently, indicate a winning outcome. This type of game is referred to as a <em>nonlocal game</em>. A few additional notes on the above are in order.</p>
<h4 id="public-information">Public Information</h4>
<p>First, let’s be more precise about Step 1 where the referee “randomly” generates questions. More precisely, there is a predefined probability distribution, called $\pi$, that is an artifact of the game being played. Furthermore, Alice, Bob, and the referee are all aware of $\pi$, that is, it is a publicly accessible piece of information. The other piece of publicly accessible information to Alice, Bob, and the referee is the set of questions that the referee is selecting from. A particular game may be defined where</p>
\[\begin{equation}
\pi(x,y) = 1/4, \qquad \text{and} \qquad (x,y) \in \{ (0,0), (0,1), (1,0), (1,1) \}.
\end{equation}\]
<p>The above specifications define a game that has four possible question pairs</p>
\[\begin{equation}
\{ (0,0), (0,1), (1,0), (1,1) \},
\end{equation}\]
<p>each that are chosen according to a uniform distribution (the probability of selecting any of the four questions is one out of four). Alice and Bob of course will not know which of the question pairs were sent to them, but they are aware of the possible set of questions and the distribution with the questions are selected.</p>
<p>So we know that the set of questions as well as the distribution with which they are selected is publicly accessible information. It’s also true that the set of answers that Alice and Bob pick from are publicly known as well. In addition to that, the function that the referee uses to determine if Alice and Bob win is known to Alice and Bob as well. In other words, the players know what values of $x$, $y$, $a$, and $b$ will generate winning outcome, but the trick is that they don’t know what question the other player received.</p>
<h4 id="private-information">Private Information</h4>
<p>So we know that the probability distribution, set of questions, set of answers, and the referee’s predicate function are known to all three parties. What makes the game interesting (and indeed not trivial) is what is <em>not</em> known publicly.</p>
<p>As was mentioned, Alice and Bob are free to communicate prior to the game, but they may <em>not</em> communicate once the game has begun. When the referee sends questions $x$ and $y$ to Alice and Bob, Alice does not know $y$ and Bob does not know $x$.</p>
<h3 id="strategies-for-alice-and-bob">Strategies for Alice and Bob</h3>
<p>So now that we have the basic framework for how a nonlocal game is played, we can proceed to thinking about how Alice and Bob go about playing the game. That is, we consider Alice and Bob’s <em>strategy</em>: how Alice and Bob play the game given access to certain resources.</p>
<p>There are a number of strategies that Alice and Bob could use, but for simplicity, we will restrict our attention to two types of strategies:</p>
<ol>
<li>
<p>Classical Strategy: Alice and Bob answer the questions $x$ and $y$ in a deterministic manner.</p>
</li>
<li>
<p>Quantum Strategy: Alice and Bob may make use of quantum resources in the form of a shared quantum state and respective sets of measurements.</p>
</li>
</ol>
<p>The way in which the “quantum strategy” is defined is purposefully vague for the moment. What is a “shared quantum state”? What does it mean that Alice and Bob have “sets of measurements” and what do those correspond to?</p>
<p>We are going to tie both of these ideas to very concrete objects that are well-studied in the area of linear algebra. That is:</p>
<ol>
<li>Quantum state: We represent a quantum state $\rho$ as a particular type of matrix that has the properties of being positive semidefinite as well as having trace equal to one. For any matrix satisfying both of these conditions, we refer to it as a <em>density matrix</em>.</li>
</ol>
<p>Recall that a matrix is positive semidefinite if its eigenvalues are nonnegative. A matrix that has a trace equal to one is simply a matrix where if you sum along the diagonal, the total is equal to one. For example, the following matrix is both positive semidefinite and has trace equal to one, and is therefore a density matrix</p>
\[\begin{equation}
\frac{1}{2} \begin{pmatrix}
1 & 0 & 0 & 1 \\
0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 \\
1 & 0 & 0 & 1
\end{pmatrix}.
\end{equation}\]
<p>The set of all density matrices is represented as $\text{D}()$.</p>
<ol>
<li>Measurement: We represent a set of measurements as a collection of positive semidefinite matrices that sum to the identity matrix (the matrix whose diagonal consists of 1’s, and 0’s elsewhere). For instance, consider the collection of matrices:</li>
</ol>
\[\begin{equation}
P_{0} = \begin{pmatrix}
1 & 0 \\
0 & 0
\end{pmatrix}
\qquad \text{and} \qquad
P_{1} = \begin{pmatrix}
0 & 0 \\
0 & 1
\end{pmatrix}
\end{equation}\]
<p>It’s easy to check that both $P_0$ and $P_1$ are positive semidefinite and that they sum to the identity</p>
\[\begin{equation}
P_0 + P_1 = \begin{pmatrix}
1 & 0 \\
0 & 1
\end{pmatrix}.
\end{equation}\]
<p>We may sometimes represent the identity operator as $\mathbb{I}$ as a shorthand.</p>
<p>Now that we have some semblance of what a “state” and “measurement” are in mathematical terms, let us proceed to an example game where Alice and Bob use a classical strategy and a quantum strategy.</p>
<h3 id="the-chsh-game">The CHSH Game</h3>
<p>Let us define the following game where the possible pairs of questions $(x,y)$ sent from the referee to Alice and Bob are any of the four possible pairs ${ (0,0), (0,1), (1,0), (1,1) }$. Each of the four question pairs are selected uniformly. Alice and Bob win this particular game if and only if</p>
\[\begin{equation}
a \oplus b = x \land y
\end{equation}\]
<p>is satisfied. Recall that $\oplus$ refers to the XOR operation and the $\land$ symbol refers to the logical AND operation. For reference, the truth tables for both XOR and logical AND are given below, respectively.</p>
<p align="center">
<center>
<figure>
<img src="http://i.imgur.com/JpKuQwb.png?1" alt="XOR and logical AND truth tables." />
</figure>
</center>
</p>
<p>Now let’s take a look at how Alice and Bob can play the CHSH game when they use either a classical or quantum strategy.</p>
<h4 id="chsh--classical-strategy">CHSH : Classical Strategy</h4>
<p>Before we go on, I need to introduce a quantity referred to as the <em>classical value</em> of a game. For our purposes, we can assume that this quantity refers to the maximal winning probability for Alice and Bob to win over all classical strategies. In other words, the value of a given game is a quantity that corresponds to the best that Alice and Bob can do given access to classical resources.</p>
<p>For any nonlocal game, $G$, we denote the classical value of the game $G$ as $\omega(G)$.</p>
<p>In this section, we want to calculate $\omega(G_{CHSH})$, where $G_{CHSH}$ is the CHSH game. First, recall that Alice and Bob win if and only if $a \oplus b = x \land y$. Consider the following table</p>
<p align="center">
<center>
<figure>
<img src="http://i.imgur.com/LrlPXIE.png?1" alt="CHSH truth table." />
</figure>
</center>
</p>
<p>The first column corresponds to each of the possible question pairs that Alice and Bob may receive and the second column corresponds to what the value of $a \oplus b$ must evaluate to in order for Alice and Bob to win.</p>
<p>Is it possible for Alice and Bob to win for every single question pair they receive with certainty? It turns out that if Alice and Bob use a classical strategy, the answer to this question is “no”. To see why, consider the following equations:</p>
\[\begin{equation}
\begin{aligned}
a_0 \oplus b_0 = 0, &\qquad a_0 \oplus b_1 = 0, \\
a_1 \oplus b_0 = 0, &\qquad a_1 \oplus b_1 = 1.
\end{aligned}
\end{equation}\]
<p>In the above equation, $a_x$ is Alice’s answer in the event that she receives question $x$ from the referee for $x \in {0,1}$ and similarly for Bob. These equations express the winning conditions that Alice and Bob must satisfy in order to perfectly win the CHSH game. That is, if it’s possible to satisfy all of these equations simultaneously, it’s not possible for them to lose. This is not the case however, as we’ve mentioned.</p>
<p>This can be observed by adding up the equations mod $2$. If we do so, we arrive at a contradiction, that is adding up the left-hand side we obtain a value of $0$, and adding up the right-hand side we obtain a value of $1$, giving us a contradiction of $0 = 1$.</p>
<p>So we surely cannot simultaneously satisfy all four of the equations. However, it is possible to satisfy three out of the four equations. This can be achieved if Alice and Bob always send $1$ as their response, no matter what input they receive. That is if $a_0 = b_0 = a_1 = b_1 = 1$, we have that the equations</p>
\[\begin{equation}
\begin{aligned}
a_0 \oplus b_0 = 0, &\qquad a_0 \oplus b_1 = 0, \\
a_1 \oplus b_0 = 0, &
\end{aligned}
\end{equation}\]
<p>are satisfied. In other words, the classical value of the CHSH game is $3/4$, or stated in an equivalent way</p>
\[\begin{equation}
\omega(G_{CHSH}) = 3/4 = 0.75.
\end{equation}\]
<h4 id="chsh--quantum-strategy">CHSH : Quantum Strategy</h4>
<p>Just as we had a quantity referred to as the classical value of a game, there is a similar quantity referred to as the quantum value of a game. That is the <em>quantum value</em> of a game refers to the maximal winning probability for Alice and Bob to win over all quantum strategies. Again, in simpler terms, this quantity represents the best that Alice and Bob can do for a given nonlocal game when they invoke a quantum strategy.</p>
<p>For any nonlocal game, $G$, we denote the quantum value of the game $G$ as $\omega^*(G)$.</p>
<p>In this section, we want to calculate $\omega^*(G_{CHSH})$.</p>
<p>Implicit in Alice and Bob’s use of a quantum strategy is that they will make use of a quantum state and sets of measurements as their quantum resources. The following figure explicitly shows a state $\sigma$ that is shared between Alice and Bob.</p>
<p align="center">
<center>
<figure>
<img src="http://i.imgur.com/wkmGYnn.png" alt="Alice and Bob use a quantum strategy for the CHSH game." />
</figure>
</center>
</p>
<p>The $\mathsf{U}$ and $\mathsf{V}$ letters in the figure are referred to as <em>registers</em> and they represent physical systems that store quantum information on space $\mathcal{U}$ and $\mathcal{V}$.</p>
<p>What’s very intriguing about the CHSH game is that it’s an example of a nonlocal game where the players can do <em>strictly better</em> if they make use of a quantum strategy instead of a classical one. The quantum strategy that allows Alice and Bob to do strictly better is given as</p>
<ol>
<li>
<p>Alice and Bob prepare a <em>quantum state</em>:</p>
\[\sigma = \frac{1}{2} \begin{pmatrix}
1 & 0 & 0 & 1 \\
0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 \\
1 & 0 & 0 & 1
\end{pmatrix} \in \text{D}(\mathcal{U} \otimes \mathcal{V}).\]
</li>
<li>
<p>The referee sends question $x$ to Alice and $y$ to Bob.</p>
</li>
<li>
<p>Alice and Bob perform a <em>measurement</em> on their system. The outcome of this measurement yields their answers $a$ and $b$. Specifically, Alice and Bob have collections of measurements</p>
\[\{ A_a^x : a \in \Gamma_{\text{A}} \} \subset \text{Pos}(\mathcal{U}) \quad \text{and} \quad \{ B_b^y : b \in \Gamma_{\text{B}} \} \subset \text{Pos}(\mathcal{V}),\]
<p>such that</p>
\[\sum_{a \in \Gamma_{\text{A}}} A_a^x = \mathbb{I}_{\mathcal{U}} \quad \text{and} \quad \sum_{b \in \Gamma_{\text{B}}} B_b^y = \mathbb{I}_{\mathcal{V}}\]
</li>
<li>
<p>The referee determines whether Alice and Bob win or lose, based on the questions $x$ and $y$ as well as the answers $a$ and $b$.</p>
</li>
</ol>
<p>Let us elaborate a bit more on Step 3, where Alice and Bob perform a measurement on their system. When Alice and Bob apply their measurements to registers $\mathsf{U}$ and $\mathsf{V}$.</p>
<ol>
<li>
<p>Answers $a \in \Gamma_{\text{A}}$ and $b \in \Gamma_{\text{B}}$ are obtained at random. The probability of outcomes $a$ and $b$ given questions $x$ and $y$ is</p>
\[p(a,b|x,y) = \langle A_a^x \otimes B_b^y, \sigma \rangle,\]
<p>for all $a \in \Gamma_{\text{A}}$ and $b \in \Gamma_{\text{B}}$.</p>
</li>
<li>
<p>The registers $\mathsf{U}$ and $\mathsf{V}$ are no longer accessible post-measurement.</p>
</li>
</ol>
<p>As we mentioned before, Alice and Bob’s measurements are described by positive semidefinite operators, and for $G_{CHSH}$ these specific measurement operators correspond to the following matrices</p>
<p>Alice’s measurements:</p>
\[A_0^0 = \begin{pmatrix}
1 & 0 \\
0 & 0
\end{pmatrix}, \qquad
A_1^0 = \begin{pmatrix}
0 & 0 \\
0 & 1
\end{pmatrix}, \\
A_1^0 = \frac{1}{2} \begin{pmatrix}
1 & 1 \\
1 & 1
\end{pmatrix}, \qquad
A_1^1 = \frac{1}{2} \begin{pmatrix}
1 & -1 \\
-1 & 1
\end{pmatrix}.\]
<p>Bob’s measurements:</p>
\[B_0^0 = \begin{pmatrix}
c & cs \\
cs & s^2
\end{pmatrix}, \qquad
B_1^0 = \begin{pmatrix}
s^2 & -cs \\
-cs & c^2
\end{pmatrix}, \\
B_1^0 = \begin{pmatrix}
c^2 & -cs \\
-cs & s^2
\end{pmatrix}, \qquad
B_1^1 = \begin{pmatrix}
s^2 & cs \\
cs & c^2
\end{pmatrix},\]
<p>where $c = \cos(\pi/8)$ and $s = \sin(\pi/8)$. The probability that Alice and Bob win using a quantum strategy is given by the equation</p>
\[\sum_{x,y \in \Sigma_\text{A} \times \Sigma_{\text{B}}} \pi(x,y) \sum_{a, b \in \Gamma_{\text{A}} \times \Gamma_{\text{B}}} \langle A_a^x \otimes B_b^y, \sigma \rangle.\]
<p>Intuitively, the above equation is summing over all possible question and answer pairs for a given game, and then calculating the inner product between the measurements that Alice and Bob make on the state that they share for a given set of questions and answers. Expanding the above equation for the CHSH game where Alice and Bob use the quantum strategy as we’ve defined it gives us</p>
\[\frac{1}{4} \left( \langle A_0^0 \otimes B_0^0, \sigma \rangle + \langle A_1^0 \otimes B_1^0, \sigma \rangle \right) + \frac{1}{4} \left( \langle A_0^0 \otimes B_0^1, \sigma \rangle + \langle A_1^0 \otimes B_1^1, \sigma \rangle \right) + \\
\frac{1}{4} \left( \langle A_0^1 \otimes B_0^0, \sigma \rangle + \langle A_1^1 \otimes B_1^0, \sigma \rangle \right) + \frac{1}{4} \left( \langle A_0^1 \otimes B_1^1, \sigma \rangle + \langle A_1^1 \otimes B_0^1, \sigma \rangle \right) \\
= \cos^2(\pi/8) \approx 0.8536 \\\]
<p>What we have here then is a nonlocal game where the players, Alice and Bob, do strictly better when they make use of a quantum strategy, where they win the game with $\cos(\pi/8) \approx 0.8536$ probability, versus the best that they can do when they use a classical strategy where they win the game with $3/4 = 0.75$ probability. Isolating tasks for which quantum resources perform better than classical resources is one of the primary motivating factors in studying quantum computation.</p>
<h4 id="a-word-on-calculating-quantum-values">A Word on Calculating Quantum Values</h4>
<p>In the previous example, we saw that it was possible to directly calculate the quantum value of the CHSH game. In general however, if someone was to provide an arbitrary nonlocal game, it is not a straight forward task to calculate this quantity. The CHSH game happened to have a lot of nice structure that allows a more straightforward analysis, but in general this is a hard problem. Getting into this problem in detail is beyond the scope of this blog post, but if you’re inclined to read more about this, Chapter 5 of my thesis speaks more on this issue, and provides a number of great resources that explain it in far greater than in my thesis.</p>
<h3 id="extended-nonlocal-games">Extended Nonlocal Games</h3>
<p>An extended nonlocal game is what it sounds like, an “extension” of the nonlocal game framework. As a result, much of what we know about nonlocal games will carry over to extended nonlocal games. The following image is one of an extended nonlocal game, and indeed it looks quite similar to the nonlocal game setting.</p>
<p align="center">
<center>
<figure>
<img src="http://i.imgur.com/HQtCVmf.png" alt="An extended nonlocal game." />
</figure>
</center>
</p>
<p>Indeed, an extended nonlocal game looks very similar to a nonlocal game (with the exception of what appears as a blue line in the figure above). We now briefly discuss how an extended nonlocal game is played.</p>
<ol>
<li>
<p>Alice and Bob prepare a quantum state in registers $\left( \mathsf{X}, \mathsf{R}, \mathsf{Y} \right)$. Alice and Bob then send register $\mathsf{R}$ to the referee.</p>
</li>
<li>
<p>The referee then randomly generates questions denoted as $x$ and $y$. The referee sends the question $x$ to Alice and the question $y$ to Bob. The referee also keeps a copy of $x$ and $y$ for reference.</p>
</li>
<li>
<p>Alice and Bob each receive their respective questions. They are then each expected to respond to their questions with answers that we denote as $a$ and $b$. Alice sends $a$ to the referee, and Bob sends $b$.</p>
</li>
<li>
<p>When the referee receives $a$ and $b$ from Alice and Bob, it performs a measurement ${ P_{a,b,x,y}, \mathbb{I} - P_{a,b,x,y} }$ on register $\mathsf{R}$ based on the question $x$ and $y$ as well as the answers $a$ and $b$. The outcome of this measurement is either $0$ or $1$, where an outcome of $0$ indicates a loss for Alice and Bob and an outcome of $1$ indicates a win for Alice and Bob.</p>
</li>
</ol>
<p>Alice and Bob’s goal in the above game is to get the measurement in Step 4 to output a $1$, or indicate a winning outcome. This type of game is referred to as an extended nonlocal game.</p>
<h4 id="strategies-and-values-for-extended-nonlocal-games">Strategies and Values for Extended Nonlocal Games</h4>
<p>Just as we defined the notion of a strategy and value for a nonlocal game, it’s a natural extension to define a similar notion for the class of extended nonlocal games.</p>
<p>For nonlocal games we discussed classical and quantum strategies as well as their corresponding values. For extended nonlocal games, the closest analogues to these types of strategies are referred to respectively as</p>
<ol>
<li>Unentangled strategies,</li>
<li>Standard quantum strategies.</li>
</ol>
<p>The <em>value</em> of an extended nonlocal game (similar to a nonlocal game) is the maximal winning probability for the players to win over all strategies of a specified type. For an extended nonlocal game, $G$,</p>
<ol>
<li>Unentangled value: $\omega(G)$,</li>
<li>Standard quantum value: $\omega^*(G)$.</li>
</ol>
<h4 id="types-of-extended-nonlocal-games">Types of Extended Nonlocal Games</h4>
<p>In this section, we will take a look at a very specific type of extended nonlocal game called a <em>monogamy-of-entanglement game</em>, which were originally introduced in [this paper][1].</p>
<p align="center">
<center>
<figure>
<img src="http://i.imgur.com/YsVW0XW.png" alt="A monogamy-of-entanglement game." />
</figure>
</center>
</p>
<p>The monogamy-of-entanglement game proceeds in a manner that is almost identical to an extended nonlocal game. This time, Alice and Bob receive the <em>same</em> question, $x$, from the referee (instead of Alice receiving $x$ and Bob receiving $y$). Once Alice and Bob obtain their questions, they produce their answers and send them back to the referee. The referee then performs a measurement on its system. Alice and Bob win if and only if the outcome of the referee’s measurement matches the answers that Alice and Bob sent back to the referee.</p>
<p>To make this a bit more concrete, we can take a look at a specific monogamy-of-entanglement game that is referred to as the BB84 game. The name comes from the BB84 quantum cryptographic protocol scheme and is named as such because the measurements that the referee uses in this game are defined as the so-called BB84 bases, which we will explicitly define and write out.</p>
<p>Specifically, the BB84 game (or $G_{BB84}$ for short) is defined by:</p>
<ol>
<li>
<p>Question and answer sets:</p>
\[\Sigma = \Gamma = \{0,1\}.\]
</li>
<li>
<p>Uniform probability for questions:</p>
\[\pi(0) = \pi(1) = \frac{1}{2}\]
</li>
<li>
<p>Referee’s measurements are defined by the <em>“BB84 bases”</em>:</p>
\[\text{For $x = 0$}: \quad P_{0,0} = \begin{pmatrix}
1 & 0 \\
0 & 0
\end{pmatrix},
\qquad
P_{1,0} = \begin{pmatrix}
0 & 0 \\
0 & 1
\end{pmatrix}. \\
\text{For $x = 1$}: \quad P_{0,1} = \frac{1}{2} \begin{pmatrix}
1 & 1 \\
1 & 1
\end{pmatrix}, \qquad
P_{1,1} = \frac{1}{2} \begin{pmatrix}
1 & -1 \\
-1 & 1
\end{pmatrix}.\]
</li>
</ol>
<p>The scenarios in which Alice and Bob obtain a winning outcome for $G_{BB84}$ is depicted by the following four possible games:</p>
<p align="center">
<center>
<figure>
<img src="http://i.imgur.com/Z2wbWKF.png" alt="Winning scenarios for BB84 game." />
</figure>
</center>
</p>
<p>Techniques that are beyond the scope of this blog post allow us to either directly calculate or bound the value of monogamy-of-entanglement games. More information may be found in [2] and [3].</p>
<p>One property of the BB84 monogamy-of-entanglement game that was found in [1], was that the unentangled and standard quantum value of $G_{BB84}$ were the same. Specifically, the authors showed that</p>
\[\omega(G_{BB84}) = \omega^*(G_{BB84}) = \cos^2(\pi/8) \approx 0.8536.\]
<p>One reason this is interesting is that this implies that Alice and Bob gain <em>no</em> advantage in using quantum resources for the BB84 game. A question one may ask in this setting is if this type of behavior persists for every monogamy-of-entanglement game. The punchline to this question is that for certain classes of monogamy-of-entanglement games, it does turn out that Alice and Bob gain no advantage when using a quantum strategy. However, there does exist at least one example of a monogamy-of-entanglement game where Alice and Bob do indeed gain an advantage when they adopt a quantum strategy.</p>
<p>We can take a look at the monogamy-of-entanglement game that allows Alice and Bob to do strictly better in the event that they use a quantum strategy. This game consists of four possible questions and three possible answers. The way in which this game is defined, we have that</p>
<ol>
<li>
<p>Question and answer sets:</p>
\[\Sigma = \{0,1,2,3\}, \quad \Gamma = \{0,1,2\}.\]
</li>
<li>
<p>Uniform probability for questions:</p>
\[\pi(0) = \pi(1) = \pi(2) = \pi(3) = \frac{1}{4}.\]
</li>
<li>
<p>Measurements defined by a mutually unbiased basis:</p>
\[\{ P_{0,x}, P_{1,x}, P_{2,x} \}.\]
</li>
</ol>
<p>It’s possible to perform an exhaustive search over all unentangled strategies, which reveals that the optimal unentangled value is</p>
\[\omega(G) = \frac{3 + \sqrt{5}}{8} \approx 0.6545.\]
<p>Alternatively, a computer search over standard quantum strategies and a heuristic approximation for the upper bound of $\omega^*(G)$ reveals that</p>
\[2/3 \geq \omega^*(G) \geq 0.6609.\]
<p>This ability to compute upper bounds for monogamy-of-entanglement games (and indeed more generally for extended nonlocal games) is obtained from an adaptation of a technique known as the <em>QC hierarchy</em> or <em>NPA hierarchy</em>. Elaborating on this technique is most likely a topic for another post, but further information on these techniques may be found in [4],[5], and [6].</p>
<h3 id="conclusion">Conclusion</h3>
<p>The purpose of this post was to distill some of the primary results in my thesis into a blog post form. In doing so, there will inevitably be some information loss as there is anytime a simplification is performed. For the reader who is inclined to learn more details about the above, I encourage you to take a look at the thesis document [3]. I also encourage you to reach out to me if anything I’ve said either in this post or in my thesis is unclear or if you have any questions. Feel free to contact me either by email or in the comments section of this post, and I’ll do my best to get back to you as soon as I can.</p>
<p>Thanks again for taking the time to read this (or taking the time to scroll all the way to the bottom :) ).</p>
<h3 id="references">References:</h3>
<p>[1] “A monogamy of entanglement game with applications to device independent quantum cryptography”,<br />
M. Tomamichel, S. Fehr, J. Kaniewski, S. Wehner.,<br />
New Journal of Physics, IOP Publishing, 2013, 15, 103002, <br />
ArXiv: <a href="http://arxiv.org/abs/1210.4359">arxiv:1210.4359</a><br />
<br />
[2] “Extended nonlocal games and monogamy-of-entanglement games”, <br />
N. Johnston, R. Mittal, V. Russo, J. Watrous,<br />
Proc. R. Soc. A, 2016, 472, 20160003, 2016,<br />
ArXiv: <a href="https://arxiv.org/abs/1510.02083">arxiv:1510.02083</a><br />
<br />
[3] “Extended nonlocal games”, <br />
V. Russo,<br />
ArXiv: <a href="https://arxiv.org/abs/1704.07375">arxiv:1510.02083</a><br />
<br />
[4] “Bounding the set of quantum correlations”,<br />
M. Navascues, S. Pironio, A. Acin,<br />
Physical Review Letters, 98:010401, 2007,<br />
ArXiv: <a href="https://arxiv.org/abs/quant-ph/0607119">arxiv:quant-ph/0607119</a><br />
<br />
[5] “A convergent hierarchy of semidefinite programs characterizing the set of quantum correlations”,<br />
M. Navascues, S. Pironio, A. Acin,
New Journal of Physics, 10(7):073013, 2008,
ArXiv: <a href="https://arxiv.org/abs/0803.4290">arxiv:quant-ph/0803.4290</a></p>
<p>[6] “The quantum moment problem and bounds on entangled multi-prover games”,
A. Doherty, Y.C. Liang, B. Toner, S. Wehner,
Computation Complexity, 23rd Annual IEEE Conference, 2008,
ArXiv: <a href="https://arxiv.org/abs/0803.4373">arxiv:0803.4373</a></p>
Thu, 01 Jun 2017 01:58:35 +0000
http://vprusso.github.io/blog/2017/an-overview-of-my-thesis/
http://vprusso.github.io/blog/2017/an-overview-of-my-thesis/mathcomputer sciencequantum computingnonlocal gamesmath,computerscience,quantumcomputing,nonlocalgames