l3lab/ntp-mathlib huggingface dataset:
/-- `determinant` of `Matrix.kroneckerMapBilinear`.

This is primarily used with `R = ℕ` to prove `Matrix.det_kronecker`. -/
theorem det_kroneckerMapBilinear [CommSemiring R] [Fintype m] [Fintype n] [DecidableEq m]
    [DecidableEq n] [CommRing α] [CommRing β] [CommRing γ] [Module R α] [Module R β] [Module R γ]
    (f : α →ₗ[R] β →ₗ[R] γ) (h_comm : ∀ a b a' b', f (a * b) (a' * b') = f a a' * f b b')
    (A : Matrix m m α) (B : Matrix n n β) :
    det (kroneckerMapBilinear f A B) =
      det (A.map fun a => f a 1) ^ Fintype.card n * det (B.map fun b => f 1 b) ^ Fintype.card m :=
  calc
    det (kroneckerMapBilinear f A B) =
        det (kroneckerMapBilinear f A 1 * kroneckerMapBilinear f 1 B) :=
      by rw [← kroneckerMapBilinear_mul_mul f h_comm, Matrix.mul_one, Matrix.one_mul]
    _ = det (blockDiagonal fun _ => A.map fun a => f a 1) *
        det (blockDiagonal fun _ => B.map fun b => f 1 b) := by
      rw [det_mul, ← diagonal_one, ← diagonal_one, kroneckerMapBilinear_apply_apply,
        kroneckerMap_diagonal_right _ fun _ => _, kroneckerMapBilinear_apply_apply,
        kroneckerMap_diagonal_left _ fun _ => _, det_reindex_self]
      · 

Proof state:
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝¹⁰ : CommSemiring R
inst✝⁹ : Fintype m
inst✝⁸ : Fintype n
inst✝⁷ : DecidableEq m
inst✝⁶ : DecidableEq n
inst✝⁵ : CommRing α
inst✝⁴ : CommRing β
inst✝³ : CommRing γ
inst✝² : Module R α
inst✝¹ : Module R β
inst✝ : Module R γ
f : α →ₗ[R] β →ₗ[R] γ
h_comm : ∀ (a b : α) (a' b' : β), (f (a * b)) (a' * b') = (f a) a' * (f b) b'
A : Matrix m m α
B : Matrix n n β
⊢ ∀ (x : β), (f 0) x = 0

Next tactic:
intro
/-- `determinant` of `Matrix.kroneckerMapBilinear`.

This is primarily used with `R = ℕ` to prove `Matrix.det_kronecker`. -/
theorem det_kroneckerMapBilinear [CommSemiring R] [Fintype m] [Fintype n] [DecidableEq m]
    [DecidableEq n] [CommRing α] [CommRing β] [CommRing γ] [Module R α] [Module R β] [Module R γ]
    (f : α →ₗ[R] β →ₗ[R] γ) (h_comm : ∀ a b a' b', f (a * b) (a' * b') = f a a' * f b b')
    (A : Matrix m m α) (B : Matrix n n β) :
    det (kroneckerMapBilinear f A B) =
      det (A.map fun a => f a 1) ^ Fintype.card n * det (B.map fun b => f 1 b) ^ Fintype.card m :=
  calc
    det (kroneckerMapBilinear f A B) =
        det (kroneckerMapBilinear f A 1 * kroneckerMapBilinear f 1 B) :=
      by rw [← kroneckerMapBilinear_mul_mul f h_comm, Matrix.mul_one, Matrix.one_mul]
    _ = det (blockDiagonal fun _ => A.map fun a => f a 1) *
        det (blockDiagonal fun _ => B.map fun b => f 1 b) := by
      rw [det_mul, ← diagonal_one, ← diagonal_one, kroneckerMapBilinear_apply_apply,
        kroneckerMap_diagonal_right _ fun _ => _, kroneckerMapBilinear_apply_apply,
        kroneckerMap_diagonal_left _ fun _ => _, det_reindex_self]
      · intro; 

Proof state:
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝¹⁰ : CommSemiring R
inst✝⁹ : Fintype m
inst✝⁸ : Fintype n
inst✝⁷ : DecidableEq m
inst✝⁶ : DecidableEq n
inst✝⁵ : CommRing α
inst✝⁴ : CommRing β
inst✝³ : CommRing γ
inst✝² : Module R α
inst✝¹ : Module R β
inst✝ : Module R γ
f : α →ₗ[R] β →ₗ[R] γ
h_comm : ∀ (a b : α) (a' b' : β), (f (a * b)) (a' * b') = (f a) a' * (f b) b'
A : Matrix m m α
B : Matrix n n β
x✝ : β
⊢ (f 0) x✝ = 0

