Esempio n. 1
0
    def testSingletBetweenAlice1AndBobAndLocalOtherwiseIsNotInPolytope(self):
        scenario = SequentialBellScenario([[2, 2], [2, 2]], [2, 2])
        alice1blochVectors = [[1, 0, 0], [0, 1, 0]]
        alice1Observables = list(
            map(lambda bloch: createQubitObservable(bloch),
                alice1blochVectors))
        alice1Krauss = list(
            map(
                lambda qubitObservable: projectorsForQubitObservable(
                    qubitObservable), alice1Observables))

        bobUnBlochVectors = [[-1, -1, 0], [-1, 1, 0]]
        bobObservables = list(
            map(lambda bloch: createQubitObservable(bloch), bobUnBlochVectors))
        bobEffects = list(
            map(
                lambda qubitObservable: projectorsForQubitObservable(
                    qubitObservable), bobObservables))

        psi = createMaxEntState(2)

        expectedCorrelations = {((x1, x2), y, (a1, a2), b): int(
            (a2 == 0)) * ((qt.tensor(alice1Krauss[x1][a1], bobEffects[y][b]) *
                           psi * psi.dag()).tr())
                                for ((x1, x2), y, (a1, a2),
                                     b) in scenario.getTuplesOfEvents()}
        expectedBehaviour = Behaviour(scenario, expectedCorrelations)
        poly = SequentialBellPolytope(scenario)
        self.assertFalse(poly.contains(expectedBehaviour.getProbabilityList()))
Esempio n. 2
0
    def testRandProjMeasBetweenAlice1andBob(self):
        scenario = SequentialBellScenario([[2, 2], [2, 2]], [2, 2])
        alice1blochVectors = [[1, 0, 0], [0, 1, 0]]
        alice1Observables = list(
            map(lambda bloch: createQubitObservable(bloch),
                alice1blochVectors))
        alice1Krauss = list(
            map(
                lambda qubitObservable: projectorsForQubitObservable(
                    qubitObservable), alice1Observables))

        phases = [
            np.random.uniform(-np.pi / 2, np.pi / 2),
            np.random.uniform(-np.pi / 2, np.pi / 2)
        ]
        alice2blochVectors = [[np.sin(theta), 0,
                               np.cos(theta)] for theta in phases]
        alice2Observables = list(
            map(lambda bloch: createQubitObservable(bloch),
                alice2blochVectors))
        alice2Effects = list(
            map(
                lambda qubitObservable: projectorsForQubitObservable(
                    qubitObservable), alice2Observables))

        phasesBob = [
            np.random.uniform(-np.pi / 2, np.pi / 2),
            np.random.uniform(-np.pi / 2, np.pi / 2)
        ]
        bobVectors = [[np.sin(theta), 0, np.cos(theta)] for theta in phasesBob]
        bobObservables = list(
            map(lambda bloch: createQubitObservable(bloch), bobVectors))
        bobEffects = list(
            map(
                lambda qubitObservable: projectorsForQubitObservable(
                    qubitObservable), bobObservables))

        aux = alice1Krauss
        alice1Krauss = alice2Effects
        alice2Effects = aux

        psi = createMaxEntState(2)
        rho = psi * psi.dag()
        expectedCorrelations = {}
        for x1 in range(2):
            for a1 in range(2):
                postMeasrmntState = qt.tensor(
                    alice1Krauss[x1][a1], qt.qeye(2)) * rho * (qt.tensor(
                        alice1Krauss[x1][a1], qt.qeye(2))).dag()
                for x2, y, a2, b in product(range(2), repeat=4):
                    expectedCorrelations[(x1, x2), y, (a1, a2), b] = (
                        qt.tensor(alice2Effects[x2][a2], bobEffects[y][b]) *
                        postMeasrmntState).tr().real
        expectedBehaviour = Behaviour(scenario, expectedCorrelations)

        poly = BellPolytopeWithOneWayCommunication(
            SequentialBellPolytope(scenario))
        self.assertTrue(poly.contains(expectedBehaviour.getProbabilityList()),
                        'phases:' + str(phases[0]) + ', ' + str(phases[1]))
Esempio n. 3
0
    def testCHSHBetweenAlice1AndBobAndIdentityInAlice2IsInPolytope(self):
        scenario = SequentialBellScenario([[2, 2], [2, 2]], [2, 2])
        alice1blochVectors = [[1, 0, 0], [0, 1, 0]]
        alice1Observables = list(
            map(lambda bloch: createQubitObservable(bloch),
                alice1blochVectors))
        alice1Krauss = list(
            map(
                lambda qubitObservable: projectorsForQubitObservable(
                    qubitObservable), alice1Observables))

        alice2Effects = [[qt.qeye(2), 0 * qt.qeye(2)],
                         [qt.qeye(2), 0 * qt.qeye(2)]]

        bobUnBlochVectors = [[-1, -1, 0], [-1, 1, 0]]
        bobObservables = list(
            map(lambda bloch: createQubitObservable(bloch), bobUnBlochVectors))
        bobEffects = list(
            map(
                lambda qubitObservable: projectorsForQubitObservable(
                    qubitObservable), bobObservables))

        psi = createMaxEntState(2)

        rho = psi * psi.dag()
        expectedCorrelations = {}
        for x1 in range(2):
            for a1 in range(2):
                postMeasrmntState = qt.tensor(
                    alice1Krauss[x1][a1], qt.qeye(2)) * rho * (qt.tensor(
                        alice1Krauss[x1][a1], qt.qeye(2))).dag()
                for x2, y, a2, b in product(range(2), repeat=4):
                    expectedCorrelations[(x1, x2), y, (a1, a2), b] = (
                        qt.tensor(alice2Effects[x2][a2], bobEffects[y][b]) *
                        postMeasrmntState).tr().real
        expectedBehaviour = Behaviour(scenario, expectedCorrelations)

        poly = BellPolytopeWithOneWayCommunication(
            SequentialBellPolytope(scenario))
        self.assertTrue(poly.contains(expectedBehaviour.getProbabilityList()))
