<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sergey Shults</title>
    <description>The latest articles on DEV Community by Sergey Shults (@sergey_shults_c5a508dae89).</description>
    <link>https://dev.to/sergey_shults_c5a508dae89</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4249948%2Fd8476e47-9fe6-494c-8633-e103dde81089.png</url>
      <title>DEV Community: Sergey Shults</title>
      <link>https://dev.to/sergey_shults_c5a508dae89</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sergey_shults_c5a508dae89"/>
    <language>en</language>
    <item>
      <title>Schrödinger's Kittens: how I tried to breed quantum cats on IBM processors</title>
      <dc:creator>Sergey Shults</dc:creator>
      <pubDate>Tue, 17 Nov 2026 13:24:18 +0000</pubDate>
      <link>https://dev.to/sergey_shults_c5a508dae89/schrodingers-kittens-how-i-tried-to-breed-quantum-cats-on-ibm-processors-jii</link>
      <guid>https://dev.to/sergey_shults_c5a508dae89/schrodingers-kittens-how-i-tried-to-breed-quantum-cats-on-ibm-processors-jii</guid>
      <description>&lt;h2&gt;
  
  
  Schrödinger's cat: everyone has heard of it
&lt;/h2&gt;

&lt;p&gt;Probably everyone knows about Schrödinger's cat. For those who don't, here's the short version.&lt;/p&gt;

&lt;p&gt;We put a cat in a closed box. The box is completely isolated from the outside world and is in a quantum state. Inside we also put a single radioactive atom, a Geiger counter and a vial of poison. If the atom decays, the counter fires, a hammer smashes the vial, and the cat dies. If it doesn't decay, the cat lives. The chance that the atom decays is exactly 50%.&lt;/p&gt;

&lt;p&gt;And this is where the quantum weirdness begins. Until somebody opens the box, the atom is both "decayed" and "not decayed" at the same time. Which means the cat is simultaneously alive and dead, and it only gets decided when we look inside.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftvlmi43si66z8vwbuyd4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftvlmi43si66z8vwbuyd4.png" alt="Schrödinger's cat: both alive and dead while the box is closed" width="800" height="509"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Schrödinger, by the way, came up with this cat to mock other physicists: look what nonsense you get if you apply quantum mechanics to something big. It turned out the other way around: the cat became the most famous thought experiment in physics.&lt;/p&gt;

&lt;h2&gt;
  
  
  But how do you prove it?
&lt;/h2&gt;

&lt;p&gt;One thing about this story always bothered me. Fine, the cat is "alive and dead" at the same time. But how do you check that experimentally, how do you prove it?&lt;/p&gt;

&lt;p&gt;We open the box, and there's either a live cat or a dead one. Exactly the same would happen with a perfectly ordinary cat. The result is already there, we just don't know it yet. So how do you tell "the cat was in a superposition" from "the cat died long ago, we just didn't know"? Looking into the box once, you can't prove anything.&lt;/p&gt;

&lt;p&gt;And then I had an interesting idea.&lt;/p&gt;

&lt;h2&gt;
  
  
  A cat, a she-cat and 72 days
&lt;/h2&gt;

&lt;p&gt;What if we take two cats? A tomcat and a she-cat.&lt;/p&gt;

&lt;p&gt;We put them in one box with one atom, but rig the poison cleverly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if the atom decays, the cat dies;&lt;/li&gt;
&lt;li&gt;if the atom doesn't decay, the she-cat dies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In normal life one of them is bound to die. The atom either decayed or it didn't, there's no third option.&lt;/p&gt;

&lt;p&gt;But in the quantum world the atom has both decayed and not decayed at the same time. So the cat is "alive and dead", and the she-cat is "alive and dead" too. And since each of them is 50% alive… maybe they get to meet in 25% of cases?&lt;/p&gt;

&lt;p&gt;That's why we open the box not after an hour, but after 72 days. (Of course we leave enough food and water for the whole time. We're not going to hurt the kitties.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvtiinyyugenyj96jxxoh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvtiinyyugenyj96jxxoh.png" alt="A cat and a she-cat in one box: one atom, two poisons, 72 days" width="800" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And kittens would be the proof. Cats are pregnant for about nine weeks, so in 72 days everything has time to happen. If there are kittens in the box, then the cat and the she-cat were alive at the same time, inside their superposition. That doesn't happen in the normal world. But in the quantum world each parent is 50% alive, so both of them should be alive at once in 25% of cases. That is, roughly every fourth box should have kittens waiting for us. Kittens mean the quantum weirdness is proven.&lt;/p&gt;