Next tactic:
exact LinearMap.map_zero₂ _ _
/-- `determinant` of `Matrix.kroneckerMapBilinear`.

This is primarily used with `R = ℕ` to prove `Matrix.det_kronecker`. -/
theorem det_kroneckerMapBilinear [CommSemiring R] [Fintype m] [Fintype n] [DecidableEq m]
    [DecidableEq n] [CommRing α] [CommRing β] [CommRing γ] [Module R α] [Module R β] [Module R γ]
    (f : α →ₗ[R] β →ₗ[R] γ) (h_comm : ∀ a b a' b', f (a * b) (a' * b') = f a a' * f b b')
    (A : Matrix m m α) (B : Matrix n n β) :
    det (kroneckerMapBilinear f A B) =
      det (A.map fun a => f a 1) ^ Fintype.card n * det (B.map fun b => f 1 b) ^ Fintype.card m :=
  calc
    det (kroneckerMapBilinear f A B) =
        det (kroneckerMapBilinear f A 1 * kroneckerMapBilinear f 1 B) :=
      by rw [← kroneckerMapBilinear_mul_mul f h_comm, Matrix.mul_one, Matrix.one_mul]
    _ = det (blockDiagonal fun _ => A.map fun a => f a 1) *
        det (blockDiagonal fun _ => B.map fun b => f 1 b) := by
      rw [det_mul, ← diagonal_one, ← diagonal_one, kroneckerMapBilinear_apply_apply,
        kroneckerMap_diagonal_right _ fun _ => _, kroneckerMapBilinear_apply_apply,
        kroneckerMap_diagonal_left _ fun _ => _, det_reindex_self]
      · intro; exact LinearMap.map_zero₂ _ _
      · 

Proof state:
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝¹⁰ : CommSemiring R
inst✝⁹ : Fintype m
inst✝⁸ : Fintype n
inst✝⁷ : DecidableEq m
inst✝⁶ : DecidableEq n
inst✝⁵ : CommRing α
inst✝⁴ : CommRing β
inst✝³ : CommRing γ
inst✝² : Module R α
inst✝¹ : Module R β
inst✝ : Module R γ
f : α →ₗ[R] β →ₗ[R] γ
h_comm : ∀ (a b : α) (a' b' : β), (f (a * b)) (a' * b') = (f a) a' * (f b) b'
A : Matrix m m α
B : Matrix n n β
⊢ ∀ (x : α), (f x) 0 = 0

Next tactic:
intro
/-- `determinant` of `Matrix.kroneckerMapBilinear`.

This is primarily used with `R = ℕ` to prove `Matrix.det_kronecker`. -/
theorem det_kroneckerMapBilinear [CommSemiring R] [Fintype m] [Fintype n] [DecidableEq m]
    [DecidableEq n] [CommRing α] [CommRing β] [CommRing γ] [Module R α] [Module R β] [Module R γ]
    (f : α →ₗ[R] β →ₗ[R] γ) (h_comm : ∀ a b a' b', f (a * b) (a' * b') = f a a' * f b b')
    (A : Matrix m m α) (B : Matrix n n β) :
    det (kroneckerMapBilinear f A B) =
      det (A.map fun a => f a 1) ^ Fintype.card n * det (B.map fun b => f 1 b) ^ Fintype.card m :=
  calc
    det (kroneckerMapBilinear f A B) =
        det (kroneckerMapBilinear f A 1 * kroneckerMapBilinear f 1 B) :=
      by rw [← kroneckerMapBilinear_mul_mul f h_comm, Matrix.mul_one, Matrix.one_mul]
    _ = det (blockDiagonal fun _ => A.map fun a => f a 1) *
        det (blockDiagonal fun _ => B.map fun b => f 1 b) := by
      rw [det_mul, ← diagonal_one, ← diagonal_one, kroneckerMapBilinear_apply_apply,
        kroneckerMap_diagonal_right _ fun _ => _, kroneckerMapBilinear_apply_apply,
        kroneckerMap_diagonal_left _ fun _ => _, det_reindex_self]
      · intro; exact LinearMap.map_zero₂ _ _
      · intro; 

