File: Mathlib/LinearAlgebra/Matrix/SpecialLinearGroup.lean

full_name: Matrix.SpecialLinearGroup
code: /-- `SpecialLinearGroup n R` is the group of `n` by `n` `R`-matrices with determinant equal to 1.
-/
def SpecialLinearGroup 
goal: Type (max 0 u v)

full_name: MatrixGroups.«_aux_Mathlib_LinearAlgebra_Matrix_SpecialLinearGroup___macroRules_MatrixGroups_termSL(_,_)_1»
code: @[inherit_doc]
scoped[MatrixGroups] notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R
goal: Lean.Macro

full_name: MatrixGroups._aux_Mathlib_LinearAlgebra_Matrix_SpecialLinearGroup___unexpand_Matrix_SpecialLinearGroup_1
code: @[inherit_doc]
scoped[MatrixGroups] notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R
goal: Lean.PrettyPrinter.Unexpander

full_name: Matrix.SpecialLinearGroup.hasCoeToMatrix
code: instance hasCoeToMatrix : Coe (SpecialLinearGroup n R) (Matrix n n R) 
goal: Coe (Matrix.SpecialLinearGroup n R) (Matrix n n R)

full_name: Matrix.SpecialLinearGroup.«_aux_Mathlib_LinearAlgebra_Matrix_SpecialLinearGroup___macroRules_Matrix_SpecialLinearGroup_term↑ₘ__1»
code: /-- In this file, Lean often has a hard time working out the values of `n` and `R` for an expression
like `det ↑A`. Rather than writing `(A : Matrix n n R)` everywhere in this file which is annoyingly
verbose, or `A.val` which is not the simp-normal form for subtypes, we create a local notation
`↑ₘA`. This notation references the local `n` and `R` variables, so is not valid as a global
notation. -/
local notation:1024 "↑ₘ" A:1024 => ((A : SpecialLinearGroup n R) : Matrix n n R)
goal: Lean.Macro

full_name: Matrix.SpecialLinearGroup.instCoeFun
code: /-- This instance is here for convenience, but is literally the same as the coercion from
`hasCoeToMatrix`. -/
instance instCoeFun : CoeFun (SpecialLinearGroup n R) fun _ => n → n → R 
goal: CoeFun (Matrix.SpecialLinearGroup n R) fun x => n → n → R

full_name: Matrix.SpecialLinearGroup.ext_iff
code: theorem ext_iff (A B : SpecialLinearGroup n R) : A = B ↔ ∀ i j, ↑ₘA i j = ↑ₘB i j 
goal: A = B ↔ ∀ (i j : n), ↑A i j = ↑B i j

full_name: Matrix.SpecialLinearGroup.ext
code: @[ext]
theorem ext (A B : SpecialLinearGroup n R) : (∀ i j, ↑ₘA i j = ↑ₘB i j) → A = B 
goal: (∀ (i j : n), ↑A i j = ↑B i j) → A = B

full_name: Matrix.SpecialLinearGroup.subsingleton_of_subsingleton
code: instance subsingleton_of_subsingleton [Subsingleton n] : Subsingleton (SpecialLinearGroup n R) 
goal: Subsingleton (Matrix.SpecialLinearGroup n R)

full_name: Matrix.SpecialLinearGroup.hasInv
code: instance hasInv : Inv (SpecialLinearGroup n R) 
goal: Inv (Matrix.SpecialLinearGroup n R)

full_name: Matrix.SpecialLinearGroup.hasMul
code: instance hasMul : Mul (SpecialLinearGroup n R) 
goal: Mul (Matrix.SpecialLinearGroup n R)

full_name: Matrix.SpecialLinearGroup.hasOne
code: instance hasOne : One (SpecialLinearGroup n R) 
goal: One (Matrix.SpecialLinearGroup n R)

full_name: Matrix.SpecialLinearGroup.instPowNat
code: instance : Pow (SpecialLinearGroup n R) ℕ 
goal: Pow (Matrix.SpecialLinearGroup n R) ℕ

full_name: Matrix.SpecialLinearGroup.instInhabited
code: instance : Inhabited (SpecialLinearGroup n R) 
goal: Inhabited (Matrix.SpecialLinearGroup n R)

