Theorem: Matrix.det_mul_aux
File: Mathlib/LinearAlgebra/Matrix/Determinant.lean

tactic: obtain ⟨i, j, hpij, hij⟩ : ∃ i j, p i = p j ∧ i ≠ j := by
  rw [← Finite.injective_iff_bijective, Injective] at H
  push_neg  at H
  exact H
state_before: m : Type ?u.187580
n : Type u_1
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : Fintype m
R : Type v
inst✝ : CommRing R
M N : Matrix n n R
p : n → n
H : ¬Bijective p
⊢ ∑ σ : Perm n, ↑↑(↑sign σ) * ∏ x : n, M (↑σ x) (p x) * N (p x) x = 0

tactic: exact
  sum_involution (fun σ _ => σ * Equiv.swap i j)
    (fun σ _ => by
      have : (∏ x, M (σ x) (p x)) = ∏ x, M ((σ * Equiv.swap i j) x) (p x) :=
        Fintype.prod_equiv (swap i j) _ _ (by simp [apply_swap_eq_self hpij])
      simp [this, sign_swap hij, -sign_swap', prod_mul_distrib])
    (fun σ _ _ => (not_congr mul_swap_eq_iff).mpr hij) (fun _ _ => mem_univ _) fun σ _ =>
    mul_swap_involutive i j σ
state_before: case intro.intro.intro
m : Type ?u.187580
n : Type u_1
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : Fintype m
R : Type v
inst✝ : CommRing R
M N : Matrix n n R
p : n → n
H : ¬Bijective p
i j : n
hpij : p i = p j
hij : i ≠ j
⊢ ∑ σ : Perm n, ↑↑(↑sign σ) * ∏ x : n, M (↑σ x) (p x) * N (p x) x = 0

tactic: rw [← Finite.injective_iff_bijective, Injective] at H
state_before: m : Type ?u.187580
n : Type u_1
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : Fintype m
R : Type v
inst✝ : CommRing R
M N : Matrix n n R
p : n → n
H : ¬Bijective p
⊢ ∃ i j, p i = p j ∧ i ≠ j

tactic: push_neg  at H
state_before: m : Type ?u.187580
n : Type u_1
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : Fintype m
R : Type v
inst✝ : CommRing R
M N : Matrix n n R
p : n → n
H : ¬∀ ⦃a₁ a₂ : n⦄, p a₁ = p a₂ → a₁ = a₂
⊢ ∃ i j, p i = p j ∧ i ≠ j

tactic: exact H
state_before: m : Type ?u.187580
n : Type u_1
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : Fintype m
R : Type v
inst✝ : CommRing R
M N : Matrix n n R
p : n → n
H : Exists fun ⦃a₁⦄ => Exists fun ⦃a₂⦄ => p a₁ = p a₂ ∧ a₁ ≠ a₂
⊢ ∃ i j, p i = p j ∧ i ≠ j

tactic: have : (∏ x, M (σ x) (p x)) = ∏ x, M ((σ * Equiv.swap i j) x) (p x) :=
  Fintype.prod_equiv (swap i j) _ _ (by simp [apply_swap_eq_self hpij])
state_before: m : Type ?u.187580
n : Type u_1
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : Fintype m
R : Type v
inst✝ : CommRing R
M N : Matrix n n R
p : n → n
H : ¬Bijective p
i j : n
hpij : p i = p j
hij : i ≠ j
σ : Perm n
x✝ : σ ∈ univ
⊢ ↑↑(↑sign σ) * ∏ x : n, M (↑σ x) (p x) * N (p x) x +
      ↑↑(↑sign ((fun σ x => σ * Equiv.swap i j) σ x✝)) *
        ∏ x : n, M (↑((fun σ x => σ * Equiv.swap i j) σ x✝) x) (p x) * N (p x) x =
    0

tactic: simp [this, sign_swap hij, -sign_swap', prod_mul_distrib]
state_before: m : Type ?u.187580
n : Type u_1
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : Fintype m
R : Type v
inst✝ : CommRing R
M N : Matrix n n R
p : n → n
H : ¬Bijective p
i j : n
hpij : p i = p j
hij : i ≠ j
σ : Perm n
x✝ : σ ∈ univ
this : ∏ x : n, M (↑σ x) (p x) = ∏ x : n, M (↑(σ * Equiv.swap i j) x) (p x)
⊢ ↑↑(↑sign σ) * ∏ x : n, M (↑σ x) (p x) * N (p x) x +
      ↑↑(↑sign ((fun σ x => σ * Equiv.swap i j) σ x✝)) *
        ∏ x : n, M (↑((fun σ x => σ * Equiv.swap i j) σ x✝) x) (p x) * N (p x) x =
    0

tactic: simp [apply_swap_eq_self hpij]
state_before: m : Type ?u.187580
n : Type u_1
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
inst✝² : DecidableEq m
inst✝¹ : Fintype m
R : Type v
inst✝ : CommRing R
M N : Matrix n n R
p : n → n
H : ¬Bijective p
i j : n
hpij : p i = p j
hij : i ≠ j
σ : Perm n
x✝ : σ ∈ univ
⊢ ∀ (x : n), M (↑σ x) (p x) = M (↑(σ * Equiv.swap i j) (↑(Equiv.swap i j) x)) (p (↑(Equiv.swap i j) x))