File: Mathlib/GroupTheory/Perm/Sign.lean

full_name: Equiv.Perm.modSwap
code: /-- `modSwap i j` contains permutations up to swapping `i` and `j`.

We use this to partition permutations in `Matrix.det_zero_of_row_eq`, such that each partition
sums up to `0`.
-/
def modSwap (i j : α) : Setoid (Perm α) 
goal: Setoid (Equiv.Perm α)

full_name: Equiv.Perm.instDecidableRelROfFintype
code: noncomputable instance {α : Type*} [Fintype α] [DecidableEq α] (i j : α) :
    DecidableRel (modSwap i j).r 
goal: DecidableRel Setoid.r

full_name: Equiv.Perm.swapFactorsAux
code: /-- Given a list `l : List α` and a permutation `f : Perm α` such that the nonfixed points of `f`
  are in `l`, recursively factors `f` as a product of transpositions. -/
def swapFactorsAux :
    ∀ (l : List α) (f : Perm α),
      (∀ {x}, f x ≠ x → x ∈ l) → { l : List (Perm α) // l.prod = f ∧ ∀ g ∈ l, IsSwap g }
  
goal: (∀ {x : α}, f x ≠ x → x ∈ l) → { l // l.prod = f ∧ ∀ g ∈ l, g.IsSwap }

full_name: Equiv.Perm.swapFactors
code: /-- `swapFactors` represents a permutation as a product of a list of transpositions.
The representation is non unique and depends on the linear order structure.
For types without linear order `truncSwapFactors` can be used. -/
def swapFactors [Fintype α] [LinearOrder α] (f : Perm α) :
    { l : List (Perm α) // l.prod = f ∧ ∀ g ∈ l, IsSwap g } 
goal: { l // l.prod = f ∧ ∀ g ∈ l, g.IsSwap }

full_name: Equiv.Perm.truncSwapFactors
code: /-- This computably represents the fact that any permutation can be represented as the product of
  a list of transpositions. -/
def truncSwapFactors [Fintype α] (f : Perm α) :
    Trunc { l : List (Perm α) // l.prod = f ∧ ∀ g ∈ l, IsSwap g } 
goal: Trunc { l // l.prod = f ∧ ∀ g ∈ l, g.IsSwap }

full_name: Equiv.Perm.swap_induction_on
code: /-- An induction principle for permutations. If `P` holds for the identity permutation, and
is preserved under composition with a non-trivial swap, then `P` holds for all permutations. -/
@[elab_as_elim]
theorem swap_induction_on [Finite α] {P : Perm α → Prop} (f : Perm α) :
    P 1 → (∀ f x y, x ≠ y → P f → P (swap x y * f)) → P f 
goal: P 1 → (∀ (f : Equiv.Perm α) (x y : α), x ≠ y → P f → P (Equiv.swap x y * f)) → P f

full_name: Equiv.Perm.mclosure_isSwap
code: theorem mclosure_isSwap [Finite α] : Submonoid.closure { σ : Perm α | IsSwap σ } = ⊤ 
goal: Submonoid.closure {σ | σ.IsSwap} = ⊤

full_name: Equiv.Perm.closure_isSwap
code: theorem closure_isSwap [Finite α] : Subgroup.closure { σ : Perm α | IsSwap σ } = ⊤ 
goal: Subgroup.closure {σ | σ.IsSwap} = ⊤

full_name: Equiv.Perm.mclosure_swap_castSucc_succ
code: /-- Every finite symmetric group is generated by transpositions of adjacent elements. -/
theorem mclosure_swap_castSucc_succ (n : ℕ) :
    Submonoid.closure (Set.range fun i : Fin n ↦ swap i.castSucc i.succ) = ⊤ 
goal: Submonoid.closure (Set.range fun i => Equiv.swap i.castSucc i.succ) = ⊤

full_name: Equiv.Perm.swap_induction_on'
code: /-- Like `swap_induction_on`, but with the composition on the right of `f`.

An induction principle for permutations. If `P` holds for the identity permutation, and
is preserved under composition with a non-trivial swap, then `P` holds for all permutations. -/
@[elab_as_elim]
theorem swap_induction_on' [Finite α] {P : Perm α → Prop} (f : Perm α) :
    P 1 → (∀ f x y, x ≠ y → P f → P (f * swap x y)) → P f 
goal: P 1 → (∀ (f : Equiv.Perm α) (x y : α), x ≠ y → P f → P (f * Equiv.swap x y)) → P f

full_name: Equiv.Perm.isConj_swap
code: theorem isConj_swap {w x y z : α} (hwx : w ≠ x) (hyz : y ≠ z) : IsConj (swap w x) (swap y z) 
goal: IsConj (Equiv.swap w x) (Equiv.swap y z)

full_name: Equiv.Perm.finPairsLT
code: /-- set of all pairs (⟨a, b⟩ : Σ a : fin n, fin n) such that b < a -/
def finPairsLT (n : ℕ) : Finset (Σ_ : Fin n, Fin n) 
goal: Finset ((_ : Fin n) × Fin n)

full_name: Equiv.Perm.mem_finPairsLT
code: theorem mem_finPairsLT {n : ℕ} {a : Σ_ : Fin n, Fin n} : a ∈ finPairsLT n ↔ a.2 < a.1 
goal: a ∈ Equiv.Perm.finPairsLT n ↔ a.snd < a.fst

full_name: Equiv.Perm.signAux
code: /-- `signAux σ` is the sign of a permutation on `Fin n`, defined as the parity of the number of
  pairs `(x₁, x₂)` such that `x₂ < x₁` but `σ x₁ ≤ σ x₂` -/
def signAux {n : ℕ} (a : Perm (Fin n)) : ℤˣ 
goal: ℤˣ

full_name: Equiv.Perm.signAux_one
code: @[simp]
theorem signAux_one (n : ℕ) : signAux (1 : Perm (Fin n)) = 1 
goal: Equiv.Perm.signAux 1 = 1

full_name: Equiv.Perm.signBijAux
code: /-- `signBijAux f ⟨a, b⟩` returns the pair consisting of `f a` and `f b` in decreasing order. -/
def signBijAux {n : ℕ} (f : Perm (Fin n)) (a : Σ_ : Fin n, Fin n) : Σ_ : Fin n, Fin n 
goal: (_ : Fin n) × Fin n

full_name: Equiv.Perm.signBijAux_injOn
code: theorem signBijAux_injOn {n : ℕ} {f : Perm (Fin n)} :
    (finPairsLT n : Set (Σ _, Fin n)).InjOn (signBijAux f) 
goal: Set.InjOn f.signBijAux ↑(Equiv.Perm.finPairsLT n)

full_name: Equiv.Perm.signBijAux_surj
code: theorem signBijAux_surj {n : ℕ} {f : Perm (Fin n)} :
    ∀ a ∈ finPairsLT n, ∃ b ∈ finPairsLT n, signBijAux f b = a 
goal: a ∈ Equiv.Perm.finPairsLT n → ∃ b ∈ Equiv.Perm.finPairsLT n, f.signBijAux b = a

full_name: Equiv.Perm.signBijAux_mem
code: theorem signBijAux_mem {n : ℕ} {f : Perm (Fin n)} :
    ∀ a : Σ_ : Fin n, Fin n, a ∈ finPairsLT n → signBijAux f a ∈ finPairsLT n 
goal: a ∈ Equiv.Perm.finPairsLT n → f.signBijAux a ∈ Equiv.Perm.finPairsLT n

full_name: Equiv.Perm.signAux_inv
code: @[simp]
theorem signAux_inv {n : ℕ} (f : Perm (Fin n)) : signAux f⁻¹ = signAux f 
goal: f⁻¹.signAux = f.signAux

full_name: Equiv.Perm.signAux_mul
code: theorem signAux_mul {n : ℕ} (f g : Perm (Fin n)) : signAux (f * g) = signAux f * signAux g 
goal: (f * g).signAux = f.signAux * g.signAux

full_name: _private.Mathlib.GroupTheory.Perm.Sign.0.Equiv.Perm.signAux_swap_zero_one'
code: private theorem signAux_swap_zero_one' (n : ℕ) : signAux (swap (0 : Fin (n + 2)) 1) = -1 
goal: (Equiv.swap 0 1).signAux = -1

full_name: _private.Mathlib.GroupTheory.Perm.Sign.0.Equiv.Perm.signAux_swap_zero_one
code: private theorem signAux_swap_zero_one {n : ℕ} (hn : 2 ≤ n) :
    signAux (swap (⟨0, lt_of_lt_of_le (by decide) hn⟩ : Fin n) ⟨1, lt_of_lt_of_le (by decide) hn⟩) =
      -1 
goal: (Equiv.swap ⟨0, ⋯⟩ ⟨1, ⋯⟩).signAux = -1

full_name: Equiv.Perm.signAux_swap
code: theorem signAux_swap : ∀ {n : ℕ} {x y : Fin n} (_hxy : x ≠ y), signAux (swap x y) = -1
  
goal: (Equiv.swap x y).signAux = -1

full_name: Equiv.Perm.signAux2
code: /-- When the list `l : List α` contains all nonfixed points of the permutation `f : Perm α`,
  `signAux2 l f` recursively calculates the sign of `f`. -/
def signAux2 : List α → Perm α → ℤˣ
  
goal: List α → Equiv.Perm α → ℤˣ

full_name: Equiv.Perm.signAux_eq_signAux2
code: theorem signAux_eq_signAux2 {n : ℕ} :
    ∀ (l : List α) (f : Perm α) (e : α ≃ Fin n) (_h : ∀ x, f x ≠ x → x ∈ l),
      signAux ((e.symm.trans f).trans e) = signAux2 l f
  
goal: Equiv.Perm.signAux ((e.symm.trans f).trans e) = Equiv.Perm.signAux2 l f

full_name: Equiv.Perm.signAux3
code: /-- When the multiset `s : Multiset α` contains all nonfixed points of the permutation `f : Perm α`,
  `signAux2 f _` recursively calculates the sign of `f`. -/
def signAux3 [Finite α] (f : Perm α) {s : Multiset α} : (∀ x, x ∈ s) → ℤˣ 
goal: (∀ (x : α), x ∈ s) → ℤˣ

full_name: Equiv.Perm.signAux3_mul_and_swap
code: theorem signAux3_mul_and_swap [Finite α] (f g : Perm α) (s : Multiset α) (hs : ∀ x, x ∈ s) :
    signAux3 (f * g) hs = signAux3 f hs * signAux3 g hs ∧
      Pairwise fun x y => signAux3 (swap x y) hs = -1 
goal: (f * g).signAux3 hs = f.signAux3 hs * g.signAux3 hs ∧ Pairwise fun x y => (Equiv.swap x y).signAux3 hs = -1

full_name: Equiv.Perm.signAux3_symm_trans_trans
code: theorem signAux3_symm_trans_trans [Finite α] [DecidableEq β] [Finite β] (f : Perm α) (e : α ≃ β)
    {s : Multiset α} {t : Multiset β} (hs : ∀ x, x ∈ s) (ht : ∀ x, x ∈ t) :
    signAux3 ((e.symm.trans f).trans e) ht = signAux3 f hs 
goal: Equiv.Perm.signAux3 ((e.symm.trans f).trans e) ht = f.signAux3 hs

full_name: Equiv.Perm.sign
code: /-- `SignType.sign` of a permutation returns the signature or parity of a permutation, `1` for even
permutations, `-1` for odd permutations. It is the unique surjective group homomorphism from
`Perm α` to the group with two elements. -/
def sign [Fintype α] : Perm α →* ℤˣ 
goal: Equiv.Perm α →* ℤˣ

full_name: Equiv.Perm.sign_mul
code: theorem sign_mul (f g : Perm α) : sign (f * g) = sign f * sign g 
goal: Equiv.Perm.sign (f * g) = Equiv.Perm.sign f * Equiv.Perm.sign g

full_name: Equiv.Perm.sign_trans
code: @[simp]
theorem sign_trans (f g : Perm α) : sign (f.trans g) = sign g * sign f 
goal: Equiv.Perm.sign (Equiv.trans f g) = Equiv.Perm.sign g * Equiv.Perm.sign f

full_name: Equiv.Perm.sign_one
code: theorem sign_one : sign (1 : Perm α) = 1 
goal: Equiv.Perm.sign 1 = 1

full_name: Equiv.Perm.sign_refl
code: @[simp]
theorem sign_refl : sign (Equiv.refl α) = 1 
goal: Equiv.Perm.sign (Equiv.refl α) = 1

full_name: Equiv.Perm.sign_inv
code: theorem sign_inv (f : Perm α) : sign f⁻¹ = sign f 
goal: Equiv.Perm.sign f⁻¹ = Equiv.Perm.sign f

full_name: Equiv.Perm.sign_symm
code: @[simp]
theorem sign_symm (e : Perm α) : sign e.symm = sign e 
goal: Equiv.Perm.sign (Equiv.symm e) = Equiv.Perm.sign e

full_name: Equiv.Perm.sign_swap
code: theorem sign_swap {x y : α} (h : x ≠ y) : sign (swap x y) = -1 
goal: Equiv.Perm.sign (Equiv.swap x y) = -1

full_name: Equiv.Perm.sign_swap'
code: @[simp]
theorem sign_swap' {x y : α} : sign (swap x y) = if x = y then 1 else -1 
goal: Equiv.Perm.sign (Equiv.swap x y) = if x = y then 1 else -1

full_name: Equiv.Perm.IsSwap.sign_eq
code: theorem IsSwap.sign_eq {f : Perm α} (h : f.IsSwap) : sign f = -1 
goal: Equiv.Perm.sign f = -1

full_name: Equiv.Perm.sign_symm_trans_trans
code: @[simp]
theorem sign_symm_trans_trans [DecidableEq β] [Fintype β] (f : Perm α) (e : α ≃ β) :
    sign ((e.symm.trans f).trans e) = sign f 
goal: Equiv.Perm.sign ((e.symm.trans f).trans e) = Equiv.Perm.sign f

full_name: Equiv.Perm.sign_trans_trans_symm
code: @[simp]
theorem sign_trans_trans_symm [DecidableEq β] [Fintype β] (f : Perm β) (e : α ≃ β) :
    sign ((e.trans f).trans e.symm) = sign f 
goal: Equiv.Perm.sign ((e.trans f).trans e.symm) = Equiv.Perm.sign f

full_name: Equiv.Perm.sign_prod_list_swap
code: theorem sign_prod_list_swap {l : List (Perm α)} (hl : ∀ g ∈ l, IsSwap g) :
    sign l.prod = (-1) ^ l.length 
goal: Equiv.Perm.sign l.prod = (-1) ^ l.length

full_name: Equiv.Perm.sign_abs
code: @[simp]
theorem sign_abs (f : Perm α) :
    |(Equiv.Perm.sign f : ℤ)| = 1 
goal: |↑(Equiv.Perm.sign f)| = 1

full_name: Equiv.Perm.sign_surjective
code: theorem sign_surjective [Nontrivial α] : Function.Surjective (sign : Perm α → ℤˣ) 
goal: Function.Surjective ⇑Equiv.Perm.sign

full_name: Equiv.Perm.eq_sign_of_surjective_hom
code: theorem eq_sign_of_surjective_hom {s : Perm α →* ℤˣ} (hs : Surjective s) : s = sign 
goal: s = Equiv.Perm.sign

full_name: Equiv.Perm.sign_subtypePerm
code: theorem sign_subtypePerm (f : Perm α) {p : α → Prop} [DecidablePred p] (h₁ : ∀ x, p x ↔ p (f x))
    (h₂ : ∀ x, f x ≠ x → p x) : sign (subtypePerm f h₁) = sign f 
goal: Equiv.Perm.sign (f.subtypePerm h₁) = Equiv.Perm.sign f

full_name: Equiv.Perm.sign_eq_sign_of_equiv
code: theorem sign_eq_sign_of_equiv [DecidableEq β] [Fintype β] (f : Perm α) (g : Perm β) (e : α ≃ β)
    (h : ∀ x, e (f x) = g (e x)) : sign f = sign g 
goal: Equiv.Perm.sign f = Equiv.Perm.sign g

full_name: Equiv.Perm.sign_bij
code: theorem sign_bij [DecidableEq β] [Fintype β] {f : Perm α} {g : Perm β} (i : ∀ x : α, f x ≠ x → β)
    (h : ∀ x hx hx', i (f x) hx' = g (i x hx)) (hi : ∀ x₁ x₂ hx₁ hx₂, i x₁ hx₁ = i x₂ hx₂ → x₁ = x₂)
    (hg : ∀ y, g y ≠ y → ∃ x hx, i x hx = y) : sign f = sign g 
goal: Equiv.Perm.sign f = Equiv.Perm.sign g

full_name: Equiv.Perm.prod_prodExtendRight
code: /-- If we apply `prod_extendRight a (σ a)` for all `a : α` in turn,
we get `prod_congrRight σ`. -/
theorem prod_prodExtendRight {α : Type*} [DecidableEq α] (σ : α → Perm β) {l : List α}
    (hl : l.Nodup) (mem_l : ∀ a, a ∈ l) :
    (l.map fun a => prodExtendRight a (σ a)).prod = prodCongrRight σ 
goal: (List.map (fun a => Equiv.Perm.prodExtendRight a (σ a)) l).prod = Equiv.prodCongrRight σ

full_name: Equiv.Perm.sign_prodExtendRight
code: @[simp]
theorem sign_prodExtendRight (a : α) (σ : Perm β) : sign (prodExtendRight a σ) = sign σ 
goal: Equiv.Perm.sign (Equiv.Perm.prodExtendRight a σ) = Equiv.Perm.sign σ

full_name: Equiv.Perm.sign_prodCongrRight
code: theorem sign_prodCongrRight (σ : α → Perm β) : sign (prodCongrRight σ) = ∏ k, sign (σ k) 
goal: Equiv.Perm.sign (Equiv.prodCongrRight σ) = ∏ k : α, Equiv.Perm.sign (σ k)

full_name: Equiv.Perm.sign_prodCongrLeft
code: theorem sign_prodCongrLeft (σ : α → Perm β) : sign (prodCongrLeft σ) = ∏ k, sign (σ k) 
goal: Equiv.Perm.sign (Equiv.prodCongrLeft σ) = ∏ k : α, Equiv.Perm.sign (σ k)

full_name: Equiv.Perm.sign_permCongr
code: @[simp]
theorem sign_permCongr (e : α ≃ β) (p : Perm α) : sign (e.permCongr p) = sign p 
goal: Equiv.Perm.sign (e.permCongr p) = Equiv.Perm.sign p

full_name: Equiv.Perm.sign_sumCongr
code: @[simp]
theorem sign_sumCongr (σa : Perm α) (σb : Perm β) : sign (sumCongr σa σb) = sign σa * sign σb 
goal: Equiv.Perm.sign (σa.sumCongr σb) = Equiv.Perm.sign σa * Equiv.Perm.sign σb

full_name: Equiv.Perm.sign_subtypeCongr
code: @[simp]
theorem sign_subtypeCongr {p : α → Prop} [DecidablePred p] (ep : Perm { a // p a })
    (en : Perm { a // ¬p a }) : sign (ep.subtypeCongr en) = sign ep * sign en 
goal: Equiv.Perm.sign (ep.subtypeCongr en) = Equiv.Perm.sign ep * Equiv.Perm.sign en

full_name: Equiv.Perm.sign_extendDomain
code: @[simp]
theorem sign_extendDomain (e : Perm α) {p : β → Prop} [DecidablePred p] (f : α ≃ Subtype p) :
    Equiv.Perm.sign (e.extendDomain f) = Equiv.Perm.sign e 
goal: Equiv.Perm.sign (e.extendDomain f) = Equiv.Perm.sign e

full_name: Equiv.Perm.sign_ofSubtype
code: @[simp]
theorem sign_ofSubtype {p : α → Prop} [DecidablePred p] (f : Equiv.Perm (Subtype p)) :
    sign (ofSubtype f) = sign f 
goal: Equiv.Perm.sign (Equiv.Perm.ofSubtype f) = Equiv.Perm.sign f