# Going from projective measurement to unitiary operators for qiskit

I have a solution to the Peres-Mermin magic squares game (Wikipedia quantum pseudo-telepathy)

I simulate the six measurements using projective (non-unitary) measurement operators like in Nielson and Chuang's equation 2.94. I apply each of the $$M_m$$ to the state vector to generate a move by a player. The move, $$\pm 1$$, is the eignevalue.

Anyway, I want to port my solutin to qiskit so that I can run it on a real quantum computer. However, I am faced with a conceptual or mathematical difficulty. My measurement projection operators are not unitary but, I believe, in qiskit you simulate a measurement in a basis other than the computational basis using a unitary matrix. My matrices are not unitary.

How do you go from a projective measurement operator to a unitary transformation that reproduces the measurment?

The unitary operator for a measurement that has outcomes $$|a0\rangle$$, $$|a1\rangle$$, $$|b0\rangle$$ and $$|b1\rangle$$, is constructed as the transformation that maps these eigenstates to the computatitonal basis: $$|00\rangle\langle a0|+|01\rangle\langle a1|+|10\rangle\langle b0|+|11\rangle\langle b1|$$ That enables me to compute state vectors, in Qiskit, that match my calculations. However, the measurement counts still aren't right - they correspond to illegal moves in the game :-(