Proof state:
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝¹⁰ : CommSemiring R
inst✝⁹ : Fintype m
inst✝⁸ : Fintype n
inst✝⁷ : DecidableEq m
inst✝⁶ : DecidableEq n
inst✝⁵ : CommRing α
inst✝⁴ : CommRing β
inst✝³ : CommRing γ
inst✝² : Module R α
inst✝¹ : Module R β
inst✝ : Module R γ
f : α →ₗ[R] β →ₗ[R] γ
h_comm : ∀ (a b : α) (a' b' : β), (f (a * b)) (a' * b') = (f a) a' * (f b) b'
A : Matrix m m α
B : Matrix n n β
x✝ : α
⊢ (f x✝) 0 = 0

Next tactic:
exact map_zero _
/-- `determinant` of `Matrix.kroneckerMapBilinear`.

This is primarily used with `R = ℕ` to prove `Matrix.det_kronecker`. -/
theorem det_kroneckerMapBilinear [CommSemiring R] [Fintype m] [Fintype n] [DecidableEq m]
    [DecidableEq n] [CommRing α] [CommRing β] [CommRing γ] [Module R α] [Module R β] [Module R γ]
    (f : α →ₗ[R] β →ₗ[R] γ) (h_comm : ∀ a b a' b', f (a * b) (a' * b') = f a a' * f b b')
    (A : Matrix m m α) (B : Matrix n n β) :
    det (kroneckerMapBilinear f A B) =
      det (A.map fun a => f a 1) ^ Fintype.card n * det (B.map fun b => f 1 b) ^ Fintype.card m :=
  calc
    det (kroneckerMapBilinear f A B) =
        det (kroneckerMapBilinear f A 1 * kroneckerMapBilinear f 1 B) :=
      by rw [← kroneckerMapBilinear_mul_mul f h_comm, Matrix.mul_one, Matrix.one_mul]
    _ = det (blockDiagonal fun _ => A.map fun a => f a 1) *
        det (blockDiagonal fun _ => B.map fun b => f 1 b) := by
      rw [det_mul, ← diagonal_one, ← diagonal_one, kroneckerMapBilinear_apply_apply,
        kroneckerMap_diagonal_right _ fun _ => _, kroneckerMapBilinear_apply_apply,
        kroneckerMap_diagonal_left _ fun _ => _, det_reindex_self]
      · intro; exact LinearMap.map_zero₂ _ _
      · intro; exact map_zero _
    _ = _ := by 

Proof state:
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝¹⁰ : CommSemiring R
inst✝⁹ : Fintype m
inst✝⁸ : Fintype n
inst✝⁷ : DecidableEq m
inst✝⁶ : DecidableEq n
inst✝⁵ : CommRing α
inst✝⁴ : CommRing β
inst✝³ : CommRing γ
inst✝² : Module R α
inst✝¹ : Module R β
inst✝ : Module R γ
f : α →ₗ[R] β →ₗ[R] γ
h_comm : ∀ (a b : α) (a' b' : β), (f (a * b)) (a' * b') = (f a) a' * (f b) b'
A : Matrix m m α
B : Matrix n n β
⊢ det (blockDiagonal fun x => map A fun a => (f a) 1) * det (blockDiagonal fun x => map B fun b => (f 1) b) =
    det (map A fun a => (f a) 1) ^ Fintype.card n * det (map B fun b => (f 1) b) ^ Fintype.card m

Next tactic:
simp_rw [det_blockDiagonal, Finset.prod_const, Finset.card_univ]
theorem det_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) :
    det (A ⊗ₖ B) = det A ^ Fintype.card n * det B ^ Fintype.card m := by
  

Proof state:
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
⊢ det (kroneckerMap (fun x x_1 => x * x_1) A B) = det A ^ Fintype.card n * det B ^ Fintype.card m

Next tactic:
refine' (det_kroneckerMapBilinear (Algebra.lmul ℕ R).toLinearMap mul_mul_mul_comm _ _).trans _
theorem det_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) :
    det (A ⊗ₖ B) = det A ^ Fintype.card n * det B ^ Fintype.card m := by
  refine' (det_kroneckerMapBilinear (Algebra.lmul ℕ R).toLinearMap mul_mul_mul_comm _ _).trans _
  

Proof state:
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
⊢ det (map A fun a => ((AlgHom.toLinearMap (Algebra.lmul ℕ R)) a) 1) ^ Fintype.card n *
      det (map B fun b => ((AlgHom.toLinearMap (Algebra.lmul ℕ R)) 1) b) ^ Fintype.card m =
    det A ^ Fintype.card n * det B ^ Fintype.card m

Next tactic:
congr 3
theorem det_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) :
    det (A ⊗ₖ B) = det A ^ Fintype.card n * det B ^ Fintype.card m := by
  refine' (det_kroneckerMapBilinear (Algebra.lmul ℕ R).toLinearMap mul_mul_mul_comm _ _).trans _
  congr 3
  · 

