l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem signAux_inv {n : ℕ} (f : Perm (Fin n)) : signAux f⁻¹ = signAux f :=
  prod_bij (fun a _ => signBijAux f⁻¹ a) signBijAux_mem
    (fun ⟨a, b⟩ hab =>
      if h : f⁻¹ b < f⁻¹ a then by
        simp_all [signBijAux, dif_pos h, if_neg h.not_le, apply_inv_self, apply_inv_self,
          if_neg (mem_finPairsLT.1 hab).not_le]
        split_ifs with h₁
        · dsimp [finPairsLT] at hab
          simp? at hab says
            simp only [mem_sigma, mem_univ, mem_attachFin, mem_range, Fin.val_fin_lt,
              true_and] at hab
          exact absurd h₁ (not_le_of_gt hab)
        · rfl
      else by
        simp_all [signBijAux, if_pos (le_of_not_gt h), dif_neg h, apply_inv_self, apply_inv_self,
          if_pos (mem_finPairsLT.1 hab).le]
        split_ifs with h₁ h₂ h₃
        · 

Proof state:
case pos
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f : Perm (Fin n)
x✝ : (_ : Fin n) × Fin n
a b : Fin n
hab : { fst := a, snd := b } ∈ finPairsLT n
h : f⁻¹ a ≤ f⁻¹ b
h₁ : f⁻¹ b < f⁻¹ a
h₂ : f { fst := f⁻¹ a, snd := f⁻¹ b }.fst ≤ f { fst := f⁻¹ a, snd := f⁻¹ b }.snd
⊢ -1 = -1

Next tactic:
rfl
@[simp]
theorem signAux_inv {n : ℕ} (f : Perm (Fin n)) : signAux f⁻¹ = signAux f :=
  prod_bij (fun a _ => signBijAux f⁻¹ a) signBijAux_mem
    (fun ⟨a, b⟩ hab =>
      if h : f⁻¹ b < f⁻¹ a then by
        simp_all [signBijAux, dif_pos h, if_neg h.not_le, apply_inv_self, apply_inv_self,
          if_neg (mem_finPairsLT.1 hab).not_le]
        split_ifs with h₁
        · dsimp [finPairsLT] at hab
          simp? at hab says
            simp only [mem_sigma, mem_univ, mem_attachFin, mem_range, Fin.val_fin_lt,
              true_and] at hab
          exact absurd h₁ (not_le_of_gt hab)
        · rfl
      else by
        simp_all [signBijAux, if_pos (le_of_not_gt h), dif_neg h, apply_inv_self, apply_inv_self,
          if_pos (mem_finPairsLT.1 hab).le]
        split_ifs with h₁ h₂ h₃
        · rfl
        · 

Proof state:
case neg
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f : Perm (Fin n)
x✝ : (_ : Fin n) × Fin n
a b : Fin n
hab : { fst := a, snd := b } ∈ finPairsLT n
h : f⁻¹ a ≤ f⁻¹ b
h₁ : f⁻¹ b < f⁻¹ a
h₂ : ¬f { fst := f⁻¹ a, snd := f⁻¹ b }.fst ≤ f { fst := f⁻¹ a, snd := f⁻¹ b }.snd
⊢ -1 = 1

Next tactic:
exact absurd h (not_le_of_gt h₁)
@[simp]
theorem signAux_inv {n : ℕ} (f : Perm (Fin n)) : signAux f⁻¹ = signAux f :=
  prod_bij (fun a _ => signBijAux f⁻¹ a) signBijAux_mem
    (fun ⟨a, b⟩ hab =>
      if h : f⁻¹ b < f⁻¹ a then by
        simp_all [signBijAux, dif_pos h, if_neg h.not_le, apply_inv_self, apply_inv_self,
          if_neg (mem_finPairsLT.1 hab).not_le]
        split_ifs with h₁
        · dsimp [finPairsLT] at hab
          simp? at hab says
            simp only [mem_sigma, mem_univ, mem_attachFin, mem_range, Fin.val_fin_lt,
              true_and] at hab
          exact absurd h₁ (not_le_of_gt hab)
        · rfl
      else by
        simp_all [signBijAux, if_pos (le_of_not_gt h), dif_neg h, apply_inv_self, apply_inv_self,
          if_pos (mem_finPairsLT.1 hab).le]
        split_ifs with h₁ h₂ h₃
        · rfl
        · exact absurd h (not_le_of_gt h₁)
        · 

Proof state:
case pos
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f : Perm (Fin n)
x✝ : (_ : Fin n) × Fin n
a b : Fin n
hab : { fst := a, snd := b } ∈ finPairsLT n
h : f⁻¹ a ≤ f⁻¹ b
h₁ : ¬f⁻¹ b < f⁻¹ a
h₃ : f { fst := f⁻¹ b, snd := f⁻¹ a }.fst ≤ f { fst := f⁻¹ b, snd := f⁻¹ a }.snd
⊢ -1 = -1

Next tactic:
rfl
@[simp]
theorem signAux_inv {n : ℕ} (f : Perm (Fin n)) : signAux f⁻¹ = signAux f :=
  prod_bij (fun a _ => signBijAux f⁻¹ a) signBijAux_mem
    (fun ⟨a, b⟩ hab =>
      if h : f⁻¹ b < f⁻¹ a then by
        simp_all [signBijAux, dif_pos h, if_neg h.not_le, apply_inv_self, apply_inv_self,
          if_neg (mem_finPairsLT.1 hab).not_le]
        split_ifs with h₁
        · dsimp [finPairsLT] at hab
          simp? at hab says
            simp only [mem_sigma, mem_univ, mem_attachFin, mem_range, Fin.val_fin_lt,
              true_and] at hab
          exact absurd h₁ (not_le_of_gt hab)
        · rfl
      else by
        simp_all [signBijAux, if_pos (le_of_not_gt h), dif_neg h, apply_inv_self, apply_inv_self,
          if_pos (mem_finPairsLT.1 hab).le]
        split_ifs with h₁ h₂ h₃
        · rfl
        · exact absurd h (not_le_of_gt h₁)
        · rfl
        · 

Proof state:
case neg
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f : Perm (Fin n)
x✝ : (_ : Fin n) × Fin n
a b : Fin n
hab : { fst := a, snd := b } ∈ finPairsLT n
h : f⁻¹ a ≤ f⁻¹ b
h₁ : ¬f⁻¹ b < f⁻¹ a
h₃ : ¬f { fst := f⁻¹ b, snd := f⁻¹ a }.fst ≤ f { fst := f⁻¹ b, snd := f⁻¹ a }.snd
⊢ -1 = 1

Next tactic:
dsimp at *
@[simp]
theorem signAux_inv {n : ℕ} (f : Perm (Fin n)) : signAux f⁻¹ = signAux f :=
  prod_bij (fun a _ => signBijAux f⁻¹ a) signBijAux_mem
    (fun ⟨a, b⟩ hab =>
      if h : f⁻¹ b < f⁻¹ a then by
        simp_all [signBijAux, dif_pos h, if_neg h.not_le, apply_inv_self, apply_inv_self,
          if_neg (mem_finPairsLT.1 hab).not_le]
        split_ifs with h₁
        · dsimp [finPairsLT] at hab
          simp? at hab says
            simp only [mem_sigma, mem_univ, mem_attachFin, mem_range, Fin.val_fin_lt,
              true_and] at hab
          exact absurd h₁ (not_le_of_gt hab)
        · rfl
      else by
        simp_all [signBijAux, if_pos (le_of_not_gt h), dif_neg h, apply_inv_self, apply_inv_self,
          if_pos (mem_finPairsLT.1 hab).le]
        split_ifs with h₁ h₂ h₃
        · rfl
        · exact absurd h (not_le_of_gt h₁)
        · rfl
        · dsimp at *
          

Proof state:
case neg
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f : Perm (Fin n)
x✝ : (_ : Fin n) × Fin n
a b : Fin n
hab : { fst := a, snd := b } ∈ finPairsLT n
h : f⁻¹ a ≤ f⁻¹ b
h₁ : ¬f⁻¹ b < f⁻¹ a
h₃ : ¬f (f⁻¹ b) ≤ f (f⁻¹ a)
⊢ -1 = 1

Next tactic:
dsimp [finPairsLT] at hab
@[simp]
theorem signAux_inv {n : ℕ} (f : Perm (Fin n)) : signAux f⁻¹ = signAux f :=
  prod_bij (fun a _ => signBijAux f⁻¹ a) signBijAux_mem
    (fun ⟨a, b⟩ hab =>
      if h : f⁻¹ b < f⁻¹ a then by
        simp_all [signBijAux, dif_pos h, if_neg h.not_le, apply_inv_self, apply_inv_self,
          if_neg (mem_finPairsLT.1 hab).not_le]
        split_ifs with h₁
        · dsimp [finPairsLT] at hab
          simp? at hab says
            simp only [mem_sigma, mem_univ, mem_attachFin, mem_range, Fin.val_fin_lt,
              true_and] at hab
          exact absurd h₁ (not_le_of_gt hab)
        · rfl
      else by
        simp_all [signBijAux, if_pos (le_of_not_gt h), dif_neg h, apply_inv_self, apply_inv_self,
          if_pos (mem_finPairsLT.1 hab).le]
        split_ifs with h₁ h₂ h₃
        · rfl
        · exact absurd h (not_le_of_gt h₁)
        · rfl
        · dsimp at *
          dsimp [finPairsLT] at hab
          

Proof state:
case neg
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f : Perm (Fin n)
x✝ : (_ : Fin n) × Fin n
a b : Fin n
hab : { fst := a, snd := b } ∈ Finset.sigma univ fun a => attachFin (range ↑a) (_ : ∀ x ∈ range ↑a, x < n)
h : f⁻¹ a ≤ f⁻¹ b
h₁ : ¬f⁻¹ b < f⁻¹ a
h₃ : ¬f (f⁻¹ b) ≤ f (f⁻¹ a)
⊢ -1 = 1

Next tactic:
simp? at * says
            simp only [mem_sigma, mem_univ, mem_attachFin, mem_range, Fin.val_fin_lt,
              true_and, not_lt, apply_inv_self, not_le, Int.neg_units_ne_self] at *
@[simp]
theorem signAux_inv {n : ℕ} (f : Perm (Fin n)) : signAux f⁻¹ = signAux f :=
  prod_bij (fun a _ => signBijAux f⁻¹ a) signBijAux_mem
    (fun ⟨a, b⟩ hab =>
      if h : f⁻¹ b < f⁻¹ a then by
        simp_all [signBijAux, dif_pos h, if_neg h.not_le, apply_inv_self, apply_inv_self,
          if_neg (mem_finPairsLT.1 hab).not_le]
        split_ifs with h₁
        · dsimp [finPairsLT] at hab
          simp? at hab says
            simp only [mem_sigma, mem_univ, mem_attachFin, mem_range, Fin.val_fin_lt,
              true_and] at hab
          exact absurd h₁ (not_le_of_gt hab)
        · rfl
      else by
        simp_all [signBijAux, if_pos (le_of_not_gt h), dif_neg h, apply_inv_self, apply_inv_self,
          if_pos (mem_finPairsLT.1 hab).le]
        split_ifs with h₁ h₂ h₃
        · rfl
        · exact absurd h (not_le_of_gt h₁)
        · rfl
        · dsimp at *
          dsimp [finPairsLT] at hab
          simp? at * says
            

Proof state:
case neg
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f : Perm (Fin n)
x✝ : (_ : Fin n) × Fin n
a b : Fin n
hab : { fst := a, snd := b } ∈ Finset.sigma univ fun a => attachFin (range ↑a) (_ : ∀ x ∈ range ↑a, x < n)
h : f⁻¹ a ≤ f⁻¹ b
h₁ : ¬f⁻¹ b < f⁻¹ a
h₃ : ¬f (f⁻¹ b) ≤ f (f⁻¹ a)
⊢ -1 = 1

Next tactic:
simp only [mem_sigma, mem_univ, mem_attachFin, mem_range, Fin.val_fin_lt,
              true_and, not_lt, apply_inv_self, not_le, Int.neg_units_ne_self] at *
@[simp]
theorem signAux_inv {n : ℕ} (f : Perm (Fin n)) : signAux f⁻¹ = signAux f :=
  prod_bij (fun a _ => signBijAux f⁻¹ a) signBijAux_mem
    (fun ⟨a, b⟩ hab =>
      if h : f⁻¹ b < f⁻¹ a then by
        simp_all [signBijAux, dif_pos h, if_neg h.not_le, apply_inv_self, apply_inv_self,
          if_neg (mem_finPairsLT.1 hab).not_le]
        split_ifs with h₁
        · dsimp [finPairsLT] at hab
          simp? at hab says
            simp only [mem_sigma, mem_univ, mem_attachFin, mem_range, Fin.val_fin_lt,
              true_and] at hab
          exact absurd h₁ (not_le_of_gt hab)
        · rfl
      else by
        simp_all [signBijAux, if_pos (le_of_not_gt h), dif_neg h, apply_inv_self, apply_inv_self,
          if_pos (mem_finPairsLT.1 hab).le]
        split_ifs with h₁ h₂ h₃
        · rfl
        · exact absurd h (not_le_of_gt h₁)
        · rfl
        · dsimp at *
          dsimp [finPairsLT] at hab
          simp? at * says
            simp only [mem_sigma, mem_univ, mem_attachFin, mem_range, Fin.val_fin_lt,
              true_and, not_lt, apply_inv_self, not_le, Int.neg_units_ne_self] at *
          

Proof state:
case neg
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f : Perm (Fin n)
x✝ : (_ : Fin n) × Fin n
a b : Fin n
h : f⁻¹ a ≤ f⁻¹ b
hab : b < a
h₁ : f⁻¹ a ≤ f⁻¹ b
h₃ : a < b
⊢ False

Next tactic:
exact absurd h₃ (asymm_of LT.lt hab)
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  

Proof state:
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
⊢ signAux (f * g) = signAux f * signAux g

Next tactic:
rw [← signAux_inv g]
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  

Proof state:
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
⊢ signAux (f * g) = signAux f * signAux g⁻¹

Next tactic:
unfold signAux
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  

Proof state:
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
⊢ (∏ x in finPairsLT n, if (f * g) x.fst ≤ (f * g) x.snd then -1 else 1) =
    (∏ x in finPairsLT n, if f x.fst ≤ f x.snd then -1 else 1) *
      ∏ x in finPairsLT n, if g⁻¹ x.fst ≤ g⁻¹ x.snd then -1 else 1

Next tactic:
rw [← prod_mul_distrib]
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  

Proof state:
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
⊢ (∏ x in finPairsLT n, if (f * g) x.fst ≤ (f * g) x.snd then -1 else 1) =
    ∏ x in finPairsLT n, (if f x.fst ≤ f x.snd then -1 else 1) * if g⁻¹ x.fst ≤ g⁻¹ x.snd then -1 else 1

Next tactic:
refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by 

Proof state:
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
⊢ ∀ b ∈ finPairsLT n, ∃ a, ∃ (ha : a ∈ finPairsLT n), b = (fun a x => signBijAux g a) a ha

Next tactic:
simpa using signBijAux_surj
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
  

Proof state:
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
⊢ ∀ (a : (_ : Fin n) × Fin n) (ha : a ∈ finPairsLT n),
    (if (f * g) a.fst ≤ (f * g) a.snd then -1 else 1) =
      (if f ((fun a x => signBijAux g a) a ha).fst ≤ f ((fun a x => signBijAux g a) a ha).snd then -1 else 1) *
        if g⁻¹ ((fun a x => signBijAux g a) a ha).fst ≤ g⁻¹ ((fun a x => signBijAux g a) a ha).snd then -1 else 1

Next tactic:
rintro ⟨a, b⟩ hab
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
  rintro ⟨a, b⟩ hab
  

Proof state:
case mk
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
a b : Fin n
hab : { fst := a, snd := b } ∈ finPairsLT n
⊢ (if (f * g) { fst := a, snd := b }.fst ≤ (f * g) { fst := a, snd := b }.snd then -1 else 1) =
    (if
          f ((fun a x => signBijAux g a) { fst := a, snd := b } hab).fst ≤
            f ((fun a x => signBijAux g a) { fst := a, snd := b } hab).snd then
        -1
      else 1) *
      if
          g⁻¹ ((fun a x => signBijAux g a) { fst := a, snd := b } hab).fst ≤
            g⁻¹ ((fun a x => signBijAux g a) { fst := a, snd := b } hab).snd then
        -1
      else 1

Next tactic:
dsimp only [signBijAux]
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
  rintro ⟨a, b⟩ hab
  dsimp only [signBijAux]
  

Proof state:
case mk
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
a b : Fin n
hab : { fst := a, snd := b } ∈ finPairsLT n
⊢ (if (f * g) a ≤ (f * g) b then -1 else 1) =
    (if
          f (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).fst ≤
            f (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).snd then
        -1
      else 1) *
      if
          g⁻¹ (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).fst ≤
            g⁻¹ (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).snd then
        -1
      else 1

Next tactic:
rw [mul_apply, mul_apply]
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
  rintro ⟨a, b⟩ hab
  dsimp only [signBijAux]
  rw [mul_apply, mul_apply]
  

Proof state:
case mk
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
a b : Fin n
hab : { fst := a, snd := b } ∈ finPairsLT n
⊢ (if f (g a) ≤ f (g b) then -1 else 1) =
    (if
          f (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).fst ≤
            f (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).snd then
        -1
      else 1) *
      if
          g⁻¹ (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).fst ≤
            g⁻¹ (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).snd then
        -1
      else 1

Next tactic:
rw [mem_finPairsLT] at hab
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
  rintro ⟨a, b⟩ hab
  dsimp only [signBijAux]
  rw [mul_apply, mul_apply]
  rw [mem_finPairsLT] at hab
  

Proof state:
case mk
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
a b : Fin n
hab : { fst := a, snd := b }.snd < { fst := a, snd := b }.fst
⊢ (if f (g a) ≤ f (g b) then -1 else 1) =
    (if
          f (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).fst ≤
            f (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).snd then
        -1
      else 1) *
      if
          g⁻¹ (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).fst ≤
            g⁻¹ (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).snd then
        -1
      else 1

Next tactic:
by_cases h : g b < g a
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
  rintro ⟨a, b⟩ hab
  dsimp only [signBijAux]
  rw [mul_apply, mul_apply]
  rw [mem_finPairsLT] at hab
  by_cases h : g b < g a
  · 

Proof state:
case pos
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
a b : Fin n
hab : { fst := a, snd := b }.snd < { fst := a, snd := b }.fst
h : g b < g a
⊢ (if f (g a) ≤ f (g b) then -1 else 1) =
    (if
          f (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).fst ≤
            f (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).snd then
        -1
      else 1) *
      if
          g⁻¹ (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).fst ≤
            g⁻¹ (if x : g b < g a then { fst := g a, snd := g b } else { fst := g b, snd := g a }).snd then
        -1
      else 1

Next tactic:
rw [dif_pos h]
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
  rintro ⟨a, b⟩ hab
  dsimp only [signBijAux]
  rw [mul_apply, mul_apply]
  rw [mem_finPairsLT] at hab
  by_cases h : g b < g a
  · rw [dif_pos h]
    

Proof state:
case pos
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
a b : Fin n
hab : { fst := a, snd := b }.snd < { fst := a, snd := b }.fst
h : g b < g a
⊢ (if f (g a) ≤ f (g b) then -1 else 1) =
    (if f { fst := g a, snd := g b }.fst ≤ f { fst := g a, snd := g b }.snd then -1 else 1) *
      if g⁻¹ { fst := g a, snd := g b }.fst ≤ g⁻¹ { fst := g a, snd := g b }.snd then -1 else 1

Next tactic:
simp only [not_le_of_gt hab, mul_one, mul_ite, mul_neg, Perm.inv_apply_self, if_false]
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
  rintro ⟨a, b⟩ hab
  dsimp only [signBijAux]
  rw [mul_apply, mul_apply]
  rw [mem_finPairsLT] at hab
  by_cases h : g b < g a
  · rw [dif_pos h]
    simp only [not_le_of_gt hab, mul_one, mul_ite, mul_neg, Perm.inv_apply_self, if_false]
    

Proof state:
case pos
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
a b : Fin n
hab : { fst := a, snd := b }.snd < { fst := a, snd := b }.fst
h : g b < g a
⊢ (if f (g a) ≤ f (g b) then -1 else 1) =
    if a ≤ b then -if f (g a) ≤ f (g b) then -1 else 1 else if f (g a) ≤ f (g b) then -1 else 1

Next tactic:
split_ifs with h₁ h₂ h₃
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
  rintro ⟨a, b⟩ hab
  dsimp only [signBijAux]
  rw [mul_apply, mul_apply]
  rw [mem_finPairsLT] at hab
  by_cases h : g b < g a
  · rw [dif_pos h]
    simp only [not_le_of_gt hab, mul_one, mul_ite, mul_neg, Perm.inv_apply_self, if_false]
    split_ifs with h₁ h₂ h₃ <;> 

Proof state:
case pos
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
a b : Fin n
hab : { fst := a, snd := b }.snd < { fst := a, snd := b }.fst
h : g b < g a
h₁ : f (g a) ≤ f (g b)
h₂ : a ≤ b
⊢ -1 = - -1

Next tactic:
dsimp at *
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
  rintro ⟨a, b⟩ hab
  dsimp only [signBijAux]
  rw [mul_apply, mul_apply]
  rw [mem_finPairsLT] at hab
  by_cases h : g b < g a
  · rw [dif_pos h]
    simp only [not_le_of_gt hab, mul_one, mul_ite, mul_neg, Perm.inv_apply_self, if_false]
    split_ifs with h₁ h₂ h₃ <;> 

Proof state:
case neg
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
a b : Fin n
hab : { fst := a, snd := b }.snd < { fst := a, snd := b }.fst
h : g b < g a
h₁ : f (g a) ≤ f (g b)
h₂ : ¬a ≤ b
⊢ -1 = -1

Next tactic:
dsimp at *
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
  rintro ⟨a, b⟩ hab
  dsimp only [signBijAux]
  rw [mul_apply, mul_apply]
  rw [mem_finPairsLT] at hab
  by_cases h : g b < g a
  · rw [dif_pos h]
    simp only [not_le_of_gt hab, mul_one, mul_ite, mul_neg, Perm.inv_apply_self, if_false]
    split_ifs with h₁ h₂ h₃ <;> 

Proof state:
case pos
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
a b : Fin n
hab : { fst := a, snd := b }.snd < { fst := a, snd := b }.fst
h : g b < g a
h₁ : ¬f (g a) ≤ f (g b)
h₃ : a ≤ b
⊢ 1 = -1

Next tactic:
dsimp at *
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
  rintro ⟨a, b⟩ hab
  dsimp only [signBijAux]
  rw [mul_apply, mul_apply]
  rw [mem_finPairsLT] at hab
  by_cases h : g b < g a
  · rw [dif_pos h]
    simp only [not_le_of_gt hab, mul_one, mul_ite, mul_neg, Perm.inv_apply_self, if_false]
    split_ifs with h₁ h₂ h₃ <;> 

Proof state:
case neg
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
a b : Fin n
hab : { fst := a, snd := b }.snd < { fst := a, snd := b }.fst
h : g b < g a
h₁ : ¬f (g a) ≤ f (g b)
h₃ : ¬a ≤ b
⊢ 1 = 1

Next tactic:
dsimp at *
theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g := by
  rw [← signAux_inv g]
  unfold signAux
  rw [← prod_mul_distrib]
  refine'
    prod_bij (fun a _ => signBijAux g a) signBijAux_mem _ signBijAux_inj
    (by simpa using signBijAux_surj)
  rintro ⟨a, b⟩ hab
  dsimp only [signBijAux]
  rw [mul_apply, mul_apply]
  rw [mem_finPairsLT] at hab
  by_cases h : g b < g a
  · rw [dif_pos h]
    simp only [not_le_of_gt hab, mul_one, mul_ite, mul_neg, Perm.inv_apply_self, if_false]
    split_ifs with h₁ h₂ h₃ <;> dsimp at *
    · 

Proof state:
case pos
α : Type u
β : Type v
inst✝ : DecidableEq α
n : ℕ
f g : Perm (Fin n)
a b : Fin n
hab : b < a
h : g b < g a
h₁ : f (g a) ≤ f (g b)
h₂ : a ≤ b
⊢ -1 = - -1

Next tactic:
exact absurd hab (not_lt_of_ge h₂)