Esempio n. 4
0
            map(
                lambda bloch: effectForQubitPovm(
                    1 / 3, sum([paulies[i] * bloch[i] for i in range(3)])),
                trineAlice2)))

    mu = np.arctan(np.sin(2 * epsilon))
    bobUnBlochVectors = [[np.sin(mu), 0, np.cos(mu)],
                         [-np.sin(mu), 0, np.cos(mu)]]
    bobObservables = list(
        map(lambda bloch: createQubitObservable(bloch), bobUnBlochVectors))
    bobEffects = list(
        map(
            lambda qubitObservable: projectorsForQubitObservable(
                qubitObservable), bobObservables))

    psi = createMaxEntState(2)
    rho = psi * psi.dag()

    expectedCorrelations = {}
    for x1, x2, y in product(range(len(alice1outputs)),
                             range(len(alice2outputs)),
                             range(len(bobOutputs))):
        for a1, a2, b in product(range(alice1outputs[x1]),
                                 range(alice2outputs[x2]),
                                 range(bobOutputs[y])):
            postMeasrmntState = qt.tensor(
                alice1Krauss[x1][a1], qt.qeye(2)) * rho * (qt.tensor(
                    alice1Krauss[x1][a1], qt.qeye(2))).dag()
            expectedCorrelations[(x1, x2), y, (a1, a2), b] = (
                qt.tensor(alice2Effects[x2][a2], bobEffects[y][b]) *
                postMeasrmntState).tr().real
Esempio n. 5
0
    def testSeqStratForOptimalRandIsSimulable(self):
        alice1outputs = [2, 2]
        alice2outputs = [2, 2, 3]
        bobOutputs = [2, 2]
        sequentialScenario = SequentialBellScenario(
            [alice1outputs, alice2outputs], bobOutputs)
        alice1blochVectors = [[0, 0, 1]]
        alice1Observables = list(
            map(lambda bloch: createQubitObservable(bloch),
                alice1blochVectors))
        alice1Krauss = list(
            map(
                lambda qubitObservable: projectorsForQubitObservable(
                    qubitObservable), alice1Observables))

        epsilon = 7 * np.pi / 32
        plus = 1 / np.sqrt(2) * (qt.basis(2, 0) + qt.basis(2, 1))
        minus = 1 / np.sqrt(2) * (qt.basis(2, 0) - qt.basis(2, 1))
        Kplus = np.cos(epsilon) * plus * plus.dag() + np.sin(
            epsilon) * minus * minus.dag()
        Kminus = -np.cos(epsilon) * minus * minus.dag() + np.sin(
            epsilon) * plus * plus.dag()

        alice1Krauss.append([Kplus, Kminus])

        alice2blochVectors = [[0, 0, 1], [1, 0, 0]]
        alice2Observables = list(
            map(lambda bloch: createQubitObservable(bloch),
                alice2blochVectors))
        alice2Effects = list(
            map(
                lambda qubitObservable: projectorsForQubitObservable(
                    qubitObservable), alice2Observables))
        trineAlice2 = [[0, 0, 1],
                       [np.sin(2 * np.pi / 3), 0,
                        np.cos(2 * np.pi / 3)],
                       [np.sin(4 * np.pi / 3), 0,
                        np.cos(4 * np.pi / 3)]]
        paulies = [qt.sigmax(), qt.sigmay(), qt.sigmaz()]
        alice2Effects.append(
            list(
                map(
                    lambda bloch: effectForQubitPovm(
                        1 / 3, sum(
                            [paulies[i] * bloch[i] for i in range(0, 3)])),
                    trineAlice2)))

        mu = np.arctan(np.sin(2 * epsilon))
        bobUnBlochVectors = [[np.sin(mu), 0, np.cos(mu)],
                             [-np.sin(mu), 0, np.cos(mu)]]
        bobObservables = list(
            map(lambda bloch: createQubitObservable(bloch), bobUnBlochVectors))
        bobEffects = list(
            map(
                lambda qubitObservable: projectorsForQubitObservable(
                    qubitObservable), bobObservables))

        psi = createMaxEntState(2)
        rho = psi * psi.dag()
        expectedCorrelations = {}
        for x1, x2, y in product(range(2), range(3), range(2)):
            for a1, a2, b in product(range(alice1outputs[x1]),
                                     range(alice2outputs[x2]),
                                     range(bobOutputs[y])):
                postMeasrmntState = qt.tensor(
                    alice1Krauss[x1][a1], qt.qeye(2)) * rho * (qt.tensor(
                        alice1Krauss[x1][a1], qt.qeye(2))).dag()
                expectedCorrelations[(x1, x2), y, (a1, a2), b] = (
                    qt.tensor(alice2Effects[x2][a2], bobEffects[y][b]) *
                    postMeasrmntState).tr().real

        expectedBehaviour = Behaviour(sequentialScenario, expectedCorrelations)

        scenario = BellScenario([4, 4, 6, 4, 4, 6], [2, 2])
        polytope = BellPolytopeWithOneWayCommunication(BellPolytope(scenario))

        print(polytope.contains(expectedBehaviour.getProbabilityList()))