Proof state:
case e_a.e_a.e_M
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
⊢ (map A fun a => ((AlgHom.toLinearMap (Algebra.lmul ℕ R)) a) 1) = A

Next tactic:
ext i j
theorem det_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) :
    det (A ⊗ₖ B) = det A ^ Fintype.card n * det B ^ Fintype.card m := by
  refine' (det_kroneckerMapBilinear (Algebra.lmul ℕ R).toLinearMap mul_mul_mul_comm _ _).trans _
  congr 3
  · ext i j
    

Proof state:
case e_a.e_a.e_M.a.h
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
i j : m
⊢ map A (fun a => ((AlgHom.toLinearMap (Algebra.lmul ℕ R)) a) 1) i j = A i j

Next tactic:
exact mul_one _
theorem det_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) :
    det (A ⊗ₖ B) = det A ^ Fintype.card n * det B ^ Fintype.card m := by
  refine' (det_kroneckerMapBilinear (Algebra.lmul ℕ R).toLinearMap mul_mul_mul_comm _ _).trans _
  congr 3
  · ext i j
    exact mul_one _
  · 

Proof state:
case e_a.e_a.e_M
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
⊢ (map B fun b => ((AlgHom.toLinearMap (Algebra.lmul ℕ R)) 1) b) = B

Next tactic:
ext i j
theorem det_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) :
    det (A ⊗ₖ B) = det A ^ Fintype.card n * det B ^ Fintype.card m := by
  refine' (det_kroneckerMapBilinear (Algebra.lmul ℕ R).toLinearMap mul_mul_mul_comm _ _).trans _
  congr 3
  · ext i j
    exact mul_one _
  · ext i j
    

Proof state:
case e_a.e_a.e_M.a.h
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
i j : n
⊢ map B (fun b => ((AlgHom.toLinearMap (Algebra.lmul ℕ R)) 1) b) i j = B i j

Next tactic:
exact one_mul _
theorem inv_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) : (A ⊗ₖ B)⁻¹ = A⁻¹ ⊗ₖ B⁻¹ := by
  -- handle the special cases where either matrix is not invertible
  

Proof state:
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
⊢ (kroneckerMap (fun x x_1 => x * x_1) A B)⁻¹ = kroneckerMap (fun x x_1 => x * x_1) A⁻¹ B⁻¹

Next tactic:
by_cases hA : IsUnit A.det
theorem inv_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) : (A ⊗ₖ B)⁻¹ = A⁻¹ ⊗ₖ B⁻¹ := by
  -- handle the special cases where either matrix is not invertible
  by_cases hA : IsUnit A.det;
  

Proof state:
case pos
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
hA : IsUnit (det A)
⊢ (kroneckerMap (fun x x_1 => x * x_1) A B)⁻¹ = kroneckerMap (fun x x_1 => x * x_1) A⁻¹ B⁻¹
case neg
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
hA : ¬IsUnit (det A)
⊢ (kroneckerMap (fun x x_1 => x * x_1) A B)⁻¹ = kroneckerMap (fun x x_1 => x * x_1) A⁻¹ B⁻¹

Next tactic:
swap
theorem inv_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) : (A ⊗ₖ B)⁻¹ = A⁻¹ ⊗ₖ B⁻¹ := by
  -- handle the special cases where either matrix is not invertible
  by_cases hA : IsUnit A.det;
  swap
  · 

Proof state:
case neg
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
hA : ¬IsUnit (det A)
⊢ (kroneckerMap (fun x x_1 => x * x_1) A B)⁻¹ = kroneckerMap (fun x x_1 => x * x_1) A⁻¹ B⁻¹

Next tactic:
cases isEmpty_or_nonempty n
theorem inv_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) : (A ⊗ₖ B)⁻¹ = A⁻¹ ⊗ₖ B⁻¹ := by
  -- handle the special cases where either matrix is not invertible
  by_cases hA : IsUnit A.det;
  swap
  · cases isEmpty_or_nonempty n
    · 

Proof state:
case neg.inl
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
hA : ¬IsUnit (det A)
h✝ : IsEmpty n
⊢ (kroneckerMap (fun x x_1 => x * x_1) A B)⁻¹ = kroneckerMap (fun x x_1 => x * x_1) A⁻¹ B⁻¹

Next tactic:
exact Subsingleton.elim _ _
theorem inv_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) : (A ⊗ₖ B)⁻¹ = A⁻¹ ⊗ₖ B⁻¹ := by
  -- handle the special cases where either matrix is not invertible
  by_cases hA : IsUnit A.det;
  swap
  · cases isEmpty_or_nonempty n
    · exact Subsingleton.elim _ _
    