full_name: Matrix.SpecialLinearGroup.transpose
code: /-- The transpose of a matrix in `SL(n, R)` -/
def transpose (A : SpecialLinearGroup n R) : SpecialLinearGroup n R 
goal: Matrix.SpecialLinearGroup n R

full_name: Matrix.SpecialLinearGroup._aux_Mathlib_LinearAlgebra_Matrix_SpecialLinearGroup___unexpand_Matrix_SpecialLinearGroup_transpose_1
code: @[inherit_doc]
scoped postfix:1024 "ᵀ" => SpecialLinearGroup.transpose
goal: Lean.PrettyPrinter.Unexpander

full_name: Matrix.SpecialLinearGroup.«_aux_Mathlib_LinearAlgebra_Matrix_SpecialLinearGroup___macroRules_Matrix_SpecialLinearGroup_term_ᵀ_1»
code: @[inherit_doc]
scoped postfix:1024 "ᵀ" => SpecialLinearGroup.transpose
goal: Lean.Macro

full_name: Matrix.SpecialLinearGroup.coe_mk
code: theorem coe_mk (A : Matrix n n R) (h : det A = 1) : ↑(⟨A, h⟩ : SpecialLinearGroup n R) = A 
goal: ↑⟨A, h⟩ = A

full_name: Matrix.SpecialLinearGroup.coe_inv
code: @[simp]
theorem coe_inv : ↑ₘA⁻¹ = adjugate A 
goal: ↑A⁻¹ = (↑A).adjugate

full_name: Matrix.SpecialLinearGroup.coe_mul
code: @[simp]
theorem coe_mul : ↑ₘ(A * B) = ↑ₘA * ↑ₘB 
goal: ↑(A * B) = ↑A * ↑B

full_name: Matrix.SpecialLinearGroup.coe_one
code: @[simp]
theorem coe_one : ↑ₘ(1 : SpecialLinearGroup n R) = (1 : Matrix n n R) 
goal: ↑1 = 1

full_name: Matrix.SpecialLinearGroup.det_coe
code: @[simp]
theorem det_coe : det ↑ₘA = 1 
goal: (↑A).det = 1

full_name: Matrix.SpecialLinearGroup.coe_pow
code: @[simp]
theorem coe_pow (m : ℕ) : ↑ₘ(A ^ m) = ↑ₘA ^ m 
goal: ↑(A ^ m) = ↑A ^ m

full_name: Matrix.SpecialLinearGroup.coe_transpose
code: @[simp]
lemma coe_transpose (A : SpecialLinearGroup n R) : ↑ₘAᵀ = (↑ₘA)ᵀ 
goal: ↑A.transpose = (↑A).transpose

full_name: Matrix.SpecialLinearGroup.det_ne_zero
code: theorem det_ne_zero [Nontrivial R] (g : SpecialLinearGroup n R) : det ↑ₘg ≠ 0 
goal: (↑g).det ≠ 0

full_name: Matrix.SpecialLinearGroup.row_ne_zero
code: theorem row_ne_zero [Nontrivial R] (g : SpecialLinearGroup n R) (i : n) : ↑ₘg i ≠ 0 
goal: ↑g i ≠ 0

full_name: Matrix.SpecialLinearGroup.monoid
code: instance monoid : Monoid (SpecialLinearGroup n R) 
goal: Monoid (Matrix.SpecialLinearGroup n R)

full_name: Matrix.SpecialLinearGroup.instGroup
code: instance : Group (SpecialLinearGroup n R) 
goal: Group (Matrix.SpecialLinearGroup n R)

full_name: Matrix.SpecialLinearGroup.toLin'
code: /-- A version of `Matrix.toLin' A` that produces linear equivalences. -/
def toLin' : SpecialLinearGroup n R →* (n → R) ≃ₗ[R] n → R 
goal: Matrix.SpecialLinearGroup n R →* (n → R) ≃ₗ[R] n → R

full_name: Matrix.SpecialLinearGroup.toLin'_apply
code: theorem toLin'_apply (A : SpecialLinearGroup n R) (v : n → R) :
    SpecialLinearGroup.toLin' A v = Matrix.toLin' (↑ₘA) v 
