This problem set practises Lecture 7. It works with the
course library LeanFV.Quantum: kets, brackets, the Pauli matrices, CNOT and the no-cloning
theorem.
How to work on it. Open the lean/ folder in VS Code with the Lean 4 extension, then open
LeanFV/Homework/HW03.lean. Each problem below names its theorem in that file, such as
HW03.Z_mul_X. Replace each sorry with a proof. You can also work in a notebook: start it
with leanmagic.setup("import LeanFV.Homework.HW03"), as in
Notebook 7. Solutions are collapsed. Many proofs are correct, and yours
need not match.
The file starts with the header below, so every name from the library is in scope. The
solutions on this page assume it too.
Follow the proof of in Lecture 7: unfold the matrices, multiply with
mul_fin_two, then compare entries with ext i j and fin_cases.
Solution
theorem Z_mul_X : Z * X = I • Y := by rw [Z, X, Y, mul_fin_two] ext i j fin_cases i <;> fin_cases j <;> simp
I • Y is scalar multiplication, so the right side is not a product of two matrices and
needs no mul_fin_two. simp knows how • acts on each entry.
Problem 2 (Y and X anticommute).
Prove (HW03.Y_mul_X).
Solution
theorem Y_mul_X : Y * X = -(X * Y) := by rw [X, Y, mul_fin_two, mul_fin_two] ext i j fin_cases i <;> fin_cases j <;> simp
Problem 3 (The commutator of X and Y).
Prove (HW03.commutator_X_Y) without unfolding X, Y or Z. Use
Y_mul_X from Problem 2 and the library lemma X_mul_Y : X * Y = I • Z.
Hint
After rewriting with Y_mul_X the goal contains X * Y - -(X * Y). Then look for
sub_neg_eq_add, two_smul and smul_smul.
Solution
theorem commutator_X_Y : X * Y - Y * X = (2 * I) • Z := by rw [Y_mul_X, sub_neg_eq_add, X_mul_Y, ← two_smul ℂ, smul_smul]
The chain is . Read it in the rewrites:
sub_neg_eq_add turns into , and X_mul_Y rewrites both copies of .
← two_smul ℂ folds into , and smul_smul merges the two scalars.
Working from proved identities instead of entries is how longer calculations stay
manageable.
Problem 4 (Y is Hermitian).
Prove (HW03.Y_conjTranspose). In Lean, Yᴴ is the conjugate transpose.
Solution
theorem Y_conjTranspose : Yᴴ = Y := by rw [Y] ext i j fin_cases i <;> fin_cases j <;> simp
The off-diagonal entries need and ; simp knows
both (Complex.conj_I).
Problem 5 (Y is unitary).
Prove Y ∈ unitaryGroup (Fin 2) ℂ (HW03.Y_mem_unitaryGroup).
Hint
Lecture 7 proves the same fact for X in one rw. You need Problem 4 and the
library’s Y_mul_Y.
Solution
theorem Y_mem_unitaryGroup : Y ∈ unitaryGroup (Fin 2) ℂ := by rw [mem_unitaryGroup_iff', star_eq_conjTranspose, Y_conjTranspose, Y_mul_Y]
A normalised state
The homework file defines a second qubit state,
. It is marked noncomputable
because division in is (Notebook 7 shows why).
Unfold braket, ketA and dotProduct, split the sum with Fin.sum_univ_two, and let
simp clean up. Look at the goal that remains: what fact about I does it need?
After simp the goal is 3 / 5 * (3 / 5) + -(4 / 5 * I * (4 / 5 * I)) = 1, which holds because
. linear_combination (-16 / 25 : ℂ) * I_sq says that the goal is times
the equation I_sq : I ^ 2 = -1, up to ring arithmetic, and ring checks the rest.
Show that no unitary clones both ket0 and ketA onto the same normalised blank state
(HW03.not_clones_ket0_and_ketA). The statement is
¬ (Clones U s ket0 ∧ Clones U s ketA), for any U in the unitary group and any s with
braket s s = 1.
Hint
no_cloning gives braket ket0 ketA = 0 ∨ braket ket0 ketA = 1. Rewrite both cases with
Problem 7; norm_num refutes and .
Solution
theorem not_clones_ket0_and_ketA {U : Matrix (Fin 2 × Fin 2) (Fin 2 × Fin 2) ℂ} (hU : U ∈ unitaryGroup (Fin 2 × Fin 2) ℂ) {s : Ket (Fin 2)} (hs : braket s s = 1) : ¬ (Clones U s ket0 ∧ Clones U s ketA) := by rintro ⟨h0, hA⟩ rcases no_cloning hU hs h0 hA with h | h <;> rw [braket_ket0_ketA] at h <;> norm_num at h
This is most of the existential form of no-cloning from Lecture 7: a universal cloner
would clone these two states in particular. The TODO(you) block in
lean/LeanFV/Quantum/NoCloning.lean asks for the rest.
Problem 9 (CNOT does not clone (1, 1)).
Prove ¬ Clones CNOT ket0 ![1, 1] (HW03.CNOT_not_clones). Before you start, explain why
no_cloning cannot do this for you.
Hint
CNOT clones ket0, and braket ket0 ![1, 1] = 1, a value no_cloning allows. The vector
is not normalised, so overlap 1 does not mean “the same state”. Compute directly
instead: compare the two sides at the index (0, 1) with congrFun h (0, 1).
Solution
theorem CNOT_not_clones : ¬ Clones CNOT ket0 ![1, 1] := by intro h have h01 := congrFun h (0, 1) simp [CNOT, tensor, ket0, X, mulVec, dotProduct, Fintype.sum_prod_type, Fin.sum_univ_two, one_apply] at h01
CNOT sends to , so the entry at
of the output is . The entry of there is .
simp evaluates both entries, reduces h01 to False, and so closes the goal. The lesson
about statements: no_cloning says nothing useful about vectors whose overlap is
without being equal, and an unnormalised vector can be one of them.