Zulip Chat Archive

Stream: maths

Topic: Unable to prove Matrix lemma


Jai Patel (Jul 03 2025 at 13:24):

I was trying to prove the given lemma, however, I have not been able to do so. I was wondering what the best approach would be to solving lemmas of this form.

import Mathlib
open Matrix

def CNOT1 : Matrix (Fin 4) (Fin 4)  :=
   !![1, 0, 0, 0;
      0, 1, 0, 0;
      0, 0, 0, 1;
      0, 0, 1, 0]

def CNOT2 : Matrix (Fin 4) (Fin 4)  :=
   !![1, 0, 0, 0;
      0, 0, 0, 1;
      0, 0, 1, 0;
      0, 1, 0, 0]

def SWAP : Matrix (Fin 4) (Fin 4)  :=
   !![1, 0, 0, 0;
      0, 0, 1, 0;
      0, 1, 0, 0;
      0, 0, 0, 1]

def identity_matrix (n : ) : Matrix (Fin n) (Fin n)  :=
  fun i j => if i = j then 1 else 0
def tensor_product_2 {m n o p : }
  (A : Matrix (Fin m) (Fin n) )
  (B : Matrix (Fin o) (Fin p) ) :
  Matrix (Fin (m * o)) (Fin (n * p))  :=
  (Matrix.kroneckerMap (fun (a b : ) => a * b) A B).reindex finProdFinEquiv finProdFinEquiv

infixl:80 " ⊗ " => tensor_product_2
theorem h:((CNOT1)(identity_matrix 2) * (identity_matrix 2)(CNOT1) * (CNOT1)(identity_matrix 2) * (identity_matrix 2)(CNOT1))=
  ((identity_matrix 2)(SWAP) * ((CNOT2)(identity_matrix 2) * (identity_matrix 2)(SWAP))):= by {
   sorry
}

Eric Wieser (Jul 04 2025 at 08:36):

I think you'll have an easier time using 1 instead of identity_matrix


Last updated: Dec 20 2025 at 21:32 UTC