Proof state:
case neg.inr
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
hA : ¬IsUnit (det A)
h✝ : Nonempty n
⊢ (kroneckerMap (fun x x_1 => x * x_1) A B)⁻¹ = kroneckerMap (fun x x_1 => x * x_1) A⁻¹ B⁻¹

Next tactic:
have hAB : ¬IsUnit (A ⊗ₖ B).det := by
      refine' mt (fun hAB => _) hA
      rw [det_kronecker] at hAB
      exact (isUnit_pow_iff Fintype.card_ne_zero).mp (isUnit_of_mul_isUnit_left hAB)
theorem inv_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) : (A ⊗ₖ B)⁻¹ = A⁻¹ ⊗ₖ B⁻¹ := by
  -- handle the special cases where either matrix is not invertible
  by_cases hA : IsUnit A.det;
  swap
  · cases isEmpty_or_nonempty n
    · exact Subsingleton.elim _ _
    have hAB : ¬IsUnit (A ⊗ₖ B).det := by
      

Proof state:
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
hA : ¬IsUnit (det A)
h✝ : Nonempty n
⊢ ¬IsUnit (det (kroneckerMap (fun x x_1 => x * x_1) A B))

Next tactic:
refine' mt (fun hAB => _) hA
theorem inv_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) : (A ⊗ₖ B)⁻¹ = A⁻¹ ⊗ₖ B⁻¹ := by
  -- handle the special cases where either matrix is not invertible
  by_cases hA : IsUnit A.det;
  swap
  · cases isEmpty_or_nonempty n
    · exact Subsingleton.elim _ _
    have hAB : ¬IsUnit (A ⊗ₖ B).det := by
      refine' mt (fun hAB => _) hA
      

Proof state:
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
hA : ¬IsUnit (det A)
h✝ : Nonempty n
hAB : IsUnit (det (kroneckerMap (fun x x_1 => x * x_1) A B))
⊢ IsUnit (det A)

Next tactic:
rw [det_kronecker] at hAB
theorem inv_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) : (A ⊗ₖ B)⁻¹ = A⁻¹ ⊗ₖ B⁻¹ := by
  -- handle the special cases where either matrix is not invertible
  by_cases hA : IsUnit A.det;
  swap
  · cases isEmpty_or_nonempty n
    · exact Subsingleton.elim _ _
    have hAB : ¬IsUnit (A ⊗ₖ B).det := by
      refine' mt (fun hAB => _) hA
      rw [det_kronecker] at hAB
      

Proof state:
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
hA : ¬IsUnit (det A)
h✝ : Nonempty n
hAB : IsUnit (det A ^ Fintype.card n * det B ^ Fintype.card m)
⊢ IsUnit (det A)

Next tactic:
exact (isUnit_pow_iff Fintype.card_ne_zero).mp (isUnit_of_mul_isUnit_left hAB)
theorem inv_kronecker [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [CommRing R]
    (A : Matrix m m R) (B : Matrix n n R) : (A ⊗ₖ B)⁻¹ = A⁻¹ ⊗ₖ B⁻¹ := by
  -- handle the special cases where either matrix is not invertible
  by_cases hA : IsUnit A.det;
  swap
  · cases isEmpty_or_nonempty n
    · exact Subsingleton.elim _ _
    have hAB : ¬IsUnit (A ⊗ₖ B).det := by
      refine' mt (fun hAB => _) hA
      rw [det_kronecker] at hAB
      exact (isUnit_pow_iff Fintype.card_ne_zero).mp (isUnit_of_mul_isUnit_left hAB)
    

Proof state:
case neg.inr
R : Type u_1
α : Type u_2
α' : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
l : Type u_8
m : Type u_9
n : Type u_10
p : Type u_11
q : Type u_12
r : Type u_13
l' : Type u_14
m' : Type u_15
n' : Type u_16
p' : Type u_17
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : CommRing R
A : Matrix m m R
B : Matrix n n R
hA : ¬IsUnit (det A)
h✝ : Nonempty n
hAB : ¬IsUnit (det (kroneckerMap (fun x x_1 => x * x_1) A B))
⊢ (kroneckerMap (fun x x_1 => x * x_1) A B)⁻¹ = kroneckerMap (fun x x_1 => x * x_1) A⁻¹ B⁻¹

Next tactic:
rw [nonsing_inv_apply_not_isUnit _ hA, zero_kronecker, nonsing_inv_apply_not_isUnit _ hAB]