&lt;p&gt;Well, I do have a box, and I can build the mechanism in my garage… but where do I get quantum cats? (I'm not going to hurt real ones, I love cats.)&lt;/p&gt;

&lt;p&gt;And then it hit me: there are quantum computers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faznmt9h73katbd96epkt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faznmt9h73katbd96epkt.jpg" alt="IBM Quantum System One with the cover off" width="800" height="1062"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Here it is, our box for quantum cats. This is what an IBM quantum computer looks like without its casing: the golden "chandelier" is the refrigerator, and the processor with the qubits is hidden at the very bottom. Photo: OJB Quantum, &lt;a href="https://commons.wikimedia.org/wiki/File:IBM_Quantum_System_One.jpg" rel="noopener noreferrer"&gt;Wikimedia Commons&lt;/a&gt;, CC BY 4.0.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A cat named Qubit
&lt;/h2&gt;

&lt;p&gt;A quantum computer is made of qubits. They're almost the same as ordinary bits, except a qubit can be both 0 and 1 at the same time, each with some probability. That's called superposition. For our experiment they're perfect cats: "1" means alive, "0" means dead.&lt;/p&gt;

&lt;p&gt;We'll need four qubits: an &lt;strong&gt;atom&lt;/strong&gt; that we set exactly "half decayed", a &lt;strong&gt;cat&lt;/strong&gt; and a &lt;strong&gt;she-cat&lt;/strong&gt; (both alive at the start), and a &lt;strong&gt;kitten&lt;/strong&gt; that doesn't exist at the start.&lt;/p&gt;

&lt;p&gt;Then the quantum computer applies three "if X then Y" rules:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If the atom decayed, the cat dies.&lt;/li&gt;
&lt;li&gt;If the atom didn't decay, the she-cat dies.&lt;/li&gt;
&lt;li&gt;If both the cat and the she-cat are alive, a kitten is born.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpt31592ejgee96b8o12h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpt31592ejgee96b8o12h.png" alt="The box as a circuit: atom, cat, she-cat and kitten, then 72 days and we open the box" width="800" height="506"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then we "open" the box: we measure the cat, the she-cat and the kitten. And we repeat the experiment a thousand times to see what comes out and how often.&lt;/p&gt;

&lt;p&gt;We wrote all of this in Python using Qiskit, IBM's free library for quantum computers. There are two programs. The first, a small console app, puts the cats in the box, runs the experiment a thousand times and draws a histogram of who survived how many times. The second is a Jupyter notebook: there you can look inside the box, watch step by step what happens to each cat, and play with "noisy" simulators. Both run on a simulator right on your home PC and on real IBM quantum processors.&lt;/p&gt;

&lt;p&gt;All the code and setup instructions are in the repository, linked in the appendix at the end. And the box itself takes about a dozen lines of Qiskit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;qiskit&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;QuantumCircuit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;QuantumRegister&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;ClassicalRegister&lt;/span&gt;

&lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;she&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;kit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;atom&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;QuantumRegister&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"cat"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"she_cat"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"kitten"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"atom"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;qc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;QuantumCircuit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;she&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;kit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;atom&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;ClassicalRegister&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;qc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;x&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                             &lt;span class="c1"&gt;# the cat is alive&lt;/span&gt;
&lt;span class="n"&gt;qc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;x&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;she&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                             &lt;span class="c1"&gt;# the she-cat is alive&lt;/span&gt;
&lt;span class="n"&gt;qc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pi&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;atom&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;              &lt;span class="c1"&gt;# the atom: 50/50, decayed or not&lt;/span&gt;

&lt;span class="n"&gt;qc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;atom&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                      &lt;span class="c1"&gt;# decayed     -&amp;gt; the cat dies&lt;/span&gt;
&lt;span class="n"&gt;qc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;atom&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;she&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ctrl_state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;        &lt;span class="c1"&gt;# not decayed -&amp;gt; the she-cat dies&lt;/span&gt;
&lt;span class="n"&gt;qc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ccx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;she&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;kit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                 &lt;span class="c1"&gt;# both alive  -&amp;gt; a kitten is born&lt;/span&gt;

&lt;span class="n"&gt;qc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;measure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;she&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;kit&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# open the box&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are only four kinds of quantum operations here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;x&lt;/code&gt;: flips a qubit, 0 becomes 1. That's how we "bring the cats to life" at the start.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ry(π/2)&lt;/code&gt;: rotates a qubit exactly halfway from 0 to 1. That gives us an atom that has decayed with 50% probability.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cx&lt;/code&gt; (CNOT): "if the control qubit is 1, flip the target". With &lt;code&gt;ctrl_state=0&lt;/code&gt; it works the other way round, when the control is 0. These are our two poisons.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ccx&lt;/code&gt; (Toffoli gate): the same, but with two conditions. The kitten flips from 0 to 1 only if both parents are 1.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is what the circuit looks like in Qiskit (time flows left to right):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7o1rmo2rjy12tap8iv05.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7o1rmo2rjy12tap8iv05.png" alt="The box circuit in Qiskit: X, RY, two CNOTs, a Toffoli and measurements" width="800" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Opening the box
&lt;/h2&gt;

&lt;p&gt;First on a simulator, that is, an ideal quantum computer computed right on a home PC. No noise, no errors, pure quantum mechanics.&lt;/p&gt;

&lt;p&gt;Run it. A thousand boxes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F687yto0qb9b5zv41xjww.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F687yto0qb9b5zv41xjww.png" alt="Ideal simulator: 0 kittens out of 1000 boxes" width="800" height="813"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In about half of the boxes the cat is alive, in the other half the she-cat. Kittens…&lt;/p&gt;

&lt;p&gt;Zero. Not a single one. In none of the thousand boxes.&lt;/p&gt;

&lt;p&gt;How can that be? We had such high hopes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why there are no kittens
&lt;/h2&gt;

&lt;p&gt;I had to figure it out. And it turned out the mistake was in how we understood the word "simultaneously".&lt;/p&gt;

&lt;p&gt;We thought each cat was half alive on its own. But actually there are two whole stories in the box at once:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;story one: the atom decayed, the cat is dead, the she-cat is alive;&lt;/li&gt;
&lt;li&gt;story two: the atom didn't decay, the cat is alive, the she-cat is dead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The box lives in both stories at once, but in neither of them are the cat and the she-cat alive together. So the kitten simply has nowhere to come from: you can't glue the cat from one story to the she-cat from another.&lt;/p&gt;

&lt;p&gt;If you look at each cat separately, it has an honest 50/50. But together it's one story for two, like two sides of the same coin: if one is alive, the other is dead. Physicists call this shared fate entanglement. In other words, neither the cat nor the she-cat has its own probability: there's only one joint probability for the two of them, in which the cat and the she-cat are in antiphase.&lt;/p&gt;

&lt;h2&gt;
  
  
  A check: give each one its own atom
&lt;/h2&gt;

&lt;p&gt;To make sure kittens can be born at all, let's change the setup: the cat gets its own atom, the she-cat gets its own, independent one.&lt;/p&gt;

&lt;p&gt;Now it's just like two coins: in a quarter of cases both survive. And the simulator dutifully produced kittens in about 25% of the boxes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvt2c90xtcrh6gs9bq9r9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvt2c90xtcrh6gs9bq9r9.png" alt="Each has its own atom: kittens in every fourth box" width="800" height="813"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So our circuit works. It's just that when the atom is shared, nature doesn't allow kittens.&lt;/p&gt;

&lt;p&gt;So is that it? Did the experiment fail? Not at all. I want a quantum kitten.&lt;/p&gt;

&lt;h2&gt;
  
  
  A real quantum computer and kittens
&lt;/h2&gt;

&lt;p&gt;A simulator is nice, but I want real hardware. IBM gives free access to its quantum processors: sign up, get a key, write the program, run it (all links and instructions are in the appendix), put the job in the queue, wait… It worked. (We're optimists, after all.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F78n5ldarra4sow4k55oy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F78n5ldarra4sow4k55oy.png" alt="Real IBM processor: 201 ghost kittens out of 4000 boxes" width="800" height="813"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We open the results, and…&lt;/p&gt;

&lt;p&gt;Hooray, kittens. We believed! About 5% of the boxes. Let's gather up our kittens:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4231q13mmjuu9gsdj9bc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4231q13mmjuu9gsdj9bc.png" alt="Collecting our kittens: 49, 57, 63 and 32, 201 in total" width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Oh, my little ones… Anyone want a quantum kitten? DM me, I'll give away the first 200 and keep one for myself. Just don't forget to feed them: not all of them have a mom…&lt;/p&gt;

&lt;p&gt;By the way. If you look closely at the litter, something strange is going on with our kittens.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The she-cat is dead, but there's a kitten:&lt;/strong&gt; 89 times. Who gave birth to it? And 32 of them are complete orphans, with both parents dead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The cat is dead, but there's a kitten:&lt;/strong&gt; 63 times. Our sentence is instant, so no "he made it just in time" excuse works here.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Both alive and there's a kitten:&lt;/strong&gt; 49 times. The most "honest" kittens: the poison didn't work, lucky them. But in our box someone has to die, so there's no quantum miracle here either, the vial was just screwed on crooked.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that's not all. In 19 boxes both parents are alive but there are no kittens ("didn't work out"), and in 120 both are dead, even though one of them had to survive. Correct outcomes (exactly one of the two alive, no kittens) came out to 91.5%. Everything else is stories that can't happen either in the normal world or in the quantum one: the device just makes mistakes sometimes. So we've got ghost kittens.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the ghost kittens come from
&lt;/h2&gt;

&lt;p&gt;Ghost kittens are noise, and every processor has its own. We ran the cats on two IBM chips: on ibm_kingston kittens were born in 5% of the boxes, and on ibm_marrakesh in 3.7%. Maybe some other chip will give even more?&lt;/p&gt;

&lt;p&gt;Quantum computers still have a lot of errors, noise in quantum computing. And our ghosts turned out to have three sources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Noise.&lt;/strong&gt; A qubit is a very delicate thing. It lives at a few hundredths of a degree above absolute zero, one of the coldest places in the Universe, more than a hundred times colder than open space. And it still "talks" to the outside world a little. Every such touch slightly blurs the quantum story, and that's enough for a kitten to be born where it shouldn't.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Readout errors.&lt;/strong&gt; When the box is opened, the device sometimes confuses "alive" and "dead". And it more often reads a live one as dead: the excited state of a qubit likes to "slide" down on its own. That's where the extra "both dead" boxes come from.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Seating.&lt;/strong&gt; This one we didn't expect at all. On the chip, the qubits aren't all connected to each other, only to their nearest neighbors, like a honeycomb. And for a kitten to be born, the cat, the she-cat and the kitten have to meet as a threesome. The computer has to move qubit states from place to place, and every move can go wrong. As a result, our small circuit roughly doubled in size on the real chip.&lt;/p&gt;

&lt;p&gt;After compiling for the real processor, the circuit grew a lot. On paper we have three operations: two CNOTs and one Toffoli. But an IBM chip can only do one two-qubit operation natively, CZ, and the Qiskit compiler decomposes everything into it. If all qubits were connected to each other, 8 of them would be enough. But on the real chip with its honeycomb it comes to 14–17, and the circuit depth (how many steps in a row) reaches 54. Here's what our box looks like after compiling for ibm_kingston:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2j4dizny0vvlnxe8zicy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2j4dizny0vvlnxe8zicy.png" alt="The same circuit compiled for the ibm_kingston chip: dozens of operations instead of five" width="800" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you look at the bottom right corner, the cat ends up being measured on qubit 36, and that's where the atom was at the start. The compiler swapped them along the way: that's exactly the "seating" move.&lt;/p&gt;

&lt;p&gt;And we can estimate how many errors pile up. One CZ on such a chip fails in roughly 0.3% of cases, reading one qubit in about 1–2%. 17 operations plus three readouts give somewhere around 8% spoiled boxes. We got 8.5% "wrong" ones, so the estimate almost matches the hardware.&lt;/p&gt;

&lt;p&gt;You can check this at home too: the simulator has a "noisy" mode where you set the errors yourself. The more errors, the more ghost kittens. And the operations where two qubits meet affect them most. With settings similar to the real chip, the simulator gave almost the same picture as kingston.&lt;/p&gt;

&lt;h2&gt;
  
  
  So did we prove it or not?
&lt;/h2&gt;

&lt;p&gt;We did. Just not what we wanted.&lt;/p&gt;

&lt;p&gt;The kittens we were waiting for are not allowed by nature, and the ideal simulator honestly showed it: zero out of a thousand. And the kittens that were born on the real processor are just traces of the hardware still being imperfect.&lt;/p&gt;

&lt;p&gt;But we learned first-hand (well, first-paw, on virtual cats) how superposition works: whole stories live inside it, and you can't mix cats from different stories. And we also found out that you can get your hands on a real quantum computer for free. 90% of the time it behaves like in the textbook, and the remaining 10% is what everyone building these computers is working on right now.&lt;/p&gt;

&lt;h2&gt;
  
  
  Epilogue
&lt;/h2&gt;

&lt;p&gt;And I still have one box sitting closed in my garage.&lt;/p&gt;

&lt;p&gt;As long as I don't open it, the kittens in there both exist and don't.&lt;/p&gt;

&lt;p&gt;To open or not to open, that is the question.&lt;/p&gt;

&lt;h2&gt;
  
  
  Appendix: how to reproduce it
&lt;/h2&gt;

&lt;p&gt;All the code is in the repository &lt;a href="https://github.com/EstariolGH/schrodinger-kittens" rel="noopener noreferrer"&gt;github.com/EstariolGH/schrodinger-kittens&lt;/a&gt;: the console program &lt;code&gt;cats.py&lt;/code&gt; and a Jupyter notebook with pictures and noisy simulators. There's also a step-by-step guide from scratch: how to install Python, sign up for IBM Quantum and run the cats on a real quantum processor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python cats.py                       &lt;span class="c"&gt;# shared atom: no kittens&lt;/span&gt;
python cats.py --mode independent    &lt;span class="c"&gt;# each has its own atom: kittens&lt;/span&gt;
python cats.py --backend ibm         &lt;span class="c"&gt;# a real quantum computer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I'm announcing a contest in two categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"Noisiest"&lt;/strong&gt;: whoever gets the most quantum kittens;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Tidiest"&lt;/strong&gt;: whoever gets the fewest.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Write in the comments which chip you used and how many kittens you got. My record: 201 kittens out of 4000 boxes.&lt;/p&gt;

&lt;h2&gt;
  
  
  P.S. For the most attentive readers
&lt;/h2&gt;

&lt;p&gt;Yes, we know, we noticed it ourselves, we know you've been chuckling at us for half the article.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hole one: symmetry.&lt;/strong&gt; The condition "there will be kittens if both are alive" is actually asymmetric. The cat only has to survive until they meet, but the she-cat has to survive until the birth. If the she-cat is dead, there will be no kittens no matter what the cat does. But actually it doesn't matter: the kitties' fate is decided at the moment the box is opened anyway.&lt;/p&gt;

&lt;p&gt;So here's the thing: this is our &lt;strong&gt;convention&lt;/strong&gt;. In our box the device checks the atom exactly once, at the moment the lid closes. The sentence is passed instantly and in both variants at once: decayed means poison for the cat, not decayed means poison for the she-cat. Which one turns out to be real is decided only when the box is opened. But nobody manages to do anything before the sentence. After that, kittens are only possible if both survived the sentence, and then it no longer matters who has to hold out for how long.&lt;/p&gt;

&lt;p&gt;A quantum computer, by the way, works exactly the same way: first the atom decides the cats' fate, and only then do we check whether a kitten was born. So there are no complaints about the circuit, only about the biology. And biology has always been tricky in quantum physics: even Schrödinger never said whether his cat was fed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hole two: the kittens we were waiting for.&lt;/strong&gt; Now let's look at the litter from the real processor once more. 57 kittens: dad alive, no mom. 63 kittens: mom alive, no dad. Why, that's exactly what we dreamed of at the very beginning. While the box was closed, both parents were 50% alive, they managed to meet, and when the box was opened one of them, alas, turned out to be dead. There it is, the kitten, the evidence is right there.&lt;/p&gt;

&lt;p&gt;So why were we so quick to write them off as ghosts? We, of course, know for sure that this is noise too. But knowing and proving are two very different things. How do you tell such a ghost kitten from a real quantum one? If you figure it out, write in the comments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An honest confession.&lt;/strong&gt; The idea, the experiment, the code and all the IBM runs are mine. Claude helped with the text, the pictures, proofreading and the English translation. So if you sensed AI somewhere, you weren't imagining it.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;No cats were harmed during this experiment.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>quantumcomputing</category>
      <category>python</category>
      <category>qiskit</category>
      <category>science</category>
    </item>
  </channel>
</rss>