goal: (Matrix.SpecialLinearGroup.toLin' A) v = (Matrix.toLin' ↑A) v

full_name: Matrix.SpecialLinearGroup.toLin'_to_linearMap
code: theorem toLin'_to_linearMap (A : SpecialLinearGroup n R) :
    ↑(SpecialLinearGroup.toLin' A) = Matrix.toLin' ↑ₘA 
goal: ↑(Matrix.SpecialLinearGroup.toLin' A) = Matrix.toLin' ↑A

full_name: Matrix.SpecialLinearGroup.toLin'_symm_apply
code: theorem toLin'_symm_apply (A : SpecialLinearGroup n R) (v : n → R) :
    A.toLin'.symm v = Matrix.toLin' (↑ₘA⁻¹) v 
goal: (Matrix.SpecialLinearGroup.toLin' A).symm v = (Matrix.toLin' ↑A⁻¹) v

full_name: Matrix.SpecialLinearGroup.toLin'_symm_to_linearMap
code: theorem toLin'_symm_to_linearMap (A : SpecialLinearGroup n R) :
    ↑A.toLin'.symm = Matrix.toLin' ↑ₘA⁻¹ 
goal: ↑(Matrix.SpecialLinearGroup.toLin' A).symm = Matrix.toLin' ↑A⁻¹

full_name: Matrix.SpecialLinearGroup.toLin'_injective
code: theorem toLin'_injective :
    Function.Injective ↑(toLin' : SpecialLinearGroup n R →* (n → R) ≃ₗ[R] n → R) 
goal: Function.Injective ⇑Matrix.SpecialLinearGroup.toLin'

full_name: Matrix.SpecialLinearGroup.toGL
code: /-- `toGL` is the map from the special linear group to the general linear group -/
def toGL : SpecialLinearGroup n R →* GeneralLinearGroup R (n → R) 
goal: Matrix.SpecialLinearGroup n R →* LinearMap.GeneralLinearGroup R (n → R)

full_name: Matrix.SpecialLinearGroup.coe_toGL
code: theorem coe_toGL (A : SpecialLinearGroup n R) : SpecialLinearGroup.toGL A = A.toLin'.toLinearMap 
goal: ↑(Matrix.SpecialLinearGroup.toGL A) = ↑(Matrix.SpecialLinearGroup.toLin' A)

full_name: Matrix.SpecialLinearGroup.map_apply_coe
code: /-- A ring homomorphism from `R` to `S` induces a group homomorphism from
`SpecialLinearGroup n R` to `SpecialLinearGroup n S`. -/
@[simps]
def map (f : R →+* S) : SpecialLinearGroup n R →* SpecialLinearGroup n S 
goal: ↑((Matrix.SpecialLinearGroup.map f) g) = f.mapMatrix ↑g

full_name: Matrix.SpecialLinearGroup.map
code: /-- A ring homomorphism from `R` to `S` induces a group homomorphism from
`SpecialLinearGroup n R` to `SpecialLinearGroup n S`. -/
@[simps]
def map (f : R →+* S) : SpecialLinearGroup n R →* SpecialLinearGroup n S 
goal: Matrix.SpecialLinearGroup n R →* Matrix.SpecialLinearGroup n S

full_name: Matrix.SpecialLinearGroup.center_eq_bot_of_subsingleton
code: @[simp]
theorem center_eq_bot_of_subsingleton [Subsingleton n] :
    center (SpecialLinearGroup n R) = ⊥ 
goal: Subgroup.center (Matrix.SpecialLinearGroup n R) = ⊥

full_name: Matrix.SpecialLinearGroup.scalar_eq_self_of_mem_center
code: theorem scalar_eq_self_of_mem_center
    {A : SpecialLinearGroup n R} (hA : A ∈ center (SpecialLinearGroup n R)) (i : n) :
    scalar n (A i i) = A 
goal: (Matrix.scalar n) (↑A i i) = ↑A

full_name: Matrix.SpecialLinearGroup.scalar_eq_coe_self_center
code: theorem scalar_eq_coe_self_center
    (A : center (SpecialLinearGroup n R)) (i : n) :
    scalar n ((A : Matrix n n R) i i) = A 
goal: (Matrix.scalar n) (↑↑A i i) = ↑↑A

full_name: Matrix.SpecialLinearGroup.mem_center_iff
code: /-- The center of a special linear group of degree `n` is the subgroup of scalar matrices, for which
the scalars are the `n`-th roots of unity. -/
theorem mem_center_iff {A : SpecialLinearGroup n R} :
    A ∈ center (SpecialLinearGroup n R) ↔ ∃ (r : R), r ^ (Fintype.card n) = 1 ∧ scalar n r = A 
goal: A ∈ Subgroup.center (Matrix.SpecialLinearGroup n R) ↔ ∃ r, r ^ Fintype.card n = 1 ∧ (Matrix.scalar n) r = ↑A

full_name: Matrix.SpecialLinearGroup.center_equiv_rootsOfUnity'_symm_apply_coe_coe
code: /-- An equivalence of groups, from the center of the special linear group to the roots of unity. -/
@[simps]
def center_equiv_rootsOfUnity' (i : n) :
    center (SpecialLinearGroup n R) ≃* rootsOfUnity (Fintype.card n).toPNat' R 
goal: ↑↑((Matrix.SpecialLinearGroup.center_equiv_rootsOfUnity' i).symm a) = a • 1

full_name: Matrix.SpecialLinearGroup.center_equiv_rootsOfUnity'_apply
code: /-- An equivalence of groups, from the center of the special linear group to the roots of unity. -/
@[simps]
def center_equiv_rootsOfUnity' (i : n) :
    center (SpecialLinearGroup n R) ≃* rootsOfUnity (Fintype.card n).toPNat' R 
goal: (Matrix.SpecialLinearGroup.center_equiv_rootsOfUnity' i) A = rootsOfUnity.mkOfPowEq (↑↑A i i) ⋯

full_name: Matrix.SpecialLinearGroup.center_equiv_rootsOfUnity'
code: /-- An equivalence of groups, from the center of the special linear group to the roots of unity. -/
@[simps]
def center_equiv_rootsOfUnity' (i : n) :
    center (SpecialLinearGroup n R) ≃* rootsOfUnity (Fintype.card n).toPNat' R 
goal: ↥(Subgroup.center (Matrix.SpecialLinearGroup n R)) ≃* ↥(rootsOfUnity (Fintype.card n).toPNat' R)

full_name: Matrix.SpecialLinearGroup.center_equiv_rootsOfUnity
code: /-- An equivalence of groups, from the center of the special linear group to the roots of unity.

See also `center_equiv_rootsOfUnity'`. -/
noncomputable def center_equiv_rootsOfUnity :
    center (SpecialLinearGroup n R) ≃* rootsOfUnity (Fintype.card n).toPNat' R 
goal: ↥(Subgroup.center (Matrix.SpecialLinearGroup n R)) ≃* ↥(rootsOfUnity (Fintype.card n).toPNat' R)

full_name: Matrix.SpecialLinearGroup.instCoeInt
code: /-- Coercion of SL `n` `ℤ` to SL `n` `R` for a commutative ring `R`. -/
instance : Coe (SpecialLinearGroup n ℤ) (SpecialLinearGroup n R) 
goal: Coe (Matrix.SpecialLinearGroup n ℤ) (Matrix.SpecialLinearGroup n R)

full_name: Matrix.SpecialLinearGroup.coe_matrix_coe
code: @[simp]
theorem coe_matrix_coe (g : SpecialLinearGroup n ℤ) :
    ↑(g : SpecialLinearGroup n R) = (↑g : Matrix n n ℤ).map (Int.castRingHom R) 
goal: ↑((Matrix.SpecialLinearGroup.map (Int.castRingHom R)) g) = (↑g).map ⇑(Int.castRingHom R)

full_name: Matrix.SpecialLinearGroup.instNeg
code: /-- Formal operation of negation on special linear group on even cardinality `n` given by negating
each element. -/
instance instNeg : Neg (SpecialLinearGroup n R) 
goal: Neg (Matrix.SpecialLinearGroup n R)

full_name: Matrix.SpecialLinearGroup.coe_neg
code: @[simp]
theorem coe_neg (g : SpecialLinearGroup n R) : ↑(-g) = -(g : Matrix n n R) 
goal: ↑(-g) = -↑g

full_name: Matrix.SpecialLinearGroup.instHasDistribNeg
code: instance : HasDistribNeg (SpecialLinearGroup n R) 
goal: HasDistribNeg (Matrix.SpecialLinearGroup n R)

full_name: Matrix.SpecialLinearGroup.coe_int_neg
code: @[simp]
theorem coe_int_neg (g : SpecialLinearGroup n ℤ) : ↑(-g) = (-↑g : SpecialLinearGroup n R) 
goal: (Matrix.SpecialLinearGroup.map (Int.castRingHom R)) (-g) = -(Matrix.SpecialLinearGroup.map (Int.castRingHom R)) g

full_name: Matrix.SpecialLinearGroup.SL2_inv_expl_det
code: theorem SL2_inv_expl_det (A : SL(2, R)) :
    det ![![A.1 1 1, -A.1 0 1], ![-A.1 1 0, A.1 0 0]] = 1 
goal: Matrix.det ![![↑A 1 1, -↑A 0 1], ![-↑A 1 0, ↑A 0 0]] = 1

full_name: Matrix.SpecialLinearGroup.SL2_inv_expl
code: theorem SL2_inv_expl (A : SL(2, R)) :
    A⁻¹ = ⟨![![A.1 1 1, -A.1 0 1], ![-A.1 1 0, A.1 0 0]], SL2_inv_expl_det A⟩ 
goal: A⁻¹ = ⟨![![↑A 1 1, -↑A 0 1], ![-↑A 1 0, ↑A 0 0]], ⋯⟩

full_name: Matrix.SpecialLinearGroup.fin_two_induction
code: theorem fin_two_induction (P : SL(2, R) → Prop)
    (h : ∀ (a b c d : R) (hdet : a * d - b * c = 1), P ⟨!![a, b; c, d], by rwa [det_fin_two_of]⟩)
    (g : SL(2, R)) : P g 
goal: P g

full_name: Matrix.SpecialLinearGroup.fin_two_exists_eq_mk_of_apply_zero_one_eq_zero
code: theorem fin_two_exists_eq_mk_of_apply_zero_one_eq_zero {R : Type*} [Field R] (g : SL(2, R))
    (hg : (g : Matrix (Fin 2) (Fin 2) R) 1 0 = 0) :
    ∃ (a b : R) (h : a ≠ 0), g = (⟨!![a, b; 0, a⁻¹], by simp [h]⟩ : SL(2, R)) 
goal: ∃ a b, ∃ (h : a ≠ 0), g = ⟨!![a, b; 0, a⁻¹], ⋯⟩

full_name: Matrix.SpecialLinearGroup.isCoprime_row
code: lemma isCoprime_row (A : SL(2, R)) (i : Fin 2) : IsCoprime (A i 0) (A i 1) 
goal: IsCoprime (↑A i 0) (↑A i 1)

full_name: Matrix.SpecialLinearGroup.isCoprime_col
code: lemma isCoprime_col (A : SL(2, R)) (j : Fin 2) : IsCoprime (A 0 j) (A 1 j) 
goal: IsCoprime (↑A 0 j) (↑A 1 j)

full_name: IsCoprime.exists_SL2_col
code: /-- Given any pair of coprime elements of `R`, there exists a matrix in `SL(2, R)` having those
entries as its left or right column. -/
lemma exists_SL2_col {a b : R} (hab : IsCoprime a b) (j : Fin 2) :
    ∃ g : SL(2, R), g 0 j = a ∧ g 1 j = b 
goal: ∃ g, ↑g 0 j = a ∧ ↑g 1 j = b

full_name: IsCoprime.exists_SL2_row
code: /-- Given any pair of coprime elements of `R`, there exists a matrix in `SL(2, R)` having those
entries as its top or bottom row. -/
lemma exists_SL2_row {a b : R} (hab : IsCoprime a b) (i : Fin 2) :
    ∃ g : SL(2, R), g i 0 = a ∧ g i 1 = b 
goal: ∃ g, ↑g i 0 = a ∧ ↑g i 1 = b

full_name: IsCoprime.vecMulSL
code: /-- A vector with coprime entries, right-multiplied by a matrix in `SL(2, R)`, has
coprime entries. -/
lemma vecMulSL {v : Fin 2 → R} (hab : IsCoprime (v 0) (v 1)) (A : SL(2, R)) :
    IsCoprime ((v ᵥ* A.1) 0) ((v ᵥ* A.1) 1) 
goal: IsCoprime (Matrix.vecMul v (↑A) 0) (Matrix.vecMul v (↑A) 1)

full_name: IsCoprime.mulVecSL
code: /-- A vector with coprime entries, left-multiplied by a matrix in `SL(2, R)`, has
coprime entries. -/
lemma mulVecSL {v : Fin 2 → R} (hab : IsCoprime (v 0) (v 1)) (A : SL(2, R)) :
    IsCoprime ((A.1 *ᵥ v) 0) ((A.1 *ᵥ v) 1) 
goal: IsCoprime ((↑A).mulVec v 0) ((↑A).mulVec v 1)

full_name: ModularGroup.«_aux_Mathlib_LinearAlgebra_Matrix_SpecialLinearGroup___macroRules_ModularGroup_term↑ₘ__1»
code: local notation:1024 "↑ₘ" A:1024 => ((A : SL(2, ℤ)) : Matrix (Fin 2) (Fin 2) ℤ)
goal: Lean.Macro

full_name: ModularGroup.S
code: /-- The matrix `S = [[0, -1], [1, 0]]` as an element of `SL(2, ℤ)`.

This element acts naturally on the Euclidean plane as a rotation about the origin by `π / 2`.

This element also acts naturally on the hyperbolic plane as rotation about `i` by `π`. It
represents the Mobiüs transformation `z ↦ -1/z` and is an involutive elliptic isometry. -/
def S : SL(2, ℤ) 
goal: Matrix.SpecialLinearGroup (Fin 2) ℤ

full_name: ModularGroup.T
code: /-- The matrix `T = [[1, 1], [0, 1]]` as an element of `SL(2, ℤ)` -/
def T : SL(2, ℤ) 
goal: Matrix.SpecialLinearGroup (Fin 2) ℤ

full_name: ModularGroup.coe_S
code: theorem coe_S : ↑ₘS = !![0, -1; 1, 0] 
goal: ↑ModularGroup.S = !![0, -1; 1, 0]

full_name: ModularGroup.coe_T
code: theorem coe_T : ↑ₘT = !![1, 1; 0, 1] 
goal: ↑ModularGroup.T = !![1, 1; 0, 1]

full_name: ModularGroup.coe_T_inv
code: theorem coe_T_inv : ↑ₘT⁻¹ = !![1, -1; 0, 1] 
goal: ↑ModularGroup.T⁻¹ = !![1, -1; 0, 1]

full_name: ModularGroup.coe_T_zpow
code: theorem coe_T_zpow (n : ℤ) : ↑ₘ(T ^ n) = !![1, n; 0, 1] 
goal: ↑(ModularGroup.T ^ n) = !![1, n; 0, 1]

full_name: ModularGroup.T_pow_mul_apply_one
code: @[simp]
theorem T_pow_mul_apply_one (n : ℤ) (g : SL(2, ℤ)) : ↑ₘ(T ^ n * g) 1 = ↑ₘg 1 
goal: ↑(ModularGroup.T ^ n * g) 1 = ↑g 1

full_name: ModularGroup.T_mul_apply_one
code: @[simp]
theorem T_mul_apply_one (g : SL(2, ℤ)) : ↑ₘ(T * g) 1 = ↑ₘg 1 
goal: ↑(ModularGroup.T * g) 1 = ↑g 1

full_name: ModularGroup.T_inv_mul_apply_one
code: @[simp]
theorem T_inv_mul_apply_one (g : SL(2, ℤ)) : ↑ₘ(T⁻¹ * g) 1 = ↑ₘg 1 
goal: ↑(ModularGroup.T⁻¹ * g) 1 = ↑g 1